diff options
-rw-r--r-- | common/genericresource.cpp | 9 | ||||
-rw-r--r-- | common/genericresource.h | 1 | ||||
-rw-r--r-- | examples/dummyresource/resourcefactory.cpp | 6 | ||||
-rw-r--r-- | examples/dummyresource/resourcefactory.h | 1 |
4 files changed, 15 insertions, 2 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp index 66f5dcf..7b8d9bb 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp | |||
@@ -266,8 +266,8 @@ GenericResource::GenericResource(const QByteArray &resourceInstanceIdentifier, c | |||
266 | mProcessor = new Processor(mPipeline.data(), QList<MessageQueue*>() << &mUserQueue << &mSynchronizerQueue); | 266 | mProcessor = new Processor(mPipeline.data(), QList<MessageQueue*>() << &mUserQueue << &mSynchronizerQueue); |
267 | QObject::connect(mProcessor, &Processor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); }); | 267 | QObject::connect(mProcessor, &Processor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); }); |
268 | QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, this, &Resource::revisionUpdated); | 268 | QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, this, &Resource::revisionUpdated); |
269 | mSourceChangeReplay = new ChangeReplay(resourceInstanceIdentifier, [](const QByteArray &type, const QByteArray &key, const QByteArray &value) { | 269 | mSourceChangeReplay = new ChangeReplay(resourceInstanceIdentifier, [this](const QByteArray &type, const QByteArray &key, const QByteArray &value) { |
270 | return KAsync::null<void>(); | 270 | return this->replay(type, key, value); |
271 | }); | 271 | }); |
272 | QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, mSourceChangeReplay, &ChangeReplay::revisionChanged); | 272 | QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, mSourceChangeReplay, &ChangeReplay::revisionChanged); |
273 | QObject::connect(mSourceChangeReplay, &ChangeReplay::changesReplayed, this, &GenericResource::updateLowerBoundRevision); | 273 | QObject::connect(mSourceChangeReplay, &ChangeReplay::changesReplayed, this, &GenericResource::updateLowerBoundRevision); |
@@ -285,6 +285,11 @@ GenericResource::~GenericResource() | |||
285 | delete mSourceChangeReplay; | 285 | delete mSourceChangeReplay; |
286 | } | 286 | } |
287 | 287 | ||
288 | KAsync::Job<void> GenericResource::replay(const QByteArray &type, const QByteArray &key, const QByteArray &value) | ||
289 | { | ||
290 | return KAsync::null<void>(); | ||
291 | } | ||
292 | |||
288 | void GenericResource::removeFromDisk(const QByteArray &instanceIdentifier) | 293 | void GenericResource::removeFromDisk(const QByteArray &instanceIdentifier) |
289 | { | 294 | { |
290 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier, Akonadi2::Storage::ReadWrite).removeFromDisk(); | 295 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier, Akonadi2::Storage::ReadWrite).removeFromDisk(); |
diff --git a/common/genericresource.h b/common/genericresource.h index 33de0e7..97251a9 100644 --- a/common/genericresource.h +++ b/common/genericresource.h | |||
@@ -53,6 +53,7 @@ private Q_SLOTS: | |||
53 | void updateLowerBoundRevision(); | 53 | void updateLowerBoundRevision(); |
54 | 54 | ||
55 | protected: | 55 | protected: |
56 | virtual KAsync::Job<void> replay(const QByteArray &type, const QByteArray &key, const QByteArray &value); | ||
56 | void onProcessorError(int errorCode, const QString &errorMessage); | 57 | void onProcessorError(int errorCode, const QString &errorMessage); |
57 | void enqueueCommand(MessageQueue &mq, int commandId, const QByteArray &data); | 58 | void enqueueCommand(MessageQueue &mq, int commandId, const QByteArray &data); |
58 | flatbuffers::FlatBufferBuilder m_fbb; | 59 | flatbuffers::FlatBufferBuilder m_fbb; |
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index 91a1229..ddae80e 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp | |||
@@ -279,6 +279,12 @@ KAsync::Job<void> DummyResource::synchronizeWithSource() | |||
279 | }); | 279 | }); |
280 | } | 280 | } |
281 | 281 | ||
282 | KAsync::Job<void> DummyResource::replay(const QByteArray &type, const QByteArray &key, const QByteArray &value) | ||
283 | { | ||
284 | Trace() << "Replaying " << key; | ||
285 | return KAsync::null<void>(); | ||
286 | } | ||
287 | |||
282 | void DummyResource::removeFromDisk(const QByteArray &instanceIdentifier) | 288 | void DummyResource::removeFromDisk(const QByteArray &instanceIdentifier) |
283 | { | 289 | { |
284 | GenericResource::removeFromDisk(instanceIdentifier); | 290 | GenericResource::removeFromDisk(instanceIdentifier); |
diff --git a/examples/dummyresource/resourcefactory.h b/examples/dummyresource/resourcefactory.h index 4144985..dc248c0 100644 --- a/examples/dummyresource/resourcefactory.h +++ b/examples/dummyresource/resourcefactory.h | |||
@@ -36,6 +36,7 @@ public: | |||
36 | KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE; | 36 | KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE; |
37 | static void removeFromDisk(const QByteArray &instanceIdentifier); | 37 | static void removeFromDisk(const QByteArray &instanceIdentifier); |
38 | private: | 38 | private: |
39 | KAsync::Job<void> replay(const QByteArray &type, const QByteArray &key, const QByteArray &value) Q_DECL_OVERRIDE; | ||
39 | QString resolveRemoteId(const QByteArray &type, const QString &remoteId, Akonadi2::Storage::Transaction &transaction); | 40 | QString resolveRemoteId(const QByteArray &type, const QString &remoteId, Akonadi2::Storage::Transaction &transaction); |
40 | void createEvent(const QByteArray &rid, const QMap<QString, QVariant> &data, flatbuffers::FlatBufferBuilder &entityFbb, Akonadi2::Storage::Transaction &); | 41 | void createEvent(const QByteArray &rid, const QMap<QString, QVariant> &data, flatbuffers::FlatBufferBuilder &entityFbb, Akonadi2::Storage::Transaction &); |
41 | void createMail(const QByteArray &rid, const QMap<QString, QVariant> &data, flatbuffers::FlatBufferBuilder &entityFbb, Akonadi2::Storage::Transaction &); | 42 | void createMail(const QByteArray &rid, const QMap<QString, QVariant> &data, flatbuffers::FlatBufferBuilder &entityFbb, Akonadi2::Storage::Transaction &); |