diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2014-12-29 19:56:23 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-06 16:45:27 +0100 |
commit | 3e786efb2811f1e88485ffff50d1327d07f40892 (patch) | |
tree | bdcc7826c4799e168454d296e8d769897b6b7a1f /common | |
parent | e1c6979863b4994eabeb7ae35208472c234b24f6 (diff) | |
download | sink-3e786efb2811f1e88485ffff50d1327d07f40892.tar.gz sink-3e786efb2811f1e88485ffff50d1327d07f40892.zip |
Turned synchronizeResource command into a job.
Diffstat (limited to 'common')
-rw-r--r-- | common/resourceaccess.cpp | 8 | ||||
-rw-r--r-- | common/resourceaccess.h | 3 |
2 files changed, 8 insertions, 3 deletions
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 & | |||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | void ResourceAccess::synchronizeResource(const std::function<void()> &resultHandler) | 164 | Async::Job<void> ResourceAccess::synchronizeResource() |
165 | { | 165 | { |
166 | sendCommand(Commands::SynchronizeCommand, resultHandler); | 166 | return Async::start<void>([this](Async::Future<void> &f) { |
167 | sendCommand(Commands::SynchronizeCommand, [&f]() { | ||
168 | f.setFinished(); | ||
169 | }); | ||
170 | }); | ||
167 | } | 171 | } |
168 | 172 | ||
169 | void ResourceAccess::open() | 173 | 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 @@ | |||
25 | #include <QTimer> | 25 | #include <QTimer> |
26 | 26 | ||
27 | #include <flatbuffers/flatbuffers.h> | 27 | #include <flatbuffers/flatbuffers.h> |
28 | #include <async/src/async.h> | ||
28 | 29 | ||
29 | namespace Akonadi2 | 30 | namespace Akonadi2 |
30 | { | 31 | { |
@@ -43,7 +44,7 @@ public: | |||
43 | //TODO use jobs | 44 | //TODO use jobs |
44 | void sendCommand(int commandId, const std::function<void()> &callback = std::function<void()>()); | 45 | void sendCommand(int commandId, const std::function<void()> &callback = std::function<void()>()); |
45 | void sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb, const std::function<void()> &callback); | 46 | void sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb, const std::function<void()> &callback); |
46 | void synchronizeResource(const std::function<void()> &resultHandler); | 47 | Async::Job<void> synchronizeResource(); |
47 | 48 | ||
48 | public Q_SLOTS: | 49 | public Q_SLOTS: |
49 | void open(); | 50 | void open(); |