diff options
author | Michael Bohlender <michael.bohlender@kdemail.net> | 2017-05-03 18:57:32 +0200 |
---|---|---|
committer | Michael Bohlender <michael.bohlender@kdemail.net> | 2017-05-03 18:57:32 +0200 |
commit | 8bc60f6b3fb54f844a026d505bf3f4070503f95d (patch) | |
tree | 55d7f274f71699d57ba127e1daa0b8154ec1e677 | |
parent | d33eb2ea64172240c0b26f9945cfffa6935d7cfa (diff) | |
download | kube-8bc60f6b3fb54f844a026d505bf3f4070503f95d.tar.gz kube-8bc60f6b3fb54f844a026d505bf3f4070503f95d.zip |
add initial inline accountsView
-rw-r--r-- | components/kube/contents/ui/AccountsView.qml | 119 | ||||
-rw-r--r-- | components/kube/contents/ui/Kube.qml | 14 | ||||
-rw-r--r-- | framework/qml/AccountSwitcher.qml | 201 | ||||
-rw-r--r-- | framework/qmldir | 2 |
4 files changed, 133 insertions, 203 deletions
diff --git a/components/kube/contents/ui/AccountsView.qml b/components/kube/contents/ui/AccountsView.qml new file mode 100644 index 00000000..6ab8387b --- /dev/null +++ b/components/kube/contents/ui/AccountsView.qml | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | * | ||
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 | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
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., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | import QtQuick 2.4 | ||
20 | import QtQuick.Layouts 1.1 | ||
21 | |||
22 | import org.kube.framework 1.0 as Kube | ||
23 | |||
24 | Rectangle { | ||
25 | id: app | ||
26 | |||
27 | height: 800 | ||
28 | width: 1400 | ||
29 | |||
30 | color: Kube.Colors.backgroundColor | ||
31 | |||
32 | RowLayout { | ||
33 | |||
34 | anchors.fill: parent | ||
35 | |||
36 | Item { | ||
37 | id: accountList | ||
38 | width: 300 | ||
39 | Layout.fillHeight: true | ||
40 | |||
41 | Kube.PositiveButton { | ||
42 | id: newAccountButton | ||
43 | anchors { | ||
44 | top: parent.top | ||
45 | left: parent.left | ||
46 | right: parent.right | ||
47 | margins: Kube.Units.largeSpacing | ||
48 | } | ||
49 | text: "New Account" | ||
50 | } | ||
51 | |||
52 | ListView { | ||
53 | id: listView | ||
54 | |||
55 | anchors { | ||
56 | top: newAccountButton.bottom | ||
57 | left: parent.left | ||
58 | right: parent.right | ||
59 | bottom: parent.bottom | ||
60 | topMargin: Kube.Units.largeSpacing | ||
61 | } | ||
62 | |||
63 | clip: true | ||
64 | |||
65 | model: Kube.AccountsModel {} | ||
66 | |||
67 | delegate: Rectangle { | ||
68 | height: Kube.Units.gridUnit * 3 | ||
69 | width: listView.width | ||
70 | |||
71 | border.color: Kube.Colors.buttonColor | ||
72 | border.width: 1 | ||
73 | color: Kube.Colors.viewBackgroundColor | ||
74 | |||
75 | Kube.Label { | ||
76 | anchors.centerIn: parent | ||
77 | text: model.name | ||
78 | } | ||
79 | |||
80 | MouseArea { | ||
81 | id: mouseArea | ||
82 | anchors.fill: parent | ||
83 | |||
84 | onClicked: { | ||
85 | console.log("clicked account \"" + model.accountId + "\"" ) | ||
86 | //editAccountComponent.createObject(app, {accountId:model.accountId}) | ||
87 | edit.accountId = model.accountId | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | |||
94 | Rectangle { | ||
95 | height: parent.height | ||
96 | width: 1 | ||
97 | color: Kube.Colors.buttonColor | ||
98 | } | ||
99 | |||
100 | Item { | ||
101 | |||
102 | height: parent.height | ||
103 | width: 200 | ||
104 | Layout.fillWidth: true | ||
105 | |||
106 | Kube.EditAccount { | ||
107 | id: edit | ||
108 | |||
109 | anchors { | ||
110 | top: parent.top | ||
111 | left: parent.left | ||
112 | right: parent.right | ||
113 | bottom: parent.bottom | ||
114 | margins: Kube.Units.largeSpacing | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | } | ||
diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml index b5eee31f..18c1b6ec 100644 --- a/components/kube/contents/ui/Kube.qml +++ b/components/kube/contents/ui/Kube.qml | |||
@@ -152,7 +152,10 @@ Controls2.ApplicationWindow { | |||
152 | width: height | 152 | width: height |
153 | } | 153 | } |
154 | 154 | ||
155 | Kube.AccountSwitcher {} | 155 | Kube.IconButton { |
156 | iconName: Kube.Icons.menu_inverted | ||
157 | onClicked: kubeViews.setAccountsView() | ||
158 | } | ||
156 | } | 159 | } |
157 | } | 160 | } |
158 | StackView { | 161 | StackView { |
@@ -173,6 +176,10 @@ Controls2.ApplicationWindow { | |||
173 | //TODO replacing here while a composer is open is destructive | 176 | //TODO replacing here while a composer is open is destructive |
174 | kubeViews.push({item: mailView, replace: true, immediate: true}) | 177 | kubeViews.push({item: mailView, replace: true, immediate: true}) |
175 | } | 178 | } |
179 | function setAccountsView() { | ||
180 | kubeViews.push({item: accountsView, replace: true, immediate: true}) | ||
181 | } | ||
182 | |||
176 | function openComposer() { | 183 | function openComposer() { |
177 | kubeViews.push({item: composerView, immediate: true}) | 184 | kubeViews.push({item: composerView, immediate: true}) |
178 | } | 185 | } |
@@ -193,6 +200,11 @@ Controls2.ApplicationWindow { | |||
193 | onDone: kubeViews.pop({immediate: true}) | 200 | onDone: kubeViews.pop({immediate: true}) |
194 | } | 201 | } |
195 | } | 202 | } |
203 | Component { | ||
204 | id: accountsView | ||
205 | AccountsView { | ||
206 | } | ||
207 | } | ||
196 | } | 208 | } |
197 | } | 209 | } |
198 | //END Main content | 210 | //END Main content |
diff --git a/framework/qml/AccountSwitcher.qml b/framework/qml/AccountSwitcher.qml deleted file mode 100644 index b44dd3d7..00000000 --- a/framework/qml/AccountSwitcher.qml +++ /dev/null | |||
@@ -1,201 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | * | ||
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 | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
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., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | import QtQuick 2.4 | ||
20 | import QtQuick.Layouts 1.1 | ||
21 | import QtQuick.Controls 2.0 as Controls2 | ||
22 | import QtQuick.Controls 1.4 as Controls | ||
23 | |||
24 | import QtQml 2.2 as QtQml | ||
25 | |||
26 | import org.kde.kirigami 1.0 as Kirigami | ||
27 | import org.kube.framework 1.0 as Kube | ||
28 | |||
29 | |||
30 | Kube.IconButton { | ||
31 | id: accountSwitcher | ||
32 | |||
33 | property variant accountId | ||
34 | property variant accountName | ||
35 | |||
36 | iconName: Kube.Icons.menu_inverted | ||
37 | |||
38 | Kube.AccountsModel { | ||
39 | id: accountsModel | ||
40 | } | ||
41 | |||
42 | onClicked: { | ||
43 | popup.open() | ||
44 | } | ||
45 | |||
46 | Kube.Popup { | ||
47 | id: popup | ||
48 | |||
49 | height: listView.count == 0 ? Kirigami.Units.gridUnit * 4 : Kirigami.Units.gridUnit * 2 + listView.count * Kirigami.Units.gridUnit * 3 | ||
50 | width: Kirigami.Units.gridUnit * 20 | ||
51 | |||
52 | y: accountSwitcher.y - height | ||
53 | |||
54 | Item { | ||
55 | id: buttons | ||
56 | anchors { | ||
57 | bottom: parent.bottom | ||
58 | } | ||
59 | |||
60 | height: Kirigami.Units.gridUnit * 2 | ||
61 | width: parent.width | ||
62 | |||
63 | Kube.Button { | ||
64 | anchors { | ||
65 | left: parent.left | ||
66 | bottom: parent.bottom | ||
67 | } | ||
68 | |||
69 | //iconName: "view-refresh" | ||
70 | text: "Sync" | ||
71 | onClicked: { | ||
72 | Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": accountSwitcher.accountId}) | ||
73 | popup.close() | ||
74 | } | ||
75 | } | ||
76 | |||
77 | Kube.PositiveButton { | ||
78 | id: newAccountButton | ||
79 | |||
80 | anchors { | ||
81 | right: parent.right | ||
82 | bottom: parent.bottom | ||
83 | } | ||
84 | |||
85 | text: "Create new Account" | ||
86 | |||
87 | onClicked: { | ||
88 | accountWizard.open() | ||
89 | popup.close() | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | |||
94 | ListView { | ||
95 | id: listView | ||
96 | |||
97 | anchors { | ||
98 | top: parent.top | ||
99 | bottom: buttons.top | ||
100 | left: parent.left | ||
101 | right: parent.right | ||
102 | } | ||
103 | |||
104 | clip: true | ||
105 | |||
106 | model: accountsModel | ||
107 | |||
108 | delegate: Kirigami.AbstractListItem { | ||
109 | id: accountDelegate | ||
110 | |||
111 | height: Kirigami.Units.gridUnit * 2 | ||
112 | |||
113 | enabled: true | ||
114 | supportsMouseEvents: true | ||
115 | |||
116 | checked: listView.currentIndex == index | ||
117 | onClicked: { | ||
118 | listView.currentIndex = model.index | ||
119 | popup.close() | ||
120 | } | ||
121 | Item { | ||
122 | height: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing * 1 | ||
123 | width: listView.width | ||
124 | |||
125 | QtQml.Binding { | ||
126 | target: accountSwitcher | ||
127 | property: "accountId" | ||
128 | when: listView.currentIndex == index | ||
129 | value: model.accountId | ||
130 | } | ||
131 | |||
132 | QtQml.Binding { | ||
133 | target: accountSwitcher | ||
134 | property: "accountName" | ||
135 | when: listView.currentIndex == index | ||
136 | value: model.name | ||
137 | } | ||
138 | |||
139 | RowLayout { | ||
140 | anchors { | ||
141 | verticalCenter: parent.verticalCenter | ||
142 | left: parent.left | ||
143 | margins: Kirigami.Units.smallSpacing | ||
144 | } | ||
145 | |||
146 | Layout.fillHeight: true | ||
147 | |||
148 | Kube.Label { | ||
149 | text: model.name | ||
150 | } | ||
151 | |||
152 | Controls.ToolButton { | ||
153 | id: statusIcon | ||
154 | visible: false | ||
155 | iconName: "" | ||
156 | enabled: false | ||
157 | states: [ | ||
158 | State { | ||
159 | name: "busy"; when: model.status == Kube.AccountsModel.BusyStatus | ||
160 | PropertyChanges { target: statusIcon; iconName: Kube.Icons.busy; visible: true } | ||
161 | }, | ||
162 | State { | ||
163 | name: "error"; when: model.status == Kube.AccountsModel.ErrorStatus | ||
164 | PropertyChanges { target: statusIcon; iconName: Kube.Icons.error; visible: true } | ||
165 | }, | ||
166 | State { | ||
167 | name: "checkmark"; when: model.status == Kube.AccountsModel.ConnectedStatus | ||
168 | PropertyChanges { target: statusIcon; iconName: Kube.Icons.connected; visible: true } | ||
169 | } | ||
170 | ] | ||
171 | } | ||
172 | } | ||
173 | Kube.Button { | ||
174 | |||
175 | anchors { | ||
176 | right: parent.right | ||
177 | rightMargin: Kirigami.Units.largeSpacing | ||
178 | verticalCenter: parent.verticalCenter | ||
179 | } | ||
180 | |||
181 | opacity: hovered ? 1 : 0.7 | ||
182 | visible: accountDelegate.containsMouse | ||
183 | text: "edit" | ||
184 | |||
185 | onClicked: { | ||
186 | editAccountComponent.createObject(app, {accountId:model.accountId}) | ||
187 | popup.close() | ||
188 | } | ||
189 | |||
190 | Component { | ||
191 | id: editAccountComponent | ||
192 | Kube.EditAccountDialog { | ||
193 | anchors.fill: parent | ||
194 | } | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | } | ||
200 | } | ||
201 | } | ||
diff --git a/framework/qmldir b/framework/qmldir index 5bb1530b..4de45a1c 100644 --- a/framework/qmldir +++ b/framework/qmldir | |||
@@ -5,10 +5,10 @@ FocusComposer 1.0 FocusComposer.qml | |||
5 | ConversationView 1.0 ConversationView.qml | 5 | ConversationView 1.0 ConversationView.qml |
6 | FolderListView 1.0 FolderListView.qml | 6 | FolderListView 1.0 FolderListView.qml |
7 | MailListView 1.0 MailListView.qml | 7 | MailListView 1.0 MailListView.qml |
8 | AccountSwitcher 1.0 AccountSwitcher.qml | ||
9 | InlineAccountSwitcher 1.0 InlineAccountSwitcher.qml | 8 | InlineAccountSwitcher 1.0 InlineAccountSwitcher.qml |
10 | NewAccountDialog 1.0 NewAccountDialog.qml | 9 | NewAccountDialog 1.0 NewAccountDialog.qml |
11 | EditAccountDialog 1.0 EditAccountDialog.qml | 10 | EditAccountDialog 1.0 EditAccountDialog.qml |
11 | EditAccount 1.0 EditAccount.qml | ||
12 | OverlayDialog 1.0 OverlayDialog.qml | 12 | OverlayDialog 1.0 OverlayDialog.qml |
13 | Outbox 1.0 Outbox.qml | 13 | Outbox 1.0 Outbox.qml |
14 | People 1.0 People.qml | 14 | People 1.0 People.qml |