From 2b8653a06a716fda634d71ada0230b2076c3f639 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 24 Oct 2017 10:46:26 +0200 Subject: Only load the login view for accounts that require a keyring --- components/kube/contents/ui/Kube.qml | 55 ++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'components') 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 { } } + Kube.AccountFactory { + id: accountFactory + accountId: app.currentAccount + } + //Interval sync Timer { id: intervalSync @@ -251,12 +256,39 @@ Controls2.ApplicationWindow { } Layout.fillWidth: true + function loginIfNecessary() + { + if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { + if (accountFactory.requiresKeyring) { + setLoginView() + } else { + Kube.Keyring.unlock(app.currentAccount) + } + } + } + Kube.Listener { filter: Kube.Messages.componentDone onMessageReceived: { kubeViews.pop(Controls2.StackView.Immediate) - if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { - kubeViews.setLoginView() + loginIfNecessary() + } + } + + onCurrentItemChanged: { + if (currentItem) { + currentItem.forceActiveFocus() + } + } + + Component.onCompleted: { + //Setup the initial item stack + if (!currentItem) { + setMailView() + if (startupCheck.noAccount) { + setAccountsView() + } else { + loginIfNecessary() } } } @@ -304,25 +336,6 @@ Controls2.ApplicationWindow { pushView(composerView, {message: mail, loadAsDraft: openAsDraft}) } - onCurrentItemChanged: { - if (currentItem) { - currentItem.forceActiveFocus() - } - } - - Component.onCompleted: { - //Setup the initial item stack - if (!currentItem) { - setMailView(); - if (startupCheck.noAccount) { - setAccountsView() - } else { - if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { - setLoginView() - } - } - } - } //These items are not visible until pushed onto the stack, so we keep them in resources instead of items resources: [ -- cgit v1.2.3