diff options
Diffstat (limited to 'components/accounts/contents/ui/CreateMaildir.qml')
-rw-r--r-- | components/accounts/contents/ui/CreateMaildir.qml | 201 |
1 files changed, 201 insertions, 0 deletions
diff --git a/components/accounts/contents/ui/CreateMaildir.qml b/components/accounts/contents/ui/CreateMaildir.qml new file mode 100644 index 00000000..99bde452 --- /dev/null +++ b/components/accounts/contents/ui/CreateMaildir.qml | |||
@@ -0,0 +1,201 @@ | |||
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 | |||
19 | import QtQuick 2.7 | ||
20 | import QtQuick.Layouts 1.1 | ||
21 | import QtQuick.Controls 1.4 as Controls | ||
22 | import QtQuick.Controls 2.0 as Controls2 | ||
23 | import org.kde.kirigami 1.0 as Kirigami | ||
24 | import QtQuick.Dialogs 1.0 as Dialogs | ||
25 | |||
26 | import org.kube.framework.accounts 1.0 as KubeAccounts | ||
27 | |||
28 | Item { | ||
29 | id: root | ||
30 | |||
31 | //Controller | ||
32 | KubeAccounts.MaildirController { | ||
33 | id: account | ||
34 | } | ||
35 | |||
36 | //Navigation | ||
37 | Controls.ToolButton { | ||
38 | iconName: "go-previous" | ||
39 | |||
40 | tooltip: "go back" | ||
41 | |||
42 | onClicked: { | ||
43 | stack.pop() | ||
44 | } | ||
45 | } | ||
46 | |||
47 | //Item to avoid anchors conflict with stack | ||
48 | Item { | ||
49 | |||
50 | anchors { | ||
51 | fill: parent | ||
52 | margins: Kirigami.Units.largeSpacing * 2 | ||
53 | } | ||
54 | |||
55 | |||
56 | //BEGIN heading | ||
57 | Kirigami.Heading { | ||
58 | id: heading | ||
59 | text: "Add your Maildir archive" | ||
60 | |||
61 | color: Kirigami.Theme.highlightColor | ||
62 | } | ||
63 | |||
64 | Controls2.Label { | ||
65 | id: subHeadline | ||
66 | |||
67 | anchors { | ||
68 | left: heading.left | ||
69 | top: heading.bottom | ||
70 | } | ||
71 | |||
72 | width: parent.width | ||
73 | |||
74 | text: "To let Kube access your maildir archive, add the path to your archive and give the account a title that will be displayed inside Kube" | ||
75 | |||
76 | color: Kirigami.Theme.disabledTextColor | ||
77 | wrapMode: Text.Wrap | ||
78 | } | ||
79 | //END heading | ||
80 | |||
81 | GridLayout { | ||
82 | anchors { | ||
83 | top:subHeadline.bottom | ||
84 | bottom: parent.bottom | ||
85 | left: parent.left | ||
86 | right: parent.right | ||
87 | topMargin: Kirigami.Units.largeSpacing * 2 | ||
88 | } | ||
89 | |||
90 | columns: 2 | ||
91 | columnSpacing: Kirigami.Units.largeSpacing | ||
92 | rowSpacing: Kirigami.Units.largeSpacing | ||
93 | |||
94 | Controls2.Label { | ||
95 | text: "Title of account" | ||
96 | Layout.alignment: Qt.AlignRight | ||
97 | } | ||
98 | Controls.TextField { | ||
99 | id: title | ||
100 | Layout.fillWidth: true | ||
101 | |||
102 | text: account.name | ||
103 | |||
104 | onTextChanged: { | ||
105 | account.name = text | ||
106 | } | ||
107 | } | ||
108 | |||
109 | Controls2.Label { | ||
110 | text: "Path" | ||
111 | Layout.alignment: Qt.AlignRight | ||
112 | } | ||
113 | RowLayout { | ||
114 | Layout.fillWidth: true | ||
115 | |||
116 | Controls.TextField { | ||
117 | id: path | ||
118 | Layout.fillWidth: true | ||
119 | |||
120 | enabled: false | ||
121 | |||
122 | text: account.path | ||
123 | } | ||
124 | |||
125 | Controls.Button { | ||
126 | iconName: "folder" | ||
127 | |||
128 | onClicked: { | ||
129 | fileDialogComponent.createObject(parent) | ||
130 | } | ||
131 | |||
132 | Component { | ||
133 | id: fileDialogComponent | ||
134 | Dialogs.FileDialog { | ||
135 | id: fileDialog | ||
136 | |||
137 | visible: true | ||
138 | title: "Choose the maildir folder" | ||
139 | |||
140 | selectFolder: true | ||
141 | |||
142 | onAccepted: { | ||
143 | account.path = fileDialog.fileUrl | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | |||
150 | /* | ||
151 | Controls2.Label { | ||
152 | text: "" | ||
153 | } | ||
154 | Controls.CheckBox { | ||
155 | id: readOnly | ||
156 | text: "Read only" | ||
157 | } | ||
158 | */ | ||
159 | |||
160 | Controls2.Label { | ||
161 | text: "" | ||
162 | Layout.fillHeight: true | ||
163 | } | ||
164 | Controls2.Label { | ||
165 | text: "" | ||
166 | } | ||
167 | |||
168 | Controls2.Label { | ||
169 | text: "" | ||
170 | } | ||
171 | Item { | ||
172 | Layout.fillWidth: true | ||
173 | |||
174 | Controls2.Button { | ||
175 | text: "Discard" | ||
176 | |||
177 | onClicked: { | ||
178 | //account.clear() | ||
179 | popup.close() | ||
180 | } | ||
181 | } | ||
182 | |||
183 | Controls2.Button { | ||
184 | id: saveButton | ||
185 | |||
186 | anchors.right: parent.right | ||
187 | |||
188 | text: "Save" | ||
189 | |||
190 | enabled: account.createAction.enabled | ||
191 | |||
192 | onClicked: { | ||
193 | account.createAction.execute() | ||
194 | popup.close() | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | } | ||
200 | } | ||
201 | |||