diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/accounts/CMakeLists.txt | 3 | ||||
-rw-r--r-- | framework/accounts/accountsplugin.cpp | 6 | ||||
-rw-r--r-- | framework/accounts/kolabnowcontroller.cpp | 88 | ||||
-rw-r--r-- | framework/accounts/kolabnowcontroller.h | 54 | ||||
-rw-r--r-- | framework/accounts/maildircontroller.cpp | 78 | ||||
-rw-r--r-- | framework/accounts/maildircontroller.h | 51 |
6 files changed, 0 insertions, 280 deletions
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 | ||
10 | add_library(accountsplugin SHARED ${accountsplugin_SRCS}) | 7 | add_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 | |||
23 | using namespace Sink; | ||
24 | using namespace Sink::ApplicationDomain; | ||
25 | |||
26 | KolabNowController::KolabNowController() : Kube::Controller(), | ||
27 | action_create{new Kube::ControllerAction{this, &KolabNowController::create}}, | ||
28 | action_modify{new Kube::ControllerAction{this, &KolabNowController::modify}}, | ||
29 | action_remove{new Kube::ControllerAction{this, &KolabNowController::remove}} | ||
30 | { | ||
31 | |||
32 | } | ||
33 | |||
34 | void 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 | |||
69 | void KolabNowController::modify() { | ||
70 | //TODO | ||
71 | } | ||
72 | |||
73 | void KolabNowController::remove() { | ||
74 | SinkAccount account(m_accountId); | ||
75 | Store::remove(account).exec(); | ||
76 | } | ||
77 | |||
78 | void 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 | |||
27 | class 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 | |||
43 | public: | ||
44 | explicit KolabNowController(); | ||
45 | |||
46 | public slots: | ||
47 | void load(const QByteArray &id); | ||
48 | |||
49 | private: | ||
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 | |||
23 | using namespace Sink; | ||
24 | using namespace Sink::ApplicationDomain; | ||
25 | |||
26 | MaildirController::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 | |||
34 | void 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 | |||
49 | void MaildirController::modify() { | ||
50 | SinkResource resource(m_resourceId); | ||
51 | resource.setProperty("path", getPath().path()); | ||
52 | Store::modify(resource).exec(); | ||
53 | } | ||
54 | |||
55 | void MaildirController::remove() { | ||
56 | SinkAccount account(m_accountId); | ||
57 | Store::remove(account).exec(); | ||
58 | |||
59 | clear(); | ||
60 | } | ||
61 | |||
62 | void 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 | |||
28 | class 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 | |||
42 | public: | ||
43 | explicit MaildirController(); | ||
44 | |||
45 | public slots: | ||
46 | void load(const QByteArray &id); | ||
47 | |||
48 | private: | ||
49 | QByteArray m_accountId; | ||
50 | QByteArray m_resourceId; | ||
51 | }; | ||