diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-23 22:42:39 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-23 22:45:02 +0100 |
commit | 5f17e726ad63eec6ef78d15baa8ed42625679197 (patch) | |
tree | 416a8f9a8ed68ebbbaf8f89e6b4224c51cddec79 | |
parent | 4fbaad6d3a14326641669c0614f9acba82572d9a (diff) | |
download | kube-5f17e726ad63eec6ef78d15baa8ed42625679197.tar.gz kube-5f17e726ad63eec6ef78d15baa8ed42625679197.zip |
Dynamically create the accountwizard
to avoid maintaining state. We used to see the old wizard when creating
an additional account.
-rw-r--r-- | components/accounts/qml/AccountWizard.qml | 2 | ||||
-rw-r--r-- | views/accounts/qml/View.qml | 37 |
2 files changed, 18 insertions, 21 deletions
diff --git a/components/accounts/qml/AccountWizard.qml b/components/accounts/qml/AccountWizard.qml index 9c4adbe2..58ef4509 100644 --- a/components/accounts/qml/AccountWizard.qml +++ b/components/accounts/qml/AccountWizard.qml | |||
@@ -85,7 +85,7 @@ Kube.Popup { | |||
85 | focus: true | 85 | focus: true |
86 | requireSetup: root.requireSetup | 86 | requireSetup: root.requireSetup |
87 | onDone: { | 87 | onDone: { |
88 | root.close() | 88 | root.destroy() |
89 | Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) | 89 | Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) |
90 | } | 90 | } |
91 | } | 91 | } |
diff --git a/views/accounts/qml/View.qml b/views/accounts/qml/View.qml index b81579ae..28849ae4 100644 --- a/views/accounts/qml/View.qml +++ b/views/accounts/qml/View.qml | |||
@@ -50,7 +50,9 @@ FocusScope { | |||
50 | } | 50 | } |
51 | text: qsTr("New Account") | 51 | text: qsTr("New Account") |
52 | 52 | ||
53 | onClicked: accountWizard.open() | 53 | onClicked: { |
54 | accountWizardComponent.createObject(root, {}).open() | ||
55 | } | ||
54 | } | 56 | } |
55 | 57 | ||
56 | Kube.ListView { | 58 | Kube.ListView { |
@@ -112,32 +114,27 @@ FocusScope { | |||
112 | //FIXME: this assumes we load accounts synchronously, which we do right now. | 114 | //FIXME: this assumes we load accounts synchronously, which we do right now. |
113 | if (accountId == "") { | 115 | if (accountId == "") { |
114 | //Require the setup to be completed since it's the first account | 116 | //Require the setup to be completed since it's the first account |
115 | accountWizard.requireSetup = true | 117 | accountWizardComponent.createObject(root, {requireSetup: true}).open() |
116 | //Launch account wizard | ||
117 | accountWizard.open() | ||
118 | } | 118 | } |
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | onActiveFocusChanged: { | ||
125 | if (activeFocus && accountWizard.visible) { | ||
126 | accountWizard.forceActiveFocus() | ||
127 | } | ||
128 | } | ||
129 | |||
130 | //BEGIN AccountWizard | 124 | //BEGIN AccountWizard |
131 | KubeAccounts.AccountWizard { | 125 | Component { |
132 | id: accountWizard | 126 | id: accountWizardComponent |
133 | 127 | KubeAccounts.AccountWizard { | |
134 | parent: ApplicationWindow.overlay | 128 | id: accountWizard |
135 | height: root.height | 129 | |
136 | width: root.width | 130 | parent: ApplicationWindow.overlay |
137 | x: root.mapToGlobal(root.x, root.y).x | 131 | height: root.height |
138 | y: 0 | 132 | width: root.width |
139 | 133 | x: root.mapToGlobal(root.x, root.y).x | |
140 | availableAccountPlugins: root.availableAccountPlugins | 134 | y: 0 |
135 | |||
136 | availableAccountPlugins: root.availableAccountPlugins | ||
137 | } | ||
141 | } | 138 | } |
142 | //END AccountWizard | 139 | //END AccountWizard |
143 | } | 140 | } |