diff options
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/maildir/maildirsettings.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/accounts/maildir/maildirsettings.cpp b/accounts/maildir/maildirsettings.cpp index 96b75a1e..c66f9729 100644 --- a/accounts/maildir/maildirsettings.cpp +++ b/accounts/maildir/maildirsettings.cpp | |||
@@ -57,7 +57,7 @@ void MaildirSettings::setAccountIdentifier(const QByteArray &id) | |||
57 | emit changed(); | 57 | emit changed(); |
58 | }).exec(); | 58 | }).exec(); |
59 | 59 | ||
60 | Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::PropertyFilter("account", QVariant::fromValue(id)) + Sink::Query::PropertyFilter("type", QString("org.kde.maildir"))) | 60 | Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter("storage")) |
61 | .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) { | 61 | .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) { |
62 | mIdentifier = resource.identifier(); | 62 | mIdentifier = resource.identifier(); |
63 | auto path = resource.getProperty("path").toString(); | 63 | auto path = resource.getProperty("path").toString(); |
@@ -70,7 +70,7 @@ void MaildirSettings::setAccountIdentifier(const QByteArray &id) | |||
70 | qWarning() << "Failed to find the maildir resource: " << errorMessage; | 70 | qWarning() << "Failed to find the maildir resource: " << errorMessage; |
71 | }).exec(); | 71 | }).exec(); |
72 | 72 | ||
73 | Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::PropertyFilter("account", QVariant::fromValue(id)) + Sink::Query::PropertyFilter("type", QString("org.kde.mailtransport"))) | 73 | Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter("transport")) |
74 | .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) { | 74 | .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) { |
75 | mMailtransportIdentifier = resource.identifier(); | 75 | mMailtransportIdentifier = resource.identifier(); |
76 | mSmtpServer = resource.getProperty("server").toString(); | 76 | mSmtpServer = resource.getProperty("server").toString(); |
@@ -83,7 +83,7 @@ void MaildirSettings::setAccountIdentifier(const QByteArray &id) | |||
83 | }).exec(); | 83 | }).exec(); |
84 | 84 | ||
85 | //FIXME this assumes that we only ever have one identity per account | 85 | //FIXME this assumes that we only ever have one identity per account |
86 | Sink::Store::fetchOne<Sink::ApplicationDomain::Identity>(Sink::Query::PropertyFilter("account", QVariant::fromValue(id))) | 86 | Sink::Store::fetchOne<Sink::ApplicationDomain::Identity>(Sink::Query::AccountFilter(id)) |
87 | .then<void, Sink::ApplicationDomain::Identity>([this](const Sink::ApplicationDomain::Identity &identity) { | 87 | .then<void, Sink::ApplicationDomain::Identity>([this](const Sink::ApplicationDomain::Identity &identity) { |
88 | mIdentityIdentifier = identity.identifier(); | 88 | mIdentityIdentifier = identity.identifier(); |
89 | mUsername = identity.getProperty("username").toString(); | 89 | mUsername = identity.getProperty("username").toString(); |
@@ -176,11 +176,9 @@ void MaildirSettings::save() | |||
176 | }) | 176 | }) |
177 | .exec(); | 177 | .exec(); |
178 | } else { | 178 | } else { |
179 | auto resource = Sink::ApplicationDomain::ApplicationDomainType::createEntity<Sink::ApplicationDomain::SinkResource>(); | 179 | auto resource = Sink::ApplicationDomain::MaildirResource::create(mAccountIdentifier); |
180 | mIdentifier = resource.identifier(); | ||
181 | resource.setProperty("path", property("path")); | 180 | resource.setProperty("path", property("path")); |
182 | resource.setProperty("type", "org.kde.maildir"); | 181 | mIdentifier = resource.identifier(); |
183 | resource.setProperty("account", mAccountIdentifier); | ||
184 | Sink::Store::create(resource).then<void>([]() {}, | 182 | Sink::Store::create(resource).then<void>([]() {}, |
185 | [](int errorCode, const QString &errorMessage) { | 183 | [](int errorCode, const QString &errorMessage) { |
186 | qWarning() << "Error while creating resource: " << errorMessage; | 184 | qWarning() << "Error while creating resource: " << errorMessage; |
@@ -198,10 +196,8 @@ void MaildirSettings::save() | |||
198 | }) | 196 | }) |
199 | .exec(); | 197 | .exec(); |
200 | } else { | 198 | } else { |
201 | auto resource = Sink::ApplicationDomain::ApplicationDomainType::createEntity<Sink::ApplicationDomain::SinkResource>(); | 199 | auto resource = Sink::ApplicationDomain::MailtransportResource::create(mAccountIdentifier); |
202 | mMailtransportIdentifier = resource.identifier(); | 200 | mMailtransportIdentifier = resource.identifier(); |
203 | resource.setProperty("type", "org.kde.mailtransport"); | ||
204 | resource.setProperty("account", mAccountIdentifier); | ||
205 | resource.setProperty("server", mSmtpServer); | 201 | resource.setProperty("server", mSmtpServer); |
206 | resource.setProperty("username", mSmtpUsername); | 202 | resource.setProperty("username", mSmtpUsername); |
207 | resource.setProperty("password", mSmtpPassword); | 203 | resource.setProperty("password", mSmtpPassword); |