From 3e786efb2811f1e88485ffff50d1327d07f40892 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 29 Dec 2014 19:56:23 +0100 Subject: Turned synchronizeResource command into a job. --- common/resourceaccess.cpp | 8 ++++++-- common/resourceaccess.h | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 31b9e79..9fb0d4c 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp @@ -161,9 +161,13 @@ void ResourceAccess::sendCommand(int commandId, flatbuffers::FlatBufferBuilder & } } -void ResourceAccess::synchronizeResource(const std::function &resultHandler) +Async::Job ResourceAccess::synchronizeResource() { - sendCommand(Commands::SynchronizeCommand, resultHandler); + return Async::start([this](Async::Future &f) { + sendCommand(Commands::SynchronizeCommand, [&f]() { + f.setFinished(); + }); + }); } void ResourceAccess::open() diff --git a/common/resourceaccess.h b/common/resourceaccess.h index d79c993..d45ebde 100644 --- a/common/resourceaccess.h +++ b/common/resourceaccess.h @@ -25,6 +25,7 @@ #include #include +#include namespace Akonadi2 { @@ -43,7 +44,7 @@ public: //TODO use jobs void sendCommand(int commandId, const std::function &callback = std::function()); void sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb, const std::function &callback); - void synchronizeResource(const std::function &resultHandler); + Async::Job synchronizeResource(); public Q_SLOTS: void open(); -- cgit v1.2.3