From 1b1e83aeb820df85ce7f10e81fe1f44deab2174e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 21 Sep 2017 17:30:25 +0200 Subject: A login view --- components/kube/contents/ui/Kube.qml | 27 ++++++++++++++++++++- components/kube/contents/ui/LoginView.qml | 39 +++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 components/kube/contents/ui/LoginView.qml (limited to 'components') 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 { bottom: mainContent.bottom } Layout.fillWidth: true - initialItem: mailView Kube.Listener { filter: Kube.Messages.componentDone @@ -282,6 +281,10 @@ Controls2.ApplicationWindow { replaceView(logView) } + function setLoginView() { + pushView(loginView, {accountId: currentAccount}) + } + function openComposer(newMessage, recipients) { pushView(composerView, {newMessage: newMessage, recipients: recipients}) } @@ -296,6 +299,17 @@ Controls2.ApplicationWindow { } } + Component.onCompleted: { + if (!currentItem) { + if (!Kube.Keyring.isUnlocked(app.currentAccount)) { + setMailView(); + setLoginView() + } else { + setMailView(); + } + } + } + //These items are not visible until pushed onto the stack, so we keep them in resources instead of items resources: [ //Not components so we maintain state @@ -303,17 +317,20 @@ Controls2.ApplicationWindow { id: mailView anchors.fill: parent Controls2.StackView.onActivated: mailButton.checked = true + Controls2.StackView.onDeactivated: mailButton.checked = false }, PeopleView { id: peopleView anchors.fill: parent Controls2.StackView.onActivated: peopleButton.checked = true + Controls2.StackView.onDeactivated: peopleButton.checked = false }, //Not a component because otherwise we can't log stuff LogView { id: logView anchors.fill: parent Controls2.StackView.onActivated: logButton.checked = true + Controls2.StackView.onDeactivated: logButton.checked = false } ] //A component so it's always destroyed when we're done @@ -322,6 +339,7 @@ Controls2.ApplicationWindow { ComposerView { anchors.fill: parent Controls2.StackView.onActivated: composerButton.checked = true + Controls2.StackView.onDeactivated: composerButton.checked = false } } Component { @@ -329,6 +347,13 @@ Controls2.ApplicationWindow { AccountsView { anchors.fill: parent Controls2.StackView.onActivated: accountsButton.checked = true + Controls2.StackView.onDeactivated: accountsButton.checked = false + } + } + Component { + id: loginView + LoginView { + anchors.fill: parent } } } 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 @@ +/* + * Copyright (C) 2017 Michael Bohlender, + * Copyright (C) 2017 Christian Mollekopf, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.4 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.3 as Controls +import QtQuick.Controls 2.0 +import org.kube.framework 1.0 as Kube + +Rectangle { + id: root + property alias accountId: login.accountId + + color: Kube.Colors.backgroundColor + + Kube.LoginAccount { + id: login + anchors { + fill: parent + bottomMargin: Kube.Units.largeSpacing + } + } +} -- cgit v1.2.3