diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-22 14:19:43 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-22 15:57:44 +0100 |
commit | cb2b1a35e14031f15155243aee12fc862cb65ebf (patch) | |
tree | cc6a28ef675953d41b9eeb98b21325d9a7b030b4 /components/package/contents/ui | |
parent | b08e78c52a0b6a3c725ce58e0c3fb0bfcdf2bc55 (diff) | |
download | kube-cb2b1a35e14031f15155243aee12fc862cb65ebf.tar.gz kube-cb2b1a35e14031f15155243aee12fc862cb65ebf.zip |
Fixed kolabnow account setup page.
The account plugin supplies the configuration UI, the application
supplies the scaffolding. That way we ensure the application doens't
contain any account specific code and account configurations are free to
offer specialized UI's that work best for them.
We're not currently using a standardized controller, but if we did those
controllers would have to live with the plugin, not the framework or the
components.
Diffstat (limited to 'components/package/contents/ui')
-rw-r--r-- | components/package/contents/ui/AccountSwitcher.qml | 20 | ||||
-rw-r--r-- | components/package/contents/ui/EditAccount.qml | 138 | ||||
-rw-r--r-- | components/package/contents/ui/EditAccountDialog.qml | 20 |
3 files changed, 144 insertions, 34 deletions
diff --git a/components/package/contents/ui/AccountSwitcher.qml b/components/package/contents/ui/AccountSwitcher.qml index eb5702e0..48bb2c1b 100644 --- a/components/package/contents/ui/AccountSwitcher.qml +++ b/components/package/contents/ui/AccountSwitcher.qml | |||
@@ -72,14 +72,11 @@ Controls.ToolButton { | |||
72 | width: parent.width | 72 | width: parent.width |
73 | 73 | ||
74 | Controls2.Button { | 74 | Controls2.Button { |
75 | |||
76 | |||
77 | anchors { | 75 | anchors { |
78 | left: parent.left | 76 | left: parent.left |
79 | bottom: parent.bottom | 77 | bottom: parent.bottom |
80 | } | 78 | } |
81 | 79 | ||
82 | |||
83 | //iconName: "view-refresh" | 80 | //iconName: "view-refresh" |
84 | text: "Sync" | 81 | text: "Sync" |
85 | enabled: folderController.synchronizeAction.enabled | 82 | enabled: folderController.synchronizeAction.enabled |
@@ -160,15 +157,6 @@ Controls.ToolButton { | |||
160 | 157 | ||
161 | Layout.fillHeight: true | 158 | Layout.fillHeight: true |
162 | 159 | ||
163 | KubeAccounts.AccountFactory { | ||
164 | id: accountFactory | ||
165 | accountId: model.accountId | ||
166 | } | ||
167 | |||
168 | // Kirigami.Icon { | ||
169 | // source: model.icon | ||
170 | // } | ||
171 | |||
172 | Controls2.Label { | 160 | Controls2.Label { |
173 | text: model.name | 161 | text: model.name |
174 | } | 162 | } |
@@ -191,20 +179,14 @@ Controls.ToolButton { | |||
191 | text: "edit" | 179 | text: "edit" |
192 | 180 | ||
193 | onClicked: { | 181 | onClicked: { |
194 | editAccountComponent.createObject(app) | 182 | editAccountComponent.createObject(app, {accountId:model.accountId}) |
195 | popup.close() | 183 | popup.close() |
196 | } | 184 | } |
197 | 185 | ||
198 | Component { | 186 | Component { |
199 | id: editAccountComponent | 187 | id: editAccountComponent |
200 | |||
201 | KubeComponents.EditAccountDialog { | 188 | KubeComponents.EditAccountDialog { |
202 | id: editAccount | ||
203 | |||
204 | anchors.fill: parent | 189 | anchors.fill: parent |
205 | |||
206 | accountId: accountFactory.accountId | ||
207 | uiSource: accountFactory.uiPath | ||
208 | } | 190 | } |
209 | } | 191 | } |
210 | } | 192 | } |
diff --git a/components/package/contents/ui/EditAccount.qml b/components/package/contents/ui/EditAccount.qml new file mode 100644 index 00000000..e3e049fa --- /dev/null +++ b/components/package/contents/ui/EditAccount.qml | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | import QtQuick 2.7 | ||
21 | import QtQuick.Layouts 1.1 | ||
22 | import QtQuick.Controls 1.4 as Controls | ||
23 | import QtQuick.Controls 2.0 as Controls2 | ||
24 | import org.kde.kirigami 1.0 as Kirigami | ||
25 | |||
26 | import org.kube.framework.accounts 1.0 as KubeAccounts | ||
27 | |||
28 | Item { | ||
29 | id: root | ||
30 | property string accountId | ||
31 | |||
32 | KubeAccounts.AccountFactory { | ||
33 | id: accountFactory | ||
34 | accountId: root.accountId | ||
35 | } | ||
36 | |||
37 | Item { | ||
38 | |||
39 | anchors { | ||
40 | fill: parent | ||
41 | margins: Kirigami.Units.largeSpacing * 2 | ||
42 | } | ||
43 | |||
44 | Kirigami.Heading { | ||
45 | id: heading | ||
46 | text: loader.item.heading | ||
47 | color: Kirigami.Theme.highlightColor | ||
48 | } | ||
49 | |||
50 | Kirigami.Label { | ||
51 | id: subHeadline | ||
52 | |||
53 | anchors { | ||
54 | left: heading.left | ||
55 | top: heading.bottom | ||
56 | } | ||
57 | |||
58 | width: parent.width | ||
59 | text: loader.item.subheadline | ||
60 | color: Kirigami.Theme.disabledTextColor | ||
61 | wrapMode: Text.Wrap | ||
62 | } | ||
63 | |||
64 | Item { | ||
65 | id: accountEdit | ||
66 | anchors { | ||
67 | top:subHeadline.bottom | ||
68 | bottom: spacer.top | ||
69 | left: parent.left | ||
70 | right: parent.right | ||
71 | topMargin: Kirigami.Units.largeSpacing * 2 | ||
72 | } | ||
73 | |||
74 | Loader { | ||
75 | id: loader | ||
76 | anchors.fill: parent | ||
77 | source: accountFactory.uiPath | ||
78 | onLoaded: item.accountId = root.accountId | ||
79 | } | ||
80 | } | ||
81 | |||
82 | Item { | ||
83 | id: spacer | ||
84 | Layout.fillHeight: true | ||
85 | anchors { | ||
86 | top:accountEdit.bottom | ||
87 | bottom: footer.top | ||
88 | left: parent.left | ||
89 | right: parent.right | ||
90 | } | ||
91 | } | ||
92 | |||
93 | //This is where we should place the account wizard ui | ||
94 | GridLayout { | ||
95 | id: footer | ||
96 | anchors { | ||
97 | top:spacer.bottom | ||
98 | bottom: parent.bottom | ||
99 | left: parent.left | ||
100 | right: parent.right | ||
101 | topMargin: Kirigami.Units.largeSpacing * 2 | ||
102 | } | ||
103 | |||
104 | columns: 2 | ||
105 | columnSpacing: Kirigami.Units.largeSpacing | ||
106 | rowSpacing: Kirigami.Units.largeSpacing | ||
107 | |||
108 | Item { | ||
109 | Layout.fillHeight: true | ||
110 | } | ||
111 | |||
112 | Kirigami.Label { | ||
113 | text: "" | ||
114 | } | ||
115 | |||
116 | Item { | ||
117 | Layout.fillWidth: true | ||
118 | |||
119 | Controls.Button { | ||
120 | text: "Discard" | ||
121 | |||
122 | onClicked: { | ||
123 | dialog.closeDialog() | ||
124 | } | ||
125 | } | ||
126 | |||
127 | Controls.Button { | ||
128 | anchors.right: parent.right | ||
129 | text: "Save" | ||
130 | onClicked: { | ||
131 | loader.item.save() | ||
132 | dialog.closeDialog() | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | } | ||
diff --git a/components/package/contents/ui/EditAccountDialog.qml b/components/package/contents/ui/EditAccountDialog.qml index 19349f38..a7461640 100644 --- a/components/package/contents/ui/EditAccountDialog.qml +++ b/components/package/contents/ui/EditAccountDialog.qml | |||
@@ -21,28 +21,18 @@ import QtQuick.Layouts 1.1 | |||
21 | 21 | ||
22 | import org.kde.kirigami 1.0 as Kirigami | 22 | import org.kde.kirigami 1.0 as Kirigami |
23 | 23 | ||
24 | import org.kube.framework.settings 1.0 as KubeSettings | ||
25 | import org.kube.framework.domain 1.0 as KubeFramework | ||
26 | import org.kube.components 1.0 as KubeComponents | 24 | import org.kube.components 1.0 as KubeComponents |
27 | 25 | ||
28 | KubeComponents.OverlayDialog { | 26 | KubeComponents.OverlayDialog { |
29 | id: root | 27 | id: dialog |
30 | 28 | ||
31 | property variant uiSource | ||
32 | property variant accountId | 29 | property variant accountId |
30 | EditAccount { | ||
31 | accountId: dialog.accountId | ||
33 | 32 | ||
34 | Item { | ||
35 | id: dialog | ||
36 | anchors.centerIn: parent | 33 | anchors.centerIn: parent |
37 | 34 | ||
38 | height: root.height * 0.8 | 35 | height: dialog.height * 0.8 |
39 | width: root.width * 0.8 | 36 | width: dialog.width * 0.8 |
40 | |||
41 | Loader { | ||
42 | anchors.fill: parent | ||
43 | |||
44 | source: root.uiSource | ||
45 | onLoaded: item.accountId = root.accountId | ||
46 | } | ||
47 | } | 37 | } |
48 | } | 38 | } |