summaryrefslogtreecommitdiffstats
path: root/examples/dummyresource/resourcefactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/dummyresource/resourcefactory.cpp')
-rw-r--r--examples/dummyresource/resourcefactory.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp
index c7a3eef..e9bf6cd 100644
--- a/examples/dummyresource/resourcefactory.cpp
+++ b/examples/dummyresource/resourcefactory.cpp
@@ -35,12 +35,8 @@
35//This is the resources entity type, and not the domain type 35//This is the resources entity type, and not the domain type
36#define ENTITY_TYPE_EVENT "event" 36#define ENTITY_TYPE_EVENT "event"
37 37
38DummyResource::DummyResource(const QByteArray &instanceIdentifier) 38DummyResource::DummyResource(const QByteArray &instanceIdentifier, const QSharedPointer<Akonadi2::Pipeline> &pipeline)
39 : Akonadi2::GenericResource(instanceIdentifier) 39 : Akonadi2::GenericResource(instanceIdentifier, pipeline)
40{
41}
42
43void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline)
44{ 40{
45 auto eventFactory = QSharedPointer<DummyEventAdaptorFactory>::create(); 41 auto eventFactory = QSharedPointer<DummyEventAdaptorFactory>::create();
46 const auto resourceIdentifier = mResourceInstanceIdentifier; 42 const auto resourceIdentifier = mResourceInstanceIdentifier;
@@ -57,15 +53,14 @@ void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline)
57 } 53 }
58 }); 54 });
59 55
60 pipeline->setPreprocessors(ENTITY_TYPE_EVENT, Akonadi2::Pipeline::NewPipeline, QVector<Akonadi2::Preprocessor*>() << eventIndexer); 56 mPipeline->setPreprocessors(ENTITY_TYPE_EVENT, Akonadi2::Pipeline::NewPipeline, QVector<Akonadi2::Preprocessor*>() << eventIndexer);
61 pipeline->setAdaptorFactory(ENTITY_TYPE_EVENT, eventFactory); 57 mPipeline->setAdaptorFactory(ENTITY_TYPE_EVENT, eventFactory);
62 //TODO cleanup indexes during removal 58 //TODO cleanup indexes during removal
63 GenericResource::configurePipeline(pipeline);
64} 59}
65 60
66KAsync::Job<void> DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeline) 61KAsync::Job<void> DummyResource::synchronizeWithSource()
67{ 62{
68 return KAsync::start<void>([this, pipeline](KAsync::Future<void> &f) { 63 return KAsync::start<void>([this](KAsync::Future<void> &f) {
69 //TODO start transaction on index 64 //TODO start transaction on index
70 Index uidIndex(Akonadi2::Store::storageLocation(), mResourceInstanceIdentifier + ".index.uid", Akonadi2::Storage::ReadOnly); 65 Index uidIndex(Akonadi2::Store::storageLocation(), mResourceInstanceIdentifier + ".index.uid", Akonadi2::Storage::ReadOnly);
71 66