diff options
-rw-r--r-- | common/changereplay.cpp | 2 | ||||
-rw-r--r-- | common/commandprocessor.cpp | 12 | ||||
-rw-r--r-- | common/messagequeue.cpp | 2 | ||||
-rw-r--r-- | common/pipeline.cpp | 2 | ||||
-rw-r--r-- | common/queryrunner.cpp | 4 | ||||
-rw-r--r-- | common/resourcecontrol.cpp | 4 | ||||
-rw-r--r-- | common/store.cpp | 2 | ||||
-rw-r--r-- | common/synchronizer.cpp | 8 | ||||
-rw-r--r-- | examples/imapresource/imapresource.cpp | 40 | ||||
-rw-r--r-- | examples/imapresource/imapserverproxy.cpp | 14 | ||||
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 4 | ||||
-rw-r--r-- | examples/mailtransportresource/mailtransportresource.cpp | 2 | ||||
-rw-r--r-- | sinksh/syntax_modules/sink_sync.cpp | 2 | ||||
-rw-r--r-- | tests/accountstest.cpp | 8 | ||||
-rw-r--r-- | tests/clientapitest.cpp | 2 | ||||
-rw-r--r-- | tests/mailsynctest.cpp | 28 | ||||
-rw-r--r-- | tests/mailtest.cpp | 18 | ||||
-rw-r--r-- | tests/mailthreadtest.cpp | 2 | ||||
-rw-r--r-- | tests/resourcecommunicationtest.cpp | 6 |
19 files changed, 81 insertions, 81 deletions
diff --git a/common/changereplay.cpp b/common/changereplay.cpp index 5d5afbb..224fb25 100644 --- a/common/changereplay.cpp +++ b/common/changereplay.cpp | |||
@@ -151,7 +151,7 @@ KAsync::Job<void> ChangeReplay::replayNextRevision() | |||
151 | return KAsync::value(KAsync::Break); | 151 | return KAsync::value(KAsync::Break); |
152 | }); | 152 | }); |
153 | })) | 153 | })) |
154 | .syncThen<void>([this, lastReplayedRevision]() { | 154 | .then([this, lastReplayedRevision]() { |
155 | recordReplayedRevision(*lastReplayedRevision); | 155 | recordReplayedRevision(*lastReplayedRevision); |
156 | mMainStoreTransaction.abort(); | 156 | mMainStoreTransaction.abort(); |
157 | if (ChangeReplay::allChangesReplayed()) { | 157 | if (ChangeReplay::allChangesReplayed()) { |
diff --git a/common/commandprocessor.cpp b/common/commandprocessor.cpp index 7cd4a5f..87a120b 100644 --- a/common/commandprocessor.cpp +++ b/common/commandprocessor.cpp | |||
@@ -169,7 +169,7 @@ void CommandProcessor::process() | |||
169 | } | 169 | } |
170 | mProcessingLock = true; | 170 | mProcessingLock = true; |
171 | auto job = processPipeline() | 171 | auto job = processPipeline() |
172 | .syncThen<void>([this]() { | 172 | .then([this]() { |
173 | mProcessingLock = false; | 173 | mProcessingLock = false; |
174 | if (messagesToProcessAvailable()) { | 174 | if (messagesToProcessAvailable()) { |
175 | process(); | 175 | process(); |
@@ -193,10 +193,10 @@ KAsync::Job<qint64> CommandProcessor::processQueuedCommand(const Sink::QueuedCom | |||
193 | case Sink::Commands::InspectionCommand: | 193 | case Sink::Commands::InspectionCommand: |
194 | Q_ASSERT(mInspector); | 194 | Q_ASSERT(mInspector); |
195 | return mInspector->processCommand(data, size) | 195 | return mInspector->processCommand(data, size) |
196 | .syncThen<qint64>([]() { return -1; }); | 196 | .then(KAsync::value<qint64>(-1)); |
197 | case Sink::Commands::FlushCommand: | 197 | case Sink::Commands::FlushCommand: |
198 | return flush(data, size) | 198 | return flush(data, size) |
199 | .syncThen<qint64>([]() { return -1; }); | 199 | .then(KAsync::value<qint64>(-1)); |
200 | default: | 200 | default: |
201 | return KAsync::error<qint64>(-1, "Unhandled command"); | 201 | return KAsync::error<qint64>(-1, "Unhandled command"); |
202 | } | 202 | } |
@@ -234,7 +234,7 @@ KAsync::Job<void> CommandProcessor::processQueue(MessageQueue *queue) | |||
234 | [this, time](const QByteArray &data) -> KAsync::Job<void> { | 234 | [this, time](const QByteArray &data) -> KAsync::Job<void> { |
235 | time->start(); | 235 | time->start(); |
236 | return processQueuedCommand(data) | 236 | return processQueuedCommand(data) |
237 | .syncThen<void, qint64>([this, time](qint64 createdRevision) { | 237 | .then([this, time](qint64 createdRevision) { |
238 | SinkTraceCtx(mLogCtx) << "Created revision " << createdRevision << ". Processing took: " << Log::TraceTime(time->elapsed()); | 238 | SinkTraceCtx(mLogCtx) << "Created revision " << createdRevision << ". Processing took: " << Log::TraceTime(time->elapsed()); |
239 | }); | 239 | }); |
240 | }) | 240 | }) |
@@ -251,7 +251,7 @@ KAsync::Job<void> CommandProcessor::processQueue(MessageQueue *queue) | |||
251 | } | 251 | } |
252 | }); | 252 | }); |
253 | })) | 253 | })) |
254 | .syncThen<void>([this](const KAsync::Error &) { mPipeline->commit(); }); | 254 | .then([this](const KAsync::Error &) { mPipeline->commit(); }); |
255 | } | 255 | } |
256 | 256 | ||
257 | KAsync::Job<void> CommandProcessor::processPipeline() | 257 | KAsync::Job<void> CommandProcessor::processPipeline() |
@@ -273,7 +273,7 @@ KAsync::Job<void> CommandProcessor::processPipeline() | |||
273 | 273 | ||
274 | auto queue = it->next(); | 274 | auto queue = it->next(); |
275 | return processQueue(queue) | 275 | return processQueue(queue) |
276 | .syncThen<KAsync::ControlFlowFlag>([this, time, it]() { | 276 | .then([this, time, it]() { |
277 | SinkTraceCtx(mLogCtx) << "Queue processed." << Log::TraceTime(time->elapsed()); | 277 | SinkTraceCtx(mLogCtx) << "Queue processed." << Log::TraceTime(time->elapsed()); |
278 | if (it->hasNext()) { | 278 | if (it->hasNext()) { |
279 | return KAsync::Continue; | 279 | return KAsync::Continue; |
diff --git a/common/messagequeue.cpp b/common/messagequeue.cpp index 0fcbf99..6e79d89 100644 --- a/common/messagequeue.cpp +++ b/common/messagequeue.cpp | |||
@@ -108,7 +108,7 @@ KAsync::Job<void> MessageQueue::dequeueBatch(int maxBatchSize, const std::functi | |||
108 | 108 | ||
109 | // Trace() << "Waiting on " << waitCondition.size() << " results"; | 109 | // Trace() << "Waiting on " << waitCondition.size() << " results"; |
110 | KAsync::waitForCompletion(waitCondition) | 110 | KAsync::waitForCompletion(waitCondition) |
111 | .syncThen<void>([this, resultCount, &future]() { | 111 | .then([this, resultCount, &future]() { |
112 | processRemovals(); | 112 | processRemovals(); |
113 | if (*resultCount == 0) { | 113 | if (*resultCount == 0) { |
114 | future.setFinished(); | 114 | future.setFinished(); |
diff --git a/common/pipeline.cpp b/common/pipeline.cpp index 4cb5f21..32f6454 100644 --- a/common/pipeline.cpp +++ b/common/pipeline.cpp | |||
@@ -279,7 +279,7 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size) | |||
279 | 279 | ||
280 | SinkTraceCtx(d->logCtx) << "Moving entity to new resource " << newEntity.identifier() << newEntity.resourceInstanceIdentifier() << targetResource; | 280 | SinkTraceCtx(d->logCtx) << "Moving entity to new resource " << newEntity.identifier() << newEntity.resourceInstanceIdentifier() << targetResource; |
281 | auto job = TypeHelper<CreateHelper>{bufferType}.operator()<KAsync::Job<void>, ApplicationDomain::ApplicationDomainType&>(newEntity); | 281 | auto job = TypeHelper<CreateHelper>{bufferType}.operator()<KAsync::Job<void>, ApplicationDomain::ApplicationDomainType&>(newEntity); |
282 | job = job.syncThen<void>([this, current, isMove, targetResource, bufferType](const KAsync::Error &error) { | 282 | job = job.then([this, current, isMove, targetResource, bufferType](const KAsync::Error &error) { |
283 | if (!error) { | 283 | if (!error) { |
284 | SinkTraceCtx(d->logCtx) << "Move of " << current.identifier() << "was successfull"; | 284 | SinkTraceCtx(d->logCtx) << "Move of " << current.identifier() << "was successfull"; |
285 | if (isMove) { | 285 | if (isMove) { |
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp index f1e21f4..6730894 100644 --- a/common/queryrunner.cpp +++ b/common/queryrunner.cpp | |||
@@ -94,7 +94,7 @@ QueryRunner<DomainType>::QueryRunner(const Sink::Query &query, const Sink::Resou | |||
94 | const auto newRevisionAndReplayedEntities = worker.executeInitialQuery(query, parent, *resultProvider, offset, batchSize); | 94 | const auto newRevisionAndReplayedEntities = worker.executeInitialQuery(query, parent, *resultProvider, offset, batchSize); |
95 | return newRevisionAndReplayedEntities; | 95 | return newRevisionAndReplayedEntities; |
96 | }) | 96 | }) |
97 | .template syncThen<void, ReplayResult>([this, parentId, query, parent, resultProvider, guardPtr](const ReplayResult &newRevisionAndReplayedEntities) { | 97 | .template then([this, parentId, query, parent, resultProvider, guardPtr](const ReplayResult &newRevisionAndReplayedEntities) { |
98 | if (!guardPtr) { | 98 | if (!guardPtr) { |
99 | qWarning() << "The parent object is already gone"; | 99 | qWarning() << "The parent object is already gone"; |
100 | return; | 100 | return; |
@@ -124,7 +124,7 @@ QueryRunner<DomainType>::QueryRunner(const Sink::Query &query, const Sink::Resou | |||
124 | const auto newRevisionAndReplayedEntities = worker.executeIncrementalQuery(query, *resultProvider); | 124 | const auto newRevisionAndReplayedEntities = worker.executeIncrementalQuery(query, *resultProvider); |
125 | return newRevisionAndReplayedEntities; | 125 | return newRevisionAndReplayedEntities; |
126 | }) | 126 | }) |
127 | .template syncThen<void, ReplayResult>([query, this, resultProvider, guardPtr](const ReplayResult &newRevisionAndReplayedEntities) { | 127 | .template then([query, this, resultProvider, guardPtr](const ReplayResult &newRevisionAndReplayedEntities) { |
128 | if (!guardPtr) { | 128 | if (!guardPtr) { |
129 | qWarning() << "The parent object is already gone"; | 129 | qWarning() << "The parent object is already gone"; |
130 | return; | 130 | return; |
diff --git a/common/resourcecontrol.cpp b/common/resourcecontrol.cpp index c1fbf06..b24c902 100644 --- a/common/resourcecontrol.cpp +++ b/common/resourcecontrol.cpp | |||
@@ -64,7 +64,7 @@ KAsync::Job<void> ResourceControl::shutdown(const QByteArray &identifier) | |||
64 | future.setFinished(); | 64 | future.setFinished(); |
65 | } | 65 | } |
66 | }); | 66 | }); |
67 | }).syncThen<void>([time] { | 67 | }).then([time] { |
68 | SinkTrace() << "Shutdown complete." << Log::TraceTime(time->elapsed()); | 68 | SinkTrace() << "Shutdown complete." << Log::TraceTime(time->elapsed()); |
69 | }); | 69 | }); |
70 | }); | 70 | }); |
@@ -77,7 +77,7 @@ KAsync::Job<void> ResourceControl::start(const QByteArray &identifier) | |||
77 | time->start(); | 77 | time->start(); |
78 | auto resourceAccess = ResourceAccessFactory::instance().getAccess(identifier, ResourceConfig::getResourceType(identifier)); | 78 | auto resourceAccess = ResourceAccessFactory::instance().getAccess(identifier, ResourceConfig::getResourceType(identifier)); |
79 | resourceAccess->open(); | 79 | resourceAccess->open(); |
80 | return resourceAccess->sendCommand(Sink::Commands::PingCommand).addToContext(resourceAccess).syncThen<void>([time]() { SinkTrace() << "Start complete." << Log::TraceTime(time->elapsed()); }); | 80 | return resourceAccess->sendCommand(Sink::Commands::PingCommand).addToContext(resourceAccess).then([time]() { SinkTrace() << "Start complete." << Log::TraceTime(time->elapsed()); }); |
81 | } | 81 | } |
82 | 82 | ||
83 | KAsync::Job<void> ResourceControl::flushMessageQueue(const QByteArrayList &resourceIdentifier) | 83 | KAsync::Job<void> ResourceControl::flushMessageQueue(const QByteArrayList &resourceIdentifier) |
diff --git a/common/store.cpp b/common/store.cpp index 38445e5..b4ef2b7 100644 --- a/common/store.cpp +++ b/common/store.cpp | |||
@@ -263,7 +263,7 @@ KAsync::Job<void> Store::removeDataFromDisk(const QByteArray &identifier) | |||
263 | future.setFinished(); | 263 | future.setFinished(); |
264 | } | 264 | } |
265 | }) | 265 | }) |
266 | .syncThen<void>([time]() { | 266 | .then([time]() { |
267 | SinkTrace() << "Remove from disk complete." << Log::TraceTime(time->elapsed()); | 267 | SinkTrace() << "Remove from disk complete." << Log::TraceTime(time->elapsed()); |
268 | }); | 268 | }); |
269 | } | 269 | } |
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index a4e64c9..bb1a3f4 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -286,7 +286,7 @@ KAsync::Job<void> Synchronizer::processSyncQueue() | |||
286 | while (!mSyncRequestQueue.isEmpty()) { | 286 | while (!mSyncRequestQueue.isEmpty()) { |
287 | auto request = mSyncRequestQueue.takeFirst(); | 287 | auto request = mSyncRequestQueue.takeFirst(); |
288 | if (request.requestType == Synchronizer::SyncRequest::Synchronization) { | 288 | if (request.requestType == Synchronizer::SyncRequest::Synchronization) { |
289 | job = job.syncThen<void>([this, request] { | 289 | job = job.then([this, request] { |
290 | Sink::Notification n; | 290 | Sink::Notification n; |
291 | n.id = request.requestId; | 291 | n.id = request.requestId; |
292 | n.type = Notification::Status; | 292 | n.type = Notification::Status; |
@@ -294,7 +294,7 @@ KAsync::Job<void> Synchronizer::processSyncQueue() | |||
294 | n.code = ApplicationDomain::BusyStatus; | 294 | n.code = ApplicationDomain::BusyStatus; |
295 | emit notify(n); | 295 | emit notify(n); |
296 | SinkLogCtx(mLogCtx) << "Synchronizing " << request.query; | 296 | SinkLogCtx(mLogCtx) << "Synchronizing " << request.query; |
297 | }).then(synchronizeWithSource(request.query)).syncThen<void>([this] { | 297 | }).then(synchronizeWithSource(request.query)).then([this] { |
298 | //Commit after every request, so implementations only have to commit more if they add a lot of data. | 298 | //Commit after every request, so implementations only have to commit more if they add a lot of data. |
299 | commit(); | 299 | commit(); |
300 | }).then<void>([this, request](const KAsync::Error &error) { | 300 | }).then<void>([this, request](const KAsync::Error &error) { |
@@ -431,7 +431,7 @@ KAsync::Job<void> Synchronizer::replay(const QByteArray &type, const QByteArray | |||
431 | job = replay(mail, operation, oldRemoteId, modifiedProperties); | 431 | job = replay(mail, operation, oldRemoteId, modifiedProperties); |
432 | } | 432 | } |
433 | 433 | ||
434 | return job.syncThen<void, QByteArray>([this, operation, type, uid, oldRemoteId](const QByteArray &remoteId) { | 434 | return job.then([this, operation, type, uid, oldRemoteId](const QByteArray &remoteId) { |
435 | if (operation == Sink::Operation_Creation) { | 435 | if (operation == Sink::Operation_Creation) { |
436 | SinkTrace() << "Replayed creation with remote id: " << remoteId; | 436 | SinkTrace() << "Replayed creation with remote id: " << remoteId; |
437 | if (remoteId.isEmpty()) { | 437 | if (remoteId.isEmpty()) { |
@@ -453,7 +453,7 @@ KAsync::Job<void> Synchronizer::replay(const QByteArray &type, const QByteArray | |||
453 | SinkError() << "Unkown operation" << operation; | 453 | SinkError() << "Unkown operation" << operation; |
454 | } | 454 | } |
455 | }) | 455 | }) |
456 | .syncThen<void>([this](const KAsync::Error &error) { | 456 | .then([this](const KAsync::Error &error) { |
457 | if (error) { | 457 | if (error) { |
458 | SinkWarning() << "Failed to replay change: " << error.errorMessage; | 458 | SinkWarning() << "Failed to replay change: " << error.errorMessage; |
459 | } | 459 | } |
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index a204f4c..c608b04 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -116,7 +116,7 @@ public: | |||
116 | if (!parentFolderRid.isEmpty()) { | 116 | if (!parentFolderRid.isEmpty()) { |
117 | folder.setParent(syncStore().resolveRemoteId(ENTITY_TYPE_FOLDER, parentFolderRid)); | 117 | folder.setParent(syncStore().resolveRemoteId(ENTITY_TYPE_FOLDER, parentFolderRid)); |
118 | } | 118 | } |
119 | createOrModify(ApplicationDomain::getTypeName<ApplicationDomain::Folder>, remoteId, folder); | 119 | createOrModify(ApplicationDomain::getTypeName<ApplicationDomain::Folder>(), remoteId, folder); |
120 | return remoteId; | 120 | return remoteId; |
121 | } | 121 | } |
122 | 122 | ||
@@ -244,14 +244,14 @@ public: | |||
244 | 244 | ||
245 | modify(ENTITY_TYPE_MAIL, remoteId, mail); | 245 | modify(ENTITY_TYPE_MAIL, remoteId, mail); |
246 | }) | 246 | }) |
247 | .syncThen<void, SelectResult>([=](const SelectResult &selectResult) { | 247 | .then([=](const SelectResult &selectResult) { |
248 | SinkLogCtx(mLogCtx) << "Flags updated. New changedsince value: " << selectResult.highestModSequence; | 248 | SinkLogCtx(mLogCtx) << "Flags updated. New changedsince value: " << selectResult.highestModSequence; |
249 | syncStore().writeValue(folderRemoteId, "changedsince", QByteArray::number(selectResult.highestModSequence)); | 249 | syncStore().writeValue(folderRemoteId, "changedsince", QByteArray::number(selectResult.highestModSequence)); |
250 | }); | 250 | }); |
251 | } else { | 251 | } else { |
252 | //We hit this path on initial sync and simply record the current changedsince value | 252 | //We hit this path on initial sync and simply record the current changedsince value |
253 | return imap->select(imap->mailboxFromFolder(folder)) | 253 | return imap->select(imap->mailboxFromFolder(folder)) |
254 | .syncThen<void, SelectResult>([=](const SelectResult &selectResult) { | 254 | .then([=](const SelectResult &selectResult) { |
255 | SinkLogCtx(mLogCtx) << "No flags to update. New changedsince value: " << selectResult.highestModSequence; | 255 | SinkLogCtx(mLogCtx) << "No flags to update. New changedsince value: " << selectResult.highestModSequence; |
256 | syncStore().writeValue(folderRemoteId, "changedsince", QByteArray::number(selectResult.highestModSequence)); | 256 | syncStore().writeValue(folderRemoteId, "changedsince", QByteArray::number(selectResult.highestModSequence)); |
257 | }); | 257 | }); |
@@ -303,7 +303,7 @@ public: | |||
303 | commit(); | 303 | commit(); |
304 | } | 304 | } |
305 | }) | 305 | }) |
306 | .syncThen<void>([=]() { | 306 | .then([=]() { |
307 | SinkLogCtx(mLogCtx) << "UIDMAX: " << *maxUid << folder.path(); | 307 | SinkLogCtx(mLogCtx) << "UIDMAX: " << *maxUid << folder.path(); |
308 | if (*maxUid > 0) { | 308 | if (*maxUid > 0) { |
309 | syncStore().writeValue(folderRemoteId, "uidnext", QByteArray::number(*maxUid)); | 309 | syncStore().writeValue(folderRemoteId, "uidnext", QByteArray::number(*maxUid)); |
@@ -345,7 +345,7 @@ public: | |||
345 | } | 345 | } |
346 | }); | 346 | }); |
347 | }) | 347 | }) |
348 | .syncThen<void>([=]() { | 348 | .then([=]() { |
349 | SinkLogCtx(mLogCtx) << "Headers fetched: " << folder.path(); | 349 | SinkLogCtx(mLogCtx) << "Headers fetched: " << folder.path(); |
350 | syncStore().writeValue(folderRemoteId, "headersFetched", "true"); | 350 | syncStore().writeValue(folderRemoteId, "headersFetched", "true"); |
351 | commit(); | 351 | commit(); |
@@ -359,7 +359,7 @@ public: | |||
359 | //Finally remove messages that are no longer existing on the server. | 359 | //Finally remove messages that are no longer existing on the server. |
360 | .then<void>([=]() { | 360 | .then<void>([=]() { |
361 | //TODO do an examine with QRESYNC and remove VANISHED messages if supported instead | 361 | //TODO do an examine with QRESYNC and remove VANISHED messages if supported instead |
362 | return imap->fetchUids(folder).syncThen<void, QVector<qint64>>([=](const QVector<qint64> &uids) { | 362 | return imap->fetchUids(folder).then([=](const QVector<qint64> &uids) { |
363 | SinkTraceCtx(mLogCtx) << "Syncing removals: " << folder.path(); | 363 | SinkTraceCtx(mLogCtx) << "Syncing removals: " << folder.path(); |
364 | synchronizeRemovals(folderRemoteId, uids.toList().toSet()); | 364 | synchronizeRemovals(folderRemoteId, uids.toList().toSet()); |
365 | commit(); | 365 | commit(); |
@@ -425,7 +425,7 @@ public: | |||
425 | .onError([](const KAsync::Error &error) { | 425 | .onError([](const KAsync::Error &error) { |
426 | SinkWarning() << "Folder list sync failed."; | 426 | SinkWarning() << "Folder list sync failed."; |
427 | }) | 427 | }) |
428 | .syncThen<QVector<Folder>>([folderList]() { return *folderList; } ); | 428 | .then([folderList]() { return *folderList; } ); |
429 | } | 429 | } |
430 | } | 430 | } |
431 | 431 | ||
@@ -439,7 +439,7 @@ public: | |||
439 | return imap->fetchFolders([folderList](const Folder &folder) { | 439 | return imap->fetchFolders([folderList](const Folder &folder) { |
440 | *folderList << folder; | 440 | *folderList << folder; |
441 | }) | 441 | }) |
442 | .syncThen<void>([this, folderList]() { | 442 | .then([this, folderList]() { |
443 | synchronizeFolders(*folderList); | 443 | synchronizeFolders(*folderList); |
444 | }); | 444 | }); |
445 | }) | 445 | }) |
@@ -537,7 +537,7 @@ public: | |||
537 | QDateTime internalDate = mail.getDate(); | 537 | QDateTime internalDate = mail.getDate(); |
538 | job = login.then(imap->append(mailbox, content, flags, internalDate)) | 538 | job = login.then(imap->append(mailbox, content, flags, internalDate)) |
539 | .addToContext(imap) | 539 | .addToContext(imap) |
540 | .syncThen<QByteArray, qint64>([mail](qint64 uid) { | 540 | .then([mail](qint64 uid) { |
541 | const auto remoteId = assembleMailRid(mail, uid); | 541 | const auto remoteId = assembleMailRid(mail, uid); |
542 | SinkTrace() << "Finished creating a new mail: " << remoteId; | 542 | SinkTrace() << "Finished creating a new mail: " << remoteId; |
543 | return remoteId; | 543 | return remoteId; |
@@ -550,7 +550,7 @@ public: | |||
550 | KIMAP2::ImapSet set; | 550 | KIMAP2::ImapSet set; |
551 | set.add(uid); | 551 | set.add(uid); |
552 | job = login.then(imap->remove(mailbox, set)) | 552 | job = login.then(imap->remove(mailbox, set)) |
553 | .syncThen<QByteArray>([imap, oldRemoteId] { | 553 | .then([imap, oldRemoteId] { |
554 | SinkTrace() << "Finished removing a mail: " << oldRemoteId; | 554 | SinkTrace() << "Finished removing a mail: " << oldRemoteId; |
555 | return QByteArray(); | 555 | return QByteArray(); |
556 | }); | 556 | }); |
@@ -586,7 +586,7 @@ public: | |||
586 | job = login.then(imap->select(mailbox)) | 586 | job = login.then(imap->select(mailbox)) |
587 | .addToContext(imap) | 587 | .addToContext(imap) |
588 | .then(imap->storeFlags(set, flags)) | 588 | .then(imap->storeFlags(set, flags)) |
589 | .syncThen<QByteArray>([=] { | 589 | .then([=] { |
590 | SinkTrace() << "Finished modifying mail"; | 590 | SinkTrace() << "Finished modifying mail"; |
591 | return oldRemoteId; | 591 | return oldRemoteId; |
592 | }); | 592 | }); |
@@ -616,13 +616,13 @@ public: | |||
616 | SinkTrace() << "Creating a new folder: " << parentFolder << folder.getName(); | 616 | SinkTrace() << "Creating a new folder: " << parentFolder << folder.getName(); |
617 | auto rid = QSharedPointer<QByteArray>::create(); | 617 | auto rid = QSharedPointer<QByteArray>::create(); |
618 | auto createFolder = login.then<QString>(imap->createSubfolder(parentFolder, folder.getName())) | 618 | auto createFolder = login.then<QString>(imap->createSubfolder(parentFolder, folder.getName())) |
619 | .syncThen<void, QString>([imap, rid](const QString &createdFolder) { | 619 | .then([imap, rid](const QString &createdFolder) { |
620 | SinkTrace() << "Finished creating a new folder: " << createdFolder; | 620 | SinkTrace() << "Finished creating a new folder: " << createdFolder; |
621 | *rid = createdFolder.toUtf8(); | 621 | *rid = createdFolder.toUtf8(); |
622 | }); | 622 | }); |
623 | if (folder.getSpecialPurpose().isEmpty()) { | 623 | if (folder.getSpecialPurpose().isEmpty()) { |
624 | return createFolder | 624 | return createFolder |
625 | .syncThen<QByteArray>([rid](){ | 625 | .then([rid](){ |
626 | return *rid; | 626 | return *rid; |
627 | }); | 627 | }); |
628 | } else { //We try to merge special purpose folders first | 628 | } else { //We try to merge special purpose folders first |
@@ -644,13 +644,13 @@ public: | |||
644 | } | 644 | } |
645 | SinkTrace() << "No match found for merging, creating a new folder"; | 645 | SinkTrace() << "No match found for merging, creating a new folder"; |
646 | return imap->createSubfolder(parentFolder, folder.getName()) | 646 | return imap->createSubfolder(parentFolder, folder.getName()) |
647 | .syncThen<void, QString>([imap, rid](const QString &createdFolder) { | 647 | .then([imap, rid](const QString &createdFolder) { |
648 | SinkTrace() << "Finished creating a new folder: " << createdFolder; | 648 | SinkTrace() << "Finished creating a new folder: " << createdFolder; |
649 | *rid = createdFolder.toUtf8(); | 649 | *rid = createdFolder.toUtf8(); |
650 | }); | 650 | }); |
651 | 651 | ||
652 | }) | 652 | }) |
653 | .syncThen<QByteArray>([rid](){ | 653 | .then([rid](){ |
654 | return *rid; | 654 | return *rid; |
655 | }); | 655 | }); |
656 | return mergeJob; | 656 | return mergeJob; |
@@ -658,7 +658,7 @@ public: | |||
658 | } else if (operation == Sink::Operation_Removal) { | 658 | } else if (operation == Sink::Operation_Removal) { |
659 | SinkTrace() << "Removing a folder: " << oldRemoteId; | 659 | SinkTrace() << "Removing a folder: " << oldRemoteId; |
660 | return login.then<void>(imap->remove(oldRemoteId)) | 660 | return login.then<void>(imap->remove(oldRemoteId)) |
661 | .syncThen<QByteArray>([oldRemoteId, imap]() { | 661 | .then([oldRemoteId, imap]() { |
662 | SinkTrace() << "Finished removing a folder: " << oldRemoteId; | 662 | SinkTrace() << "Finished removing a folder: " << oldRemoteId; |
663 | return QByteArray(); | 663 | return QByteArray(); |
664 | }); | 664 | }); |
@@ -666,11 +666,11 @@ public: | |||
666 | SinkTrace() << "Renaming a folder: " << oldRemoteId << folder.getName(); | 666 | SinkTrace() << "Renaming a folder: " << oldRemoteId << folder.getName(); |
667 | auto rid = QSharedPointer<QByteArray>::create(); | 667 | auto rid = QSharedPointer<QByteArray>::create(); |
668 | return login.then<QString>(imap->renameSubfolder(oldRemoteId, folder.getName())) | 668 | return login.then<QString>(imap->renameSubfolder(oldRemoteId, folder.getName())) |
669 | .syncThen<void, QString>([imap, rid](const QString &createdFolder) { | 669 | .then([imap, rid](const QString &createdFolder) { |
670 | SinkTrace() << "Finished renaming a folder: " << createdFolder; | 670 | SinkTrace() << "Finished renaming a folder: " << createdFolder; |
671 | *rid = createdFolder.toUtf8(); | 671 | *rid = createdFolder.toUtf8(); |
672 | }) | 672 | }) |
673 | .syncThen<QByteArray>([rid](){ | 673 | .then([rid](){ |
674 | return *rid; | 674 | return *rid; |
675 | }); | 675 | }); |
676 | } | 676 | } |
@@ -731,7 +731,7 @@ protected: | |||
731 | SinkTrace() << "as:" << mUser; | 731 | SinkTrace() << "as:" << mUser; |
732 | auto inspectionJob = imap->login(mUser, mPassword) | 732 | auto inspectionJob = imap->login(mUser, mPassword) |
733 | .then<Imap::SelectResult>(imap->select(folderRemoteId)) | 733 | .then<Imap::SelectResult>(imap->select(folderRemoteId)) |
734 | .syncThen<void, Imap::SelectResult>([](Imap::SelectResult){}) | 734 | .then([](Imap::SelectResult){}) |
735 | .then<void>(imap->fetch(set, scope, [imap, messageByUid](const Imap::Message &message) { | 735 | .then<void>(imap->fetch(set, scope, [imap, messageByUid](const Imap::Message &message) { |
736 | messageByUid->insert(message.uid, message); | 736 | messageByUid->insert(message.uid, message); |
737 | })); | 737 | })); |
@@ -792,7 +792,7 @@ protected: | |||
792 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); | 792 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); |
793 | auto messageByUid = QSharedPointer<QHash<qint64, Imap::Message>>::create(); | 793 | auto messageByUid = QSharedPointer<QHash<qint64, Imap::Message>>::create(); |
794 | return imap->login(mUser, mPassword) | 794 | return imap->login(mUser, mPassword) |
795 | .then<void>(imap->select(remoteId).syncThen<void>([](){})) | 795 | .then<void>(imap->select(remoteId).then([](){})) |
796 | .then<void>(imap->fetch(set, scope, [=](const Imap::Message message) { | 796 | .then<void>(imap->fetch(set, scope, [=](const Imap::Message message) { |
797 | messageByUid->insert(message.uid, message); | 797 | messageByUid->insert(message.uid, message); |
798 | })) | 798 | })) |
diff --git a/examples/imapresource/imapserverproxy.cpp b/examples/imapresource/imapserverproxy.cpp index c16021e..a98483b 100644 --- a/examples/imapresource/imapserverproxy.cpp +++ b/examples/imapresource/imapserverproxy.cpp | |||
@@ -130,7 +130,7 @@ KAsync::Job<void> ImapServerProxy::login(const QString &username, const QString | |||
130 | }); | 130 | }); |
131 | auto namespaceJob = new KIMAP2::NamespaceJob(mSession); | 131 | auto namespaceJob = new KIMAP2::NamespaceJob(mSession); |
132 | 132 | ||
133 | return runJob(loginJob).then(runJob(capabilitiesJob)).syncThen<void>([this](){ | 133 | return runJob(loginJob).then(runJob(capabilitiesJob)).then([this](){ |
134 | SinkTrace() << "Supported capabilities: " << mCapabilities; | 134 | SinkTrace() << "Supported capabilities: " << mCapabilities; |
135 | QStringList requiredExtensions = QStringList() << "UIDPLUS" << "NAMESPACE"; | 135 | QStringList requiredExtensions = QStringList() << "UIDPLUS" << "NAMESPACE"; |
136 | for (const auto &requiredExtension : requiredExtensions) { | 136 | for (const auto &requiredExtension : requiredExtensions) { |
@@ -139,7 +139,7 @@ KAsync::Job<void> ImapServerProxy::login(const QString &username, const QString | |||
139 | //TODO fail the job | 139 | //TODO fail the job |
140 | } | 140 | } |
141 | } | 141 | } |
142 | }).then(runJob(namespaceJob)).syncThen<void>([this, namespaceJob] { | 142 | }).then(runJob(namespaceJob)).then([this, namespaceJob] { |
143 | for (const auto &ns :namespaceJob->personalNamespaces()) { | 143 | for (const auto &ns :namespaceJob->personalNamespaces()) { |
144 | mPersonalNamespaces << ns.name; | 144 | mPersonalNamespaces << ns.name; |
145 | mPersonalNamespaceSeparator = ns.separator; | 145 | mPersonalNamespaceSeparator = ns.separator; |
@@ -324,7 +324,7 @@ KAsync::Job<QVector<qint64>> ImapServerProxy::fetchHeaders(const QString &mailbo | |||
324 | 324 | ||
325 | list->append(result.uid); | 325 | list->append(result.uid); |
326 | }) | 326 | }) |
327 | .syncThen<QVector<qint64>>([list](){ | 327 | .then([list](){ |
328 | return *list; | 328 | return *list; |
329 | }); | 329 | }); |
330 | } | 330 | } |
@@ -378,7 +378,7 @@ KAsync::Job<QString> ImapServerProxy::createSubfolder(const QString &parentMailb | |||
378 | } | 378 | } |
379 | SinkTrace() << "Creating subfolder: " << *folder; | 379 | SinkTrace() << "Creating subfolder: " << *folder; |
380 | return create(*folder) | 380 | return create(*folder) |
381 | .syncThen<QString>([=]() { | 381 | .then([=]() { |
382 | return *folder; | 382 | return *folder; |
383 | }); | 383 | }); |
384 | }); | 384 | }); |
@@ -393,7 +393,7 @@ KAsync::Job<QString> ImapServerProxy::renameSubfolder(const QString &oldMailbox, | |||
393 | auto folder = QSharedPointer<QString>::create(parts.join(mPersonalNamespaceSeparator) + mPersonalNamespaceSeparator + newName); | 393 | auto folder = QSharedPointer<QString>::create(parts.join(mPersonalNamespaceSeparator) + mPersonalNamespaceSeparator + newName); |
394 | SinkTrace() << "Renaming subfolder: " << oldMailbox << *folder; | 394 | SinkTrace() << "Renaming subfolder: " << oldMailbox << *folder; |
395 | return rename(oldMailbox, *folder) | 395 | return rename(oldMailbox, *folder) |
396 | .syncThen<QString>([=]() { | 396 | .then([=]() { |
397 | return *folder; | 397 | return *folder; |
398 | }); | 398 | }); |
399 | }); | 399 | }); |
@@ -436,7 +436,7 @@ KAsync::Job<SelectResult> ImapServerProxy::fetchFlags(const Folder &folder, cons | |||
436 | scope.mode = KIMAP2::FetchJob::FetchScope::Flags; | 436 | scope.mode = KIMAP2::FetchJob::FetchScope::Flags; |
437 | scope.changedSince = changedsince; | 437 | scope.changedSince = changedsince; |
438 | 438 | ||
439 | return fetch(set, scope, callback).syncThen<SelectResult>([selectResult] { | 439 | return fetch(set, scope, callback).then([selectResult] { |
440 | return selectResult; | 440 | return selectResult; |
441 | }); | 441 | }); |
442 | }); | 442 | }); |
@@ -503,7 +503,7 @@ KAsync::Job<void> ImapServerProxy::fetchMessages(const Folder &folder, const QVe | |||
503 | callback(message); | 503 | callback(message); |
504 | }); | 504 | }); |
505 | }) | 505 | }) |
506 | .syncThen<void>([time]() { | 506 | .then([time]() { |
507 | SinkTrace() << "The fetch took: " << Sink::Log::TraceTime(time->elapsed()); | 507 | SinkTrace() << "The fetch took: " << Sink::Log::TraceTime(time->elapsed()); |
508 | }); | 508 | }); |
509 | } | 509 | } |
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 6ddb5d2..3d299b4 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -369,11 +369,11 @@ public: | |||
369 | }); | 369 | }); |
370 | 370 | ||
371 | if (query.type() == ApplicationDomain::getTypeName<ApplicationDomain::Folder>()) { | 371 | if (query.type() == ApplicationDomain::getTypeName<ApplicationDomain::Folder>()) { |
372 | job = job.syncThen<void>([this] { | 372 | job = job.then([this] { |
373 | synchronizeFolders(); | 373 | synchronizeFolders(); |
374 | }); | 374 | }); |
375 | } else if (query.type() == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) { | 375 | } else if (query.type() == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) { |
376 | job = job.syncThen<void>([this, query] { | 376 | job = job.then([this, query] { |
377 | QStringList folders; | 377 | QStringList folders; |
378 | if (query.hasFilter<ApplicationDomain::Mail::Folder>()) { | 378 | if (query.hasFilter<ApplicationDomain::Mail::Folder>()) { |
379 | auto folderFilter = query.getFilter<ApplicationDomain::Mail::Folder>(); | 379 | auto folderFilter = query.getFilter<ApplicationDomain::Mail::Folder>(); |
diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index e475139..a4622f3 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp | |||
@@ -118,7 +118,7 @@ public: | |||
118 | }); | 118 | }); |
119 | }); | 119 | }); |
120 | } | 120 | } |
121 | job = job.syncThen<void>([&future](const KAsync::Error &) { | 121 | job = job.then([&future](const KAsync::Error &) { |
122 | future.setFinished(); | 122 | future.setFinished(); |
123 | }); | 123 | }); |
124 | job.exec(); | 124 | job.exec(); |
diff --git a/sinksh/syntax_modules/sink_sync.cpp b/sinksh/syntax_modules/sink_sync.cpp index f90f055..250cd75 100644 --- a/sinksh/syntax_modules/sink_sync.cpp +++ b/sinksh/syntax_modules/sink_sync.cpp | |||
@@ -54,7 +54,7 @@ bool sync(const QStringList &args, State &state) | |||
54 | QTimer::singleShot(0, [query, state]() { | 54 | QTimer::singleShot(0, [query, state]() { |
55 | Sink::Store::synchronize(query) | 55 | Sink::Store::synchronize(query) |
56 | .then(Sink::ResourceControl::flushMessageQueue(query.getResourceFilter().ids)) | 56 | .then(Sink::ResourceControl::flushMessageQueue(query.getResourceFilter().ids)) |
57 | .syncThen<void>([state](const KAsync::Error &error) { | 57 | .then([state](const KAsync::Error &error) { |
58 | if (error) { | 58 | if (error) { |
59 | state.printLine("Synchronization failed!"); | 59 | state.printLine("Synchronization failed!"); |
60 | } else { | 60 | } else { |
diff --git a/tests/accountstest.cpp b/tests/accountstest.cpp index cce5c7b..0ab18ef 100644 --- a/tests/accountstest.cpp +++ b/tests/accountstest.cpp | |||
@@ -39,7 +39,7 @@ private slots: | |||
39 | account.setIcon(accountIcon); | 39 | account.setIcon(accountIcon); |
40 | Store::create(account).exec().waitForFinished(); | 40 | Store::create(account).exec().waitForFinished(); |
41 | 41 | ||
42 | Store::fetchAll<SinkAccount>(Query()).syncThen<void, QList<SinkAccount::Ptr>>([&](const QList<SinkAccount::Ptr> &accounts) { | 42 | Store::fetchAll<SinkAccount>(Query()).then([&](const QList<SinkAccount::Ptr> &accounts) { |
43 | QCOMPARE(accounts.size(), 1); | 43 | QCOMPARE(accounts.size(), 1); |
44 | auto account = accounts.first(); | 44 | auto account = accounts.first(); |
45 | QCOMPARE(account->getAccountType(), QString("maildir")); | 45 | QCOMPARE(account->getAccountType(), QString("maildir")); |
@@ -60,7 +60,7 @@ private slots: | |||
60 | Store::create(resource).exec().waitForFinished(); | 60 | Store::create(resource).exec().waitForFinished(); |
61 | 61 | ||
62 | 62 | ||
63 | Store::fetchAll<SinkResource>(Query()).syncThen<void, QList<SinkResource::Ptr>>([&](const QList<SinkResource::Ptr> &resources) { | 63 | Store::fetchAll<SinkResource>(Query()).then([&](const QList<SinkResource::Ptr> &resources) { |
64 | QCOMPARE(resources.size(), 1); | 64 | QCOMPARE(resources.size(), 1); |
65 | auto resource = resources.first(); | 65 | auto resource = resources.first(); |
66 | QCOMPARE(resource->getResourceType(), QByteArray("sink.mailtransport")); | 66 | QCOMPARE(resource->getResourceType(), QByteArray("sink.mailtransport")); |
@@ -74,7 +74,7 @@ private slots: | |||
74 | identity.setAccount(account.identifier()); | 74 | identity.setAccount(account.identifier()); |
75 | Store::create(identity).exec().waitForFinished(); | 75 | Store::create(identity).exec().waitForFinished(); |
76 | 76 | ||
77 | Store::fetchAll<Identity>(Query()).syncThen<void, QList<Identity::Ptr>>([&](const QList<Identity::Ptr> &identities) { | 77 | Store::fetchAll<Identity>(Query()).then([&](const QList<Identity::Ptr> &identities) { |
78 | QCOMPARE(identities.size(), 1); | 78 | QCOMPARE(identities.size(), 1); |
79 | QCOMPARE(identities.first()->getName(), smtpServer); | 79 | QCOMPARE(identities.first()->getName(), smtpServer); |
80 | QCOMPARE(identities.first()->getAddress(), smtpUsername); | 80 | QCOMPARE(identities.first()->getAddress(), smtpUsername); |
@@ -85,7 +85,7 @@ private slots: | |||
85 | 85 | ||
86 | Store::remove(resource).exec().waitForFinished(); | 86 | Store::remove(resource).exec().waitForFinished(); |
87 | 87 | ||
88 | Store::fetchAll<SinkResource>(Query()).syncThen<void, QList<SinkResource::Ptr>>([](const QList<SinkResource::Ptr> &resources) { | 88 | Store::fetchAll<SinkResource>(Query()).then([](const QList<SinkResource::Ptr> &resources) { |
89 | QCOMPARE(resources.size(), 0); | 89 | QCOMPARE(resources.size(), 0); |
90 | }) | 90 | }) |
91 | .exec().waitForFinished(); | 91 | .exec().waitForFinished(); |
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 544b981..8fc76df 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -276,7 +276,7 @@ private slots: | |||
276 | 276 | ||
277 | bool gotValue = false; | 277 | bool gotValue = false; |
278 | auto result = Sink::Store::fetchOne<Sink::ApplicationDomain::Event>(query) | 278 | auto result = Sink::Store::fetchOne<Sink::ApplicationDomain::Event>(query) |
279 | .syncThen<void, Sink::ApplicationDomain::Event>([&gotValue](const Sink::ApplicationDomain::Event &event) { gotValue = true; }) | 279 | .then([&gotValue](const Sink::ApplicationDomain::Event &event) { gotValue = true; }) |
280 | .exec(); | 280 | .exec(); |
281 | result.waitForFinished(); | 281 | result.waitForFinished(); |
282 | QVERIFY(!result.errorCode()); | 282 | QVERIFY(!result.errorCode()); |
diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 96a2daa..d3b0fe3 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp | |||
@@ -68,7 +68,7 @@ void MailSyncTest::testListFolders() | |||
68 | //First figure out how many folders we have by default | 68 | //First figure out how many folders we have by default |
69 | { | 69 | { |
70 | auto job = Store::fetchAll<Folder>(Query()) | 70 | auto job = Store::fetchAll<Folder>(Query()) |
71 | .syncThen<void, QList<Folder::Ptr>>([&](const QList<Folder::Ptr> &folders) { | 71 | .then([&](const QList<Folder::Ptr> &folders) { |
72 | QStringList names; | 72 | QStringList names; |
73 | for (const auto &folder : folders) { | 73 | for (const auto &folder : folders) { |
74 | names << folder->getName(); | 74 | names << folder->getName(); |
@@ -87,7 +87,7 @@ void MailSyncTest::testListFolders() | |||
87 | VERIFYEXEC(Store::synchronize(query)); | 87 | VERIFYEXEC(Store::synchronize(query)); |
88 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 88 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
89 | 89 | ||
90 | auto job = Store::fetchAll<Folder>(query).syncThen<void, QList<Folder::Ptr>>([=](const QList<Folder::Ptr> &folders) { | 90 | auto job = Store::fetchAll<Folder>(query).then([=](const QList<Folder::Ptr> &folders) { |
91 | QStringList names; | 91 | QStringList names; |
92 | QHash<QByteArray, QByteArray> specialPurposeFolders; | 92 | QHash<QByteArray, QByteArray> specialPurposeFolders; |
93 | for (const auto &folder : folders) { | 93 | for (const auto &folder : folders) { |
@@ -128,7 +128,7 @@ void MailSyncTest::testListNewFolder() | |||
128 | VERIFYEXEC(Store::synchronize(query)); | 128 | VERIFYEXEC(Store::synchronize(query)); |
129 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 129 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
130 | 130 | ||
131 | auto job = Store::fetchAll<Folder>(query).syncThen<void, QList<Folder::Ptr>>([](const QList<Folder::Ptr> &folders) { | 131 | auto job = Store::fetchAll<Folder>(query).then([](const QList<Folder::Ptr> &folders) { |
132 | QStringList names; | 132 | QStringList names; |
133 | for (const auto &folder : folders) { | 133 | for (const auto &folder : folders) { |
134 | names << folder->getName(); | 134 | names << folder->getName(); |
@@ -153,7 +153,7 @@ void MailSyncTest::testListRemovedFolder() | |||
153 | VERIFYEXEC(Store::synchronize(query)); | 153 | VERIFYEXEC(Store::synchronize(query)); |
154 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 154 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
155 | 155 | ||
156 | auto job = Store::fetchAll<Folder>(query).syncThen<void, QList<Folder::Ptr>>([](const QList<Folder::Ptr> &folders) { | 156 | auto job = Store::fetchAll<Folder>(query).then([](const QList<Folder::Ptr> &folders) { |
157 | QStringList names; | 157 | QStringList names; |
158 | for (const auto &folder : folders) { | 158 | for (const auto &folder : folders) { |
159 | names << folder->getName(); | 159 | names << folder->getName(); |
@@ -178,7 +178,7 @@ void MailSyncTest::testListFolderHierarchy() | |||
178 | VERIFYEXEC(Store::synchronize(query)); | 178 | VERIFYEXEC(Store::synchronize(query)); |
179 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 179 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
180 | 180 | ||
181 | auto job = Store::fetchAll<Folder>(query).syncThen<void, QList<Folder::Ptr>>([=](const QList<Folder::Ptr> &folders) { | 181 | auto job = Store::fetchAll<Folder>(query).then([=](const QList<Folder::Ptr> &folders) { |
182 | QHash<QString, Folder::Ptr> map; | 182 | QHash<QString, Folder::Ptr> map; |
183 | for (const auto &folder : folders) { | 183 | for (const auto &folder : folders) { |
184 | map.insert(folder->getName(), folder); | 184 | map.insert(folder->getName(), folder); |
@@ -221,7 +221,7 @@ void MailSyncTest::testListNewSubFolder() | |||
221 | VERIFYEXEC(Store::synchronize(query)); | 221 | VERIFYEXEC(Store::synchronize(query)); |
222 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 222 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
223 | 223 | ||
224 | auto job = Store::fetchAll<Folder>(query).syncThen<void, QList<Folder::Ptr>>([](const QList<Folder::Ptr> &folders) { | 224 | auto job = Store::fetchAll<Folder>(query).then([](const QList<Folder::Ptr> &folders) { |
225 | QStringList names; | 225 | QStringList names; |
226 | for (const auto &folder : folders) { | 226 | for (const auto &folder : folders) { |
227 | names << folder->getName(); | 227 | names << folder->getName(); |
@@ -249,7 +249,7 @@ void MailSyncTest::testListRemovedSubFolder() | |||
249 | VERIFYEXEC(Store::synchronize(query)); | 249 | VERIFYEXEC(Store::synchronize(query)); |
250 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 250 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
251 | 251 | ||
252 | auto job = Store::fetchAll<Folder>(query).syncThen<void, QList<Folder::Ptr>>([](const QList<Folder::Ptr> &folders) { | 252 | auto job = Store::fetchAll<Folder>(query).then([](const QList<Folder::Ptr> &folders) { |
253 | QStringList names; | 253 | QStringList names; |
254 | for (const auto &folder : folders) { | 254 | for (const auto &folder : folders) { |
255 | names << folder->getName(); | 255 | names << folder->getName(); |
@@ -269,7 +269,7 @@ void MailSyncTest::testListMails() | |||
269 | VERIFYEXEC(Store::synchronize(query)); | 269 | VERIFYEXEC(Store::synchronize(query)); |
270 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 270 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
271 | 271 | ||
272 | auto job = Store::fetchAll<Mail>(query).syncThen<void, QList<Mail::Ptr>>([](const QList<Mail::Ptr> &mails) { | 272 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { |
273 | QCOMPARE(mails.size(), 1); | 273 | QCOMPARE(mails.size(), 1); |
274 | QVERIFY(mails.first()->getSubject().startsWith(QString("[Nepomuk] Jenkins build is still unstable"))); | 274 | QVERIFY(mails.first()->getSubject().startsWith(QString("[Nepomuk] Jenkins build is still unstable"))); |
275 | const auto data = mails.first()->getMimeMessage(); | 275 | const auto data = mails.first()->getMimeMessage(); |
@@ -298,7 +298,7 @@ void MailSyncTest::testResyncMails() | |||
298 | VERIFYEXEC(Store::synchronize(query)); | 298 | VERIFYEXEC(Store::synchronize(query)); |
299 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 299 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
300 | 300 | ||
301 | auto job = Store::fetchAll<Mail>(query).syncThen<void, QList<Mail::Ptr>>([](const QList<Mail::Ptr> &mails) { | 301 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { |
302 | QCOMPARE(mails.size(), 1); | 302 | QCOMPARE(mails.size(), 1); |
303 | }); | 303 | }); |
304 | VERIFYEXEC(job); | 304 | VERIFYEXEC(job); |
@@ -323,7 +323,7 @@ void MailSyncTest::testFetchNewRemovedMessages() | |||
323 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 323 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
324 | 324 | ||
325 | { | 325 | { |
326 | auto job = Store::fetchAll<Mail>(query).syncThen<void, QList<Mail::Ptr>>([](const QList<Mail::Ptr> &mails) { | 326 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { |
327 | QCOMPARE(mails.size(), 2); | 327 | QCOMPARE(mails.size(), 2); |
328 | }); | 328 | }); |
329 | VERIFYEXEC(job); | 329 | VERIFYEXEC(job); |
@@ -335,7 +335,7 @@ void MailSyncTest::testFetchNewRemovedMessages() | |||
335 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 335 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
336 | 336 | ||
337 | { | 337 | { |
338 | auto job = Store::fetchAll<Mail>(query).syncThen<void, QList<Mail::Ptr>>([](const QList<Mail::Ptr> &mails) { | 338 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { |
339 | QCOMPARE(mails.size(), 1); | 339 | QCOMPARE(mails.size(), 1); |
340 | }); | 340 | }); |
341 | VERIFYEXEC(job); | 341 | VERIFYEXEC(job); |
@@ -358,7 +358,7 @@ void MailSyncTest::testFlagChange() | |||
358 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 358 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
359 | 359 | ||
360 | { | 360 | { |
361 | auto job = Store::fetchAll<Mail>(query).syncThen<void, QList<Mail::Ptr>>([](const QList<Mail::Ptr> &mails) { | 361 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { |
362 | QCOMPARE(mails.size(), 0); | 362 | QCOMPARE(mails.size(), 0); |
363 | }); | 363 | }); |
364 | VERIFYEXEC(job); | 364 | VERIFYEXEC(job); |
@@ -371,7 +371,7 @@ void MailSyncTest::testFlagChange() | |||
371 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 371 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
372 | 372 | ||
373 | { | 373 | { |
374 | auto job = Store::fetchAll<Mail>(query).syncThen<void, QList<Mail::Ptr>>([](const QList<Mail::Ptr> &mails) { | 374 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { |
375 | QCOMPARE(mails.size(), 1); | 375 | QCOMPARE(mails.size(), 1); |
376 | QVERIFY(mails.first()->getImportant()); | 376 | QVERIFY(mails.first()->getImportant()); |
377 | }); | 377 | }); |
@@ -387,7 +387,7 @@ void MailSyncTest::testSyncSingleFolder() | |||
387 | 387 | ||
388 | Folder::Ptr folder; | 388 | Folder::Ptr folder; |
389 | { | 389 | { |
390 | auto job = Store::fetchAll<Folder>(Sink::Query{}.resourceFilter(mResourceInstanceIdentifier).filter<Folder::Name>("test")).template syncThen<void, QList<Folder::Ptr>>([&](const QList<Folder::Ptr> &folders) { | 390 | auto job = Store::fetchAll<Folder>(Sink::Query{}.resourceFilter(mResourceInstanceIdentifier).filter<Folder::Name>("test")).template then([&](const QList<Folder::Ptr> &folders) { |
391 | QCOMPARE(folders.size(), 1); | 391 | QCOMPARE(folders.size(), 1); |
392 | folder = folders.first(); | 392 | folder = folders.first(); |
393 | }); | 393 | }); |
diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp index fe28cde..c51fc56 100644 --- a/tests/mailtest.cpp +++ b/tests/mailtest.cpp | |||
@@ -67,7 +67,7 @@ void MailTest::testCreateModifyDeleteFolder() | |||
67 | //First figure out how many folders we have by default | 67 | //First figure out how many folders we have by default |
68 | { | 68 | { |
69 | auto job = Store::fetchAll<Folder>(Query()) | 69 | auto job = Store::fetchAll<Folder>(Query()) |
70 | .syncThen<void, QList<Folder::Ptr>>([&](const QList<Folder::Ptr> &folders) { | 70 | .then([&](const QList<Folder::Ptr> &folders) { |
71 | baseCount = folders.size(); | 71 | baseCount = folders.size(); |
72 | }); | 72 | }); |
73 | VERIFYEXEC(job); | 73 | VERIFYEXEC(job); |
@@ -84,7 +84,7 @@ void MailTest::testCreateModifyDeleteFolder() | |||
84 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 84 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
85 | { | 85 | { |
86 | auto job = Store::fetchAll<Folder>(Query().request<Folder::Name>().request<Folder::Icon>()) | 86 | auto job = Store::fetchAll<Folder>(Query().request<Folder::Name>().request<Folder::Icon>()) |
87 | .syncThen<void, QList<Folder::Ptr>>([=](const QList<Folder::Ptr> &folders) { | 87 | .then([=](const QList<Folder::Ptr> &folders) { |
88 | QCOMPARE(folders.size(), baseCount + 1); | 88 | QCOMPARE(folders.size(), baseCount + 1); |
89 | QHash<QString, Folder::Ptr> foldersByName; | 89 | QHash<QString, Folder::Ptr> foldersByName; |
90 | for (const auto &folder : folders) { | 90 | for (const auto &folder : folders) { |
@@ -110,7 +110,7 @@ void MailTest::testCreateModifyDeleteFolder() | |||
110 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 110 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
111 | { | 111 | { |
112 | auto job = Store::fetchAll<Folder>(Query().request<Folder::Name>().request<Folder::Icon>()) | 112 | auto job = Store::fetchAll<Folder>(Query().request<Folder::Name>().request<Folder::Icon>()) |
113 | .syncThen<void, QList<Folder::Ptr>>([=](const QList<Folder::Ptr> &folders) { | 113 | .then([=](const QList<Folder::Ptr> &folders) { |
114 | QCOMPARE(folders.size(), baseCount + 1); | 114 | QCOMPARE(folders.size(), baseCount + 1); |
115 | QHash<QString, Folder::Ptr> foldersByName; | 115 | QHash<QString, Folder::Ptr> foldersByName; |
116 | for (const auto &folder : folders) { | 116 | for (const auto &folder : folders) { |
@@ -131,7 +131,7 @@ void MailTest::testCreateModifyDeleteFolder() | |||
131 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 131 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
132 | { | 132 | { |
133 | auto job = Store::fetchAll<Folder>(Query().request<Folder::Name>().request<Folder::Icon>()) | 133 | auto job = Store::fetchAll<Folder>(Query().request<Folder::Name>().request<Folder::Icon>()) |
134 | .syncThen<void, QList<Folder::Ptr>>([=](const QList<Folder::Ptr> &folders) { | 134 | .then([=](const QList<Folder::Ptr> &folders) { |
135 | QCOMPARE(folders.size(), baseCount); | 135 | QCOMPARE(folders.size(), baseCount); |
136 | }); | 136 | }); |
137 | VERIFYEXEC(job); | 137 | VERIFYEXEC(job); |
@@ -161,7 +161,7 @@ void MailTest::testCreateModifyDeleteMail() | |||
161 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 161 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
162 | { | 162 | { |
163 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>().request<Mail::MimeMessage>()) | 163 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>().request<Mail::MimeMessage>()) |
164 | .syncThen<void, QList<Mail::Ptr>>([=](const QList<Mail::Ptr> &mails) { | 164 | .then([=](const QList<Mail::Ptr> &mails) { |
165 | QCOMPARE(mails.size(), 1); | 165 | QCOMPARE(mails.size(), 1); |
166 | auto mail = *mails.first(); | 166 | auto mail = *mails.first(); |
167 | QCOMPARE(mail.getSubject(), subject); | 167 | QCOMPARE(mail.getSubject(), subject); |
@@ -190,7 +190,7 @@ void MailTest::testCreateModifyDeleteMail() | |||
190 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 190 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
191 | { | 191 | { |
192 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>().request<Mail::MimeMessage>()) | 192 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>().request<Mail::MimeMessage>()) |
193 | .syncThen<void, QList<Mail::Ptr>>([=](const QList<Mail::Ptr> &mails) { | 193 | .then([=](const QList<Mail::Ptr> &mails) { |
194 | QCOMPARE(mails.size(), 1); | 194 | QCOMPARE(mails.size(), 1); |
195 | auto mail = *mails.first(); | 195 | auto mail = *mails.first(); |
196 | QCOMPARE(mail.getSubject(), subject2); | 196 | QCOMPARE(mail.getSubject(), subject2); |
@@ -212,7 +212,7 @@ void MailTest::testCreateModifyDeleteMail() | |||
212 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 212 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
213 | { | 213 | { |
214 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>()) | 214 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>()) |
215 | .syncThen<void, QList<Mail::Ptr>>([=](const QList<Mail::Ptr> &mails) { | 215 | .then([=](const QList<Mail::Ptr> &mails) { |
216 | QCOMPARE(mails.size(), 0); | 216 | QCOMPARE(mails.size(), 0); |
217 | }); | 217 | }); |
218 | VERIFYEXEC(job); | 218 | VERIFYEXEC(job); |
@@ -248,7 +248,7 @@ void MailTest::testMoveMail() | |||
248 | Mail modifiedMail; | 248 | Mail modifiedMail; |
249 | { | 249 | { |
250 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>().request<Mail::MimeMessage>()) | 250 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>().request<Mail::MimeMessage>()) |
251 | .syncThen<void, QList<Mail::Ptr>>([=, &modifiedMail](const QList<Mail::Ptr> &mails) { | 251 | .then([=, &modifiedMail](const QList<Mail::Ptr> &mails) { |
252 | QCOMPARE(mails.size(), 1); | 252 | QCOMPARE(mails.size(), 1); |
253 | auto mail = *mails.first(); | 253 | auto mail = *mails.first(); |
254 | modifiedMail = mail; | 254 | modifiedMail = mail; |
@@ -267,7 +267,7 @@ void MailTest::testMoveMail() | |||
267 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 267 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
268 | { | 268 | { |
269 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>().request<Mail::MimeMessage>()) | 269 | auto job = Store::fetchAll<Mail>(Query().request<Mail::Folder>().request<Mail::Subject>().request<Mail::MimeMessage>()) |
270 | .syncThen<void, QList<Mail::Ptr>>([=](const QList<Mail::Ptr> &mails) { | 270 | .then([=](const QList<Mail::Ptr> &mails) { |
271 | QCOMPARE(mails.size(), 1); | 271 | QCOMPARE(mails.size(), 1); |
272 | auto mail = *mails.first(); | 272 | auto mail = *mails.first(); |
273 | QCOMPARE(mail.getFolder(), folder1.identifier()); | 273 | QCOMPARE(mail.getFolder(), folder1.identifier()); |
diff --git a/tests/mailthreadtest.cpp b/tests/mailthreadtest.cpp index 3684514..82f9331 100644 --- a/tests/mailthreadtest.cpp +++ b/tests/mailthreadtest.cpp | |||
@@ -179,7 +179,7 @@ void MailThreadTest::testIndexInMixedOrder() | |||
179 | /* VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); */ | 179 | /* VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); */ |
180 | /* { */ | 180 | /* { */ |
181 | /* auto job = Store::fetchAll<Mail>(Query::RequestedProperties(QByteArrayList() << Mail::Folder::name << Mail::Subject::name)) */ | 181 | /* auto job = Store::fetchAll<Mail>(Query::RequestedProperties(QByteArrayList() << Mail::Folder::name << Mail::Subject::name)) */ |
182 | /* .syncThen<void, QList<Mail::Ptr>>([=](const QList<Mail::Ptr> &mails) { */ | 182 | /* .then([=](const QList<Mail::Ptr> &mails) { */ |
183 | /* QCOMPARE(mails.size(), 0); */ | 183 | /* QCOMPARE(mails.size(), 0); */ |
184 | /* }); */ | 184 | /* }); */ |
185 | /* VERIFYEXEC(job); */ | 185 | /* VERIFYEXEC(job); */ |
diff --git a/tests/resourcecommunicationtest.cpp b/tests/resourcecommunicationtest.cpp index 201db53..7beafc7 100644 --- a/tests/resourcecommunicationtest.cpp +++ b/tests/resourcecommunicationtest.cpp | |||
@@ -51,7 +51,7 @@ private slots: | |||
51 | int errors = 0; | 51 | int errors = 0; |
52 | for (int i = 0; i < count; i++) { | 52 | for (int i = 0; i < count; i++) { |
53 | auto result = resourceAccess.sendCommand(Sink::Commands::PingCommand) | 53 | auto result = resourceAccess.sendCommand(Sink::Commands::PingCommand) |
54 | .syncThen<void>([&resourceAccess, &errors, &complete](const KAsync::Error &error) { | 54 | .then([&resourceAccess, &errors, &complete](const KAsync::Error &error) { |
55 | complete++; | 55 | complete++; |
56 | if (error) { | 56 | if (error) { |
57 | qWarning() << error.errorMessage; | 57 | qWarning() << error.errorMessage; |
@@ -77,7 +77,7 @@ private slots: | |||
77 | int errors = 0; | 77 | int errors = 0; |
78 | for (int i = 0; i < count; i++) { | 78 | for (int i = 0; i < count; i++) { |
79 | resourceAccess.sendCommand(Sink::Commands::PingCommand) | 79 | resourceAccess.sendCommand(Sink::Commands::PingCommand) |
80 | .syncThen<void>([&resourceAccess, &errors, &complete](const KAsync::Error &error) { | 80 | .then([&resourceAccess, &errors, &complete](const KAsync::Error &error) { |
81 | complete++; | 81 | complete++; |
82 | if (error) { | 82 | if (error) { |
83 | qWarning() << error.errorMessage; | 83 | qWarning() << error.errorMessage; |
@@ -104,7 +104,7 @@ private slots: | |||
104 | auto resourceAccess = Sink::ResourceAccessFactory::instance().getAccess(resourceIdentifier, ""); | 104 | auto resourceAccess = Sink::ResourceAccessFactory::instance().getAccess(resourceIdentifier, ""); |
105 | weakRef = resourceAccess.toWeakRef(); | 105 | weakRef = resourceAccess.toWeakRef(); |
106 | resourceAccess->open(); | 106 | resourceAccess->open(); |
107 | resourceAccess->sendCommand(Sink::Commands::PingCommand).syncThen<void>([resourceAccess]() { qDebug() << "Ping complete"; }).exec(); | 107 | resourceAccess->sendCommand(Sink::Commands::PingCommand).then([resourceAccess]() { qDebug() << "Ping complete"; }).exec(); |
108 | } | 108 | } |
109 | QVERIFY(weakRef.toStrongRef()); | 109 | QVERIFY(weakRef.toStrongRef()); |
110 | QTRY_VERIFY(!weakRef.toStrongRef()); | 110 | QTRY_VERIFY(!weakRef.toStrongRef()); |