diff options
Diffstat (limited to 'common/clientapi.cpp')
-rw-r--r-- | common/clientapi.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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<void> Store::synchronize(const Akonadi2::Query &query) | |||
212 | .template then<void>([](){}); | 212 | .template then<void>([](){}); |
213 | } | 213 | } |
214 | 214 | ||
215 | KAsync::Job<void> Store::flushMessageQueue(const QByteArrayList &resourceIdentifier) | ||
216 | { | ||
217 | Trace() << "flushMessageQueue" << resourceIdentifier; | ||
218 | return KAsync::iterate(resourceIdentifier) | ||
219 | .template each<void, QByteArray>([](const QByteArray &resource, KAsync::Future<void> &future) { | ||
220 | Trace() << "Flushing message queue " << resource; | ||
221 | auto resourceAccess = QSharedPointer<Akonadi2::ResourceAccess>::create(resource); | ||
222 | resourceAccess->open(); | ||
223 | resourceAccess->synchronizeResource(false, true).then<void>([&future, resourceAccess]() { | ||
224 | future.setFinished(); | ||
225 | }).exec(); | ||
226 | }) | ||
227 | //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) | ||
228 | .template then<void>([](){}); | ||
229 | } | ||
230 | |||
215 | template <class DomainType> | 231 | template <class DomainType> |
216 | KAsync::Job<DomainType> Store::fetchOne(const Akonadi2::Query &query) | 232 | KAsync::Job<DomainType> Store::fetchOne(const Akonadi2::Query &query) |
217 | { | 233 | { |