diff options
-rw-r--r-- | components/mail/contents/ui/main.qml | 54 | ||||
-rw-r--r-- | components/package/contents/ui/AccountSwitcher.qml | 128 |
2 files changed, 87 insertions, 95 deletions
diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml index 88aabf7e..8ee1c794 100644 --- a/components/mail/contents/ui/main.qml +++ b/components/mail/contents/ui/main.qml | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2015 Michael Bohlender, <michael.bohlender@kdemail.net> | 2 | * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net> |
3 | 3 | * | |
4 | This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
6 | the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | (at your option) any later version. | 7 | * (at your option) any later version. |
8 | 8 | * | |
9 | This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | 13 | * | |
14 | You should have received a copy of the GNU General Public License along | 14 | * You should have received a copy of the GNU General Public License along |
15 | with this program; if not, write to the Free Software Foundation, Inc., | 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | 19 | ||
20 | import QtQuick 2.7 | 20 | import QtQuick 2.7 |
@@ -152,7 +152,9 @@ Controls2.ApplicationWindow { | |||
152 | 152 | ||
153 | spacing: Kirigami.Units.largeSpacing | 153 | spacing: Kirigami.Units.largeSpacing |
154 | 154 | ||
155 | ToolButton { | 155 | KubeComponents.AccountSwitcher { |
156 | id: accountSwitcher | ||
157 | |||
156 | iconName: "kdenlive-menu" | 158 | iconName: "kdenlive-menu" |
157 | height: Kirigami.Units.gridUnit * 1.5 | 159 | height: Kirigami.Units.gridUnit * 1.5 |
158 | width: height | 160 | width: height |
@@ -212,8 +214,8 @@ Controls2.ApplicationWindow { | |||
212 | } | 214 | } |
213 | } | 215 | } |
214 | 216 | ||
215 | KubeComponents.AccountSwitcher { | 217 | Item { |
216 | id: accountSwitcher | 218 | id: accountName |
217 | 219 | ||
218 | anchors { | 220 | anchors { |
219 | top: newMailButton.bottom | 221 | top: newMailButton.bottom |
@@ -222,13 +224,25 @@ Controls2.ApplicationWindow { | |||
222 | 224 | ||
223 | width: parent.width | 225 | width: parent.width |
224 | height: Kirigami.Units.gridUnit * 2 | 226 | height: Kirigami.Units.gridUnit * 2 |
227 | |||
228 | Text { | ||
229 | anchors { | ||
230 | bottom: parent.bottom | ||
231 | left: parent.left | ||
232 | leftMargin: Kirigami.Units.smallSpacing | ||
233 | } | ||
234 | |||
235 | text: accountSwitcher.accountName | ||
236 | font.weight: Font.DemiBold | ||
237 | color: "white" | ||
238 | } | ||
225 | } | 239 | } |
226 | 240 | ||
227 | KubeComponents.FolderListView { | 241 | KubeComponents.FolderListView { |
228 | id: folderListView | 242 | id: folderListView |
229 | 243 | ||
230 | anchors { | 244 | anchors { |
231 | top: accountSwitcher.bottom | 245 | top: accountName.bottom |
232 | topMargin: Kirigami.Units.smallSpacing | 246 | topMargin: Kirigami.Units.smallSpacing |
233 | bottom: parent.bottom | 247 | bottom: parent.bottom |
234 | left: parent.left | 248 | left: parent.left |
diff --git a/components/package/contents/ui/AccountSwitcher.qml b/components/package/contents/ui/AccountSwitcher.qml index 616286f0..eb5702e0 100644 --- a/components/package/contents/ui/AccountSwitcher.qml +++ b/components/package/contents/ui/AccountSwitcher.qml | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> | 2 | * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net> |
3 | 3 | * | |
4 | This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
6 | the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | (at your option) any later version. | 7 | * (at your option) any later version. |
8 | 8 | * | |
9 | This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | 13 | * | |
14 | You should have received a copy of the GNU General Public License along | 14 | * You should have received a copy of the GNU General Public License along |
15 | with this program; if not, write to the Free Software Foundation, Inc., | 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | import QtQuick 2.4 | 19 | import QtQuick 2.4 |
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 |
@@ -29,7 +29,7 @@ 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 | Item { | 32 | Controls.ToolButton { |
33 | id: accountSwitcher | 33 | id: accountSwitcher |
34 | 34 | ||
35 | property variant accountId | 35 | property variant accountId |
@@ -37,8 +37,6 @@ Item { | |||
37 | 37 | ||
38 | width: parent.width | 38 | width: parent.width |
39 | 39 | ||
40 | clip: true | ||
41 | |||
42 | KubeFramework.FolderController { | 40 | KubeFramework.FolderController { |
43 | id: folderController | 41 | id: folderController |
44 | } | 42 | } |
@@ -47,76 +45,55 @@ Item { | |||
47 | id: accountsModel | 45 | id: accountsModel |
48 | } | 46 | } |
49 | 47 | ||
50 | Text { | ||
51 | anchors { | ||
52 | left: parent.left | ||
53 | leftMargin: Kirigami.Units.smallSpacing | ||
54 | bottom: parent.bottom | ||
55 | } | ||
56 | 48 | ||
57 | text: accountName | 49 | onClicked: { |
58 | color: Kirigami.Theme.backgroundColor | 50 | popup.open() |
59 | font.weight: Font.DemiBold | ||
60 | } | 51 | } |
61 | 52 | ||
62 | MouseArea { | 53 | Controls2.Popup { |
63 | anchors.fill: parent | 54 | id: popup |
64 | 55 | ||
65 | acceptedButtons: Qt.LeftButton | Qt.RightButton | 56 | height: listView.count == 0 ? Kirigami.Units.gridUnit * 4 : Kirigami.Units.gridUnit * 2 + listView.count * Kirigami.Units.gridUnit * 3 |
57 | width: Kirigami.Units.gridUnit * 20 | ||
66 | 58 | ||
67 | onClicked: { | 59 | y: accountSwitcher.height |
68 | if (mouse.button == Qt.RightButton) { | ||
69 | contextMenu.popup() | ||
70 | } else { | ||
71 | popup.open() | ||
72 | focus = false | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | 60 | ||
77 | Controls.Menu { | 61 | modal: true |
78 | id: contextMenu | 62 | focus: true |
79 | title: "Edit" | 63 | closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutsideParent |
80 | 64 | ||
81 | Controls.MenuItem { | 65 | Item { |
82 | text: "Synchronize" | 66 | id: buttons |
83 | onTriggered: { | 67 | anchors { |
84 | folderController.synchronizeAction.execute() | 68 | bottom: parent.bottom |
85 | } | 69 | } |
86 | } | ||
87 | } | ||
88 | 70 | ||
89 | Controls2.Popup { | 71 | height: Kirigami.Units.gridUnit * 2 |
90 | id: popup | 72 | width: parent.width |
91 | 73 | ||
92 | height: listView.count == 0 ? Kirigami.Units.gridUnit * 2 : Kirigami.Units.gridUnit * 2 + listView.count * Kirigami.Units.gridUnit * 3 | 74 | Controls2.Button { |
93 | width: parent.width | ||
94 | 75 | ||
95 | modal: true | ||
96 | focus: true | ||
97 | closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutsideParent | ||
98 | 76 | ||
77 | anchors { | ||
78 | left: parent.left | ||
79 | bottom: parent.bottom | ||
80 | } | ||
99 | 81 | ||
100 | // Controls2.Button { | 82 | |
101 | // anchors { | 83 | //iconName: "view-refresh" |
102 | // verticalCenter: parent.verticalCenter | 84 | text: "Sync" |
103 | // left: parent.left | 85 | enabled: folderController.synchronizeAction.enabled |
104 | // } | 86 | onClicked: { |
105 | // | 87 | folderController.synchronizeAction.execute() |
106 | // //iconName: "view-refresh" | 88 | popup.close() |
107 | // text: "Sync" | 89 | } |
108 | // enabled: folderController.synchronizeAction.enabled | 90 | } |
109 | // onClicked: { | ||
110 | // folderController.synchronizeAction.execute() | ||
111 | // popup.close() | ||
112 | // } | ||
113 | // } | ||
114 | 91 | ||
115 | Controls2.Button { | 92 | Controls2.Button { |
116 | id: newAccountButton | 93 | id: newAccountButton |
117 | 94 | ||
118 | anchors { | 95 | anchors { |
119 | horizontalCenter: parent.horizontalCenter | 96 | right: parent.right |
120 | bottom: parent.bottom | 97 | bottom: parent.bottom |
121 | } | 98 | } |
122 | 99 | ||
@@ -127,13 +104,14 @@ Item { | |||
127 | popup.close() | 104 | popup.close() |
128 | } | 105 | } |
129 | } | 106 | } |
107 | } | ||
130 | 108 | ||
131 | ListView { | 109 | ListView { |
132 | id: listView | 110 | id: listView |
133 | 111 | ||
134 | anchors { | 112 | anchors { |
135 | top: parent.top | 113 | top: parent.top |
136 | bottom: newAccountButton.top | 114 | bottom: buttons.top |
137 | left: parent.left | 115 | left: parent.left |
138 | right: parent.right | 116 | right: parent.right |
139 | } | 117 | } |
@@ -187,9 +165,9 @@ Item { | |||
187 | accountId: model.accountId | 165 | accountId: model.accountId |
188 | } | 166 | } |
189 | 167 | ||
190 | // Kirigami.Icon { | 168 | // Kirigami.Icon { |
191 | // source: model.icon | 169 | // source: model.icon |
192 | // } | 170 | // } |
193 | 171 | ||
194 | Controls2.Label { | 172 | Controls2.Label { |
195 | text: model.name | 173 | text: model.name |