diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-22 10:23:44 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-22 10:27:56 +0200 |
commit | 2a60a0723257cfd6855233b9af27dc9735915435 (patch) | |
tree | 9dcabe95cff050ad77f7bca03c4b85e51c4ffa10 /components | |
parent | 1f1ffbceb15dbc9e8a7ff567666a026ef221039e (diff) | |
download | kube-2a60a0723257cfd6855233b9af27dc9735915435.tar.gz kube-2a60a0723257cfd6855233b9af27dc9735915435.zip |
Keyring fixes
* Avoid double free
* track unlocked state
* Ensure we bring up the login screen on startup and after saving the
configuration.
Diffstat (limited to 'components')
-rw-r--r-- | components/kube/contents/ui/Kube.qml | 17 |
1 files changed, 10 insertions, 7 deletions
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 { | |||
47 | property variant currentAccount | 47 | property variant currentAccount |
48 | onCurrentAccountChanged: { | 48 | onCurrentAccountChanged: { |
49 | if (!!currentAccount) { | 49 | if (!!currentAccount) { |
50 | console.warn("Syncing account", currentAccount) | 50 | if (kubeViews.currentItem && !Kube.Keyring.isUnlocked(currentAccount)) { |
51 | Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": currentAccount}) | 51 | kubeViews.setLoginView() |
52 | } else { | ||
53 | Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": currentAccount}) | ||
54 | } | ||
52 | } | 55 | } |
53 | } | 56 | } |
54 | 57 | ||
@@ -282,7 +285,9 @@ Controls2.ApplicationWindow { | |||
282 | } | 285 | } |
283 | 286 | ||
284 | function setLoginView() { | 287 | function setLoginView() { |
285 | pushView(loginView, {accountId: currentAccount}) | 288 | if (currentItem != loginView) { |
289 | pushView(loginView, {accountId: currentAccount}) | ||
290 | } | ||
286 | } | 291 | } |
287 | 292 | ||
288 | function openComposer(newMessage, recipients) { | 293 | function openComposer(newMessage, recipients) { |
@@ -301,11 +306,9 @@ Controls2.ApplicationWindow { | |||
301 | 306 | ||
302 | Component.onCompleted: { | 307 | Component.onCompleted: { |
303 | if (!currentItem) { | 308 | if (!currentItem) { |
304 | if (!Kube.Keyring.isUnlocked(app.currentAccount)) { | 309 | setMailView(); |
305 | setMailView(); | 310 | if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) { |
306 | setLoginView() | 311 | setLoginView() |
307 | } else { | ||
308 | setMailView(); | ||
309 | } | 312 | } |
310 | } | 313 | } |
311 | } | 314 | } |