diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/kube/contents/ui/Kube.qml | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml index ccbec2da..c5726eff 100644 --- a/components/kube/contents/ui/Kube.qml +++ b/components/kube/contents/ui/Kube.qml | |||
@@ -50,6 +50,11 @@ Controls2.ApplicationWindow { | |||
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | Kube.AccountFactory { | ||
54 | id: accountFactory | ||
55 | accountId: app.currentAccount | ||
56 | } | ||
57 | |||
53 | //Interval sync | 58 | //Interval sync |
54 | Timer { | 59 | Timer { |
55 | id: intervalSync | 60 | id: intervalSync |
@@ -251,12 +256,39 @@ Controls2.ApplicationWindow { | |||
251 | } | 256 | } |
252 | Layout.fillWidth: true | 257 | Layout.fillWidth: true |
253 | 258 | ||
259 | function loginIfNecessary() | ||
260 | { | ||
261 | if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { | ||
262 | if (accountFactory.requiresKeyring) { | ||
263 | setLoginView() | ||
264 | } else { | ||
265 | Kube.Keyring.unlock(app.currentAccount) | ||
266 | } | ||
267 | } | ||
268 | } | ||
269 | |||
254 | Kube.Listener { | 270 | Kube.Listener { |
255 | filter: Kube.Messages.componentDone | 271 | filter: Kube.Messages.componentDone |
256 | onMessageReceived: { | 272 | onMessageReceived: { |
257 | kubeViews.pop(Controls2.StackView.Immediate) | 273 | kubeViews.pop(Controls2.StackView.Immediate) |
258 | if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { | 274 | loginIfNecessary() |
259 | kubeViews.setLoginView() | 275 | } |
276 | } | ||
277 | |||
278 | onCurrentItemChanged: { | ||
279 | if (currentItem) { | ||
280 | currentItem.forceActiveFocus() | ||
281 | } | ||
282 | } | ||
283 | |||
284 | Component.onCompleted: { | ||
285 | //Setup the initial item stack | ||
286 | if (!currentItem) { | ||
287 | setMailView() | ||
288 | if (startupCheck.noAccount) { | ||
289 | setAccountsView() | ||
290 | } else { | ||
291 | loginIfNecessary() | ||
260 | } | 292 | } |
261 | } | 293 | } |
262 | } | 294 | } |
@@ -304,25 +336,6 @@ Controls2.ApplicationWindow { | |||
304 | pushView(composerView, {message: mail, loadAsDraft: openAsDraft}) | 336 | pushView(composerView, {message: mail, loadAsDraft: openAsDraft}) |
305 | } | 337 | } |
306 | 338 | ||
307 | onCurrentItemChanged: { | ||
308 | if (currentItem) { | ||
309 | currentItem.forceActiveFocus() | ||
310 | } | ||
311 | } | ||
312 | |||
313 | Component.onCompleted: { | ||
314 | //Setup the initial item stack | ||
315 | if (!currentItem) { | ||
316 | setMailView(); | ||
317 | if (startupCheck.noAccount) { | ||
318 | setAccountsView() | ||
319 | } else { | ||
320 | if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { | ||
321 | setLoginView() | ||
322 | } | ||
323 | } | ||
324 | } | ||
325 | } | ||
326 | 339 | ||
327 | //These items are not visible until pushed onto the stack, so we keep them in resources instead of items | 340 | //These items are not visible until pushed onto the stack, so we keep them in resources instead of items |
328 | resources: [ | 341 | resources: [ |