summaryrefslogtreecommitdiffstats
path: root/examples/dummyresource/resourcefactory.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-01 15:47:34 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-01 15:47:34 +0100
commitd5606030b5eb6f7ec92bc9b9d4218692af43a628 (patch)
tree54b50b71e9026b9179b06e5b621861d42ec820cd /examples/dummyresource/resourcefactory.cpp
parent0e8a515aefafbf0595883879d269849b9154ba20 (diff)
downloadsink-d5606030b5eb6f7ec92bc9b9d4218692af43a628.tar.gz
sink-d5606030b5eb6f7ec92bc9b9d4218692af43a628.zip
We don't need the remoteId index
Diffstat (limited to 'examples/dummyresource/resourcefactory.cpp')
-rw-r--r--examples/dummyresource/resourcefactory.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp
index 8dae749..73b2eb5 100644
--- a/examples/dummyresource/resourcefactory.cpp
+++ b/examples/dummyresource/resourcefactory.cpp
@@ -55,27 +55,28 @@
55 */ 55 */
56class IndexUpdater : public Akonadi2::Preprocessor { 56class IndexUpdater : public Akonadi2::Preprocessor {
57public: 57public:
58 IndexUpdater(const QByteArray &index, const QByteArray &type) 58 IndexUpdater(const QByteArray &index, const QByteArray &type, const QByteArray &property)
59 :mIndexIdentifier(index), 59 :mIndexIdentifier(index),
60 mBufferType(type) 60 mBufferType(type),
61 mProperty(property)
61 { 62 {
62 63
63 } 64 }
64 65
65 void newEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE 66 void newEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE
66 { 67 {
67 add(newEntity.getProperty("remoteId"), uid, transaction); 68 add(newEntity.getProperty(mProperty), uid, transaction);
68 } 69 }
69 70
70 void modifiedEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE 71 void modifiedEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE
71 { 72 {
72 remove(oldEntity.getProperty("remoteId"), uid, transaction); 73 remove(oldEntity.getProperty(mProperty), uid, transaction);
73 add(newEntity.getProperty("remoteId"), uid, transaction); 74 add(newEntity.getProperty(mProperty), uid, transaction);
74 } 75 }
75 76
76 void deletedEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE 77 void deletedEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE
77 { 78 {
78 remove(oldEntity.getProperty("remoteId"), uid, transaction); 79 remove(oldEntity.getProperty(mProperty), uid, transaction);
79 } 80 }
80 81
81private: 82private:
@@ -94,6 +95,7 @@ private:
94 95
95 QByteArray mIndexIdentifier; 96 QByteArray mIndexIdentifier;
96 QByteArray mBufferType; 97 QByteArray mBufferType;
98 QByteArray mProperty;
97}; 99};
98 100
99template<typename DomainType> 101template<typename DomainType>
@@ -122,21 +124,18 @@ DummyResource::DummyResource(const QByteArray &instanceIdentifier, const QShared
122 { 124 {
123 QVector<Akonadi2::Preprocessor*> eventPreprocessors; 125 QVector<Akonadi2::Preprocessor*> eventPreprocessors;
124 eventPreprocessors << new DefaultIndexUpdater<Akonadi2::ApplicationDomain::Event>; 126 eventPreprocessors << new DefaultIndexUpdater<Akonadi2::ApplicationDomain::Event>;
125 eventPreprocessors << new IndexUpdater("event.index.rid", ENTITY_TYPE_EVENT);
126 mPipeline->setPreprocessors(ENTITY_TYPE_EVENT, eventPreprocessors); 127 mPipeline->setPreprocessors(ENTITY_TYPE_EVENT, eventPreprocessors);
127 mPipeline->setAdaptorFactory(ENTITY_TYPE_EVENT, QSharedPointer<DummyEventAdaptorFactory>::create()); 128 mPipeline->setAdaptorFactory(ENTITY_TYPE_EVENT, QSharedPointer<DummyEventAdaptorFactory>::create());
128 } 129 }
129 { 130 {
130 QVector<Akonadi2::Preprocessor*> mailPreprocessors; 131 QVector<Akonadi2::Preprocessor*> mailPreprocessors;
131 mailPreprocessors << new DefaultIndexUpdater<Akonadi2::ApplicationDomain::Mail>; 132 mailPreprocessors << new DefaultIndexUpdater<Akonadi2::ApplicationDomain::Mail>;
132 mailPreprocessors << new IndexUpdater("mail.index.rid", ENTITY_TYPE_MAIL);
133 mPipeline->setPreprocessors(ENTITY_TYPE_MAIL, mailPreprocessors); 133 mPipeline->setPreprocessors(ENTITY_TYPE_MAIL, mailPreprocessors);
134 mPipeline->setAdaptorFactory(ENTITY_TYPE_MAIL, QSharedPointer<DummyMailAdaptorFactory>::create()); 134 mPipeline->setAdaptorFactory(ENTITY_TYPE_MAIL, QSharedPointer<DummyMailAdaptorFactory>::create());
135 } 135 }
136 { 136 {
137 QVector<Akonadi2::Preprocessor*> folderPreprocessors; 137 QVector<Akonadi2::Preprocessor*> folderPreprocessors;
138 folderPreprocessors << new DefaultIndexUpdater<Akonadi2::ApplicationDomain::Folder>; 138 folderPreprocessors << new DefaultIndexUpdater<Akonadi2::ApplicationDomain::Folder>;
139 folderPreprocessors << new IndexUpdater("folder.index.rid", ENTITY_TYPE_FOLDER);
140 mPipeline->setPreprocessors(ENTITY_TYPE_FOLDER, folderPreprocessors); 139 mPipeline->setPreprocessors(ENTITY_TYPE_FOLDER, folderPreprocessors);
141 mPipeline->setAdaptorFactory(ENTITY_TYPE_FOLDER, QSharedPointer<DummyFolderAdaptorFactory>::create()); 140 mPipeline->setAdaptorFactory(ENTITY_TYPE_FOLDER, QSharedPointer<DummyFolderAdaptorFactory>::create());
142 } 141 }