From d5606030b5eb6f7ec92bc9b9d4218692af43a628 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 1 Dec 2015 15:47:34 +0100 Subject: We don't need the remoteId index --- examples/dummyresource/resourcefactory.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'examples') 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 @@ */ class IndexUpdater : public Akonadi2::Preprocessor { public: - IndexUpdater(const QByteArray &index, const QByteArray &type) + IndexUpdater(const QByteArray &index, const QByteArray &type, const QByteArray &property) :mIndexIdentifier(index), - mBufferType(type) + mBufferType(type), + mProperty(property) { } void newEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE { - add(newEntity.getProperty("remoteId"), uid, transaction); + add(newEntity.getProperty(mProperty), uid, transaction); } void modifiedEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE { - remove(oldEntity.getProperty("remoteId"), uid, transaction); - add(newEntity.getProperty("remoteId"), uid, transaction); + remove(oldEntity.getProperty(mProperty), uid, transaction); + add(newEntity.getProperty(mProperty), uid, transaction); } void deletedEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE { - remove(oldEntity.getProperty("remoteId"), uid, transaction); + remove(oldEntity.getProperty(mProperty), uid, transaction); } private: @@ -94,6 +95,7 @@ private: QByteArray mIndexIdentifier; QByteArray mBufferType; + QByteArray mProperty; }; template @@ -122,21 +124,18 @@ DummyResource::DummyResource(const QByteArray &instanceIdentifier, const QShared { QVector eventPreprocessors; eventPreprocessors << new DefaultIndexUpdater; - eventPreprocessors << new IndexUpdater("event.index.rid", ENTITY_TYPE_EVENT); mPipeline->setPreprocessors(ENTITY_TYPE_EVENT, eventPreprocessors); mPipeline->setAdaptorFactory(ENTITY_TYPE_EVENT, QSharedPointer::create()); } { QVector mailPreprocessors; mailPreprocessors << new DefaultIndexUpdater; - mailPreprocessors << new IndexUpdater("mail.index.rid", ENTITY_TYPE_MAIL); mPipeline->setPreprocessors(ENTITY_TYPE_MAIL, mailPreprocessors); mPipeline->setAdaptorFactory(ENTITY_TYPE_MAIL, QSharedPointer::create()); } { QVector folderPreprocessors; folderPreprocessors << new DefaultIndexUpdater; - folderPreprocessors << new IndexUpdater("folder.index.rid", ENTITY_TYPE_FOLDER); mPipeline->setPreprocessors(ENTITY_TYPE_FOLDER, folderPreprocessors); mPipeline->setAdaptorFactory(ENTITY_TYPE_FOLDER, QSharedPointer::create()); } -- cgit v1.2.3