1- import QtQml 2.12
2- import QtQml.Models 2.1
31import QtQuick 2.15
42import QtQuick.Window 2.3
53import QtQuick.Controls 2.3
@@ -13,7 +11,7 @@ import Style 1.0
1311
1412import com.nextcloud.desktopclient 1.0
1513
16- Window {
14+ ApplicationWindow {
1715 id: trayWindow
1816
1917 title: Systray .windowTitle
@@ -53,6 +51,13 @@ Window {
5351 syncStatus .model .load ();
5452 }
5553
54+ background: Rectangle {
55+ radius: Systray .useNormalWindow ? 0.0 : Style .trayWindowRadius
56+ border .width : Style .trayWindowBorderWidth
57+ border .color : Style .menuBorder
58+ color: Style .backgroundColor
59+ }
60+
5661 Connections {
5762 target: UserModel
5863 function onCurrentUserChanged () {
@@ -78,6 +83,8 @@ Window {
7883 target: Systray
7984
8085 function onIsOpenChanged () {
86+ userStatusDrawer .close ()
87+
8188 if (Systray .isOpen ) {
8289 accountMenu .close ();
8390 appsMenu .close ();
@@ -98,39 +105,72 @@ Window {
98105 OpacityMask {
99106 anchors .fill : parent
100107 source: ShaderEffectSource {
101- sourceItem: trayWindowBackground
108+ sourceItem: trayWindowMainItem
102109 hideSource: true
103110 }
104111 maskSource: Rectangle {
105- width: trayWindowBackground .width
106- height: trayWindowBackground .height
112+ width: trayWindow .width
113+ height: trayWindow .height
107114 radius: Systray .useNormalWindow ? 0.0 : Style .trayWindowRadius
108115 }
109116 }
110117
111- Rectangle {
112- id: trayWindowBackground
118+ Drawer {
119+ id: userStatusDrawer
120+ width: parent .width
121+ height: parent .height
122+ padding: 0
123+ edge: Qt .BottomEdge
124+ modal: false
125+ visible: false
126+
127+ background: Rectangle {
128+ radius: Systray .useNormalWindow ? 0.0 : Style .trayWindowRadius
129+ border .width : Style .trayWindowBorderWidth
130+ border .color : Style .menuBorder
131+ color: Style .backgroundColor
132+ }
133+
134+ property int userIndex: 0
135+
136+ function openUserStatusDrawer (index ) {
137+ console .log (` About to show dialog for user with index ${ index} ` );
138+ userIndex = index;
139+ open ();
140+ }
141+
142+ Loader {
143+ id: userStatusContents
144+ anchors .fill : parent
145+ active: userStatusDrawer .visible
146+ sourceComponent: UserStatusSelectorPage {
147+ anchors .fill : parent
148+ userIndex: userStatusDrawer .userIndex
149+ onFinished: userStatusDrawer .close ()
150+ }
151+ }
152+ }
153+
154+ Item {
155+ id: trayWindowMainItem
113156
114157 property bool isUnifiedSearchActive: unifiedSearchResultsListViewSkeletonLoader .active
115158 || unifiedSearchResultNothingFound .visible
116159 || unifiedSearchResultsErrorLabel .visible
117160 || unifiedSearchResultsListView .visible
118161
119162 anchors .fill : parent
120- radius: Systray .useNormalWindow ? 0.0 : Style .trayWindowRadius
121- border .width : Style .trayWindowBorderWidth
122- border .color : Style .menuBorder
123- color: Style .backgroundColor
163+ clip: true
124164
125165 Accessible .role : Accessible .Grouping
126166 Accessible .name : qsTr (" Nextcloud desktop main dialog" )
127167
128168 Rectangle {
129169 id: trayWindowHeaderBackground
130170
131- anchors .left : trayWindowBackground .left
132- anchors .right : trayWindowBackground .right
133- anchors .top : trayWindowBackground .top
171+ anchors .left : trayWindowMainItem .left
172+ anchors .right : trayWindowMainItem .right
173+ anchors .top : trayWindowMainItem .top
134174 height: Style .trayWindowHeaderHeight
135175 color: UserModel .currentUser .headerColor
136176
@@ -206,35 +246,12 @@ Window {
206246 userLineInstantiator .active = true ;
207247 }
208248
209- Loader {
210- id: userStatusSelectorDialogLoader
211-
212- property int userIndex
213-
214- function openDialog (newUserIndex ) {
215- console .log (` About to show dialog for user with index ${ newUserIndex} ` );
216- userIndex = newUserIndex;
217- active = true ;
218- item .show ();
219- }
220-
221- active: false
222- sourceComponent: UserStatusSelectorDialog {
223- userIndex: userStatusSelectorDialogLoader .userIndex
224- }
225-
226- onLoaded: {
227- item .model .load (userIndex);
228- item .show ();
229- }
230- }
231-
232249 Instantiator {
233250 id: userLineInstantiator
234251 model: UserModel
235252 delegate: UserLine {
236- onShowUserStatusSelectorDialog : {
237- userStatusSelectorDialogLoader . openDialog (model .index );
253+ onShowUserStatusSelector : {
254+ userStatusDrawer . openUserStatusDrawer (model .index );
238255 accountMenu .close ();
239256 }
240257 }
@@ -661,8 +678,8 @@ Window {
661678
662679 anchors {
663680 top: trayWindowHeaderBackground .bottom
664- left: trayWindowBackground .left
665- right: trayWindowBackground .right
681+ left: trayWindowMainItem .left
682+ right: trayWindowMainItem .right
666683
667684 topMargin: Style .trayHorizontalMargin + controlRoot .padding
668685 leftMargin: Style .trayHorizontalMargin + controlRoot .padding
@@ -681,17 +698,17 @@ Window {
681698 visible: UserModel .currentUser .unifiedSearchResultsListModel .errorString && ! unifiedSearchResultsListView .visible && ! UserModel .currentUser .unifiedSearchResultsListModel .isSearchInProgress && ! UserModel .currentUser .unifiedSearchResultsListModel .currentFetchMoreInProgressProviderId
682699 text: UserModel .currentUser .unifiedSearchResultsListModel .errorString
683700 anchors .top : trayWindowUnifiedSearchInputContainer .bottom
684- anchors .left : trayWindowBackground .left
685- anchors .right : trayWindowBackground .right
701+ anchors .left : trayWindowMainItem .left
702+ anchors .right : trayWindowMainItem .right
686703 anchors .margins : Style .trayHorizontalMargin
687704 }
688705
689706 UnifiedSearchResultNothingFound {
690707 id: unifiedSearchResultNothingFound
691708 visible: false
692709 anchors .top : trayWindowUnifiedSearchInputContainer .bottom
693- anchors .left : trayWindowBackground .left
694- anchors .right : trayWindowBackground .right
710+ anchors .left : trayWindowMainItem .left
711+ anchors .right : trayWindowMainItem .right
695712 anchors .topMargin : Style .trayHorizontalMargin
696713
697714 text: UserModel .currentUser .unifiedSearchResultsListModel .searchTerm
@@ -724,9 +741,9 @@ Window {
724741 Loader {
725742 id: unifiedSearchResultsListViewSkeletonLoader
726743 anchors .top : trayWindowUnifiedSearchInputContainer .bottom
727- anchors .left : trayWindowBackground .left
728- anchors .right : trayWindowBackground .right
729- anchors .bottom : trayWindowBackground .bottom
744+ anchors .left : trayWindowMainItem .left
745+ anchors .right : trayWindowMainItem .right
746+ anchors .bottom : trayWindowMainItem .bottom
730747
731748 active: ! unifiedSearchResultNothingFound .visible &&
732749 ! unifiedSearchResultsListView .visible &&
@@ -752,9 +769,9 @@ Window {
752769 visible: unifiedSearchResultsListView .count > 0
753770
754771 anchors .top : trayWindowUnifiedSearchInputContainer .bottom
755- anchors .left : trayWindowBackground .left
756- anchors .right : trayWindowBackground .right
757- anchors .bottom : trayWindowBackground .bottom
772+ anchors .left : trayWindowMainItem .left
773+ anchors .right : trayWindowMainItem .right
774+ anchors .bottom : trayWindowMainItem .bottom
758775
759776 ListView {
760777 id: unifiedSearchResultsListView
@@ -791,19 +808,19 @@ Window {
791808 SyncStatus {
792809 id: syncStatus
793810
794- visible: ! trayWindowBackground .isUnifiedSearchActive
811+ visible: ! trayWindowMainItem .isUnifiedSearchActive
795812
796813 anchors .top : trayWindowUnifiedSearchInputContainer .bottom
797- anchors .left : trayWindowBackground .left
798- anchors .right : trayWindowBackground .right
814+ anchors .left : trayWindowMainItem .left
815+ anchors .right : trayWindowMainItem .right
799816 }
800817
801818 ActivityList {
802- visible: ! trayWindowBackground .isUnifiedSearchActive
819+ visible: ! trayWindowMainItem .isUnifiedSearchActive
803820 anchors .top : syncStatus .bottom
804- anchors .left : trayWindowBackground .left
805- anchors .right : trayWindowBackground .right
806- anchors .bottom : trayWindowBackground .bottom
821+ anchors .left : trayWindowMainItem .left
822+ anchors .right : trayWindowMainItem .right
823+ anchors .bottom : trayWindowMainItem .bottom
807824
808825 activeFocusOnTab: true
809826 model: activityModel
@@ -833,5 +850,5 @@ Window {
833850
834851 onLoaded: refresh ()
835852 }
836- } // Rectangle trayWindowBackground
853+ } // Item trayWindowMainItem
837854}
0 commit comments