summaryrefslogtreecommitdiffstats
path: root/components/accounts/qml/AccountWizardPage.qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-12-18 21:00:05 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-12-18 21:00:05 +0100
commitb77216db4b6d941afb03325e0843509621a283da (patch)
tree9decab63473890c2aa125d75170ecce851031a96 /components/accounts/qml/AccountWizardPage.qml
parent1f62cf29d038e1dfd9bd56505ecaae10ca14b60b (diff)
downloadkube-b77216db4b6d941afb03325e0843509621a283da.tar.gz
kube-b77216db4b6d941afb03325e0843509621a283da.zip
We no longer need the kpackage structure
Diffstat (limited to 'components/accounts/qml/AccountWizardPage.qml')
-rw-r--r--components/accounts/qml/AccountWizardPage.qml155
1 files changed, 155 insertions, 0 deletions
diff --git a/components/accounts/qml/AccountWizardPage.qml b/components/accounts/qml/AccountWizardPage.qml
new file mode 100644
index 00000000..9f11ac36
--- /dev/null
+++ b/components/accounts/qml/AccountWizardPage.qml
@@ -0,0 +1,155 @@
1/*
2 * Copyright (C) 2016 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.7
21import QtQuick.Layouts 1.1
22import QtQuick.Controls 1.4 as Controls
23import QtQuick.Controls 2.0 as Controls2
24import org.kube.framework 1.0 as Kube
25
26
27FocusScope {
28 id: root
29 property string accountType
30 signal done()
31
32 property bool isFirstView: root.Controls2.StackView.index == 0
33 property bool requireSetup: false
34
35 function save() {
36 if (loader.item.valid) {
37 loader.item.save()
38 Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": loader.item.accountIdentifier});
39 root.done()
40 } else {
41 console.warn("Invalid settings.");
42 }
43 }
44
45 //accountType -> uiPath
46 Kube.AccountFactory {
47 id: accountFactory
48 accountType: root.accountType
49 }
50
51 Controls.ToolButton {
52 id: backButton
53 iconName: Kube.Icons.goBack
54 tooltip: "go back"
55 visible: !root.isFirstView
56 onClicked: {
57 stack.pop()
58 }
59 }
60
61 Keys.onReturnPressed: save()
62
63 //Item to avoid anchors conflict with stack
64 Item {
65 anchors{
66 top: backButton.bottom
67 left: parent.left
68 right: parent.right
69 bottom: parent.bottom
70 }
71
72 Kube.Heading {
73 id: heading
74 text: loader.item.heading
75 color: Kube.Colors.highlightColor
76 }
77
78 Kube.Label {
79 id: subHeadline
80
81 anchors {
82 left: heading.left
83 top: heading.bottom
84 }
85
86 width: parent.width
87 text: loader.item.subheadline
88 color: Kube.Colors.disabledTextColor
89 wrapMode: Text.Wrap
90 }
91
92 Item {
93 id: accountEdit
94 anchors {
95 top:subHeadline.bottom
96 left: parent.left
97 right: parent.right
98 topMargin: Kube.Units.largeSpacing * 2
99 }
100
101 Loader {
102 id: loader
103 anchors.fill: parent
104 focus: true
105 source: accountFactory.uiPath
106 }
107 }
108
109 Item {
110 id: spacer
111 Layout.fillHeight: true
112 anchors {
113 top:accountEdit.bottom
114 bottom: footer.top
115 left: parent.left
116 right: parent.right
117 }
118 }
119
120 //This is where we should place the account wizard ui
121 Item {
122 id: footer
123
124 anchors {
125 bottom: parent.bottom
126 left: parent.left
127 right: parent.right
128 topMargin: Kube.Units.largeSpacing * 2
129 }
130
131 Kube.Button {
132 anchors {
133 left: parent.left
134 bottom: parent.bottom
135 }
136 visible: !root.requireSetup
137
138 text: qsTr("Discard")
139 onClicked: {
140 root.done()
141 }
142 }
143
144 Kube.PositiveButton {
145 anchors {
146 right: parent.right
147 bottom: parent.bottom
148 }
149
150 text: qsTr("Save")
151 onClicked: save()
152 }
153 }
154 }
155}