From 6f4e9230a88bc2262a1093ae9f2507f1160bff54 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 7 Sep 2017 17:07:29 +0200 Subject: Single account mode It's hardcoded to be enabled and set to kolabnow at the moment (TBD). --- components/accounts/contents/ui/AccountWizard.qml | 18 ++++++++++++++---- components/accounts/contents/ui/AccountWizardPage.qml | 5 +++++ components/kube/contents/ui/AccountsView.qml | 15 +++++++++++++++ framework/qml/EditAccount.qml | 2 ++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/components/accounts/contents/ui/AccountWizard.qml b/components/accounts/contents/ui/AccountWizard.qml index ea7b491f..996eeb6c 100644 --- a/components/accounts/contents/ui/AccountWizard.qml +++ b/components/accounts/contents/ui/AccountWizard.qml @@ -22,11 +22,15 @@ import QtQuick.Controls 2.0 as Controls2 import org.kube.framework 1.0 as Kube Kube.Popup { - id: popup + id: root + + + property bool singleAccountMode: false + property string forceAccountType: "" modal: true focus: true - closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutside + closePolicy: singleAccountMode ? Controls2.Popup.NoAutoClose : Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutside clip: true @@ -35,7 +39,12 @@ Kube.Popup { anchors.fill: parent - initialItem: mainView + initialItem: root.singleAccountMode ? null : mainView + Component.onCompleted: { + if (root.singleAccountMode) { + stack.push(wizardPage.createObject(app, {accountType: root.forceAccountType})) + } + } } Component { @@ -72,8 +81,9 @@ Kube.Popup { Component { id: wizardPage AccountWizardPage { + singleAccountMode: root.singleAccountMode onDone: { - popup.close() + 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 f5d10258..6c9befea 100644 --- a/components/accounts/contents/ui/AccountWizardPage.qml +++ b/components/accounts/contents/ui/AccountWizardPage.qml @@ -29,6 +29,9 @@ Item { property string accountType signal done() + property bool isFirstView: root.Controls2.StackView.index == 0 + property bool singleAccountMode: false + Kube.AccountFactory { id: accountFactory accountType: root.accountType @@ -38,6 +41,7 @@ Item { id: backButton iconName: Kube.Icons.goBack tooltip: "go back" + visible: !root.isFirstView onClicked: { stack.pop() } @@ -115,6 +119,7 @@ Item { left: parent.left bottom: parent.bottom } + visible: !root.singleAccountMode text: qsTr("Discard") onClicked: { diff --git a/components/kube/contents/ui/AccountsView.qml b/components/kube/contents/ui/AccountsView.qml index 235ead8e..adcc2b68 100644 --- a/components/kube/contents/ui/AccountsView.qml +++ b/components/kube/contents/ui/AccountsView.qml @@ -19,11 +19,14 @@ import QtQuick 2.4 import QtQuick.Layouts 1.1 import QtQuick.Controls 1.3 as Controls +import QtQuick.Controls 2.0 as Controls2 import org.kube.framework 1.0 as Kube import org.kube.components.accounts 1.0 as KubeAccounts Rectangle { + id: root color: Kube.Colors.backgroundColor + property bool singleAccountMode: true Controls.SplitView { height: parent.height @@ -33,6 +36,7 @@ Rectangle { id: accountList width: Kube.Units.gridUnit * 12 Layout.fillHeight: true + visible: !root.singleAccountMode Kube.PositiveButton { id: newAccountButton @@ -98,6 +102,14 @@ Rectangle { bottomMargin: Kube.Units.largeSpacing } + singleAccountMode: root.singleAccountMode + + Component.onCompleted: { + //FIXME: this assumes we load accounts synchronously, which we do right now. + if (accountId == "") { + accountWizard.open() + } + } } } } @@ -106,6 +118,9 @@ Rectangle { KubeAccounts.AccountWizard { id: accountWizard + singleAccountMode: root.singleAccountMode + forceAccountType: "kolabnow" + height: app.height * 0.85 width: app.width * 0.85 diff --git a/framework/qml/EditAccount.qml b/framework/qml/EditAccount.qml index 03bf2dea..fb21f655 100644 --- a/framework/qml/EditAccount.qml +++ b/framework/qml/EditAccount.qml @@ -25,6 +25,7 @@ import org.kube.framework 1.0 as Kube Item { id: root property string accountId + property bool singleAccountMode: false Kube.AccountFactory { id: accountFactory @@ -113,6 +114,7 @@ Item { Kube.Button { text: qsTr("Remove Account") + visible: !root.singleAccountMode onClicked: { loader.item.remove() -- cgit v1.2.3