summaryrefslogtreecommitdiffstats
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
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.
-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
-rw-r--r--components/accounts/contents/ui/AccountWizard.qml2
-rw-r--r--components/accounts/contents/ui/CreateImap.qml165
-rw-r--r--components/accounts/contents/ui/CreateKolabNow.qml208
-rw-r--r--components/accounts/contents/ui/CreateMaildir.qml201
-rw-r--r--components/accounts/contents/ui/EditImap.qml1
-rw-r--r--components/accounts/contents/ui/EditKolabNow.qml1
-rw-r--r--components/accounts/contents/ui/EditMaildir.qml1
-rw-r--r--framework/accounts/CMakeLists.txt3
-rw-r--r--framework/accounts/accountsplugin.cpp6
-rw-r--r--framework/accounts/kolabnowcontroller.cpp88
-rw-r--r--framework/accounts/kolabnowcontroller.h54
-rw-r--r--framework/accounts/maildircontroller.cpp78
-rw-r--r--framework/accounts/maildircontroller.h51
24 files changed, 406 insertions, 1056 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}
diff --git a/components/accounts/contents/ui/AccountWizard.qml b/components/accounts/contents/ui/AccountWizard.qml
index ffc3f5da..ddf7a6ef 100644
--- a/components/accounts/contents/ui/AccountWizard.qml
+++ b/components/accounts/contents/ui/AccountWizard.qml
@@ -53,7 +53,7 @@ Controls2.Popup {
53 53
54 Repeater { 54 Repeater {
55 //TODO replace by model of available accounts 55 //TODO replace by model of available accounts
56 model: ["kolabnow", "imap", "maildir"] 56 model: ["kolabnow", "imap", "maildir", "gmail"]
57 delegate: Controls2.Button { 57 delegate: Controls2.Button {
58 Layout.fillWidth: true 58 Layout.fillWidth: true
59 text: modelData +" account" 59 text: modelData +" account"
diff --git a/components/accounts/contents/ui/CreateImap.qml b/components/accounts/contents/ui/CreateImap.qml
deleted file mode 100644
index 7f355409..00000000
--- a/components/accounts/contents/ui/CreateImap.qml
+++ /dev/null
@@ -1,165 +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 1.4 as Controls
22import QtQuick.Controls 2.0 as Controls2
23import org.kde.kirigami 1.0 as Kirigami
24
25Item {
26
27 Controls.ToolButton {
28 iconName: "go-previous"
29
30 tooltip: "go back"
31
32 onClicked: {
33 stack.pop()
34 }
35 }
36
37 //Item to avoid anchors conflict with stack
38 Item {
39
40 anchors {
41 fill: parent
42 margins: Kirigami.Units.largeSpacing * 2
43 }
44
45 Kirigami.Heading {
46 id: heading
47 text: "Connect your IMAP account"
48
49 color: Kirigami.Theme.highlightColor
50 }
51
52 Kirigami.Label {
53 id: subHeadline
54
55 anchors {
56 left: heading.left
57 top: heading.bottom
58 }
59
60 width: parent.width
61
62 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."
63
64 color: Kirigami.Theme.disabledTextColor
65
66 wrapMode: Text.Wrap
67 }
68
69 GridLayout {
70 anchors {
71 top:subHeadline.bottom
72 bottom: parent.bottom
73 left: parent.left
74 right: parent.right
75 topMargin: Kirigami.Units.largeSpacing * 2
76 }
77
78 columns: 2
79 columnSpacing: Kirigami.Units.largeSpacing
80 rowSpacing: Kirigami.Units.largeSpacing
81
82 Controls.Label {
83 text: "Title of Account"
84 Layout.alignment: Qt.AlignRight
85 }
86 Controls.TextField {
87 Layout.fillWidth: true
88
89 placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name"
90 }
91
92 Controls.Label {
93 text: "Email address"
94 Layout.alignment: Qt.AlignRight
95 }
96
97 Controls.TextField {
98 Layout.fillWidth: true
99
100 placeholderText: "Your email address"
101 }
102
103 Kirigami.Label {
104 text: "Password"
105 Layout.alignment: Qt.AlignRight
106 }
107
108 RowLayout {
109 Layout.fillWidth: true
110
111 Controls.TextField {
112 id: pwField
113 Layout.fillWidth: true
114
115 placeholderText: "Password of your email account"
116 echoMode: TextInput.Password
117 }
118
119 Controls.CheckBox {
120 text: "Show Password"
121 onClicked: {
122 if(pwField.echoMode == TextInput.Password) {
123 pwField.echoMode = TextInput.Normal;
124 } else {
125 pwField.echoMode = TextInput.Password;
126 }
127 }
128 }
129 }
130
131 Item {
132 Layout.fillHeight: true
133 }
134
135 Kirigami.Label {
136 text: ""
137 }
138
139 Kirigami.Label {
140 text: ""
141 }
142
143 Item {
144 Layout.fillWidth: true
145
146 Controls.Button {
147 text: "Discard"
148
149 onClicked: {
150 popup.close()
151 }
152 }
153
154 Controls.Button {
155 anchors.right: parent.right
156
157 text: "Next"
158
159 onClicked: {
160 }
161 }
162 }
163 }
164 }
165}
diff --git a/components/accounts/contents/ui/CreateKolabNow.qml b/components/accounts/contents/ui/CreateKolabNow.qml
deleted file mode 100644
index e6022cbb..00000000
--- a/components/accounts/contents/ui/CreateKolabNow.qml
+++ /dev/null
@@ -1,208 +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 1.4 as Controls
22import QtQuick.Controls 2.0 as Controls2
23import org.kde.kirigami 1.0 as Kirigami
24
25import org.kube.framework.accounts 1.0 as KubeAccounts
26
27Item {
28
29 KubeAccounts.KolabNowController {
30 id: account
31 }
32
33 Controls.ToolButton {
34 iconName: "go-previous"
35
36 tooltip: "go back"
37
38 onClicked: {
39 stack.pop()
40 }
41 }
42
43 //Item to avoid anchors conflict with stack
44 Item {
45
46 anchors {
47 fill: parent
48 margins: Kirigami.Units.largeSpacing * 2
49 }
50
51 Kirigami.Heading {
52 id: heading
53 text: "Connect your Kolab Now account"
54
55 color: Kirigami.Theme.highlightColor
56 }
57
58 Kirigami.Label {
59 id: subHeadline
60
61 anchors {
62 left: heading.left
63 top: heading.bottom
64 }
65
66 width: parent.width
67
68 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."
69
70 color: Kirigami.Theme.disabledTextColor
71
72 wrapMode: Text.Wrap
73 }
74
75 GridLayout {
76 anchors {
77 top:subHeadline.bottom
78 bottom: parent.bottom
79 left: parent.left
80 right: parent.right
81 topMargin: Kirigami.Units.largeSpacing * 2
82 }
83
84 columns: 2
85 columnSpacing: Kirigami.Units.largeSpacing
86 rowSpacing: Kirigami.Units.largeSpacing
87
88 Controls.Label {
89 text: "Title of Account"
90 Layout.alignment: Qt.AlignRight
91 }
92 Controls.TextField {
93 Layout.fillWidth: true
94
95 placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name"
96
97 text: account.name
98
99 onTextChanged: {
100 account.name = text
101 }
102 }
103
104 Controls.Label {
105 text: "Name"
106 Layout.alignment: Qt.AlignRight
107 }
108 Controls.TextField {
109 Layout.fillWidth: true
110
111 placeholderText: "Your name"
112
113 text: account.identityName
114
115 onTextChanged: {
116 account.identityName = text
117 }
118 }
119
120 Controls.Label {
121 text: "Email address"
122 Layout.alignment: Qt.AlignRight
123 }
124
125 Controls.TextField {
126 Layout.fillWidth: true
127
128 text: account.emailAddress
129
130 onTextChanged: {
131 account.emailAddress = text
132 }
133
134 placeholderText: "Your email address"
135 }
136
137 Kirigami.Label {
138 text: "Password"
139 Layout.alignment: Qt.AlignRight
140 }
141
142 RowLayout {
143 Layout.fillWidth: true
144
145 Controls.TextField {
146 id: pwField
147 Layout.fillWidth: true
148
149 placeholderText: "Password of your email account"
150
151 text: account.password
152
153 onTextChanged: {
154 account.password = text
155 }
156
157 echoMode: TextInput.Password
158 }
159
160 Controls.CheckBox {
161 text: "Show Password"
162 onClicked: {
163 if(pwField.echoMode == TextInput.Password) {
164 pwField.echoMode = TextInput.Normal;
165 } else {
166 pwField.echoMode = TextInput.Password;
167 }
168 }
169 }
170 }
171
172 Item {
173 Layout.fillHeight: true
174 }
175
176 Kirigami.Label {
177 text: ""
178 }
179
180 Kirigami.Label {
181 text: ""
182 }
183
184 Item {
185 Layout.fillWidth: true
186
187 Controls.Button {
188 text: "Discard"
189
190 onClicked: {
191 popup.close()
192 }
193 }
194
195 Controls.Button {
196 anchors.right: parent.right
197
198 text: "Save"
199
200 onClicked: {
201 account.createAction.execute()
202 popup.close()
203 }
204 }
205 }
206 }
207 }
208}
diff --git a/components/accounts/contents/ui/CreateMaildir.qml b/components/accounts/contents/ui/CreateMaildir.qml
deleted file mode 100644
index 99bde452..00000000
--- a/components/accounts/contents/ui/CreateMaildir.qml
+++ /dev/null
@@ -1,201 +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 1.4 as Controls
22import QtQuick.Controls 2.0 as Controls2
23import org.kde.kirigami 1.0 as Kirigami
24import QtQuick.Dialogs 1.0 as Dialogs
25
26import org.kube.framework.accounts 1.0 as KubeAccounts
27
28Item {
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
diff --git a/components/accounts/contents/ui/EditImap.qml b/components/accounts/contents/ui/EditImap.qml
deleted file mode 100644
index 8b137891..00000000
--- a/components/accounts/contents/ui/EditImap.qml
+++ /dev/null
@@ -1 +0,0 @@
1
diff --git a/components/accounts/contents/ui/EditKolabNow.qml b/components/accounts/contents/ui/EditKolabNow.qml
deleted file mode 100644
index 8b137891..00000000
--- a/components/accounts/contents/ui/EditKolabNow.qml
+++ /dev/null
@@ -1 +0,0 @@
1
diff --git a/components/accounts/contents/ui/EditMaildir.qml b/components/accounts/contents/ui/EditMaildir.qml
deleted file mode 100644
index 8b137891..00000000
--- a/components/accounts/contents/ui/EditMaildir.qml
+++ /dev/null
@@ -1 +0,0 @@
1
diff --git a/framework/accounts/CMakeLists.txt b/framework/accounts/CMakeLists.txt
index 06fcbf08..bccafd77 100644
--- a/framework/accounts/CMakeLists.txt
+++ b/framework/accounts/CMakeLists.txt
@@ -2,9 +2,6 @@ set(accountsplugin_SRCS
2 accountsplugin.cpp 2 accountsplugin.cpp
3 accountfactory.cpp 3 accountfactory.cpp
4 accountsmodel.cpp 4 accountsmodel.cpp
5 maildircontroller.cpp
6 kolabnowcontroller.cpp
7 gmailcontroller.cpp
8) 5)
9 6
10add_library(accountsplugin SHARED ${accountsplugin_SRCS}) 7add_library(accountsplugin SHARED ${accountsplugin_SRCS})
diff --git a/framework/accounts/accountsplugin.cpp b/framework/accounts/accountsplugin.cpp
index 83ae6f0b..e980d5f3 100644
--- a/framework/accounts/accountsplugin.cpp
+++ b/framework/accounts/accountsplugin.cpp
@@ -20,9 +20,6 @@
20 20
21#include "accountsmodel.h" 21#include "accountsmodel.h"
22#include "accountfactory.h" 22#include "accountfactory.h"
23#include "maildircontroller.h"
24#include "kolabnowcontroller.h"
25#include "gmailcontroller.h"
26 23
27#include <QtQml> 24#include <QtQml>
28 25
@@ -31,7 +28,4 @@ void AccountsPlugin::registerTypes (const char *uri)
31 Q_ASSERT(uri == QLatin1String("org.kube.framework.accounts")); 28 Q_ASSERT(uri == QLatin1String("org.kube.framework.accounts"));
32 qmlRegisterType<AccountFactory>(uri, 1, 0, "AccountFactory"); 29 qmlRegisterType<AccountFactory>(uri, 1, 0, "AccountFactory");
33 qmlRegisterType<AccountsModel>(uri, 1, 0, "AccountsModel"); 30 qmlRegisterType<AccountsModel>(uri, 1, 0, "AccountsModel");
34 qmlRegisterType<MaildirController>(uri, 1, 0, "MaildirController");
35 qmlRegisterType<KolabNowController>(uri, 1, 0, "KolabNowController");
36 qmlRegisterType<GmailController>(uri, 1, 0, "GmailController");
37} 31}
diff --git a/framework/accounts/kolabnowcontroller.cpp b/framework/accounts/kolabnowcontroller.cpp
deleted file mode 100644
index d584b598..00000000
--- a/framework/accounts/kolabnowcontroller.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * Copyright (C) 2017 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#include "kolabnowcontroller.h"
20
21#include <sink/store.h>
22
23using namespace Sink;
24using namespace Sink::ApplicationDomain;
25
26KolabNowController::KolabNowController() : Kube::Controller(),
27action_create{new Kube::ControllerAction{this, &KolabNowController::create}},
28action_modify{new Kube::ControllerAction{this, &KolabNowController::modify}},
29action_remove{new Kube::ControllerAction{this, &KolabNowController::remove}}
30{
31
32}
33
34void KolabNowController::create() {
35
36 //account
37 auto account = ApplicationDomainType::createEntity<SinkAccount>();
38 account.setProperty("type", "kolabnow");
39 account.setProperty("name", getName());
40 Store::create(account).exec().waitForFinished();
41
42 //imap
43 auto resource = ApplicationDomainType::createEntity<SinkResource>();
44 resource.setResourceType("sink.imap");
45 resource.setAccount(account);
46 resource.setProperty("server","imaps://beta.kolabnow.com:143");
47 resource.setProperty("username", getEmailAddress());
48 resource.setProperty("password", getPassword());
49 Store::create(resource).exec().waitForFinished();
50
51 //smtp
52 resource = ApplicationDomainType::createEntity<SinkResource>();
53 resource.setResourceType("sink.mailtransport");
54 resource.setAccount(account);
55 resource.setProperty("server", "smtps://smtp.kolabnow.com:465");
56 resource.setProperty("username", getEmailAddress());
57 resource.setProperty("password", getPassword());
58 Store::create(resource).exec().waitForFinished();
59
60 //identity
61 auto identity = ApplicationDomainType::createEntity<Identity>();
62 m_identityId = identity.identifier();
63 identity.setAccount(account);
64 identity.setName(getIdentityName());
65 identity.setAddress(getEmailAddress());
66 Store::create(identity).exec();
67}
68
69void KolabNowController::modify() {
70 //TODO
71}
72
73void KolabNowController::remove() {
74 SinkAccount account(m_accountId);
75 Store::remove(account).exec();
76}
77
78void KolabNowController::load(const QByteArray &id) {
79
80 m_accountId = id;
81
82 Store::fetchOne<SinkAccount>(Query().filter(m_accountId))
83 .then([this](const SinkAccount &account) {
84 setName(account.getName());
85 }).exec();
86
87 //TODO
88}
diff --git a/framework/accounts/kolabnowcontroller.h b/framework/accounts/kolabnowcontroller.h
deleted file mode 100644
index 85918800..00000000
--- a/framework/accounts/kolabnowcontroller.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 Copyright (C) 2017 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#pragma once
20
21#include <QObject>
22#include <QString>
23#include <QByteArray>
24
25#include <domain/controller.h>
26
27class KolabNowController : public Kube::Controller
28{
29 Q_OBJECT
30
31 //Interface properties
32 KUBE_CONTROLLER_PROPERTY(QString, Name, name)
33
34 KUBE_CONTROLLER_PROPERTY(QString, EmailAddress, emailAddress)
35 KUBE_CONTROLLER_PROPERTY(QString, Password, password)
36 KUBE_CONTROLLER_PROPERTY(QString, IdentityName, identityName)
37
38 //Actions
39 KUBE_CONTROLLER_ACTION(create)
40 KUBE_CONTROLLER_ACTION(modify)
41 KUBE_CONTROLLER_ACTION(remove)
42
43public:
44 explicit KolabNowController();
45
46public slots:
47 void load(const QByteArray &id);
48
49private:
50 QByteArray m_accountId;
51 QByteArray m_smtpId;
52 QByteArray m_imapId;
53 QByteArray m_identityId;
54};
diff --git a/framework/accounts/maildircontroller.cpp b/framework/accounts/maildircontroller.cpp
deleted file mode 100644
index c2e15eb8..00000000
--- a/framework/accounts/maildircontroller.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * Copyright (C) 2017 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#include "maildircontroller.h"
20
21#include <sink/store.h>
22
23using namespace Sink;
24using namespace Sink::ApplicationDomain;
25
26MaildirController::MaildirController() : Kube::Controller(),
27 action_create{new Kube::ControllerAction{this, &MaildirController::create}},
28 action_modify{new Kube::ControllerAction{this, &MaildirController::modify}},
29 action_remove{new Kube::ControllerAction{this, &MaildirController::remove}}
30{
31
32}
33
34void MaildirController::create() {
35 auto account = ApplicationDomainType::createEntity<SinkAccount>();
36 account.setProperty("type", "maildir");
37 account.setProperty("name", getName());
38 //account.setProperty("icon", getIcon());
39 Store::create(account).exec().waitForFinished();
40
41 auto resource = ApplicationDomainType::createEntity<SinkResource>();
42 resource.setResourceType("sink.maildir");
43 resource.setAccount(account);
44 resource.setProperty("path", getPath().path());
45
46 Store::create(resource).exec().waitForFinished();
47}
48
49void MaildirController::modify() {
50 SinkResource resource(m_resourceId);
51 resource.setProperty("path", getPath().path());
52 Store::modify(resource).exec();
53}
54
55void MaildirController::remove() {
56 SinkAccount account(m_accountId);
57 Store::remove(account).exec();
58
59 clear();
60}
61
62void MaildirController::load(const QByteArray &id) {
63
64 m_accountId = id;
65 clear();
66
67 Store::fetchOne<SinkAccount>(Query().filter(m_accountId))
68 .then([this](const SinkAccount &account) {
69 setIcon(account.getIcon());
70 setName(account.getName());
71 }).exec();
72
73 Store::fetchOne<SinkResource>(Query().filter<SinkResource::Account>(m_accountId).containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::storage))
74 .then([this](const SinkResource &resource) {
75 m_resourceId = resource.identifier();
76 setPath(resource.getProperty("path").toString());
77 }).exec();
78}
diff --git a/framework/accounts/maildircontroller.h b/framework/accounts/maildircontroller.h
deleted file mode 100644
index 5965f118..00000000
--- a/framework/accounts/maildircontroller.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 Copyright (C) 2017 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#pragma once
20
21#include <QObject>
22#include <QString>
23#include <QUrl>
24#include <QByteArray>
25
26#include <domain/controller.h>
27
28class MaildirController : public Kube::Controller
29{
30 Q_OBJECT
31
32 //Interface properties
33 KUBE_CONTROLLER_PROPERTY(QString, Name, name)
34 KUBE_CONTROLLER_PROPERTY(QString, Icon, icon)
35 KUBE_CONTROLLER_PROPERTY(QUrl, Path, path)
36
37 //Actions
38 KUBE_CONTROLLER_ACTION(create)
39 KUBE_CONTROLLER_ACTION(modify)
40 KUBE_CONTROLLER_ACTION(remove)
41
42public:
43 explicit MaildirController();
44
45public slots:
46 void load(const QByteArray &id);
47
48private:
49 QByteArray m_accountId;
50 QByteArray m_resourceId;
51};