From 3f1187e1ecd3dfa04f8bdf8022b03e7d739d9b80 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 8 Sep 2017 12:54:31 +0200 Subject: 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. --- components/accounts/contents/ui/AccountWizard.qml | 21 ++++++++++----------- .../accounts/contents/ui/AccountWizardPage.qml | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'components/accounts') 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 { id: root - property bool singleAccountMode: false - property string forceAccountType: "" + property bool requireSetup: false + property var availableAccountPlugins: [] modal: true focus: true - closePolicy: singleAccountMode ? Controls2.Popup.NoAutoClose : Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutside + closePolicy: requireSetup ? Controls2.Popup.NoAutoClose : Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutside clip: true Controls2.StackView { id: stack - anchors.fill: parent - - initialItem: root.singleAccountMode ? null : mainView Component.onCompleted: { - if (root.singleAccountMode) { - stack.push(wizardPage.createObject(app, {accountType: root.forceAccountType})) + //If we only have one account type we skip the selection + if (root.availableAccountPlugins.length == 1) { + stack.push(wizardPage.createObject(app, {accountType: root.availableAccountPlugins[0]})) + } else { + stack.push(mainView.createObject(app)) } } } @@ -64,8 +64,7 @@ Kube.Popup { spacing: Kube.Units.largeSpacing Repeater { - //TODO replace by model of available accounts - model: ["kolabnow", "imap", "maildir", "gmail"] + model: root.availableAccountPlugins delegate: Kube.Button { Layout.fillWidth: true text: modelData @@ -81,7 +80,7 @@ Kube.Popup { Component { id: wizardPage AccountWizardPage { - singleAccountMode: root.singleAccountMode + requireSetup: root.requireSetup onDone: { root.close() 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 { signal done() property bool isFirstView: root.Controls2.StackView.index == 0 - property bool singleAccountMode: false + property bool requireSetup: false Kube.AccountFactory { id: accountFactory @@ -119,7 +119,7 @@ Item { left: parent.left bottom: parent.bottom } - visible: !root.singleAccountMode + visible: !root.requireSetup text: qsTr("Discard") onClicked: { -- cgit v1.2.3