diff options
Diffstat (limited to 'components/accounts')
-rw-r--r-- | components/accounts/contents/ui/AccountWizard.qml | 76 | ||||
-rw-r--r-- | components/accounts/contents/ui/AccountWizardPage.qml | 144 |
2 files changed, 155 insertions, 65 deletions
diff --git a/components/accounts/contents/ui/AccountWizard.qml b/components/accounts/contents/ui/AccountWizard.qml index 8cc90acb..ffc3f5da 100644 --- a/components/accounts/contents/ui/AccountWizard.qml +++ b/components/accounts/contents/ui/AccountWizard.qml | |||
@@ -51,47 +51,15 @@ Controls2.Popup { | |||
51 | 51 | ||
52 | spacing: Kirigami.Units.largeSpacing | 52 | spacing: Kirigami.Units.largeSpacing |
53 | 53 | ||
54 | Controls2.Button { | 54 | Repeater { |
55 | 55 | //TODO replace by model of available accounts | |
56 | Layout.fillWidth: true | 56 | model: ["kolabnow", "imap", "maildir"] |
57 | 57 | delegate: Controls2.Button { | |
58 | text: "kolabnow account" | 58 | Layout.fillWidth: true |
59 | 59 | text: modelData +" account" | |
60 | onClicked: { | 60 | onClicked: { |
61 | stack.push(kolabnow) | 61 | stack.push(wizardPage.createObject(app, {accountType:modelData})) |
62 | } | 62 | } |
63 | } | ||
64 | |||
65 | Controls2.Button { | ||
66 | |||
67 | Layout.fillWidth: true | ||
68 | |||
69 | text: "gmail account" | ||
70 | |||
71 | onClicked: { | ||
72 | stack.push(gmail) | ||
73 | } | ||
74 | } | ||
75 | |||
76 | Controls2.Button { | ||
77 | |||
78 | Layout.fillWidth: true | ||
79 | |||
80 | text: "imap account" | ||
81 | |||
82 | onClicked: { | ||
83 | stack.push(imap) | ||
84 | } | ||
85 | } | ||
86 | |||
87 | Controls2.Button { | ||
88 | |||
89 | Layout.fillWidth: true | ||
90 | |||
91 | text: "maildir archive" | ||
92 | |||
93 | onClicked: { | ||
94 | stack.push(maildir) | ||
95 | } | 63 | } |
96 | } | 64 | } |
97 | } | 65 | } |
@@ -99,30 +67,8 @@ Controls2.Popup { | |||
99 | } | 67 | } |
100 | 68 | ||
101 | Component { | 69 | Component { |
102 | id: kolabnow | 70 | id: wizardPage |
103 | 71 | AccountWizardPage { | |
104 | CreateKolabNow { | ||
105 | } | ||
106 | } | ||
107 | |||
108 | Component { | ||
109 | id: gmail | ||
110 | |||
111 | CreateGmail { | ||
112 | } | ||
113 | } | ||
114 | |||
115 | Component { | ||
116 | id: imap | ||
117 | |||
118 | CreateImap { | ||
119 | } | ||
120 | } | ||
121 | |||
122 | Component { | ||
123 | id: maildir | ||
124 | |||
125 | CreateMaildir { | ||
126 | } | 72 | } |
127 | } | 73 | } |
128 | } | 74 | } |
diff --git a/components/accounts/contents/ui/AccountWizardPage.qml b/components/accounts/contents/ui/AccountWizardPage.qml new file mode 100644 index 00000000..967bd4ab --- /dev/null +++ b/components/accounts/contents/ui/AccountWizardPage.qml | |||
@@ -0,0 +1,144 @@ | |||
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 | |||
20 | import QtQuick 2.7 | ||
21 | import QtQuick.Layouts 1.1 | ||
22 | import QtQuick.Controls 1.4 as Controls | ||
23 | import QtQuick.Controls 2.0 as Controls2 | ||
24 | import org.kde.kirigami 1.0 as Kirigami | ||
25 | |||
26 | import org.kube.framework.accounts 1.0 as KubeAccounts | ||
27 | |||
28 | Item { | ||
29 | id: root | ||
30 | property string accountType | ||
31 | |||
32 | KubeAccounts.AccountFactory { | ||
33 | id: accountFactory | ||
34 | accountType: root.accountType | ||
35 | } | ||
36 | |||
37 | Controls.ToolButton { | ||
38 | iconName: "go-previous" | ||
39 | tooltip: "go back" | ||
40 | onClicked: { | ||
41 | stack.pop() | ||
42 | } | ||
43 | } | ||
44 | |||
45 | //Item to avoid anchors conflict with stack | ||
46 | Item { | ||
47 | |||
48 | anchors { | ||
49 | fill: parent | ||
50 | margins: Kirigami.Units.largeSpacing * 2 | ||
51 | } | ||
52 | |||
53 | Kirigami.Heading { | ||
54 | id: heading | ||
55 | text: loader.item.heading | ||
56 | color: Kirigami.Theme.highlightColor | ||
57 | } | ||
58 | |||
59 | Kirigami.Label { | ||
60 | id: subHeadline | ||
61 | |||
62 | anchors { | ||
63 | left: heading.left | ||
64 | top: heading.bottom | ||
65 | } | ||
66 | |||
67 | width: parent.width | ||
68 | text: loader.item.subheadline | ||
69 | color: Kirigami.Theme.disabledTextColor | ||
70 | wrapMode: Text.Wrap | ||
71 | } | ||
72 | |||
73 | Item { | ||
74 | id: accountEdit | ||
75 | anchors { | ||
76 | top:subHeadline.bottom | ||
77 | left: parent.left | ||
78 | right: parent.right | ||
79 | topMargin: Kirigami.Units.largeSpacing * 2 | ||
80 | } | ||
81 | |||
82 | Loader { | ||
83 | id: loader | ||
84 | anchors.fill: parent | ||
85 | source: accountFactory.uiPath | ||
86 | } | ||
87 | } | ||
88 | |||
89 | Item { | ||
90 | id: spacer | ||
91 | Layout.fillHeight: true | ||
92 | anchors { | ||
93 | top:accountEdit.bottom | ||
94 | bottom: footer.top | ||
95 | left: parent.left | ||
96 | right: parent.right | ||
97 | } | ||
98 | } | ||
99 | |||
100 | //This is where we should place the account wizard ui | ||
101 | GridLayout { | ||
102 | id: footer | ||
103 | anchors { | ||
104 | bottom: parent.bottom | ||
105 | left: parent.left | ||
106 | right: parent.right | ||
107 | topMargin: Kirigami.Units.largeSpacing * 2 | ||
108 | } | ||
109 | |||
110 | columns: 2 | ||
111 | columnSpacing: Kirigami.Units.largeSpacing | ||
112 | rowSpacing: Kirigami.Units.largeSpacing | ||
113 | |||
114 | Item { | ||
115 | Layout.fillHeight: true | ||
116 | } | ||
117 | |||
118 | Kirigami.Label { | ||
119 | text: "" | ||
120 | } | ||
121 | |||
122 | Item { | ||
123 | Layout.fillWidth: true | ||
124 | |||
125 | Controls.Button { | ||
126 | text: "Discard" | ||
127 | |||
128 | onClicked: { | ||
129 | popup.close() | ||
130 | } | ||
131 | } | ||
132 | |||
133 | Controls.Button { | ||
134 | anchors.right: parent.right | ||
135 | text: "Save" | ||
136 | onClicked: { | ||
137 | loader.item.save() | ||
138 | popup.close() | ||
139 | } | ||
140 | } | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | } | ||