summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-21 17:30:25 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-22 10:26:27 +0200
commit1b1e83aeb820df85ce7f10e81fe1f44deab2174e (patch)
tree8a137d8f286a3595d9171c24b45655c4b2b03427 /components
parent777cb40dae338e79e8f4160882b7c37900b42238 (diff)
downloadkube-1b1e83aeb820df85ce7f10e81fe1f44deab2174e.tar.gz
kube-1b1e83aeb820df85ce7f10e81fe1f44deab2174e.zip
A login view
Diffstat (limited to 'components')
-rw-r--r--components/kube/contents/ui/Kube.qml27
-rw-r--r--components/kube/contents/ui/LoginView.qml39
2 files changed, 65 insertions, 1 deletions
diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml
index a9e8af09..603a499f 100644
--- a/components/kube/contents/ui/Kube.qml
+++ b/components/kube/contents/ui/Kube.qml
@@ -246,7 +246,6 @@ Controls2.ApplicationWindow {
246 bottom: mainContent.bottom 246 bottom: mainContent.bottom
247 } 247 }
248 Layout.fillWidth: true 248 Layout.fillWidth: true
249 initialItem: mailView
250 249
251 Kube.Listener { 250 Kube.Listener {
252 filter: Kube.Messages.componentDone 251 filter: Kube.Messages.componentDone
@@ -282,6 +281,10 @@ Controls2.ApplicationWindow {
282 replaceView(logView) 281 replaceView(logView)
283 } 282 }
284 283
284 function setLoginView() {
285 pushView(loginView, {accountId: currentAccount})
286 }
287
285 function openComposer(newMessage, recipients) { 288 function openComposer(newMessage, recipients) {
286 pushView(composerView, {newMessage: newMessage, recipients: recipients}) 289 pushView(composerView, {newMessage: newMessage, recipients: recipients})
287 } 290 }
@@ -296,6 +299,17 @@ Controls2.ApplicationWindow {
296 } 299 }
297 } 300 }
298 301
302 Component.onCompleted: {
303 if (!currentItem) {
304 if (!Kube.Keyring.isUnlocked(app.currentAccount)) {
305 setMailView();
306 setLoginView()
307 } else {
308 setMailView();
309 }
310 }
311 }
312
299 //These items are not visible until pushed onto the stack, so we keep them in resources instead of items 313 //These items are not visible until pushed onto the stack, so we keep them in resources instead of items
300 resources: [ 314 resources: [
301 //Not components so we maintain state 315 //Not components so we maintain state
@@ -303,17 +317,20 @@ Controls2.ApplicationWindow {
303 id: mailView 317 id: mailView
304 anchors.fill: parent 318 anchors.fill: parent
305 Controls2.StackView.onActivated: mailButton.checked = true 319 Controls2.StackView.onActivated: mailButton.checked = true
320 Controls2.StackView.onDeactivated: mailButton.checked = false
306 }, 321 },
307 PeopleView { 322 PeopleView {
308 id: peopleView 323 id: peopleView
309 anchors.fill: parent 324 anchors.fill: parent
310 Controls2.StackView.onActivated: peopleButton.checked = true 325 Controls2.StackView.onActivated: peopleButton.checked = true
326 Controls2.StackView.onDeactivated: peopleButton.checked = false
311 }, 327 },
312 //Not a component because otherwise we can't log stuff 328 //Not a component because otherwise we can't log stuff
313 LogView { 329 LogView {
314 id: logView 330 id: logView
315 anchors.fill: parent 331 anchors.fill: parent
316 Controls2.StackView.onActivated: logButton.checked = true 332 Controls2.StackView.onActivated: logButton.checked = true
333 Controls2.StackView.onDeactivated: logButton.checked = false
317 } 334 }
318 ] 335 ]
319 //A component so it's always destroyed when we're done 336 //A component so it's always destroyed when we're done
@@ -322,6 +339,7 @@ Controls2.ApplicationWindow {
322 ComposerView { 339 ComposerView {
323 anchors.fill: parent 340 anchors.fill: parent
324 Controls2.StackView.onActivated: composerButton.checked = true 341 Controls2.StackView.onActivated: composerButton.checked = true
342 Controls2.StackView.onDeactivated: composerButton.checked = false
325 } 343 }
326 } 344 }
327 Component { 345 Component {
@@ -329,6 +347,13 @@ Controls2.ApplicationWindow {
329 AccountsView { 347 AccountsView {
330 anchors.fill: parent 348 anchors.fill: parent
331 Controls2.StackView.onActivated: accountsButton.checked = true 349 Controls2.StackView.onActivated: accountsButton.checked = true
350 Controls2.StackView.onDeactivated: accountsButton.checked = false
351 }
352 }
353 Component {
354 id: loginView
355 LoginView {
356 anchors.fill: parent
332 } 357 }
333 } 358 }
334 } 359 }
diff --git a/components/kube/contents/ui/LoginView.qml b/components/kube/contents/ui/LoginView.qml
new file mode 100644
index 00000000..c5fdc396
--- /dev/null
+++ b/components/kube/contents/ui/LoginView.qml
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net>
3 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick 2.4
21import QtQuick.Layouts 1.1
22import QtQuick.Controls 1.3 as Controls
23import QtQuick.Controls 2.0
24import org.kube.framework 1.0 as Kube
25
26Rectangle {
27 id: root
28 property alias accountId: login.accountId
29
30 color: Kube.Colors.backgroundColor
31
32 Kube.LoginAccount {
33 id: login
34 anchors {
35 fill: parent
36 bottomMargin: Kube.Units.largeSpacing
37 }
38 }
39}