diff options
-rw-r--r-- | components/mail/contents/ui/main.qml | 25 | ||||
-rw-r--r-- | components/package/contents/ui/AccountSwitcher.qml | 116 |
2 files changed, 88 insertions, 53 deletions
diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml index c79a656b..8190d59b 100644 --- a/components/mail/contents/ui/main.qml +++ b/components/mail/contents/ui/main.qml | |||
@@ -185,13 +185,25 @@ Controls2.ApplicationWindow { | |||
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | KubeComponents.AccountSwitcher { | ||
189 | id: accountSwitcher | ||
190 | |||
191 | anchors { | ||
192 | top: newMailButton.bottom | ||
193 | topMargin: Kirigami.Units.smallSpacing | ||
194 | } | ||
195 | |||
196 | width: parent.width | ||
197 | height: Kirigami.Units.gridUnit * 2 | ||
198 | } | ||
199 | |||
188 | KubeComponents.FolderListView { | 200 | KubeComponents.FolderListView { |
189 | id: folderListView | 201 | id: folderListView |
190 | 202 | ||
191 | anchors { | 203 | anchors { |
192 | top: newMailButton.bottom | 204 | top: accountSwitcher.bottom |
193 | topMargin: Kirigami.Units.smallSpacing | 205 | topMargin: Kirigami.Units.smallSpacing |
194 | bottom: accountSwitcher.top | 206 | bottom: parent.bottom |
195 | left: parent.left | 207 | left: parent.left |
196 | right: parent.right | 208 | right: parent.right |
197 | } | 209 | } |
@@ -199,15 +211,6 @@ Controls2.ApplicationWindow { | |||
199 | focus: true | 211 | focus: true |
200 | accountId: accountSwitcher.accountId | 212 | accountId: accountSwitcher.accountId |
201 | } | 213 | } |
202 | |||
203 | KubeComponents.AccountSwitcher { | ||
204 | id: accountSwitcher | ||
205 | |||
206 | anchors.bottom: parent.bottom | ||
207 | |||
208 | width: parent.width | ||
209 | height: Kirigami.Units.gridUnit * 2 | ||
210 | } | ||
211 | } | 214 | } |
212 | 215 | ||
213 | KubeComponents.MailListView { | 216 | KubeComponents.MailListView { |
diff --git a/components/package/contents/ui/AccountSwitcher.qml b/components/package/contents/ui/AccountSwitcher.qml index 6d1c0aa2..616286f0 100644 --- a/components/package/contents/ui/AccountSwitcher.qml +++ b/components/package/contents/ui/AccountSwitcher.qml | |||
@@ -29,53 +29,95 @@ import org.kube.framework.domain 1.0 as KubeFramework | |||
29 | import org.kube.framework.accounts 1.0 as KubeAccounts | 29 | import org.kube.framework.accounts 1.0 as KubeAccounts |
30 | import org.kube.components 1.0 as KubeComponents | 30 | import org.kube.components 1.0 as KubeComponents |
31 | 31 | ||
32 | Controls2.Button { | 32 | Item { |
33 | id: accountSwitcher | 33 | id: accountSwitcher |
34 | 34 | ||
35 | property variant accountId | 35 | property variant accountId |
36 | property variant accountName | ||
37 | |||
38 | width: parent.width | ||
39 | |||
40 | clip: true | ||
36 | 41 | ||
37 | KubeFramework.FolderController { | 42 | KubeFramework.FolderController { |
38 | id: folderController | 43 | id: folderController |
39 | } | 44 | } |
40 | 45 | ||
41 | text: "Accounts" | 46 | KubeAccounts.AccountsModel { |
47 | id: accountsModel | ||
48 | } | ||
49 | |||
50 | Text { | ||
51 | anchors { | ||
52 | left: parent.left | ||
53 | leftMargin: Kirigami.Units.smallSpacing | ||
54 | bottom: parent.bottom | ||
55 | } | ||
42 | 56 | ||
43 | onClicked: { | 57 | text: accountName |
44 | popup.open() | 58 | color: Kirigami.Theme.backgroundColor |
45 | focus = false | 59 | font.weight: Font.DemiBold |
60 | } | ||
61 | |||
62 | MouseArea { | ||
63 | anchors.fill: parent | ||
64 | |||
65 | acceptedButtons: Qt.LeftButton | Qt.RightButton | ||
66 | |||
67 | onClicked: { | ||
68 | if (mouse.button == Qt.RightButton) { | ||
69 | contextMenu.popup() | ||
70 | } else { | ||
71 | popup.open() | ||
72 | focus = false | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | |||
77 | Controls.Menu { | ||
78 | id: contextMenu | ||
79 | title: "Edit" | ||
80 | |||
81 | Controls.MenuItem { | ||
82 | text: "Synchronize" | ||
83 | onTriggered: { | ||
84 | folderController.synchronizeAction.execute() | ||
85 | } | ||
86 | } | ||
46 | } | 87 | } |
47 | 88 | ||
48 | Controls2.Popup { | 89 | Controls2.Popup { |
49 | id: popup | 90 | id: popup |
50 | 91 | ||
51 | height: 300 | 92 | height: listView.count == 0 ? Kirigami.Units.gridUnit * 2 : Kirigami.Units.gridUnit * 2 + listView.count * Kirigami.Units.gridUnit * 3 |
52 | width: 600 | 93 | width: parent.width |
53 | |||
54 | x: 0 | ||
55 | y: - popup.height | ||
56 | 94 | ||
57 | modal: true | 95 | modal: true |
58 | focus: true | 96 | focus: true |
59 | closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutsideParent | 97 | closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutsideParent |
60 | 98 | ||
61 | Item { | ||
62 | id: footer | ||
63 | 99 | ||
64 | anchors { | 100 | // Controls2.Button { |
65 | bottom: parent.bottom | 101 | // anchors { |
66 | left: parent.left | 102 | // verticalCenter: parent.verticalCenter |
67 | right: parent.right | 103 | // left: parent.left |
68 | margins: Kirigami.Units.largeSpacing | 104 | // } |
69 | } | 105 | // |
70 | 106 | // //iconName: "view-refresh" | |
71 | height: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing * 1 | 107 | // text: "Sync" |
72 | width: listView.width | 108 | // enabled: folderController.synchronizeAction.enabled |
109 | // onClicked: { | ||
110 | // folderController.synchronizeAction.execute() | ||
111 | // popup.close() | ||
112 | // } | ||
113 | // } | ||
73 | 114 | ||
74 | Controls2.Button { | 115 | Controls2.Button { |
116 | id: newAccountButton | ||
75 | 117 | ||
76 | anchors { | 118 | anchors { |
77 | verticalCenter: parent.verticalCenter | 119 | horizontalCenter: parent.horizontalCenter |
78 | right: parent.right | 120 | bottom: parent.bottom |
79 | } | 121 | } |
80 | 122 | ||
81 | text: "Create new Account" | 123 | text: "Create new Account" |
@@ -86,36 +128,19 @@ Controls2.Button { | |||
86 | } | 128 | } |
87 | } | 129 | } |
88 | 130 | ||
89 | Controls2.Button { | ||
90 | anchors { | ||
91 | verticalCenter: parent.verticalCenter | ||
92 | left: parent.left | ||
93 | } | ||
94 | |||
95 | //iconName: "view-refresh" | ||
96 | text: "Sync" | ||
97 | enabled: folderController.synchronizeAction.enabled | ||
98 | onClicked: { | ||
99 | folderController.synchronizeAction.execute() | ||
100 | popup.close() | ||
101 | } | ||
102 | } | ||
103 | } | ||
104 | |||
105 | ListView { | 131 | ListView { |
106 | id: listView | 132 | id: listView |
107 | 133 | ||
108 | anchors { | 134 | anchors { |
109 | top: parent.top | 135 | top: parent.top |
110 | bottom: footer.top | 136 | bottom: newAccountButton.top |
111 | left: parent.left | 137 | left: parent.left |
112 | right: parent.right | 138 | right: parent.right |
113 | margins: Kirigami.Units.smallSpacing | ||
114 | } | 139 | } |
115 | 140 | ||
116 | clip: true | 141 | clip: true |
117 | 142 | ||
118 | model: KubeAccounts.AccountsModel { } | 143 | model: accountsModel |
119 | 144 | ||
120 | delegate: Kirigami.AbstractListItem { | 145 | delegate: Kirigami.AbstractListItem { |
121 | id: accountDelegate | 146 | id: accountDelegate |
@@ -141,6 +166,13 @@ Controls2.Button { | |||
141 | value: model.accountId | 166 | value: model.accountId |
142 | } | 167 | } |
143 | 168 | ||
169 | QtQml.Binding { | ||
170 | target: accountSwitcher | ||
171 | property: "accountName" | ||
172 | when: listView.currentIndex == index | ||
173 | value: model.name | ||
174 | } | ||
175 | |||
144 | RowLayout { | 176 | RowLayout { |
145 | anchors { | 177 | anchors { |
146 | verticalCenter: parent.verticalCenter | 178 | verticalCenter: parent.verticalCenter |