diff options
Diffstat (limited to 'examples/dummyresource')
-rw-r--r-- | examples/dummyresource/resourcefactory.cpp | 17 | ||||
-rw-r--r-- | examples/dummyresource/resourcefactory.h | 5 |
2 files changed, 8 insertions, 14 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 | ||
38 | DummyResource::DummyResource(const QByteArray &instanceIdentifier) | 38 | DummyResource::DummyResource(const QByteArray &instanceIdentifier, const QSharedPointer<Akonadi2::Pipeline> &pipeline) |
39 | : Akonadi2::GenericResource(instanceIdentifier) | 39 | : Akonadi2::GenericResource(instanceIdentifier, pipeline) |
40 | { | ||
41 | } | ||
42 | |||
43 | void 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 | ||
66 | KAsync::Job<void> DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeline) | 61 | KAsync::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 | ||
diff --git a/examples/dummyresource/resourcefactory.h b/examples/dummyresource/resourcefactory.h index f2362bc..4baafa7 100644 --- a/examples/dummyresource/resourcefactory.h +++ b/examples/dummyresource/resourcefactory.h | |||
@@ -32,9 +32,8 @@ | |||
32 | class DummyResource : public Akonadi2::GenericResource | 32 | class DummyResource : public Akonadi2::GenericResource |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | DummyResource(const QByteArray &instanceIdentifier); | 35 | DummyResource(const QByteArray &instanceIdentifier, const QSharedPointer<Akonadi2::Pipeline> &pipeline = QSharedPointer<Akonadi2::Pipeline>()); |
36 | KAsync::Job<void> synchronizeWithSource(Akonadi2::Pipeline *pipeline) Q_DECL_OVERRIDE; | 36 | KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE; |
37 | void configurePipeline(Akonadi2::Pipeline *pipeline) Q_DECL_OVERRIDE; | ||
38 | }; | 37 | }; |
39 | 38 | ||
40 | class DummyResourceFactory : public Akonadi2::ResourceFactory | 39 | class DummyResourceFactory : public Akonadi2::ResourceFactory |