diff options
Diffstat (limited to 'dummyresource/resourcefactory.cpp')
-rw-r--r-- | dummyresource/resourcefactory.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp index da6969a..87a6048 100644 --- a/dummyresource/resourcefactory.cpp +++ b/dummyresource/resourcefactory.cpp | |||
@@ -38,18 +38,19 @@ | |||
38 | class SimpleProcessor : public Akonadi2::Preprocessor | 38 | class SimpleProcessor : public Akonadi2::Preprocessor |
39 | { | 39 | { |
40 | public: | 40 | public: |
41 | SimpleProcessor(const std::function<void(const Akonadi2::PipelineState &state)> &f) | 41 | SimpleProcessor(const std::function<void(const Akonadi2::PipelineState &state, const Akonadi2::Entity &e)> &f) |
42 | : Akonadi2::Preprocessor(), | 42 | : Akonadi2::Preprocessor(), |
43 | mFunction(f) | 43 | mFunction(f) |
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | void process(const Akonadi2::PipelineState &state) { | 47 | void process(const Akonadi2::PipelineState &state, const Akonadi2::Entity &e) { |
48 | mFunction(state); | 48 | mFunction(state, e); |
49 | processingCompleted(state); | ||
49 | } | 50 | } |
50 | 51 | ||
51 | protected: | 52 | protected: |
52 | std::function<void(const Akonadi2::PipelineState &state)> mFunction; | 53 | std::function<void(const Akonadi2::PipelineState &state, const Akonadi2::Entity &e)> mFunction; |
53 | }; | 54 | }; |
54 | 55 | ||
55 | // template <typename DomainType> | 56 | // template <typename DomainType> |
@@ -102,13 +103,12 @@ DummyResource::DummyResource() | |||
102 | 103 | ||
103 | void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline) | 104 | void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline) |
104 | { | 105 | { |
105 | auto factory = QSharedPointer<DummyEventAdaptorFactory>::create(); | 106 | auto eventFactory = QSharedPointer<DummyEventAdaptorFactory>::create(); |
106 | //TODO setup preprocessors for each domain type and pipeline type allowing full customization | 107 | //TODO setup preprocessors for each domain type and pipeline type allowing full customization |
107 | //Eventually the order should be self configuring, for now it's hardcoded. | 108 | //Eventually the order should be self configuring, for now it's hardcoded. |
108 | auto eventIndexer = new SimpleProcessor([factory](const Akonadi2::PipelineState &state) { | 109 | auto eventIndexer = new SimpleProcessor([eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { |
109 | auto adaptor = factory->createAdaptor(state.entity()); | 110 | auto adaptor = eventFactory->createAdaptor(entity); |
110 | //Here we can plug in generic preprocessors | 111 | qDebug() << "Summary preprocessor: " << adaptor->getProperty("summary").toString(); |
111 | qDebug() << adaptor->getProperty("summary").toString(); | ||
112 | }); | 112 | }); |
113 | pipeline->setPreprocessors<Akonadi2::Domain::Event>(Akonadi2::Pipeline::NewPipeline, QVector<Akonadi2::Preprocessor*>() << eventIndexer); | 113 | pipeline->setPreprocessors<Akonadi2::Domain::Event>(Akonadi2::Pipeline::NewPipeline, QVector<Akonadi2::Preprocessor*>() << eventIndexer); |
114 | } | 114 | } |