From 2a60a0723257cfd6855233b9af27dc9735915435 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 22 Sep 2017 10:23:44 +0200 Subject: Keyring fixes * Avoid double free * track unlocked state * Ensure we bring up the login screen on startup and after saving the configuration. --- components/kube/contents/ui/Kube.qml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'components') diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml index 603a499f..7625c52c 100644 --- a/components/kube/contents/ui/Kube.qml +++ b/components/kube/contents/ui/Kube.qml @@ -47,8 +47,11 @@ Controls2.ApplicationWindow { property variant currentAccount onCurrentAccountChanged: { if (!!currentAccount) { - console.warn("Syncing account", currentAccount) - Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": currentAccount}) + if (kubeViews.currentItem && !Kube.Keyring.isUnlocked(currentAccount)) { + kubeViews.setLoginView() + } else { + Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": currentAccount}) + } } } @@ -282,7 +285,9 @@ Controls2.ApplicationWindow { } function setLoginView() { - pushView(loginView, {accountId: currentAccount}) + if (currentItem != loginView) { + pushView(loginView, {accountId: currentAccount}) + } } function openComposer(newMessage, recipients) { @@ -301,11 +306,9 @@ Controls2.ApplicationWindow { Component.onCompleted: { if (!currentItem) { - if (!Kube.Keyring.isUnlocked(app.currentAccount)) { - setMailView(); + setMailView(); + if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { setLoginView() - } else { - setMailView(); } } } -- cgit v1.2.3