summaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-02-22 15:56:21 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-02-22 15:57:44 +0100
commit5ca3a769c0b0c93cfcbf6134937b32eed52e2fc2 (patch)
treebaae5147722bdef26a1a8dc99ff6a020a782bcc9 /accounts
parentcb2b1a35e14031f15155243aee12fc862cb65ebf (diff)
downloadkube-5ca3a769c0b0c93cfcbf6134937b32eed52e2fc2.tar.gz
kube-5ca3a769c0b0c93cfcbf6134937b32eed52e2fc2.zip
Removed Create/Edit*.qml and controllers, added gmail plugin
The current settings plugin could potentially be replaced by a proper controller, but what we have works so that's low priority.
Diffstat (limited to 'accounts')
-rw-r--r--accounts/CMakeLists.txt1
-rw-r--r--accounts/gmail/CMakeLists.txt43
-rw-r--r--accounts/gmail/gmailaccountplugin.cpp29
-rw-r--r--accounts/gmail/gmailaccountplugin.h31
-rw-r--r--accounts/gmail/gmailsettings.cpp58
-rw-r--r--accounts/gmail/gmailsettings.h33
-rw-r--r--accounts/gmail/package/contents/ui/GmailSettings.qml136
-rw-r--r--accounts/gmail/package/metadata.desktop8
-rw-r--r--accounts/gmail/qmldir3
-rw-r--r--accounts/imap/package/contents/ui/ImapAccountSettings.qml137
-rw-r--r--accounts/maildir/package/contents/ui/MaildirAccountSettings.qml124
11 files changed, 405 insertions, 198 deletions
diff --git a/accounts/CMakeLists.txt b/accounts/CMakeLists.txt
index e941e07d..613f9792 100644
--- a/accounts/CMakeLists.txt
+++ b/accounts/CMakeLists.txt
@@ -1,3 +1,4 @@
1add_subdirectory(maildir) 1add_subdirectory(maildir)
2add_subdirectory(imap) 2add_subdirectory(imap)
3add_subdirectory(kolabnow) 3add_subdirectory(kolabnow)
4add_subdirectory(gmail)
diff --git a/accounts/gmail/CMakeLists.txt b/accounts/gmail/CMakeLists.txt
new file mode 100644
index 00000000..f75cf388
--- /dev/null
+++ b/accounts/gmail/CMakeLists.txt
@@ -0,0 +1,43 @@
1project(kube-accounts-gmail)
2
3cmake_minimum_required(VERSION 2.8.12)
4
5include(CPack)
6include(FeatureSummary)
7find_package(PkgConfig)
8
9################# set KDE specific information #################
10
11find_package(ECM 0.0.8 REQUIRED NO_MODULE)
12
13# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
14set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
15
16include(KDEInstallDirs)
17include(KDECMakeSettings)
18include(KDECompilerSettings)
19
20find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui)
21
22set (QT_MIN_VERSION "5.4.0")
23find_package(Sink CONFIG REQUIRED)
24find_package(KF5Async CONFIG REQUIRED)
25find_package(KF5 REQUIRED COMPONENTS Package Mime)
26
27include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/)
28#FIXME
29include_directories(../../framework/)
30
31set(SRCS
32 gmailsettings.cpp
33 gmailaccountplugin.cpp
34)
35
36add_library(gmailaccountplugin SHARED ${SRCS})
37qt5_use_modules(gmailaccountplugin Core Quick Qml)
38target_link_libraries(gmailaccountplugin sink settingsplugin mailplugin)
39
40kpackage_install_package(package org.kube.accounts.gmail "genericqml")
41
42install(TARGETS gmailaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/gmail)
43install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/gmail)
diff --git a/accounts/gmail/gmailaccountplugin.cpp b/accounts/gmail/gmailaccountplugin.cpp
new file mode 100644
index 00000000..53218939
--- /dev/null
+++ b/accounts/gmail/gmailaccountplugin.cpp
@@ -0,0 +1,29 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#include "gmailaccountplugin.h"
20
21#include "gmailsettings.h"
22
23#include <QtQml>
24
25void GmailAccountPlugin::registerTypes (const char *uri)
26{
27 Q_ASSERT(uri == QLatin1String("org.kube.accounts.gmail"));
28 qmlRegisterType<GmailSettings>(uri, 1, 0, "GmailSettings");
29}
diff --git a/accounts/gmail/gmailaccountplugin.h b/accounts/gmail/gmailaccountplugin.h
new file mode 100644
index 00000000..5876e393
--- /dev/null
+++ b/accounts/gmail/gmailaccountplugin.h
@@ -0,0 +1,31 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#pragma once
20
21#include <QQmlEngine>
22#include <QQmlExtensionPlugin>
23
24class GmailAccountPlugin : public QQmlExtensionPlugin
25{
26 Q_OBJECT
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28
29public:
30 virtual void registerTypes(const char *uri);
31};
diff --git a/accounts/gmail/gmailsettings.cpp b/accounts/gmail/gmailsettings.cpp
new file mode 100644
index 00000000..428b164a
--- /dev/null
+++ b/accounts/gmail/gmailsettings.cpp
@@ -0,0 +1,58 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#include "gmailsettings.h"
20
21GmailSettings::GmailSettings(QObject *parent)
22 : AccountSettings(parent)
23{
24}
25
26void GmailSettings::load()
27{
28 loadAccount();
29 loadImapResource();
30 loadMailtransportResource();
31 loadIdentity();
32}
33
34void GmailSettings::save()
35{
36 mUsername = mEmailAddress;
37 mImapServer = "imaps://imap.gmail.com:993";
38 mImapUsername = mEmailAddress;
39 // mImapPassword = mPassword;
40
41 mSmtpServer = "smtps://smtp.gmail.com:465";
42 mSmtpUsername = mEmailAddress;
43 mSmtpPassword = mImapPassword;
44
45 saveAccount();
46 saveImapResource();
47 saveMailtransportResource();
48 saveIdentity();
49}
50
51void GmailSettings::remove()
52{
53 removeResource(mMailtransportIdentifier);
54 removeResource(mImapIdentifier);
55 removeIdentity();
56 removeAccount();
57}
58
diff --git a/accounts/gmail/gmailsettings.h b/accounts/gmail/gmailsettings.h
new file mode 100644
index 00000000..708cb94b
--- /dev/null
+++ b/accounts/gmail/gmailsettings.h
@@ -0,0 +1,33 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#pragma once
20
21#include <domain/settings/accountsettings.h>
22
23class GmailSettings : public AccountSettings
24{
25 Q_OBJECT
26
27public:
28 GmailSettings(QObject *parent = 0);
29
30 Q_INVOKABLE virtual void load() Q_DECL_OVERRIDE;
31 Q_INVOKABLE virtual void save() Q_DECL_OVERRIDE;
32 Q_INVOKABLE virtual void remove() Q_DECL_OVERRIDE;
33};
diff --git a/accounts/gmail/package/contents/ui/GmailSettings.qml b/accounts/gmail/package/contents/ui/GmailSettings.qml
new file mode 100644
index 00000000..33dafe8d
--- /dev/null
+++ b/accounts/gmail/package/contents/ui/GmailSettings.qml
@@ -0,0 +1,136 @@
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.4
21import QtQuick.Controls 1.4 as Controls
22import QtQuick.Layouts 1.1
23
24import org.kde.kirigami 1.0 as Kirigami
25
26import org.kube.framework.settings 1.0 as KubeSettings
27import org.kube.accounts.gmail 1.0 as GmailAccount
28
29Item {
30
31 property string accountId
32 property string heading: "Connect your GMail account"
33 property string subheadline: "To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube."
34
35 GmailAccount.GmailSettings {
36 id: gmailSettings
37 accountIdentifier: accountId
38 accountType: "gmail"
39 }
40
41 function save(){
42 gmailSettings.save()
43 }
44
45 function remove(){
46 gmailSettings.remove()
47 }
48
49 Item {
50 anchors {
51 fill: parent
52 }
53
54 GridLayout {
55 anchors {
56 fill: parent
57 }
58 columns: 2
59 columnSpacing: Kirigami.Units.largeSpacing
60 rowSpacing: Kirigami.Units.largeSpacing
61
62 Controls.Label {
63 text: "Title of Account"
64 Layout.alignment: Qt.AlignRight
65 }
66 Controls.TextField {
67 Layout.fillWidth: true
68 placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name"
69 text: gmailSettings.accountName
70 onTextChanged: {
71 gmailSettings.accountName = text
72 }
73 }
74
75 Controls.Label {
76 text: "Name"
77 Layout.alignment: Qt.AlignRight
78 }
79 Controls.TextField {
80 Layout.fillWidth: true
81 placeholderText: "Your name"
82 text: gmailSettings.userName
83 onTextChanged: {
84 gmailSettings.userName = text
85 }
86 }
87
88 Controls.Label {
89 text: "Email address"
90 Layout.alignment: Qt.AlignRight
91 }
92 Controls.TextField {
93 Layout.fillWidth: true
94
95 text: gmailSettings.emailAddress
96 onTextChanged: {
97 gmailSettings.emailAddress = text
98 }
99 placeholderText: "Your email address"
100 }
101
102 Controls.Label {
103 text: "Password"
104 Layout.alignment: Qt.AlignRight
105 }
106 RowLayout {
107 Layout.fillWidth: true
108
109 Controls.TextField {
110 id: pwField
111 Layout.fillWidth: true
112
113 placeholderText: "Password of your email account"
114 text: gmailSettings.imapPassword
115 onTextChanged: {
116 gmailSettings.imapPassword = text
117 gmailSettings.smtpPassword = text
118 }
119
120 echoMode: TextInput.Password
121 }
122
123 Controls.CheckBox {
124 text: "Show Password"
125 onClicked: {
126 if(pwField.echoMode == TextInput.Password) {
127 pwField.echoMode = TextInput.Normal;
128 } else {
129 pwField.echoMode = TextInput.Password;
130 }
131 }
132 }
133 }
134 }
135 }
136}
diff --git a/accounts/gmail/package/metadata.desktop b/accounts/gmail/package/metadata.desktop
new file mode 100644
index 00000000..e2b71ec9
--- /dev/null
+++ b/accounts/gmail/package/metadata.desktop
@@ -0,0 +1,8 @@
1[Desktop Entry]
2Name=Kube GMail Accounts Plugin
3X-KDE-PluginInfo-Name=org.kube.accounts.gmail
4Exec=kpackagelauncherqml -a org.kube.accounts.gmail
5X-Plasma-MainScript=ui/GmailSettings.qml
6X-KDE-ServiceTypes=KPackage/GenericQML
7Icon=folder
8Type=Service
diff --git a/accounts/gmail/qmldir b/accounts/gmail/qmldir
new file mode 100644
index 00000000..78a9e5b7
--- /dev/null
+++ b/accounts/gmail/qmldir
@@ -0,0 +1,3 @@
1module org.kube.accounts.gmail
2
3plugin gmailaccountplugin
diff --git a/accounts/imap/package/contents/ui/ImapAccountSettings.qml b/accounts/imap/package/contents/ui/ImapAccountSettings.qml
index a9ac9317..e7834368 100644
--- a/accounts/imap/package/contents/ui/ImapAccountSettings.qml
+++ b/accounts/imap/package/contents/ui/ImapAccountSettings.qml
@@ -1,5 +1,6 @@
1/* 1/*
2 Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> 2 Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
3 Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
3 4
4 This program is free software; you can redistribute it and/or modify 5 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 it under the terms of the GNU General Public License as published by
@@ -17,7 +18,7 @@
17*/ 18*/
18 19
19import QtQuick 2.4 20import QtQuick 2.4
20import QtQuick.Controls 1.4 21import QtQuick.Controls 1.4 as Controls
21import QtQuick.Layouts 1.1 22import QtQuick.Layouts 1.1
22 23
23import org.kde.kirigami 1.0 as Kirigami 24import org.kde.kirigami 1.0 as Kirigami
@@ -25,132 +26,101 @@ import org.kde.kirigami 1.0 as Kirigami
25import org.kube.framework.settings 1.0 as KubeSettings 26import org.kube.framework.settings 1.0 as KubeSettings
26import org.kube.accounts.imap 1.0 as ImapAccount 27import org.kube.accounts.imap 1.0 as ImapAccount
27 28
28
29Item { 29Item {
30 30
31 property string accountId 31 property string accountId
32 property string heading: "Connect your IMAP account"
33 property string subheadline: "To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube. For information about which SMTP, IMAP address, which authentification and port to be used, please contact your email provider."
32 34
33 ImapAccount.ImapSettings { 35 ImapAccount.ImapSettings {
34 id: imapSettings 36 id: imapSettings
35 accountIdentifier: accountId 37 accountIdentifier: accountId
38 accountType: "imap"
39 }
40
41 function save(){
42 imapSettings.save()
36 } 43 }
37 44
38 anchors.fill: parent 45 function remove(){
46 imapSettings.remove()
47 }
39 48
40 Item { 49 Item {
41 anchors { 50 anchors {
42 fill: parent 51 fill: parent
43 margins: Kirigami.Units.largeSpacing * 2
44 }
45
46 Kirigami.Heading {
47 id: heading
48 text: "Connect your IMAP account"
49
50 color: Kirigami.Theme.highlightColor
51 } 52 }
52 53
53 Label {
54 id: subHeadline
55
56 anchors {
57 left: heading.left
58 top: heading.bottom
59 }
60
61 width: parent.width
62
63 text: "To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube. For information about which SMTP, IMAP address, which authentification and port to be used, please contact your email provider"
64
65 color: Kirigami.Theme.disabledTextColor
66
67 wrapMode: Text.Wrap
68 }
69
70
71 GridLayout { 54 GridLayout {
72 anchors { 55 anchors {
73 top:subHeadline.bottom 56 fill: parent
74 bottom: parent.bottom
75 left: parent.left
76 right: parent.right
77 topMargin: Kirigami.Units.largeSpacing
78 bottomMargin: Kirigami.Units.largeSpacing * 2
79 } 57 }
80
81 columns: 2 58 columns: 2
82 columnSpacing: Kirigami.Units.largeSpacing 59 columnSpacing: Kirigami.Units.largeSpacing
83 rowSpacing: Kirigami.Units.largeSpacing 60 rowSpacing: Kirigami.Units.largeSpacing
84 61
85 Kirigami.Label { 62 Controls.Label {
86 text: "Title of Acocunt" 63 text: "Title of Account"
87 Layout.alignment: Qt.AlignRight 64 Layout.alignment: Qt.AlignRight
88 } 65 }
89 TextField { 66 Controls.TextField {
90 Layout.fillWidth: true 67 Layout.fillWidth: true
91
92 placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name" 68 placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name"
93
94 text: imapSettings.accountName 69 text: imapSettings.accountName
95 onTextChanged: { 70 onTextChanged: {
96 imapSettings.accountName = text 71 imapSettings.accountName = text
97 } 72 }
98 } 73 }
99 74
100 Kirigami.Label { 75 Controls.Label {
101 text: "Email address" 76 text: "Name"
102 Layout.alignment: Qt.AlignRight 77 Layout.alignment: Qt.AlignRight
103 } 78 }
104 79 Controls.TextField {
105 TextField {
106 Layout.fillWidth: true 80 Layout.fillWidth: true
107 81 placeholderText: "Your name"
108 placeholderText: "Your email address" 82 text: imapSettings.userName
109
110 text: imapSettings.emailAddress
111 onTextChanged: { 83 onTextChanged: {
112 imapSettings.emailAddress = text 84 imapSettings.userName = text
113 } 85 }
114 } 86 }
115 87
116 Kirigami.Label { 88 Controls.Label {
117 text: "Username" 89 text: "Email address"
118 Layout.alignment: Qt.AlignRight 90 Layout.alignment: Qt.AlignRight
119 } 91 }
120 TextField { 92 Controls.TextField {
121 Layout.fillWidth: true 93 Layout.fillWidth: true
122 94
123 placeholderText: "The name used to log into your email account" 95 text: imapSettings.emailAddress
124
125 text: imapSettings.imapUsername
126 onTextChanged: { 96 onTextChanged: {
127 imapSettings.imapUsername = text 97 imapSettings.emailAddress = text
128 imapSettings.smtpUsername = text
129 } 98 }
99 placeholderText: "Your email address"
130 } 100 }
131 101
132 Kirigami.Label { 102 Controls.Label {
133 text: "Password" 103 text: "Password"
134 Layout.alignment: Qt.AlignRight 104 Layout.alignment: Qt.AlignRight
135 } 105 }
136
137 RowLayout { 106 RowLayout {
138 Layout.fillWidth: true 107 Layout.fillWidth: true
139 108
140 TextField { 109 Controls.TextField {
141 id: pwField 110 id: pwField
142 Layout.fillWidth: true 111 Layout.fillWidth: true
143 112
144 text: imapSettings.imapPassword
145 placeholderText: "Password of your email account" 113 placeholderText: "Password of your email account"
146 echoMode: TextInput.Password 114 text: imapSettings.imapPassword
147 onTextChanged: { 115 onTextChanged: {
148 imapSettings.imapPassword = text 116 imapSettings.imapPassword = text
149 imapSettings.smtpPassword = text 117 imapSettings.smtpPassword = text
150 } 118 }
119
120 echoMode: TextInput.Password
151 } 121 }
152 122
153 CheckBox { 123 Controls.CheckBox {
154 text: "Show Password" 124 text: "Show Password"
155 onClicked: { 125 onClicked: {
156 if(pwField.echoMode == TextInput.Password) { 126 if(pwField.echoMode == TextInput.Password) {
@@ -160,14 +130,13 @@ Item {
160 } 130 }
161 } 131 }
162 } 132 }
163
164 } 133 }
165 134
166 Kirigami.Label { 135 Controls.Label {
167 text: "IMAP address" 136 text: "IMAP server address"
168 Layout.alignment: Qt.AlignRight 137 Layout.alignment: Qt.AlignRight
169 } 138 }
170 TextField { 139 Controls.TextField {
171 id: imapServer 140 id: imapServer
172 141
173 Layout.fillWidth: true 142 Layout.fillWidth: true
@@ -187,11 +156,11 @@ Item {
187 } 156 }
188 } 157 }
189 158
190 Kirigami.Label { 159 Controls.Label {
191 text: "Smtp address" 160 text: "Smtp address"
192 Layout.alignment: Qt.AlignRight 161 Layout.alignment: Qt.AlignRight
193 } 162 }
194 TextField { 163 Controls.TextField {
195 id: smtpServer 164 id: smtpServer
196 Layout.fillWidth: true 165 Layout.fillWidth: true
197 166
@@ -209,34 +178,6 @@ Item {
209 visible: smtpServer.acceptableInput 178 visible: smtpServer.acceptableInput
210 } 179 }
211 } 180 }
212
213 Label {
214 text: ""
215 }
216 Item {
217 Layout.fillWidth: true
218
219 Button {
220 text: "Delete"
221
222 onClicked: {
223 imapSettings.remove()
224 root.closeDialog()
225 }
226 }
227
228 Button {
229 anchors.right: parent.right
230
231 text: "Save"
232
233 onClicked: {
234 focus: true
235 imapSettings.save()
236 root.closeDialog()
237 }
238 }
239 }
240 } 181 }
241 } 182 }
242} 183}
diff --git a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml b/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml
index a5d35d5c..b768979a 100644
--- a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml
+++ b/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml
@@ -1,5 +1,6 @@
1/* 1/*
2 Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> 2 Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
3 Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
3 4
4 This program is free software; you can redistribute it and/or modify 5 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 it under the terms of the GNU General Public License as published by
@@ -17,108 +18,76 @@
17*/ 18*/
18 19
19import QtQuick 2.4 20import QtQuick 2.4
20import QtQuick.Controls 1.4 21import QtQuick.Controls 1.4 as Controls
22import QtQuick.Controls 2.0 as Controls2
21import QtQuick.Layouts 1.1 23import QtQuick.Layouts 1.1
22import QtQuick.Dialogs 1.0 24import QtQuick.Dialogs 1.0 as Dialogs
23 25
24import org.kde.kirigami 1.0 as Kirigami 26import org.kde.kirigami 1.0 as Kirigami
25 27
26import org.kube.framework.settings 1.0 as KubeSettings 28import org.kube.framework.settings 1.0 as KubeSettings
27import org.kube.accounts.maildir 1.0 as MaildirAccount 29import org.kube.accounts.maildir 1.0 as MaildirAccount
28 30
29
30Item { 31Item {
31 property string accountId 32 property string accountId
33 property string heading: "Add your Maildir archive"
34 property string subheadline: "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."
32 35
33 MaildirAccount.MaildirSettings { 36 MaildirAccount.MaildirSettings {
34 id: maildirSettings 37 id: maildirSettings
35 accountIdentifier: accountId 38 accountIdentifier: accountId
39 accountType: "maildir"
40 }
41
42 function save(){
43 maildirSettings.save()
36 } 44 }
37 45
38 anchors.fill: parent 46 function remove(){
47 maildirSettings.remove()
48 }
39 49
40 Item { 50 Item {
41 anchors { 51 anchors {
42 fill: parent 52 fill: parent
43 margins: Kirigami.Units.largeSpacing * 2
44 }
45
46 Kirigami.Heading {
47 id: heading
48 text: "Add your Maildir archive"
49
50 color: Kirigami.Theme.highlightColor
51 }
52
53 Label {
54 id: subHeadline
55
56 anchors {
57 left: heading.left
58 top: heading.bottom
59 }
60
61 width: parent.width
62
63 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"
64 //TODO wait for kirgami theme disabled text color
65 opacity: 0.5
66 wrapMode: Text.Wrap
67 } 53 }
68 54
69 GridLayout { 55 GridLayout {
70 anchors { 56 anchors {
71 top:subHeadline.bottom 57 fill: parent
72 bottom: parent.bottom
73 left: parent.left
74 right: parent.right
75 topMargin: Kirigami.Units.largeSpacing * 2
76 bottomMargin: Kirigami.Units.largeSpacing * 2
77 } 58 }
78
79 columns: 2 59 columns: 2
80 columnSpacing: Kirigami.Units.largeSpacing 60 columnSpacing: Kirigami.Units.largeSpacing
81 rowSpacing: Kirigami.Units.largeSpacing 61 rowSpacing: Kirigami.Units.largeSpacing
82 62
83 Kirigami.Label { 63 Controls.Label {
84 text: "Title of account" 64 text: "Title of Account"
85 Layout.alignment: Qt.AlignRight 65 Layout.alignment: Qt.AlignRight
86 } 66 }
87 TextField { 67 Controls.TextField {
88 Layout.fillWidth: true 68 Layout.fillWidth: true
89 69 placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name"
90 text: maildirSettings.accountName 70 text: maildirSettings.accountName
91 onTextChanged: { 71 onTextChanged: {
92 maildirSettings.accountName = text 72 maildirSettings.accountName = text
93 } 73 }
94 } 74 }
95 75
96 Kirigami.Label { 76 Controls2.Label {
97 text: "Path" 77 text: "Path"
98 Layout.alignment: Qt.AlignRight 78 Layout.alignment: Qt.AlignRight
99 } 79 }
100 RowLayout { 80 RowLayout {
101 Layout.fillWidth: true 81 Layout.fillWidth: true
102 82
103 TextField { 83 Controls.TextField {
104 id: path 84 id: path
105 Layout.fillWidth: true 85 Layout.fillWidth: true
106 86 enabled: false
107 text: maildirSettings.path 87 text: maildirSettings.path
108 onTextChanged: {
109 maildirSettings.path = text
110 }
111 validator: maildirSettings.pathValidator
112
113 Rectangle {
114 anchors.fill: parent
115 opacity: 0.2
116 color: "yellow"
117 visible: path.acceptableInput == false
118 }
119 } 88 }
120 89
121 Button { 90 Controls.Button {
122 iconName: "folder" 91 iconName: "folder"
123 92
124 onClicked: { 93 onClicked: {
@@ -127,7 +96,7 @@ Item {
127 96
128 Component { 97 Component {
129 id: fileDialogComponent 98 id: fileDialogComponent
130 FileDialog { 99 Dialogs.FileDialog {
131 id: fileDialog 100 id: fileDialog
132 101
133 visible: true 102 visible: true
@@ -142,51 +111,6 @@ Item {
142 } 111 }
143 } 112 }
144 } 113 }
145
146 Label {
147 text: ""
148 }
149 CheckBox {
150 text: "Read only"
151 }
152
153 Label {
154 text: ""
155 Layout.fillHeight: true
156 }
157 Label {
158 text: ""
159 }
160
161 Label {
162 text: ""
163 }
164 Item {
165 Layout.fillWidth: true
166
167 Button {
168 text: "Delete"
169
170 onClicked: {
171 maildirSettings.remove()
172 root.closeDialog()
173 }
174 }
175
176 Button {
177 id: saveButton
178
179 anchors.right: parent.right
180
181 text: "Save"
182
183 onClicked: {
184 focus: true
185 maildirSettings.save()
186 root.closeDialog()
187 }
188 }
189 }
190 } 114 }
191 } 115 }
192} 116}