diff options
Diffstat (limited to 'framework/domain/settings/accountsettings.cpp')
-rw-r--r-- | framework/domain/settings/accountsettings.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/framework/domain/settings/accountsettings.cpp b/framework/domain/settings/accountsettings.cpp index 635aef6e..ea798a73 100644 --- a/framework/domain/settings/accountsettings.cpp +++ b/framework/domain/settings/accountsettings.cpp | |||
@@ -134,9 +134,9 @@ void AccountSettings::saveAccount() | |||
134 | qDebug() << "Saving account " << mAccountIdentifier << mMailtransportIdentifier; | 134 | qDebug() << "Saving account " << mAccountIdentifier << mMailtransportIdentifier; |
135 | Q_ASSERT(!mAccountIdentifier.isEmpty()); | 135 | Q_ASSERT(!mAccountIdentifier.isEmpty()); |
136 | SinkAccount account(mAccountIdentifier); | 136 | SinkAccount account(mAccountIdentifier); |
137 | account.setProperty("type", "imap"); | 137 | account.setAccountType("imap"); |
138 | account.setProperty("name", mName); | 138 | account.setName(mName); |
139 | account.setProperty("icon", mIcon); | 139 | account.setIcon(mIcon); |
140 | Q_ASSERT(!account.identifier().isEmpty()); | 140 | Q_ASSERT(!account.identifier().isEmpty()); |
141 | Store::modify(account) | 141 | Store::modify(account) |
142 | .onError([](const KAsync::Error &error) { | 142 | .onError([](const KAsync::Error &error) { |
@@ -148,17 +148,17 @@ void AccountSettings::saveAccount() | |||
148 | void AccountSettings::loadAccount() | 148 | void AccountSettings::loadAccount() |
149 | { | 149 | { |
150 | Q_ASSERT(!mAccountIdentifier.isEmpty()); | 150 | Q_ASSERT(!mAccountIdentifier.isEmpty()); |
151 | Store::fetchOne<SinkAccount>(Query::IdentityFilter(mAccountIdentifier)) | 151 | Store::fetchOne<SinkAccount>(Query().filter(mAccountIdentifier)) |
152 | .syncThen<void, SinkAccount>([this](const SinkAccount &account) { | 152 | .syncThen<void, SinkAccount>([this](const SinkAccount &account) { |
153 | mIcon = account.getProperty("icon").toString(); | 153 | mIcon = account.getIcon(); |
154 | mName = account.getProperty("name").toString(); | 154 | mName = account.getName(); |
155 | emit changed(); | 155 | emit changed(); |
156 | }).exec(); | 156 | }).exec(); |
157 | } | 157 | } |
158 | 158 | ||
159 | void AccountSettings::loadImapResource() | 159 | void AccountSettings::loadImapResource() |
160 | { | 160 | { |
161 | Store::fetchOne<SinkResource>(Query().filter(SinkAccount(mAccountIdentifier)).containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::storage)) | 161 | Store::fetchOne<SinkResource>(Query().filter<SinkResource::Account>(mAccountIdentifier).containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::storage)) |
162 | .syncThen<void, SinkResource>([this](const SinkResource &resource) { | 162 | .syncThen<void, SinkResource>([this](const SinkResource &resource) { |
163 | mImapIdentifier = resource.identifier(); | 163 | mImapIdentifier = resource.identifier(); |
164 | mImapServer = resource.getProperty("server").toString(); | 164 | mImapServer = resource.getProperty("server").toString(); |
@@ -172,7 +172,7 @@ void AccountSettings::loadImapResource() | |||
172 | 172 | ||
173 | void AccountSettings::loadMaildirResource() | 173 | void AccountSettings::loadMaildirResource() |
174 | { | 174 | { |
175 | Store::fetchOne<SinkResource>(Query().filter(SinkAccount(mAccountIdentifier)).containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::storage)) | 175 | Store::fetchOne<SinkResource>(Query().filter<SinkResource::Account>(mAccountIdentifier).containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::storage)) |
176 | .syncThen<void, SinkResource>([this](const SinkResource &resource) { | 176 | .syncThen<void, SinkResource>([this](const SinkResource &resource) { |
177 | mMaildirIdentifier = resource.identifier(); | 177 | mMaildirIdentifier = resource.identifier(); |
178 | auto path = resource.getProperty("path").toString(); | 178 | auto path = resource.getProperty("path").toString(); |
@@ -187,7 +187,7 @@ void AccountSettings::loadMaildirResource() | |||
187 | 187 | ||
188 | void AccountSettings::loadMailtransportResource() | 188 | void AccountSettings::loadMailtransportResource() |
189 | { | 189 | { |
190 | Store::fetchOne<SinkResource>(Query().filter(SinkAccount(mAccountIdentifier)).containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::transport)) | 190 | Store::fetchOne<SinkResource>(Query().filter<SinkResource::Account>(mAccountIdentifier).containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::transport)) |
191 | .syncThen<void, SinkResource>([this](const SinkResource &resource) { | 191 | .syncThen<void, SinkResource>([this](const SinkResource &resource) { |
192 | mMailtransportIdentifier = resource.identifier(); | 192 | mMailtransportIdentifier = resource.identifier(); |
193 | mSmtpServer = resource.getProperty("server").toString(); | 193 | mSmtpServer = resource.getProperty("server").toString(); |
@@ -202,7 +202,7 @@ void AccountSettings::loadMailtransportResource() | |||
202 | void AccountSettings::loadIdentity() | 202 | void AccountSettings::loadIdentity() |
203 | { | 203 | { |
204 | //FIXME this assumes that we only ever have one identity per account | 204 | //FIXME this assumes that we only ever have one identity per account |
205 | Store::fetchOne<Identity>(Query().filter(SinkAccount(mAccountIdentifier))) | 205 | Store::fetchOne<Identity>(Query().filter<Identity::Account>(mAccountIdentifier)) |
206 | .syncThen<void, Identity>([this](const Identity &identity) { | 206 | .syncThen<void, Identity>([this](const Identity &identity) { |
207 | mIdentityIdentifier = identity.identifier(); | 207 | mIdentityIdentifier = identity.identifier(); |
208 | mUsername = identity.getProperty("username").toString(); | 208 | mUsername = identity.getProperty("username").toString(); |
@@ -283,7 +283,7 @@ void AccountSettings::saveIdentity() | |||
283 | } else { | 283 | } else { |
284 | auto identity = ApplicationDomainType::createEntity<Identity>(); | 284 | auto identity = ApplicationDomainType::createEntity<Identity>(); |
285 | mIdentityIdentifier = identity.identifier(); | 285 | mIdentityIdentifier = identity.identifier(); |
286 | identity.setProperty("account", mAccountIdentifier); | 286 | identity.setAccount(mAccountIdentifier); |
287 | identity.setProperty("username", mUsername); | 287 | identity.setProperty("username", mUsername); |
288 | identity.setProperty("address", mEmailAddress); | 288 | identity.setProperty("address", mEmailAddress); |
289 | Store::create(identity) | 289 | Store::create(identity) |
@@ -299,7 +299,7 @@ void AccountSettings::removeResource(const QByteArray &identifier) | |||
299 | if (identifier.isEmpty()) { | 299 | if (identifier.isEmpty()) { |
300 | qWarning() << "We're missing an identifier"; | 300 | qWarning() << "We're missing an identifier"; |
301 | } else { | 301 | } else { |
302 | SinkResource resource("", identifier, 0, QSharedPointer<MemoryBufferAdaptor>::create()); | 302 | SinkResource resource(identifier); |
303 | Store::remove(resource) | 303 | Store::remove(resource) |
304 | .onError([](const KAsync::Error &error) { | 304 | .onError([](const KAsync::Error &error) { |
305 | qWarning() << "Error while removing resource: " << error.errorMessage; | 305 | qWarning() << "Error while removing resource: " << error.errorMessage; |
@@ -313,7 +313,7 @@ void AccountSettings::removeAccount() | |||
313 | if (mAccountIdentifier.isEmpty()) { | 313 | if (mAccountIdentifier.isEmpty()) { |
314 | qWarning() << "We're missing an identifier"; | 314 | qWarning() << "We're missing an identifier"; |
315 | } else { | 315 | } else { |
316 | SinkAccount account("", mAccountIdentifier, 0, QSharedPointer<MemoryBufferAdaptor>::create()); | 316 | SinkAccount account(mAccountIdentifier); |
317 | Store::remove(account) | 317 | Store::remove(account) |
318 | .onError([](const KAsync::Error &error) { | 318 | .onError([](const KAsync::Error &error) { |
319 | qWarning() << "Error while removing account: " << error.errorMessage; | 319 | qWarning() << "Error while removing account: " << error.errorMessage; |
@@ -327,7 +327,7 @@ void AccountSettings::removeIdentity() | |||
327 | if (mIdentityIdentifier.isEmpty()) { | 327 | if (mIdentityIdentifier.isEmpty()) { |
328 | qWarning() << "We're missing an identifier"; | 328 | qWarning() << "We're missing an identifier"; |
329 | } else { | 329 | } else { |
330 | Identity identity("", mIdentityIdentifier, 0, QSharedPointer<MemoryBufferAdaptor>::create()); | 330 | Identity identity(mIdentityIdentifier); |
331 | Store::remove(identity) | 331 | Store::remove(identity) |
332 | .onError([](const KAsync::Error &error) { | 332 | .onError([](const KAsync::Error &error) { |
333 | qWarning() << "Error while removing identity: " << error.errorMessage; | 333 | qWarning() << "Error while removing identity: " << error.errorMessage; |