diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/accounts/contents/ui/AccountWizardPage.qml | 22 | ||||
-rw-r--r-- | components/kube/contents/ui/Kube.qml | 24 |
2 files changed, 28 insertions, 18 deletions
diff --git a/components/accounts/contents/ui/AccountWizardPage.qml b/components/accounts/contents/ui/AccountWizardPage.qml index 74decf1f..18001419 100644 --- a/components/accounts/contents/ui/AccountWizardPage.qml +++ b/components/accounts/contents/ui/AccountWizardPage.qml | |||
@@ -32,6 +32,16 @@ FocusScope { | |||
32 | property bool isFirstView: root.Controls2.StackView.index == 0 | 32 | property bool isFirstView: root.Controls2.StackView.index == 0 |
33 | property bool requireSetup: false | 33 | property bool requireSetup: false |
34 | 34 | ||
35 | function save() { | ||
36 | if (loader.item.valid) { | ||
37 | loader.item.save() | ||
38 | Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": loader.item.accountIdentifier}); | ||
39 | root.done() | ||
40 | } else { | ||
41 | console.warn("Invalid settings."); | ||
42 | } | ||
43 | } | ||
44 | |||
35 | Kube.AccountFactory { | 45 | Kube.AccountFactory { |
36 | id: accountFactory | 46 | id: accountFactory |
37 | accountType: root.accountType | 47 | accountType: root.accountType |
@@ -47,6 +57,8 @@ FocusScope { | |||
47 | } | 57 | } |
48 | } | 58 | } |
49 | 59 | ||
60 | Keys.onReturnPressed: save() | ||
61 | |||
50 | //Item to avoid anchors conflict with stack | 62 | //Item to avoid anchors conflict with stack |
51 | Item { | 63 | Item { |
52 | anchors{ | 64 | anchors{ |
@@ -135,15 +147,7 @@ FocusScope { | |||
135 | } | 147 | } |
136 | 148 | ||
137 | text: qsTr("Save") | 149 | text: qsTr("Save") |
138 | onClicked: { | 150 | onClicked: save() |
139 | if (loader.item.valid) { | ||
140 | loader.item.save() | ||
141 | Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": loader.item.accountIdentifier}); | ||
142 | root.done() | ||
143 | } else { | ||
144 | console.warn("Invalid settings."); | ||
145 | } | ||
146 | } | ||
147 | } | 151 | } |
148 | } | 152 | } |
149 | } | 153 | } |
diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml index 7625c52c..0a92b783 100644 --- a/components/kube/contents/ui/Kube.qml +++ b/components/kube/contents/ui/Kube.qml | |||
@@ -47,11 +47,7 @@ Controls2.ApplicationWindow { | |||
47 | property variant currentAccount | 47 | property variant currentAccount |
48 | onCurrentAccountChanged: { | 48 | onCurrentAccountChanged: { |
49 | if (!!currentAccount) { | 49 | if (!!currentAccount) { |
50 | if (kubeViews.currentItem && !Kube.Keyring.isUnlocked(currentAccount)) { | 50 | Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": currentAccount}) |
51 | kubeViews.setLoginView() | ||
52 | } else { | ||
53 | Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": currentAccount}) | ||
54 | } | ||
55 | } | 51 | } |
56 | } | 52 | } |
57 | 53 | ||
@@ -66,7 +62,7 @@ Controls2.ApplicationWindow { | |||
66 | } | 62 | } |
67 | 63 | ||
68 | Kube.StartupCheck { | 64 | Kube.StartupCheck { |
69 | onNoAccount: kubeViews.setAccountsView() | 65 | id: startupCheck |
70 | } | 66 | } |
71 | 67 | ||
72 | //Listener | 68 | //Listener |
@@ -252,7 +248,12 @@ Controls2.ApplicationWindow { | |||
252 | 248 | ||
253 | Kube.Listener { | 249 | Kube.Listener { |
254 | filter: Kube.Messages.componentDone | 250 | filter: Kube.Messages.componentDone |
255 | onMessageReceived: kubeViews.pop(Controls2.StackView.Immediate) | 251 | onMessageReceived: { |
252 | kubeViews.pop(Controls2.StackView.Immediate) | ||
253 | if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { | ||
254 | kubeViews.setLoginView() | ||
255 | } | ||
256 | } | ||
256 | } | 257 | } |
257 | 258 | ||
258 | ///Replace the current view (we can't go back to the old view, and we destroy the old view) | 259 | ///Replace the current view (we can't go back to the old view, and we destroy the old view) |
@@ -305,10 +306,15 @@ Controls2.ApplicationWindow { | |||
305 | } | 306 | } |
306 | 307 | ||
307 | Component.onCompleted: { | 308 | Component.onCompleted: { |
309 | //Setup the initial item stack | ||
308 | if (!currentItem) { | 310 | if (!currentItem) { |
309 | setMailView(); | 311 | setMailView(); |
310 | if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { | 312 | if (startupCheck.noAccount) { |
311 | setLoginView() | 313 | setAccountsView() |
314 | } else { | ||
315 | if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { | ||
316 | setLoginView() | ||
317 | } | ||
312 | } | 318 | } |
313 | } | 319 | } |
314 | } | 320 | } |