From b43c0cf97615957e097daef29ff8febc1ec884c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Fri, 15 May 2015 16:22:03 +0200 Subject: Adapt to KAsync namespace change --- common/genericresource.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'common/genericresource.cpp') diff --git a/common/genericresource.cpp b/common/genericresource.cpp index ea6413b..2394b80 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp @@ -61,33 +61,33 @@ private slots: }).exec(); } - Async::Job processQueuedCommand(const Akonadi2::QueuedCommand *queuedCommand) + KAsync::Job processQueuedCommand(const Akonadi2::QueuedCommand *queuedCommand) { Log() << "Processing command: " << Akonadi2::Commands::name(queuedCommand->commandId()); //Throw command into appropriate pipeline switch (queuedCommand->commandId()) { case Akonadi2::Commands::DeleteEntityCommand: //mPipeline->removedEntity - return Async::null(); + return KAsync::null(); case Akonadi2::Commands::ModifyEntityCommand: //mPipeline->modifiedEntity - return Async::null(); + return KAsync::null(); case Akonadi2::Commands::CreateEntityCommand: return mPipeline->newEntity(queuedCommand->command()->Data(), queuedCommand->command()->size()); default: - return Async::error(-1, "Unhandled command"); + return KAsync::error(-1, "Unhandled command"); } - return Async::null(); + return KAsync::null(); } //Process all messages of this queue - Async::Job processQueue(MessageQueue *queue) + KAsync::Job processQueue(MessageQueue *queue) { //TODO use something like: - //Async::foreach("pass iterator here").each("process value here").join(); - //Async::foreach("pass iterator here").parallel("process value here").join(); - return Async::dowhile( - [this, queue](Async::Future &future) { + //KAsync::foreach("pass iterator here").each("process value here").join(); + //KAsync::foreach("pass iterator here").parallel("process value here").join(); + return KAsync::dowhile( + [this, queue](KAsync::Future &future) { if (queue->isEmpty()) { future.setValue(false); future.setFinished(); @@ -133,13 +133,13 @@ private slots: ); } - Async::Job processPipeline() + KAsync::Job processPipeline() { //Go through all message queues auto it = QSharedPointer >::create(mCommandQueues); - return Async::dowhile( + return KAsync::dowhile( [it]() { return it->hasNext(); }, - [it, this](Async::Future &future) { + [it, this](KAsync::Future &future) { auto queue = it->next(); processQueue(queue).then([&future]() { Trace() << "Queue processed"; @@ -206,12 +206,12 @@ void GenericResource::processCommand(int commandId, const QByteArray &data, uint enqueueCommand(mUserQueue, commandId, data); } -Async::Job GenericResource::processAllMessages() +KAsync::Job GenericResource::processAllMessages() { //We have to wait for all items to be processed to ensure the synced items are available when a query gets executed. //TODO: report errors while processing sync? //TODO JOBAPI: A helper that waits for n events and then continues? - return Async::start([this](Async::Future &f) { + return KAsync::start([this](KAsync::Future &f) { if (mSynchronizerQueue.isEmpty()) { f.setFinished(); } else { @@ -219,7 +219,7 @@ Async::Job GenericResource::processAllMessages() f.setFinished(); }); } - }).then([this](Async::Future &f) { + }).then([this](KAsync::Future &f) { if (mUserQueue.isEmpty()) { f.setFinished(); } else { -- cgit v1.2.3