diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-07 17:07:29 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-07 22:44:36 +0200 |
commit | 6f4e9230a88bc2262a1093ae9f2507f1160bff54 (patch) | |
tree | 12fed1e37e452bf4b4bf8986492e0bdfe28a8b38 | |
parent | b7b5ec6b6b6dc269500574ea6d8c34852179edc7 (diff) | |
download | kube-6f4e9230a88bc2262a1093ae9f2507f1160bff54.tar.gz kube-6f4e9230a88bc2262a1093ae9f2507f1160bff54.zip |
Single account mode
It's hardcoded to be enabled and set to kolabnow at the moment (TBD).
-rw-r--r-- | components/accounts/contents/ui/AccountWizard.qml | 18 | ||||
-rw-r--r-- | components/accounts/contents/ui/AccountWizardPage.qml | 5 | ||||
-rw-r--r-- | components/kube/contents/ui/AccountsView.qml | 15 | ||||
-rw-r--r-- | 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 | |||
22 | import org.kube.framework 1.0 as Kube | 22 | import org.kube.framework 1.0 as Kube |
23 | 23 | ||
24 | Kube.Popup { | 24 | Kube.Popup { |
25 | id: popup | 25 | id: root |
26 | |||
27 | |||
28 | property bool singleAccountMode: false | ||
29 | property string forceAccountType: "" | ||
26 | 30 | ||
27 | modal: true | 31 | modal: true |
28 | focus: true | 32 | focus: true |
29 | closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutside | 33 | closePolicy: singleAccountMode ? Controls2.Popup.NoAutoClose : Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutside |
30 | 34 | ||
31 | clip: true | 35 | clip: true |
32 | 36 | ||
@@ -35,7 +39,12 @@ Kube.Popup { | |||
35 | 39 | ||
36 | anchors.fill: parent | 40 | anchors.fill: parent |
37 | 41 | ||
38 | initialItem: mainView | 42 | initialItem: root.singleAccountMode ? null : mainView |
43 | Component.onCompleted: { | ||
44 | if (root.singleAccountMode) { | ||
45 | stack.push(wizardPage.createObject(app, {accountType: root.forceAccountType})) | ||
46 | } | ||
47 | } | ||
39 | } | 48 | } |
40 | 49 | ||
41 | Component { | 50 | Component { |
@@ -72,8 +81,9 @@ Kube.Popup { | |||
72 | Component { | 81 | Component { |
73 | id: wizardPage | 82 | id: wizardPage |
74 | AccountWizardPage { | 83 | AccountWizardPage { |
84 | singleAccountMode: root.singleAccountMode | ||
75 | onDone: { | 85 | onDone: { |
76 | popup.close() | 86 | root.close() |
77 | Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) | 87 | Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) |
78 | } | 88 | } |
79 | } | 89 | } |
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 { | |||
29 | property string accountType | 29 | property string accountType |
30 | signal done() | 30 | signal done() |
31 | 31 | ||
32 | property bool isFirstView: root.Controls2.StackView.index == 0 | ||
33 | property bool singleAccountMode: false | ||
34 | |||
32 | Kube.AccountFactory { | 35 | Kube.AccountFactory { |
33 | id: accountFactory | 36 | id: accountFactory |
34 | accountType: root.accountType | 37 | accountType: root.accountType |
@@ -38,6 +41,7 @@ Item { | |||
38 | id: backButton | 41 | id: backButton |
39 | iconName: Kube.Icons.goBack | 42 | iconName: Kube.Icons.goBack |
40 | tooltip: "go back" | 43 | tooltip: "go back" |
44 | visible: !root.isFirstView | ||
41 | onClicked: { | 45 | onClicked: { |
42 | stack.pop() | 46 | stack.pop() |
43 | } | 47 | } |
@@ -115,6 +119,7 @@ Item { | |||
115 | left: parent.left | 119 | left: parent.left |
116 | bottom: parent.bottom | 120 | bottom: parent.bottom |
117 | } | 121 | } |
122 | visible: !root.singleAccountMode | ||
118 | 123 | ||
119 | text: qsTr("Discard") | 124 | text: qsTr("Discard") |
120 | onClicked: { | 125 | 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 @@ | |||
19 | import QtQuick 2.4 | 19 | import QtQuick 2.4 |
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 |
21 | import QtQuick.Controls 1.3 as Controls | 21 | import QtQuick.Controls 1.3 as Controls |
22 | import QtQuick.Controls 2.0 as Controls2 | ||
22 | import org.kube.framework 1.0 as Kube | 23 | import org.kube.framework 1.0 as Kube |
23 | import org.kube.components.accounts 1.0 as KubeAccounts | 24 | import org.kube.components.accounts 1.0 as KubeAccounts |
24 | 25 | ||
25 | Rectangle { | 26 | Rectangle { |
27 | id: root | ||
26 | color: Kube.Colors.backgroundColor | 28 | color: Kube.Colors.backgroundColor |
29 | property bool singleAccountMode: true | ||
27 | 30 | ||
28 | Controls.SplitView { | 31 | Controls.SplitView { |
29 | height: parent.height | 32 | height: parent.height |
@@ -33,6 +36,7 @@ Rectangle { | |||
33 | id: accountList | 36 | id: accountList |
34 | width: Kube.Units.gridUnit * 12 | 37 | width: Kube.Units.gridUnit * 12 |
35 | Layout.fillHeight: true | 38 | Layout.fillHeight: true |
39 | visible: !root.singleAccountMode | ||
36 | 40 | ||
37 | Kube.PositiveButton { | 41 | Kube.PositiveButton { |
38 | id: newAccountButton | 42 | id: newAccountButton |
@@ -98,6 +102,14 @@ Rectangle { | |||
98 | bottomMargin: Kube.Units.largeSpacing | 102 | bottomMargin: Kube.Units.largeSpacing |
99 | } | 103 | } |
100 | 104 | ||
105 | singleAccountMode: root.singleAccountMode | ||
106 | |||
107 | Component.onCompleted: { | ||
108 | //FIXME: this assumes we load accounts synchronously, which we do right now. | ||
109 | if (accountId == "") { | ||
110 | accountWizard.open() | ||
111 | } | ||
112 | } | ||
101 | } | 113 | } |
102 | } | 114 | } |
103 | } | 115 | } |
@@ -106,6 +118,9 @@ Rectangle { | |||
106 | KubeAccounts.AccountWizard { | 118 | KubeAccounts.AccountWizard { |
107 | id: accountWizard | 119 | id: accountWizard |
108 | 120 | ||
121 | singleAccountMode: root.singleAccountMode | ||
122 | forceAccountType: "kolabnow" | ||
123 | |||
109 | height: app.height * 0.85 | 124 | height: app.height * 0.85 |
110 | width: app.width * 0.85 | 125 | width: app.width * 0.85 |
111 | 126 | ||
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 | |||
25 | Item { | 25 | Item { |
26 | id: root | 26 | id: root |
27 | property string accountId | 27 | property string accountId |
28 | property bool singleAccountMode: false | ||
28 | 29 | ||
29 | Kube.AccountFactory { | 30 | Kube.AccountFactory { |
30 | id: accountFactory | 31 | id: accountFactory |
@@ -113,6 +114,7 @@ Item { | |||
113 | 114 | ||
114 | Kube.Button { | 115 | Kube.Button { |
115 | text: qsTr("Remove Account") | 116 | text: qsTr("Remove Account") |
117 | visible: !root.singleAccountMode | ||
116 | 118 | ||
117 | onClicked: { | 119 | onClicked: { |
118 | loader.item.remove() | 120 | loader.item.remove() |