Dekko
Loading...
Searching...
No Matches
NewAccountState.qml
1/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
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
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18import QtQuick 2.4
19import QtQml.StateMachine 1.0 as DSM
20import Dekko.Mail 1.0
21import Dekko.Mail.API 1.0
22import Dekko.Mail.Stores.Accounts 1.0
24DSM.State {
25 id: newAccountState
26
27 property alias backTargetState: backTransition.targetState
28 property alias nextTargetState: nextTransition.targetState
29
30 onEntered: {
31 Log.logStatus("NewAccountState::onEntered", "State entered")
32 if (d.shouldPush) {
33 Log.logInfo("NewAccountState::onEntered", "Pushing NewAccountsUI")
34 WizardActions.wizardNavigateTo(Qt.resolvedUrl("../components/NewAccountsUI.qml"), {})
35 } else {
36 // we've come back to this state so reset the NewAccount in the store
37 Log.logInfo("NewAccountState::onEntered", "Resetting account as user navigated back")
38 WizardActions.removeNewAccount()
39 WizardActions.wizardResetAccount()
40 }
41 }
42
43 onExited: {
44 Log.logInfo("NewAccountState::onExited", "Exited state")
45 }
46
47 DSM.SignalTransition {
48 id: nextTransition
49 signal: AccountSetup.goNext
50 }
51
52 DSM.SignalTransition {
53 id: backTransition
54 signal: AccountSetup.goBack
55 }
56
57 QtObject {
58 id: d
59 readonly property bool shouldPush: stack.currentItem === null || stack.currentItem.objectName !== "newAccountUI"
60 }
61}
62