From 7de95983b30ca414c04bb3f877b67c1b7e9d6fa0 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 14 Jan 2016 18:49:57 +0100 Subject: Introduced flushMessageQueue to get rid of the processAll/sync flags in the query object --- common/clientapi.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'common/clientapi.cpp') diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 2c25220..ffaa57b 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp @@ -212,6 +212,22 @@ KAsync::Job Store::synchronize(const Akonadi2::Query &query) .template then([](){}); } +KAsync::Job Store::flushMessageQueue(const QByteArrayList &resourceIdentifier) +{ + Trace() << "flushMessageQueue" << resourceIdentifier; + return KAsync::iterate(resourceIdentifier) + .template each([](const QByteArray &resource, KAsync::Future &future) { + Trace() << "Flushing message queue " << resource; + auto resourceAccess = QSharedPointer::create(resource); + resourceAccess->open(); + resourceAccess->synchronizeResource(false, true).then([&future, resourceAccess]() { + future.setFinished(); + }).exec(); + }) + //FIXME JOBAPI this is only required because we don't care about the return value of each (and each shouldn't even have a return value) + .template then([](){}); +} + template KAsync::Job Store::fetchOne(const Akonadi2::Query &query) { -- cgit v1.2.3