diff options
-rw-r--r-- | components/accounts/contents/ui/AccountWizard.qml | 21 | ||||
-rw-r--r-- | components/accounts/contents/ui/AccountWizardPage.qml | 4 | ||||
-rw-r--r-- | components/kube/contents/ui/AccountsView.qml | 14 | ||||
-rw-r--r-- | framework/qml/EditAccount.qml | 4 |
4 files changed, 24 insertions, 19 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: { |
diff --git a/components/kube/contents/ui/AccountsView.qml b/components/kube/contents/ui/AccountsView.qml index adcc2b68..5b19d3fd 100644 --- a/components/kube/contents/ui/AccountsView.qml +++ b/components/kube/contents/ui/AccountsView.qml | |||
@@ -26,7 +26,10 @@ import org.kube.components.accounts 1.0 as KubeAccounts | |||
26 | Rectangle { | 26 | Rectangle { |
27 | id: root | 27 | id: root |
28 | color: Kube.Colors.backgroundColor | 28 | color: Kube.Colors.backgroundColor |
29 | property bool singleAccountMode: true | 29 | //Defines whether more than one account is supported. |
30 | property bool singleAccountMode: false | ||
31 | //Defines available account types. | ||
32 | property var availableAccountPlugins: ["kolabnow", "imap", "maildir", "gmail"] | ||
30 | 33 | ||
31 | Controls.SplitView { | 34 | Controls.SplitView { |
32 | height: parent.height | 35 | height: parent.height |
@@ -102,11 +105,15 @@ Rectangle { | |||
102 | bottomMargin: Kube.Units.largeSpacing | 105 | bottomMargin: Kube.Units.largeSpacing |
103 | } | 106 | } |
104 | 107 | ||
105 | singleAccountMode: root.singleAccountMode | 108 | canRemove: !root.singleAccountMode |
106 | 109 | ||
107 | Component.onCompleted: { | 110 | Component.onCompleted: { |
111 | //We don't have any accounts setup if accountId is empty, so we trigger the accountWizard | ||
108 | //FIXME: this assumes we load accounts synchronously, which we do right now. | 112 | //FIXME: this assumes we load accounts synchronously, which we do right now. |
109 | if (accountId == "") { | 113 | if (accountId == "") { |
114 | //Require the setup to be completed since it's the first account | ||
115 | accountWizard.requireSetup = true | ||
116 | //Launch account wizard | ||
110 | accountWizard.open() | 117 | accountWizard.open() |
111 | } | 118 | } |
112 | } | 119 | } |
@@ -118,8 +125,7 @@ Rectangle { | |||
118 | KubeAccounts.AccountWizard { | 125 | KubeAccounts.AccountWizard { |
119 | id: accountWizard | 126 | id: accountWizard |
120 | 127 | ||
121 | singleAccountMode: root.singleAccountMode | 128 | availableAccountPlugins: root.availableAccountPlugins |
122 | forceAccountType: "kolabnow" | ||
123 | 129 | ||
124 | height: app.height * 0.85 | 130 | height: app.height * 0.85 |
125 | width: app.width * 0.85 | 131 | width: app.width * 0.85 |
diff --git a/framework/qml/EditAccount.qml b/framework/qml/EditAccount.qml index 8600868f..25d3dba0 100644 --- a/framework/qml/EditAccount.qml +++ b/framework/qml/EditAccount.qml | |||
@@ -25,7 +25,7 @@ import org.kube.framework 1.0 as Kube | |||
25 | Item { | 25 | Item { |
26 | id: root | 26 | id: root |
27 | property string accountId | 27 | property string accountId |
28 | property bool singleAccountMode: false | 28 | property bool canRemove: true |
29 | 29 | ||
30 | Kube.AccountFactory { | 30 | Kube.AccountFactory { |
31 | id: accountFactory | 31 | id: accountFactory |
@@ -114,7 +114,7 @@ Item { | |||
114 | 114 | ||
115 | Kube.Button { | 115 | Kube.Button { |
116 | text: qsTr("Remove Account") | 116 | text: qsTr("Remove Account") |
117 | visible: !root.singleAccountMode | 117 | visible: root.canRemove |
118 | 118 | ||
119 | onClicked: { | 119 | onClicked: { |
120 | loader.item.remove() | 120 | loader.item.remove() |