summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--accounts/imap/CMakeLists.txt4
-rw-r--r--accounts/imap/imapsettings.cpp237
-rw-r--r--accounts/imap/imapsettings.h51
-rw-r--r--accounts/maildir/CMakeLists.txt4
-rw-r--r--accounts/maildir/maildirsettings.cpp247
-rw-r--r--accounts/maildir/maildirsettings.h51
-rw-r--r--framework/domain/CMakeLists.txt1
-rw-r--r--framework/domain/settings/accountsettings.cpp337
-rw-r--r--framework/domain/settings/accountsettings.h110
9 files changed, 490 insertions, 552 deletions
diff --git a/accounts/imap/CMakeLists.txt b/accounts/imap/CMakeLists.txt
index 07c53701..42b50899 100644
--- a/accounts/imap/CMakeLists.txt
+++ b/accounts/imap/CMakeLists.txt
@@ -35,11 +35,11 @@ set(SRCS
35 35
36add_library(imapaccountplugin SHARED ${SRCS}) 36add_library(imapaccountplugin SHARED ${SRCS})
37qt5_use_modules(imapaccountplugin Core Quick Qml) 37qt5_use_modules(imapaccountplugin Core Quick Qml)
38target_link_libraries(imapaccountplugin sink settingsplugin) 38target_link_libraries(imapaccountplugin sink settingsplugin mailplugin)
39 39
40add_library(imapaccount_static STATIC ${SRCS}) 40add_library(imapaccount_static STATIC ${SRCS})
41qt5_use_modules(imapaccount_static Core Quick Qml) 41qt5_use_modules(imapaccount_static Core Quick Qml)
42target_link_libraries(imapaccount_static sink settingsplugin) 42target_link_libraries(imapaccount_static sink settingsplugin mailplugin)
43add_subdirectory(tests) 43add_subdirectory(tests)
44 44
45kpackage_install_package(package org.kube.accounts.imap "genericqml") 45kpackage_install_package(package org.kube.accounts.imap "genericqml")
diff --git a/accounts/imap/imapsettings.cpp b/accounts/imap/imapsettings.cpp
index fcef8971..1f338e83 100644
--- a/accounts/imap/imapsettings.cpp
+++ b/accounts/imap/imapsettings.cpp
@@ -18,241 +18,32 @@
18*/ 18*/
19#include "imapsettings.h" 19#include "imapsettings.h"
20 20
21#include <settings/settings.h>
22
23#include <sink/store.h>
24#include <QDebug>
25#include <QDir>
26#include <QUrl>
27
28ImapSettings::ImapSettings(QObject *parent) 21ImapSettings::ImapSettings(QObject *parent)
29 : QObject(parent) 22 : AccountSettings(parent)
30{
31}
32
33
34void ImapSettings::setAccountIdentifier(const QByteArray &id)
35{
36 if (id.isEmpty()) {
37 return;
38 }
39 mAccountIdentifier = id;
40
41 //Clear
42 mIcon = QString();
43 mName = QString();
44 mImapServer = QString();
45 mImapUsername = QString();
46 mImapPassword = QString();
47 mSmtpServer = QString();
48 mSmtpUsername = QString();
49 mSmtpPassword = QString();
50 emit changed();
51 emit imapResourceChanged();
52 emit smtpResourceChanged();
53
54 Q_ASSERT(!id.isEmpty());
55 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkAccount>(Sink::Query::IdentityFilter(id))
56 .then<void, Sink::ApplicationDomain::SinkAccount>([this](const Sink::ApplicationDomain::SinkAccount &account) {
57 mIcon = account.getProperty("icon").toString();
58 mName = account.getProperty("name").toString();
59 emit changed();
60 }).exec();
61
62 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::storage))
63 .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) {
64 mIdentifier = resource.identifier();
65 mImapServer = resource.getProperty("server").toString();
66 mImapUsername = resource.getProperty("username").toString();
67 mImapPassword = resource.getProperty("password").toString();
68 emit imapResourceChanged();
69 },
70 [](int errorCode, const QString &errorMessage) {
71 qWarning() << "Failed to find the imap resource: " << errorMessage;
72 }).exec();
73
74 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::transport))
75 .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) {
76 mMailtransportIdentifier = resource.identifier();
77 mSmtpServer = resource.getProperty("server").toString();
78 mSmtpUsername = resource.getProperty("username").toString();
79 mSmtpPassword = resource.getProperty("password").toString();
80 emit smtpResourceChanged();
81 },
82 [](int errorCode, const QString &errorMessage) {
83 qWarning() << "Failed to find the smtp resource: " << errorMessage;
84 }).exec();
85
86 //FIXME this assumes that we only ever have one identity per account
87 Sink::Store::fetchOne<Sink::ApplicationDomain::Identity>(Sink::Query::AccountFilter(id))
88 .then<void, Sink::ApplicationDomain::Identity>([this](const Sink::ApplicationDomain::Identity &identity) {
89 mIdentityIdentifier = identity.identifier();
90 mUsername = identity.getProperty("username").toString();
91 mEmailAddress = identity.getProperty("address").toString();
92 emit identityChanged();
93 },
94 [](int errorCode, const QString &errorMessage) {
95 qWarning() << "Failed to find the identity resource: " << errorMessage;
96 }).exec();
97}
98
99QByteArray ImapSettings::accountIdentifier() const
100{
101 return mAccountIdentifier;
102}
103
104QValidator *ImapSettings::imapServerValidator() const
105{ 23{
106 class ImapServerValidator : public QValidator {
107 State validate(QString &input, int &pos) const {
108 Q_UNUSED(pos);
109 // imaps://mainserver.example.net:475
110 const QUrl url(input);
111 static QSet<QString> validProtocols = QSet<QString>() << "imap" << "imaps";
112 if (url.isValid() && validProtocols.contains(url.scheme().toLower())) {
113 return Acceptable;
114 } else {
115 return Intermediate;
116 }
117 }
118 };
119 static ImapServerValidator *validator = new ImapServerValidator;
120 return validator;
121} 24}
122 25
123QValidator *ImapSettings::smtpServerValidator() const 26void ImapSettings::load()
124{ 27{
125 class SmtpServerValidator : public QValidator { 28 loadAccount();
126 State validate(QString &input, int &pos) const { 29 loadImapResource();
127 Q_UNUSED(pos); 30 loadMailtransportResource();
128 // smtps://mainserver.example.net:475 31 loadIdentity();
129 const QUrl url(input);
130 static QSet<QString> validProtocols = QSet<QString>() << "smtp" << "smtps";
131 if (url.isValid() && validProtocols.contains(url.scheme().toLower())) {
132 return Acceptable;
133 } else {
134 return Intermediate;
135 }
136 }
137 };
138 static SmtpServerValidator *validator = new SmtpServerValidator;
139 return validator;
140} 32}
141 33
142void ImapSettings::save() 34void ImapSettings::save()
143{ 35{
144 qDebug() << "Saving account " << mAccountIdentifier << mIdentifier << mMailtransportIdentifier; 36 saveAccount();
145 Q_ASSERT(!mAccountIdentifier.isEmpty()); 37 saveImapResource();
146 Sink::ApplicationDomain::SinkAccount account(mAccountIdentifier); 38 saveMailtransportResource();
147 account.setProperty("type", "imap"); 39 saveIdentity();
148 account.setProperty("name", mName);
149 account.setProperty("icon", mIcon);
150 Q_ASSERT(!account.identifier().isEmpty());
151 Sink::Store::modify(account).then<void>([]() {},
152 [](int errorCode, const QString &errorMessage) {
153 qWarning() << "Error while creating account: " << errorMessage;
154 })
155 .exec();
156
157 if (!mIdentifier.isEmpty()) {
158 Sink::ApplicationDomain::SinkResource resource(mIdentifier);
159 resource.setProperty("server", mImapServer);
160 resource.setProperty("username", mImapUsername);
161 resource.setProperty("password", mImapPassword);
162 Sink::Store::modify(resource).then<void>([](){}, [](int errorCode, const QString &errorMessage) {
163 qWarning() << "Error while modifying resource: " << errorMessage;
164 })
165 .exec();
166 } else {
167 auto resource = Sink::ApplicationDomain::ImapResource::create(mAccountIdentifier);
168 mIdentifier = resource.identifier();
169 resource.setProperty("server", mImapServer);
170 resource.setProperty("username", mImapUsername);
171 resource.setProperty("password", mImapPassword);
172 Sink::Store::create(resource).then<void>([]() {},
173 [](int errorCode, const QString &errorMessage) {
174 qWarning() << "Error while creating resource: " << errorMessage;
175 })
176 .exec();
177 }
178
179 if (!mMailtransportIdentifier.isEmpty()) {
180 Sink::ApplicationDomain::SinkResource resource(mMailtransportIdentifier);
181 resource.setProperty("server", mSmtpServer);
182 resource.setProperty("username", mSmtpUsername);
183 resource.setProperty("password", mSmtpPassword);
184 Sink::Store::modify(resource).then<void>([](){}, [](int errorCode, const QString &errorMessage) {
185 qWarning() << "Error while modifying resource: " << errorMessage;
186 })
187 .exec();
188 } else {
189 auto resource = Sink::ApplicationDomain::MailtransportResource::create(mAccountIdentifier);
190 mMailtransportIdentifier = resource.identifier();
191 resource.setProperty("server", mSmtpServer);
192 resource.setProperty("username", mSmtpUsername);
193 resource.setProperty("password", mSmtpPassword);
194 Sink::Store::create(resource).then<void>([]() {},
195 [](int errorCode, const QString &errorMessage) {
196 qWarning() << "Error while creating resource: " << errorMessage;
197 })
198 .exec();
199 }
200
201 if (!mIdentityIdentifier.isEmpty()) {
202 Sink::ApplicationDomain::Identity identity(mMailtransportIdentifier);
203 identity.setProperty("username", mUsername);
204 identity.setProperty("address", mEmailAddress);
205 Sink::Store::modify(identity).then<void>([](){}, [](int errorCode, const QString &errorMessage) {
206 qWarning() << "Error while modifying identity: " << errorMessage;
207 })
208 .exec();
209 } else {
210 auto identity = Sink::ApplicationDomain::ApplicationDomainType::createEntity<Sink::ApplicationDomain::Identity>();
211 mIdentityIdentifier = identity.identifier();
212 identity.setProperty("account", mAccountIdentifier);
213 identity.setProperty("username", mUsername);
214 identity.setProperty("address", mEmailAddress);
215 Sink::Store::create(identity).then<void>([]() {},
216 [](int errorCode, const QString &errorMessage) {
217 qWarning() << "Error while creating identity: " << errorMessage;
218 })
219 .exec();
220 }
221} 40}
222 41
223void ImapSettings::remove() 42void ImapSettings::remove()
224{ 43{
225 if (mMailtransportIdentifier.isEmpty()) { 44 removeResource(mMailtransportIdentifier);
226 qWarning() << "We're missing an identifier"; 45 removeResource(mImapIdentifier);
227 } else { 46 removeIdentity();
228 Sink::ApplicationDomain::SinkResource mailTransportResource("", mMailtransportIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); 47 removeAccount();
229 Sink::Store::remove(mailTransportResource).then<void>([]() {},
230 [](int errorCode, const QString &errorMessage) {
231 qWarning() << "Error while removing resource: " << errorMessage;
232 })
233 .exec();
234 }
235
236 if (mIdentifier.isEmpty()) {
237 qWarning() << "We're missing an identifier";
238 } else {
239 Sink::ApplicationDomain::SinkResource resource("", mIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create());
240 Sink::Store::remove(resource).then<void>([]() {},
241 [](int errorCode, const QString &errorMessage) {
242 qWarning() << "Error while removing resource: " << errorMessage;
243 })
244 .exec();
245 }
246
247 if (mAccountIdentifier.isEmpty()) {
248 qWarning() << "We're missing an identifier";
249 } else {
250 Sink::ApplicationDomain::SinkAccount account("", mAccountIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create());
251 Sink::Store::remove(account).then<void>([]() {},
252 [](int errorCode, const QString &errorMessage) {
253 qWarning() << "Error while removing account: " << errorMessage;
254 })
255 .exec();
256 }
257} 48}
258 49
diff --git a/accounts/imap/imapsettings.h b/accounts/imap/imapsettings.h
index 30bd67d1..ca2fd1ca 100644
--- a/accounts/imap/imapsettings.h
+++ b/accounts/imap/imapsettings.h
@@ -18,57 +18,16 @@
18*/ 18*/
19#pragma once 19#pragma once
20 20
21#include <QObject> 21#include <domain/settings/accountsettings.h>
22#include <QValidator>
23 22
24class ImapSettings : public QObject 23class ImapSettings : public AccountSettings
25{ 24{
26 Q_OBJECT 25 Q_OBJECT
27 Q_PROPERTY(QByteArray accountIdentifier READ accountIdentifier WRITE setAccountIdentifier)
28 Q_PROPERTY(QString icon MEMBER mIcon NOTIFY changed)
29 Q_PROPERTY(QString accountName MEMBER mName NOTIFY changed)
30 Q_PROPERTY(QString userName MEMBER mUsername NOTIFY identityChanged)
31 Q_PROPERTY(QString emailAddress MEMBER mEmailAddress NOTIFY identityChanged)
32 Q_PROPERTY(QString imapServer MEMBER mImapServer NOTIFY imapResourceChanged)
33 Q_PROPERTY(QValidator* imapServerValidator READ imapServerValidator CONSTANT)
34 Q_PROPERTY(QString imapUsername MEMBER mImapUsername NOTIFY imapResourceChanged)
35 Q_PROPERTY(QString imapPassword MEMBER mImapPassword NOTIFY imapResourceChanged)
36 Q_PROPERTY(QString smtpServer MEMBER mSmtpServer NOTIFY smtpResourceChanged)
37 Q_PROPERTY(QValidator* smtpServerValidator READ smtpServerValidator CONSTANT)
38 Q_PROPERTY(QString smtpUsername MEMBER mSmtpUsername NOTIFY smtpResourceChanged)
39 Q_PROPERTY(QString smtpPassword MEMBER mSmtpPassword NOTIFY smtpResourceChanged)
40 26
41public: 27public:
42 ImapSettings(QObject *parent = 0); 28 ImapSettings(QObject *parent = 0);
43 29
44 void setAccountIdentifier(const QByteArray &); 30 Q_INVOKABLE virtual void load() Q_DECL_OVERRIDE;
45 QByteArray accountIdentifier() const; 31 Q_INVOKABLE virtual void save() Q_DECL_OVERRIDE;
46 32 Q_INVOKABLE virtual void remove() Q_DECL_OVERRIDE;
47 QValidator *imapServerValidator() const;
48 QValidator *smtpServerValidator() const;
49
50 Q_INVOKABLE void save();
51 Q_INVOKABLE void remove();
52
53signals:
54 void imapResourceChanged();
55 void smtpResourceChanged();
56 void identityChanged();
57 void changed();
58
59private:
60 QByteArray mIdentifier;
61 QByteArray mAccountIdentifier;
62 QByteArray mMailtransportIdentifier;
63 QByteArray mIdentityIdentifier;
64 QString mIcon;
65 QString mName;
66 QString mUsername;
67 QString mEmailAddress;
68 QString mImapServer;
69 QString mImapUsername;
70 QString mImapPassword;
71 QString mSmtpServer;
72 QString mSmtpUsername;
73 QString mSmtpPassword;
74}; 33};
diff --git a/accounts/maildir/CMakeLists.txt b/accounts/maildir/CMakeLists.txt
index a48295d5..e50d4179 100644
--- a/accounts/maildir/CMakeLists.txt
+++ b/accounts/maildir/CMakeLists.txt
@@ -35,11 +35,11 @@ set(SRCS
35 35
36add_library(maildiraccountplugin SHARED ${SRCS}) 36add_library(maildiraccountplugin SHARED ${SRCS})
37qt5_use_modules(maildiraccountplugin Core Quick Qml) 37qt5_use_modules(maildiraccountplugin Core Quick Qml)
38target_link_libraries(maildiraccountplugin sink settingsplugin) 38target_link_libraries(maildiraccountplugin sink settingsplugin mailplugin)
39 39
40add_library(maildiraccount_static STATIC ${SRCS}) 40add_library(maildiraccount_static STATIC ${SRCS})
41qt5_use_modules(maildiraccount_static Core Quick Qml) 41qt5_use_modules(maildiraccount_static Core Quick Qml)
42target_link_libraries(maildiraccount_static sink settingsplugin) 42target_link_libraries(maildiraccount_static sink settingsplugin mailplugin)
43add_subdirectory(tests) 43add_subdirectory(tests)
44 44
45kpackage_install_package(package org.kube.accounts.maildir "genericqml") 45kpackage_install_package(package org.kube.accounts.maildir "genericqml")
diff --git a/accounts/maildir/maildirsettings.cpp b/accounts/maildir/maildirsettings.cpp
index 5c1fb177..7611251e 100644
--- a/accounts/maildir/maildirsettings.cpp
+++ b/accounts/maildir/maildirsettings.cpp
@@ -18,251 +18,32 @@
18*/ 18*/
19#include "maildirsettings.h" 19#include "maildirsettings.h"
20 20
21#include <settings/settings.h>
22
23#include <sink/store.h>
24#include <QDebug>
25#include <QDir>
26#include <QUrl>
27
28MaildirSettings::MaildirSettings(QObject *parent) 21MaildirSettings::MaildirSettings(QObject *parent)
29 : QObject(parent) 22 : AccountSettings(parent)
30{
31}
32
33
34void MaildirSettings::setAccountIdentifier(const QByteArray &id)
35{
36 if (id.isEmpty()) {
37 return;
38 }
39 mAccountIdentifier = id;
40
41 //Clear
42 mIcon = QString();
43 mName = QString();
44 mPath = QString();
45 mSmtpServer = QString();
46 mSmtpUsername = QString();
47 mSmtpPassword = QString();
48 emit changed();
49 emit pathChanged();
50 emit smtpResourceChanged();
51
52 Q_ASSERT(!id.isEmpty());
53 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkAccount>(Sink::Query::IdentityFilter(id))
54 .then<void, Sink::ApplicationDomain::SinkAccount>([this](const Sink::ApplicationDomain::SinkAccount &account) {
55 mIcon = account.getProperty("icon").toString();
56 mName = account.getProperty("name").toString();
57 emit changed();
58 }).exec();
59
60 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::storage))
61 .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) {
62 mIdentifier = resource.identifier();
63 auto path = resource.getProperty("path").toString();
64 if (mPath != path) {
65 mPath = path;
66 emit pathChanged();
67 }
68 },
69 [](int errorCode, const QString &errorMessage) {
70 qWarning() << "Failed to find the maildir resource: " << errorMessage;
71 }).exec();
72
73 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::transport))
74 .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) {
75 mMailtransportIdentifier = resource.identifier();
76 mSmtpServer = resource.getProperty("server").toString();
77 mSmtpUsername = resource.getProperty("username").toString();
78 mSmtpPassword = resource.getProperty("password").toString();
79 emit smtpResourceChanged();
80 },
81 [](int errorCode, const QString &errorMessage) {
82 qWarning() << "Failed to find the maildir resource: " << errorMessage;
83 }).exec();
84
85 //FIXME this assumes that we only ever have one identity per account
86 Sink::Store::fetchOne<Sink::ApplicationDomain::Identity>(Sink::Query::AccountFilter(id))
87 .then<void, Sink::ApplicationDomain::Identity>([this](const Sink::ApplicationDomain::Identity &identity) {
88 mIdentityIdentifier = identity.identifier();
89 mUsername = identity.getProperty("username").toString();
90 mEmailAddress = identity.getProperty("address").toString();
91 emit identityChanged();
92 },
93 [](int errorCode, const QString &errorMessage) {
94 qWarning() << "Failed to find the identity resource: " << errorMessage;
95 }).exec();
96}
97
98QByteArray MaildirSettings::accountIdentifier() const
99{ 23{
100 return mAccountIdentifier;
101} 24}
102 25
103void MaildirSettings::setPath(const QUrl &path) 26void MaildirSettings::load()
104{ 27{
105 auto normalizedPath = path.path(); 28 loadAccount();
106 if (mPath != normalizedPath) { 29 loadMaildirResource();
107 mPath = normalizedPath; 30 loadMailtransportResource();
108 emit pathChanged(); 31 loadIdentity();
109 }
110}
111
112QUrl MaildirSettings::path() const
113{
114 return QUrl(mPath);
115}
116
117QValidator *MaildirSettings::pathValidator() const
118{
119 class PathValidator : public QValidator {
120 State validate(QString &input, int &pos) const {
121 Q_UNUSED(pos);
122 if (!input.isEmpty() && QDir(input).exists()) {
123 return Acceptable;
124 } else {
125 return Intermediate;
126 }
127 }
128 };
129 static PathValidator *pathValidator = new PathValidator;
130 return pathValidator;
131}
132
133QValidator *MaildirSettings::smtpServerValidator() const
134{
135 class SmtpServerValidator : public QValidator {
136 State validate(QString &input, int &pos) const {
137 Q_UNUSED(pos);
138 // smtps://mainserver.example.net:475
139 const QUrl url(input);
140 static QSet<QString> validProtocols = QSet<QString>() << "smtp" << "smtps";
141 if (url.isValid() && validProtocols.contains(url.scheme().toLower())) {
142 return Acceptable;
143 } else {
144 return Intermediate;
145 }
146 }
147 };
148 static SmtpServerValidator *validator = new SmtpServerValidator;
149 return validator;
150} 32}
151 33
152void MaildirSettings::save() 34void MaildirSettings::save()
153{ 35{
154 if (!QDir(mPath).exists()) { 36 saveAccount();
155 qWarning() << "The path doesn't exist: " << mPath; 37 saveMaildirResource();
156 return; 38 saveMailtransportResource();
157 } 39 saveIdentity();
158 qDebug() << "Saving account " << mAccountIdentifier << mIdentifier << mMailtransportIdentifier;
159 Q_ASSERT(!mAccountIdentifier.isEmpty());
160 Sink::ApplicationDomain::SinkAccount account(mAccountIdentifier);
161 account.setProperty("type", "maildir");
162 account.setProperty("name", mName);
163 account.setProperty("icon", mIcon);
164 Q_ASSERT(!account.identifier().isEmpty());
165 Sink::Store::modify(account).then<void>([]() {},
166 [](int errorCode, const QString &errorMessage) {
167 qWarning() << "Error while creating account: " << errorMessage;
168 })
169 .exec();
170
171 if (!mIdentifier.isEmpty()) {
172 Sink::ApplicationDomain::SinkResource resource(mIdentifier);
173 resource.setProperty("path", mPath);
174 Sink::Store::modify(resource).then<void>([](){}, [](int errorCode, const QString &errorMessage) {
175 qWarning() << "Error while modifying resource: " << errorMessage;
176 })
177 .exec();
178 } else {
179 auto resource = Sink::ApplicationDomain::MaildirResource::create(mAccountIdentifier);
180 resource.setProperty("path", property("path"));
181 mIdentifier = resource.identifier();
182 Sink::Store::create(resource).then<void>([]() {},
183 [](int errorCode, const QString &errorMessage) {
184 qWarning() << "Error while creating resource: " << errorMessage;
185 })
186 .exec();
187 }
188
189 if (!mMailtransportIdentifier.isEmpty()) {
190 Sink::ApplicationDomain::SinkResource resource(mMailtransportIdentifier);
191 resource.setProperty("server", mSmtpServer);
192 resource.setProperty("username", mSmtpUsername);
193 resource.setProperty("password", mSmtpPassword);
194 Sink::Store::modify(resource).then<void>([](){}, [](int errorCode, const QString &errorMessage) {
195 qWarning() << "Error while modifying resource: " << errorMessage;
196 })
197 .exec();
198 } else {
199 auto resource = Sink::ApplicationDomain::MailtransportResource::create(mAccountIdentifier);
200 mMailtransportIdentifier = resource.identifier();
201 resource.setProperty("server", mSmtpServer);
202 resource.setProperty("username", mSmtpUsername);
203 resource.setProperty("password", mSmtpPassword);
204 Sink::Store::create(resource).then<void>([]() {},
205 [](int errorCode, const QString &errorMessage) {
206 qWarning() << "Error while creating resource: " << errorMessage;
207 })
208 .exec();
209 }
210
211 if (!mIdentityIdentifier.isEmpty()) {
212 Sink::ApplicationDomain::Identity identity(mMailtransportIdentifier);
213 identity.setProperty("username", mUsername);
214 identity.setProperty("address", mEmailAddress);
215 Sink::Store::modify(identity).then<void>([](){}, [](int errorCode, const QString &errorMessage) {
216 qWarning() << "Error while modifying identity: " << errorMessage;
217 })
218 .exec();
219 } else {
220 auto identity = Sink::ApplicationDomain::ApplicationDomainType::createEntity<Sink::ApplicationDomain::Identity>();
221 mIdentityIdentifier = identity.identifier();
222 identity.setProperty("account", mAccountIdentifier);
223 identity.setProperty("username", mUsername);
224 identity.setProperty("address", mEmailAddress);
225 Sink::Store::create(identity).then<void>([]() {},
226 [](int errorCode, const QString &errorMessage) {
227 qWarning() << "Error while creating identity: " << errorMessage;
228 })
229 .exec();
230 }
231} 40}
232 41
233void MaildirSettings::remove() 42void MaildirSettings::remove()
234{ 43{
235 if (mMailtransportIdentifier.isEmpty()) { 44 removeResource(mMailtransportIdentifier);
236 qWarning() << "We're missing an identifier"; 45 removeResource(mMaildirIdentifier);
237 } else { 46 removeIdentity();
238 Sink::ApplicationDomain::SinkResource mailTransportResource("", mMailtransportIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); 47 removeAccount();
239 Sink::Store::remove(mailTransportResource).then<void>([]() {},
240 [](int errorCode, const QString &errorMessage) {
241 qWarning() << "Error while removing resource: " << errorMessage;
242 })
243 .exec();
244 }
245
246 if (mIdentifier.isEmpty()) {
247 qWarning() << "We're missing an identifier";
248 } else {
249 Sink::ApplicationDomain::SinkResource resource("", mIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create());
250 Sink::Store::remove(resource).then<void>([]() {},
251 [](int errorCode, const QString &errorMessage) {
252 qWarning() << "Error while removing resource: " << errorMessage;
253 })
254 .exec();
255 }
256
257 if (mAccountIdentifier.isEmpty()) {
258 qWarning() << "We're missing an identifier";
259 } else {
260 Sink::ApplicationDomain::SinkAccount account("", mAccountIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create());
261 Sink::Store::remove(account).then<void>([]() {},
262 [](int errorCode, const QString &errorMessage) {
263 qWarning() << "Error while removing account: " << errorMessage;
264 })
265 .exec();
266 }
267} 48}
268 49
diff --git a/accounts/maildir/maildirsettings.h b/accounts/maildir/maildirsettings.h
index a02944d9..42336535 100644
--- a/accounts/maildir/maildirsettings.h
+++ b/accounts/maildir/maildirsettings.h
@@ -18,56 +18,15 @@
18*/ 18*/
19#pragma once 19#pragma once
20 20
21#include <QObject> 21#include <domain/settings/accountsettings.h>
22#include <QValidator>
23 22
24class MaildirSettings : public QObject 23class MaildirSettings : public AccountSettings
25{ 24{
26 Q_OBJECT 25 Q_OBJECT
27 Q_PROPERTY(QByteArray accountIdentifier READ accountIdentifier WRITE setAccountIdentifier)
28 Q_PROPERTY(QUrl path READ path WRITE setPath NOTIFY pathChanged)
29 Q_PROPERTY(QValidator* pathValidator READ pathValidator CONSTANT)
30 Q_PROPERTY(QString icon MEMBER mIcon NOTIFY changed)
31 Q_PROPERTY(QString accountName MEMBER mName NOTIFY changed)
32 Q_PROPERTY(QString userName MEMBER mUsername NOTIFY identityChanged)
33 Q_PROPERTY(QString emailAddress MEMBER mEmailAddress NOTIFY identityChanged)
34 Q_PROPERTY(QString smtpServer MEMBER mSmtpServer NOTIFY smtpResourceChanged)
35 Q_PROPERTY(QValidator* smtpServerValidator READ smtpServerValidator CONSTANT)
36 Q_PROPERTY(QString smtpUsername MEMBER mSmtpUsername NOTIFY smtpResourceChanged)
37 Q_PROPERTY(QString smtpPassword MEMBER mSmtpPassword NOTIFY smtpResourceChanged)
38
39public: 26public:
40 MaildirSettings(QObject *parent = 0); 27 MaildirSettings(QObject *parent = 0);
41 28
42 void setAccountIdentifier(const QByteArray &); 29 Q_INVOKABLE virtual void load() Q_DECL_OVERRIDE;
43 QByteArray accountIdentifier() const; 30 Q_INVOKABLE virtual void save() Q_DECL_OVERRIDE;
44 31 Q_INVOKABLE virtual void remove() Q_DECL_OVERRIDE;
45 void setPath(const QUrl &);
46 QUrl path() const;
47 QValidator *pathValidator() const;
48
49 QValidator *smtpServerValidator() const;
50
51 Q_INVOKABLE void save();
52 Q_INVOKABLE void remove();
53
54signals:
55 void pathChanged();
56 void smtpResourceChanged();
57 void identityChanged();
58 void changed();
59
60private:
61 QByteArray mIdentifier;
62 QByteArray mAccountIdentifier;
63 QByteArray mMailtransportIdentifier;
64 QByteArray mIdentityIdentifier;
65 QString mPath;
66 QString mIcon;
67 QString mName;
68 QString mUsername;
69 QString mEmailAddress;
70 QString mSmtpServer;
71 QString mSmtpUsername;
72 QString mSmtpPassword;
73}; 32};
diff --git a/framework/domain/CMakeLists.txt b/framework/domain/CMakeLists.txt
index 114b054d..39a47111 100644
--- a/framework/domain/CMakeLists.txt
+++ b/framework/domain/CMakeLists.txt
@@ -14,6 +14,7 @@ set(mailplugin_SRCS
14 accountscontroller.cpp 14 accountscontroller.cpp
15 accountsmodel.cpp 15 accountsmodel.cpp
16 identitiesmodel.cpp 16 identitiesmodel.cpp
17 settings/accountsettings.cpp
17) 18)
18add_definitions(-DMAIL_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data") 19add_definitions(-DMAIL_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data")
19 20
diff --git a/framework/domain/settings/accountsettings.cpp b/framework/domain/settings/accountsettings.cpp
new file mode 100644
index 00000000..cf348f39
--- /dev/null
+++ b/framework/domain/settings/accountsettings.cpp
@@ -0,0 +1,337 @@
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 "accountsettings.h"
20
21#include <sink/store.h>
22#include <QDebug>
23#include <QDir>
24#include <QUrl>
25
26AccountSettings::AccountSettings(QObject *parent)
27 : QObject(parent)
28{
29}
30
31
32void AccountSettings::setAccountIdentifier(const QByteArray &id)
33{
34 if (id.isEmpty()) {
35 return;
36 }
37 mAccountIdentifier = id;
38
39 //Clear
40 mIcon = QString();
41 mName = QString();
42 mImapServer = QString();
43 mImapUsername = QString();
44 mImapPassword = QString();
45 mSmtpServer = QString();
46 mSmtpUsername = QString();
47 mSmtpPassword = QString();
48 emit changed();
49 emit imapResourceChanged();
50 emit smtpResourceChanged();
51
52 load();
53
54}
55
56QByteArray AccountSettings::accountIdentifier() const
57{
58 return mAccountIdentifier;
59}
60
61void AccountSettings::setPath(const QUrl &path)
62{
63 auto normalizedPath = path.path();
64 if (mPath != normalizedPath) {
65 mPath = normalizedPath;
66 emit pathChanged();
67 }
68}
69
70QUrl AccountSettings::path() const
71{
72 return QUrl(mPath);
73}
74
75QValidator *AccountSettings::pathValidator() const
76{
77 class PathValidator : public QValidator {
78 State validate(QString &input, int &pos) const {
79 Q_UNUSED(pos);
80 if (!input.isEmpty() && QDir(input).exists()) {
81 return Acceptable;
82 } else {
83 return Intermediate;
84 }
85 }
86 };
87 static PathValidator *pathValidator = new PathValidator;
88 return pathValidator;
89}
90
91QValidator *AccountSettings::imapServerValidator() const
92{
93 class ImapServerValidator : public QValidator {
94 State validate(QString &input, int &pos) const {
95 Q_UNUSED(pos);
96 // imaps://mainserver.example.net:475
97 const QUrl url(input);
98 static QSet<QString> validProtocols = QSet<QString>() << "imap" << "imaps";
99 if (url.isValid() && validProtocols.contains(url.scheme().toLower())) {
100 return Acceptable;
101 } else {
102 return Intermediate;
103 }
104 }
105 };
106 static ImapServerValidator *validator = new ImapServerValidator;
107 return validator;
108}
109
110QValidator *AccountSettings::smtpServerValidator() const
111{
112 class SmtpServerValidator : public QValidator {
113 State validate(QString &input, int &pos) const {
114 Q_UNUSED(pos);
115 // smtps://mainserver.example.net:475
116 const QUrl url(input);
117 static QSet<QString> validProtocols = QSet<QString>() << "smtp" << "smtps";
118 if (url.isValid() && validProtocols.contains(url.scheme().toLower())) {
119 return Acceptable;
120 } else {
121 return Intermediate;
122 }
123 }
124 };
125 static SmtpServerValidator *validator = new SmtpServerValidator;
126 return validator;
127}
128
129void AccountSettings::saveAccount()
130{
131 qDebug() << "Saving account " << mAccountIdentifier << mMailtransportIdentifier;
132 Q_ASSERT(!mAccountIdentifier.isEmpty());
133 Sink::ApplicationDomain::SinkAccount account(mAccountIdentifier);
134 account.setProperty("type", "imap");
135 account.setProperty("name", mName);
136 account.setProperty("icon", mIcon);
137 Q_ASSERT(!account.identifier().isEmpty());
138 Sink::Store::modify(account).then<void>([]() {},
139 [](int errorCode, const QString &errorMessage) {
140 qWarning() << "Error while creating account: " << errorMessage;
141 })
142 .exec();
143}
144
145void AccountSettings::loadAccount()
146{
147 Q_ASSERT(!mAccountIdentifier.isEmpty());
148 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkAccount>(Sink::Query::IdentityFilter(mAccountIdentifier))
149 .then<void, Sink::ApplicationDomain::SinkAccount>([this](const Sink::ApplicationDomain::SinkAccount &account) {
150 mIcon = account.getProperty("icon").toString();
151 mName = account.getProperty("name").toString();
152 emit changed();
153 }).exec();
154}
155
156void AccountSettings::loadImapResource()
157{
158 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::AccountFilter(mAccountIdentifier) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::storage))
159 .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) {
160 mImapIdentifier = resource.identifier();
161 mImapServer = resource.getProperty("server").toString();
162 mImapUsername = resource.getProperty("username").toString();
163 mImapPassword = resource.getProperty("password").toString();
164 emit imapResourceChanged();
165 },
166 [](int errorCode, const QString &errorMessage) {
167 qWarning() << "Failed to find the imap resource: " << errorMessage;
168 }).exec();
169}
170
171void AccountSettings::loadMaildirResource()
172{
173 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::AccountFilter(mAccountIdentifier) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::storage))
174 .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) {
175 mMaildirIdentifier = resource.identifier();
176 auto path = resource.getProperty("path").toString();
177 if (mPath != path) {
178 mPath = path;
179 emit pathChanged();
180 }
181 },
182 [](int errorCode, const QString &errorMessage) {
183 qWarning() << "Failed to find the maildir resource: " << errorMessage;
184 }).exec();
185}
186
187void AccountSettings::loadMailtransportResource()
188{
189 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::AccountFilter(mAccountIdentifier) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::transport))
190 .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) {
191 mMailtransportIdentifier = resource.identifier();
192 mSmtpServer = resource.getProperty("server").toString();
193 mSmtpUsername = resource.getProperty("username").toString();
194 mSmtpPassword = resource.getProperty("password").toString();
195 emit smtpResourceChanged();
196 },
197 [](int errorCode, const QString &errorMessage) {
198 qWarning() << "Failed to find the smtp resource: " << errorMessage;
199 }).exec();
200}
201
202void AccountSettings::loadIdentity()
203{
204 //FIXME this assumes that we only ever have one identity per account
205 Sink::Store::fetchOne<Sink::ApplicationDomain::Identity>(Sink::Query::AccountFilter(mAccountIdentifier))
206 .then<void, Sink::ApplicationDomain::Identity>([this](const Sink::ApplicationDomain::Identity &identity) {
207 mIdentityIdentifier = identity.identifier();
208 mUsername = identity.getProperty("username").toString();
209 mEmailAddress = identity.getProperty("address").toString();
210 emit identityChanged();
211 },
212 [](int errorCode, const QString &errorMessage) {
213 qWarning() << "Failed to find the identity resource: " << errorMessage;
214 }).exec();
215}
216
217
218
219template<typename ResourceType>
220static QByteArray saveResource(const QByteArray &accountIdentifier, const QByteArray &identifier, const std::map<QByteArray, QVariant> &properties)
221{
222 if (!identifier.isEmpty()) {
223 Sink::ApplicationDomain::SinkResource resource(identifier);
224 for (const auto &pair : properties) {
225 resource.setProperty(pair.first, pair.second);
226 }
227 Sink::Store::modify(resource).then<void>([](){}, [](int errorCode, const QString &errorMessage) {
228 qWarning() << "Error while modifying resource: " << errorMessage;
229 })
230 .exec();
231 } else {
232 auto resource = ResourceType::create(accountIdentifier);
233 auto newIdentifier = resource.identifier();
234 for (const auto &pair : properties) {
235 resource.setProperty(pair.first, pair.second);
236 }
237 Sink::Store::create(resource).template then<void>([]() {},
238 [](int errorCode, const QString &errorMessage) {
239 qWarning() << "Error while creating resource: " << errorMessage;
240 })
241 .exec();
242 return newIdentifier;
243 }
244 return identifier;
245}
246
247void AccountSettings::saveImapResource()
248{
249 mImapIdentifier = saveResource<Sink::ApplicationDomain::ImapResource>(mAccountIdentifier, mImapIdentifier, {
250 {"server", mImapServer},
251 {"username", mImapUsername},
252 {"password", mImapPassword},
253 });
254}
255
256void AccountSettings::saveMaildirResource()
257{
258 mMaildirIdentifier = saveResource<Sink::ApplicationDomain::MaildirResource>(mAccountIdentifier, mMaildirIdentifier, {
259 {"path", mPath},
260 });
261}
262
263void AccountSettings::saveMailtransportResource()
264{
265 mMailtransportIdentifier = saveResource<Sink::ApplicationDomain::MailtransportResource>(mAccountIdentifier, mMailtransportIdentifier, {
266 {"server", mSmtpServer},
267 {"username", mSmtpUsername},
268 {"password", mSmtpPassword},
269 });
270}
271
272void AccountSettings::saveIdentity()
273{
274 if (!mIdentityIdentifier.isEmpty()) {
275 Sink::ApplicationDomain::Identity identity(mMailtransportIdentifier);
276 identity.setProperty("username", mUsername);
277 identity.setProperty("address", mEmailAddress);
278 Sink::Store::modify(identity).then<void>([](){}, [](int errorCode, const QString &errorMessage) {
279 qWarning() << "Error while modifying identity: " << errorMessage;
280 })
281 .exec();
282 } else {
283 auto identity = Sink::ApplicationDomain::ApplicationDomainType::createEntity<Sink::ApplicationDomain::Identity>();
284 mIdentityIdentifier = identity.identifier();
285 identity.setProperty("account", mAccountIdentifier);
286 identity.setProperty("username", mUsername);
287 identity.setProperty("address", mEmailAddress);
288 Sink::Store::create(identity).then<void>([]() {},
289 [](int errorCode, const QString &errorMessage) {
290 qWarning() << "Error while creating identity: " << errorMessage;
291 })
292 .exec();
293 }
294}
295
296void AccountSettings::removeResource(const QByteArray &identifier)
297{
298 if (identifier.isEmpty()) {
299 qWarning() << "We're missing an identifier";
300 } else {
301 Sink::ApplicationDomain::SinkResource resource("", identifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create());
302 Sink::Store::remove(resource).template then<void>([]() {},
303 [](int errorCode, const QString &errorMessage) {
304 qWarning() << "Error while removing resource: " << errorMessage;
305 })
306 .exec();
307 }
308}
309
310void AccountSettings::removeAccount()
311{
312 if (mAccountIdentifier.isEmpty()) {
313 qWarning() << "We're missing an identifier";
314 } else {
315 Sink::ApplicationDomain::SinkAccount account("", mAccountIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create());
316 Sink::Store::remove(account).then<void>([]() {},
317 [](int errorCode, const QString &errorMessage) {
318 qWarning() << "Error while removing account: " << errorMessage;
319 })
320 .exec();
321 }
322}
323
324void AccountSettings::removeIdentity()
325{
326 if (mIdentityIdentifier.isEmpty()) {
327 qWarning() << "We're missing an identifier";
328 } else {
329 Sink::ApplicationDomain::Identity identity("", mIdentityIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create());
330 Sink::Store::remove(identity).then<void>([]() {},
331 [](int errorCode, const QString &errorMessage) {
332 qWarning() << "Error while removing identity: " << errorMessage;
333 })
334 .exec();
335 }
336}
337
diff --git a/framework/domain/settings/accountsettings.h b/framework/domain/settings/accountsettings.h
new file mode 100644
index 00000000..08215a32
--- /dev/null
+++ b/framework/domain/settings/accountsettings.h
@@ -0,0 +1,110 @@
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 <QObject>
22#include <QValidator>
23
24class AccountSettings : public QObject
25{
26 Q_OBJECT
27 Q_PROPERTY(QByteArray accountIdentifier READ accountIdentifier WRITE setAccountIdentifier)
28 Q_PROPERTY(QString icon MEMBER mIcon NOTIFY changed)
29 Q_PROPERTY(QString accountName MEMBER mName NOTIFY changed)
30
31 Q_PROPERTY(QString userName MEMBER mUsername NOTIFY identityChanged)
32 Q_PROPERTY(QString emailAddress MEMBER mEmailAddress NOTIFY identityChanged)
33
34 Q_PROPERTY(QString imapServer MEMBER mImapServer NOTIFY imapResourceChanged)
35 Q_PROPERTY(QValidator* imapServerValidator READ imapServerValidator CONSTANT)
36 Q_PROPERTY(QString imapUsername MEMBER mImapUsername NOTIFY imapResourceChanged)
37 Q_PROPERTY(QString imapPassword MEMBER mImapPassword NOTIFY imapResourceChanged)
38
39 Q_PROPERTY(QString smtpServer MEMBER mSmtpServer NOTIFY smtpResourceChanged)
40 Q_PROPERTY(QValidator* smtpServerValidator READ smtpServerValidator CONSTANT)
41 Q_PROPERTY(QString smtpUsername MEMBER mSmtpUsername NOTIFY smtpResourceChanged)
42 Q_PROPERTY(QString smtpPassword MEMBER mSmtpPassword NOTIFY smtpResourceChanged)
43
44 Q_PROPERTY(QUrl path READ path WRITE setPath NOTIFY pathChanged)
45 Q_PROPERTY(QValidator* pathValidator READ pathValidator CONSTANT)
46
47public:
48 AccountSettings(QObject *parent = 0);
49
50 void setAccountIdentifier(const QByteArray &);
51 QByteArray accountIdentifier() const;
52
53 void setPath(const QUrl &);
54 QUrl path() const;
55
56 virtual QValidator *imapServerValidator() const;
57 virtual QValidator *smtpServerValidator() const;
58 virtual QValidator *pathValidator() const;
59
60 Q_INVOKABLE virtual void load() = 0;
61 Q_INVOKABLE virtual void save() = 0;
62 Q_INVOKABLE virtual void remove() = 0;
63
64signals:
65 void imapResourceChanged();
66 void smtpResourceChanged();
67 void identityChanged();
68 void pathChanged();
69 void changed();
70
71protected:
72 void saveAccount();
73 void saveImapResource();
74 void saveMaildirResource();
75 void saveMailtransportResource();
76 void saveIdentity();
77
78 void loadAccount();
79 void loadImapResource();
80 void loadMaildirResource();
81 void loadMailtransportResource();
82 void loadIdentity();
83
84 void removeAccount();
85 void removeResource(const QByteArray &identifier);
86
87 void removeIdentity();
88
89 QByteArray mAccountIdentifier;
90 QString mIcon;
91 QString mName;
92
93 QByteArray mImapIdentifier;
94 QString mImapServer;
95 QString mImapUsername;
96 QString mImapPassword;
97
98 QByteArray mMaildirIdentifier;
99 QString mPath;
100
101 QByteArray mMailtransportIdentifier;
102 QString mSmtpServer;
103 QString mSmtpUsername;
104 QString mSmtpPassword;
105
106 QByteArray mIdentityIdentifier;
107 QString mUsername;
108 QString mEmailAddress;
109};
110