summaryrefslogtreecommitdiffstats
path: root/components/accounts/contents/ui
diff options
context:
space:
mode:
Diffstat (limited to 'components/accounts/contents/ui')
-rw-r--r--components/accounts/contents/ui/AccountWizard.qml93
-rw-r--r--components/accounts/contents/ui/AccountWizardPage.qml154
-rw-r--r--components/accounts/contents/ui/main.qml30
3 files changed, 0 insertions, 277 deletions
diff --git a/components/accounts/contents/ui/AccountWizard.qml b/components/accounts/contents/ui/AccountWizard.qml
deleted file mode 100644
index 4a11ca05..00000000
--- a/components/accounts/contents/ui/AccountWizard.qml
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
3 *
4 * 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 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19import QtQuick 2.7
20import QtQuick.Layouts 1.1
21import QtQuick.Controls 2.0 as Controls2
22import org.kube.framework 1.0 as Kube
23
24Kube.Popup {
25 id: root
26 objectName: "accountWizard"
27
28 property bool requireSetup: false
29 property var availableAccountPlugins: []
30
31 modal: true
32 closePolicy: requireSetup ? Controls2.Popup.NoAutoClose : Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutside
33
34 clip: true
35
36 Controls2.StackView {
37 id: stack
38 anchors.fill: parent
39 Component.onCompleted: {
40 //If we only have one account type we skip the selection
41 if (root.availableAccountPlugins.length == 1) {
42 stack.push(wizardPage.createObject(app, {accountType: root.availableAccountPlugins[0]}))
43 } else {
44 stack.push(mainView.createObject(app))
45 }
46 }
47 onCurrentItemChanged: {
48 if (!!currentItem) {
49 currentItem.forceActiveFocus()
50 }
51 }
52 }
53
54 Component {
55 id: mainView
56
57 FocusScope {
58 Kube.Heading {
59 id: heading
60 text: qsTr("Select your new account type")
61 color: Kube.Colors.highlightColor
62 }
63
64 ColumnLayout {
65 anchors.centerIn: parent
66 width: parent.width * 0.4
67
68 spacing: Kube.Units.largeSpacing
69
70 Repeater {
71 model: root.availableAccountPlugins
72 delegate: Kube.Button {
73 Layout.fillWidth: true
74 text: modelData
75 onClicked: stack.push(wizardPage.createObject(app, {accountType:modelData}))
76 }
77 }
78 }
79 }
80 }
81
82 Component {
83 id: wizardPage
84 AccountWizardPage {
85 focus: true
86 requireSetup: root.requireSetup
87 onDone: {
88 root.close()
89 Kube.Fabric.postMessage(Kube.Messages.componentDone, {})
90 }
91 }
92 }
93}
diff --git a/components/accounts/contents/ui/AccountWizardPage.qml b/components/accounts/contents/ui/AccountWizardPage.qml
deleted file mode 100644
index 18001419..00000000
--- a/components/accounts/contents/ui/AccountWizardPage.qml
+++ /dev/null
@@ -1,154 +0,0 @@
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 Kube.AccountFactory {
46 id: accountFactory
47 accountType: root.accountType
48 }
49
50 Controls.ToolButton {
51 id: backButton
52 iconName: Kube.Icons.goBack
53 tooltip: "go back"
54 visible: !root.isFirstView
55 onClicked: {
56 stack.pop()
57 }
58 }
59
60 Keys.onReturnPressed: save()
61
62 //Item to avoid anchors conflict with stack
63 Item {
64 anchors{
65 top: backButton.bottom
66 left: parent.left
67 right: parent.right
68 bottom: parent.bottom
69 }
70
71 Kube.Heading {
72 id: heading
73 text: loader.item.heading
74 color: Kube.Colors.highlightColor
75 }
76
77 Kube.Label {
78 id: subHeadline
79
80 anchors {
81 left: heading.left
82 top: heading.bottom
83 }
84
85 width: parent.width
86 text: loader.item.subheadline
87 color: Kube.Colors.disabledTextColor
88 wrapMode: Text.Wrap
89 }
90
91 Item {
92 id: accountEdit
93 anchors {
94 top:subHeadline.bottom
95 left: parent.left
96 right: parent.right
97 topMargin: Kube.Units.largeSpacing * 2
98 }
99
100 Loader {
101 id: loader
102 anchors.fill: parent
103 focus: true
104 source: accountFactory.uiPath
105 }
106 }
107
108 Item {
109 id: spacer
110 Layout.fillHeight: true
111 anchors {
112 top:accountEdit.bottom
113 bottom: footer.top
114 left: parent.left
115 right: parent.right
116 }
117 }
118
119 //This is where we should place the account wizard ui
120 Item {
121 id: footer
122
123 anchors {
124 bottom: parent.bottom
125 left: parent.left
126 right: parent.right
127 topMargin: Kube.Units.largeSpacing * 2
128 }
129
130 Kube.Button {
131 anchors {
132 left: parent.left
133 bottom: parent.bottom
134 }
135 visible: !root.requireSetup
136
137 text: qsTr("Discard")
138 onClicked: {
139 root.done()
140 }
141 }
142
143 Kube.PositiveButton {
144 anchors {
145 right: parent.right
146 bottom: parent.bottom
147 }
148
149 text: qsTr("Save")
150 onClicked: save()
151 }
152 }
153 }
154}
diff --git a/components/accounts/contents/ui/main.qml b/components/accounts/contents/ui/main.qml
deleted file mode 100644
index e15bca8f..00000000
--- a/components/accounts/contents/ui/main.qml
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
3 *
4 * 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 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19import QtQuick 2.7
20import QtQuick.Controls 2.0 as Controls2
21
22Controls2.ApplicationWindow {
23 id: app
24 height: 900
25 width: 1500
26
27 AccountWizard {
28 visible: true
29 }
30}