diff options
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r-- | common/synchronizer.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index ee7a7ba..cf50b0b 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -45,9 +45,10 @@ Synchronizer::~Synchronizer() | |||
45 | 45 | ||
46 | } | 46 | } |
47 | 47 | ||
48 | void Synchronizer::setup(const std::function<void(int commandId, const QByteArray &data)> &enqueueCommandCallback) | 48 | void Synchronizer::setup(const std::function<void(int commandId, const QByteArray &data)> &enqueueCommandCallback, MessageQueue &mq) |
49 | { | 49 | { |
50 | mEnqueue = enqueueCommandCallback; | 50 | mEnqueue = enqueueCommandCallback; |
51 | mMessageQueue = &mq; | ||
51 | } | 52 | } |
52 | 53 | ||
53 | void Synchronizer::enqueueCommand(int commandId, const QByteArray &data) | 54 | void Synchronizer::enqueueCommand(int commandId, const QByteArray &data) |
@@ -239,9 +240,11 @@ void Synchronizer::modify(const DomainType &entity) | |||
239 | KAsync::Job<void> Synchronizer::synchronize() | 240 | KAsync::Job<void> Synchronizer::synchronize() |
240 | { | 241 | { |
241 | Trace() << "Synchronizing"; | 242 | Trace() << "Synchronizing"; |
243 | mMessageQueue->startTransaction(); | ||
242 | return synchronizeWithSource().then<void>([this]() { | 244 | return synchronizeWithSource().then<void>([this]() { |
243 | mSyncStore.clear(); | 245 | mSyncStore.clear(); |
244 | mEntityStore.clear(); | 246 | mEntityStore.clear(); |
247 | mMessageQueue->commit(); | ||
245 | }); | 248 | }); |
246 | } | 249 | } |
247 | 250 | ||