diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-08 12:54:31 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-08 13:59:31 +0200 |
commit | 3f1187e1ecd3dfa04f8bdf8022b03e7d739d9b80 (patch) | |
tree | 69e300bdf80cbc498e24f3f3600a98896ed32f97 /components/accounts | |
parent | 996f194ecdcc07dc71db1f28de5798bcf387b63d (diff) | |
download | kube-3f1187e1ecd3dfa04f8bdf8022b03e7d739d9b80.tar.gz kube-3f1187e1ecd3dfa04f8bdf8022b03e7d739d9b80.zip |
Generalize the single account concept.
* The wizard get's configured with a list of available accounts.
* If only a single account type is available we skip the selection.
* For the first account, account setup can not be aborted.
* In single account mode the account can not be removed.
Diffstat (limited to 'components/accounts')
-rw-r--r-- | components/accounts/contents/ui/AccountWizard.qml | 21 | ||||
-rw-r--r-- | components/accounts/contents/ui/AccountWizardPage.qml | 4 |
2 files changed, 12 insertions, 13 deletions
diff --git a/components/accounts/contents/ui/AccountWizard.qml b/components/accounts/contents/ui/AccountWizard.qml index 996eeb6c..b4720174 100644 --- a/components/accounts/contents/ui/AccountWizard.qml +++ b/components/accounts/contents/ui/AccountWizard.qml | |||
@@ -25,24 +25,24 @@ Kube.Popup { | |||
25 | id: root | 25 | id: root |
26 | 26 | ||
27 | 27 | ||
28 | property bool singleAccountMode: false | 28 | property bool requireSetup: false |
29 | property string forceAccountType: "" | 29 | property var availableAccountPlugins: [] |
30 | 30 | ||
31 | modal: true | 31 | modal: true |
32 | focus: true | 32 | focus: true |
33 | closePolicy: singleAccountMode ? Controls2.Popup.NoAutoClose : Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutside | 33 | closePolicy: requireSetup ? Controls2.Popup.NoAutoClose : Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutside |
34 | 34 | ||
35 | clip: true | 35 | clip: true |
36 | 36 | ||
37 | Controls2.StackView { | 37 | Controls2.StackView { |
38 | id: stack | 38 | id: stack |
39 | |||
40 | anchors.fill: parent | 39 | anchors.fill: parent |
41 | |||
42 | initialItem: root.singleAccountMode ? null : mainView | ||
43 | Component.onCompleted: { | 40 | Component.onCompleted: { |
44 | if (root.singleAccountMode) { | 41 | //If we only have one account type we skip the selection |
45 | stack.push(wizardPage.createObject(app, {accountType: root.forceAccountType})) | 42 | if (root.availableAccountPlugins.length == 1) { |
43 | stack.push(wizardPage.createObject(app, {accountType: root.availableAccountPlugins[0]})) | ||
44 | } else { | ||
45 | stack.push(mainView.createObject(app)) | ||
46 | } | 46 | } |
47 | } | 47 | } |
48 | } | 48 | } |
@@ -64,8 +64,7 @@ Kube.Popup { | |||
64 | spacing: Kube.Units.largeSpacing | 64 | spacing: Kube.Units.largeSpacing |
65 | 65 | ||
66 | Repeater { | 66 | Repeater { |
67 | //TODO replace by model of available accounts | 67 | model: root.availableAccountPlugins |
68 | model: ["kolabnow", "imap", "maildir", "gmail"] | ||
69 | delegate: Kube.Button { | 68 | delegate: Kube.Button { |
70 | Layout.fillWidth: true | 69 | Layout.fillWidth: true |
71 | text: modelData | 70 | text: modelData |
@@ -81,7 +80,7 @@ Kube.Popup { | |||
81 | Component { | 80 | Component { |
82 | id: wizardPage | 81 | id: wizardPage |
83 | AccountWizardPage { | 82 | AccountWizardPage { |
84 | singleAccountMode: root.singleAccountMode | 83 | requireSetup: root.requireSetup |
85 | onDone: { | 84 | onDone: { |
86 | root.close() | 85 | root.close() |
87 | Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) | 86 | Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) |
diff --git a/components/accounts/contents/ui/AccountWizardPage.qml b/components/accounts/contents/ui/AccountWizardPage.qml index b0b33049..f7885ce4 100644 --- a/components/accounts/contents/ui/AccountWizardPage.qml +++ b/components/accounts/contents/ui/AccountWizardPage.qml | |||
@@ -30,7 +30,7 @@ Item { | |||
30 | signal done() | 30 | signal done() |
31 | 31 | ||
32 | property bool isFirstView: root.Controls2.StackView.index == 0 | 32 | property bool isFirstView: root.Controls2.StackView.index == 0 |
33 | property bool singleAccountMode: false | 33 | property bool requireSetup: false |
34 | 34 | ||
35 | Kube.AccountFactory { | 35 | Kube.AccountFactory { |
36 | id: accountFactory | 36 | id: accountFactory |
@@ -119,7 +119,7 @@ Item { | |||
119 | left: parent.left | 119 | left: parent.left |
120 | bottom: parent.bottom | 120 | bottom: parent.bottom |
121 | } | 121 | } |
122 | visible: !root.singleAccountMode | 122 | visible: !root.requireSetup |
123 | 123 | ||
124 | text: qsTr("Discard") | 124 | text: qsTr("Discard") |
125 | onClicked: { | 125 | onClicked: { |