summaryrefslogtreecommitdiffstats
path: root/common/genericresource.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-30 09:32:52 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-30 09:32:52 +0100
commit02c311e38b8b9b80814a4e8e582d5c5a56a51056 (patch)
tree914255d577be2f17501c546e6d08b80aa23ca165 /common/genericresource.cpp
parente99453c21eb9100d6fe05ccec153fe6e640bb440 (diff)
downloadsink-02c311e38b8b9b80814a4e8e582d5c5a56a51056.tar.gz
sink-02c311e38b8b9b80814a4e8e582d5c5a56a51056.zip
Don't expose enabling/disabling of changerecording to resource
implementations
Diffstat (limited to 'common/genericresource.cpp')
-rw-r--r--common/genericresource.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp
index 1af9226..9fbcaaa 100644
--- a/common/genericresource.cpp
+++ b/common/genericresource.cpp
@@ -370,6 +370,26 @@ void GenericResource::processCommand(int commandId, const QByteArray &data)
370 } 370 }
371} 371}
372 372
373KAsync::Job<void> GenericResource::synchronizeWithSource()
374{
375 return KAsync::start<void>([this]() {
376 Log() << " Synchronizing";
377 //Changereplay would deadlock otherwise when trying to open the synchronization store
378 enableChangeReplay(false);
379 auto mainStore = QSharedPointer<Akonadi2::Storage>::create(Akonadi2::storageLocation(), mResourceInstanceIdentifier, Akonadi2::Storage::ReadOnly);
380 auto syncStore = QSharedPointer<Akonadi2::Storage>::create(Akonadi2::storageLocation(), mResourceInstanceIdentifier + ".synchronization", Akonadi2::Storage::ReadWrite);
381 synchronizeWithSource(*mainStore, *syncStore).then<void>([this, mainStore, syncStore]() {
382 Log() << "Done Synchronizing";
383 enableChangeReplay(true);
384 }).exec();
385 });
386}
387
388KAsync::Job<void> GenericResource::synchronizeWithSource(Akonadi2::Storage &mainStore, Akonadi2::Storage &synchronizationStore)
389{
390 return KAsync::null<void>();
391}
392
373static void waitForDrained(KAsync::Future<void> &f, MessageQueue &queue) 393static void waitForDrained(KAsync::Future<void> &f, MessageQueue &queue)
374{ 394{
375 if (queue.isEmpty()) { 395 if (queue.isEmpty()) {