summaryrefslogtreecommitdiffstats
path: root/components/kube/qml/Kube.qml
diff options
context:
space:
mode:
Diffstat (limited to 'components/kube/qml/Kube.qml')
-rw-r--r--components/kube/qml/Kube.qml38
1 files changed, 8 insertions, 30 deletions
diff --git a/components/kube/qml/Kube.qml b/components/kube/qml/Kube.qml
index 79b18a2f..e7c4f70e 100644
--- a/components/kube/qml/Kube.qml
+++ b/components/kube/qml/Kube.qml
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net> 2 * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net>
3 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -50,12 +51,6 @@ Controls2.ApplicationWindow {
50 } 51 }
51 } 52 }
52 53
53 //accountId -> requiresKeyring
54 Kube.AccountFactory {
55 id: accountFactory
56 accountId: !!app.currentAccount ? app.currentAccount : ""
57 }
58
59 //Interval sync 54 //Interval sync
60 Timer { 55 Timer {
61 id: intervalSync 56 id: intervalSync
@@ -70,10 +65,13 @@ Controls2.ApplicationWindow {
70 id: startupCheck 65 id: startupCheck
71 } 66 }
72 67
68 Accounts {
69 }
70
73 //Listener 71 //Listener
74 Kube.Listener { 72 Kube.Listener {
75 filter: Kube.Messages.accountSelection 73 filter: Kube.Messages.accountSelection
76 onMessageReceived: app.currentAccount = message.account 74 onMessageReceived: app.currentAccount = message.accountId
77 } 75 }
78 76
79 Kube.Listener { 77 Kube.Listener {
@@ -109,7 +107,7 @@ Controls2.ApplicationWindow {
109 107
110 Kube.Listener { 108 Kube.Listener {
111 filter: Kube.Messages.requestLogin 109 filter: Kube.Messages.requestLogin
112 onMessageReceived: kubeViews.setLoginView() 110 onMessageReceived: kubeViews.setLoginView(message.accountId)
113 } 111 }
114 112
115 Kube.Listener { 113 Kube.Listener {
@@ -127,12 +125,6 @@ Controls2.ApplicationWindow {
127 sequence: StandardKey.Find 125 sequence: StandardKey.Find
128 } 126 }
129 Shortcut { 127 Shortcut {
130 onActivated: {
131 Kube.Fabric.postMessage(Kube.Messages.unlockKeyring, {accountId: app.currentAccount})
132 }
133 sequence: "Ctrl+l"
134 }
135 Shortcut {
136 id: syncShortcut 128 id: syncShortcut
137 sequence: StandardKey.Refresh 129 sequence: StandardKey.Refresh
138 onActivated: !!app.currentFolder ? Kube.Fabric.postMessage(Kube.Messages.synchronize, {"folder": app.currentFolder}) : Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": app.currentAccount}) 130 onActivated: !!app.currentFolder ? Kube.Fabric.postMessage(Kube.Messages.synchronize, {"folder": app.currentFolder}) : Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": app.currentAccount})
@@ -262,17 +254,6 @@ Controls2.ApplicationWindow {
262 } 254 }
263 Layout.fillWidth: true 255 Layout.fillWidth: true
264 256
265 function loginIfNecessary()
266 {
267 if (!!app.currentAccount && !Kube.Keyring.isUnlocked(app.currentAccount)) {
268 if (accountFactory.requiresKeyring) {
269 setLoginView()
270 } else {
271 Kube.Keyring.unlock(app.currentAccount)
272 }
273 }
274 }
275
276 Kube.Listener { 257 Kube.Listener {
277 filter: Kube.Messages.componentDone 258 filter: Kube.Messages.componentDone
278 onMessageReceived: { 259 onMessageReceived: {
@@ -282,7 +263,6 @@ Controls2.ApplicationWindow {
282 } else { 263 } else {
283 kubeViews.pop(Controls2.StackView.Immediate) 264 kubeViews.pop(Controls2.StackView.Immediate)
284 } 265 }
285 kubeViews.loginIfNecessary()
286 } 266 }
287 } 267 }
288 268
@@ -298,8 +278,6 @@ Controls2.ApplicationWindow {
298 setMailView() 278 setMailView()
299 if (startupCheck.noAccount) { 279 if (startupCheck.noAccount) {
300 setAccountsView() 280 setAccountsView()
301 } else {
302 loginIfNecessary()
303 } 281 }
304 } 282 }
305 } 283 }
@@ -333,9 +311,9 @@ Controls2.ApplicationWindow {
333 replaceView(logView) 311 replaceView(logView)
334 } 312 }
335 313
336 function setLoginView() { 314 function setLoginView(account) {
337 if (currentItem != loginView) { 315 if (currentItem != loginView) {
338 pushView(loginView, {accountId: currentAccount}) 316 pushView(loginView, {accountId: account})
339 } 317 }
340 } 318 }
341 319