From 5d19ebfb9654b8998d694ff88fa4dcde94b0874c Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 5 Nov 2015 23:26:44 +0100 Subject: Implemented removeIndex --- common/domain/event.cpp | 8 ++++++++ common/domain/event.h | 1 + common/domain/mail.cpp | 8 ++++++++ common/domain/mail.h | 1 + 4 files changed, 18 insertions(+) (limited to 'common') diff --git a/common/domain/event.cpp b/common/domain/event.cpp index 83a6906..87e13bc 100644 --- a/common/domain/event.cpp +++ b/common/domain/event.cpp @@ -58,6 +58,14 @@ void TypeImplementation::index(const QByteArray &identifier, const Buffer } } +void TypeImplementation::removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction) +{ + const auto uid = bufferAdaptor.getProperty("uid"); + if (uid.isValid()) { + Index("event.index.uid", transaction).remove(uid.toByteArray(), identifier); + } +} + QSharedPointer::Buffer> > TypeImplementation::initializeReadPropertyMapper() { auto propertyMapper = QSharedPointer >::create(); diff --git a/common/domain/event.h b/common/domain/event.h index e9ba52a..577367b 100644 --- a/common/domain/event.h +++ b/common/domain/event.h @@ -57,6 +57,7 @@ public: */ static ResultSet queryIndexes(const Akonadi2::Query &query, const QByteArray &resourceInstanceIdentifier, QSet &appliedFilters, Akonadi2::Storage::Transaction &transaction); static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction); + static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction); static QSharedPointer > initializeReadPropertyMapper(); static QSharedPointer > initializeWritePropertyMapper(); }; diff --git a/common/domain/mail.cpp b/common/domain/mail.cpp index ffe322e..5373ac6 100644 --- a/common/domain/mail.cpp +++ b/common/domain/mail.cpp @@ -58,6 +58,14 @@ void TypeImplementation::index(const QByteArray &identifier, const BufferA } } +void TypeImplementation::removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction) +{ + const auto uid = bufferAdaptor.getProperty("uid"); + if (uid.isValid()) { + Index("mail.index.uid", transaction).remove(uid.toByteArray(), identifier); + } +} + QSharedPointer::Buffer> > TypeImplementation::initializeReadPropertyMapper() { auto propertyMapper = QSharedPointer >::create(); diff --git a/common/domain/mail.h b/common/domain/mail.h index 38f1d03..d1ef8d6 100644 --- a/common/domain/mail.h +++ b/common/domain/mail.h @@ -52,6 +52,7 @@ public: */ static ResultSet queryIndexes(const Akonadi2::Query &query, const QByteArray &resourceInstanceIdentifier, QSet &appliedFilters, Akonadi2::Storage::Transaction &transaction); static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction); + static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction); static QSharedPointer > initializeReadPropertyMapper(); static QSharedPointer > initializeWritePropertyMapper(); }; -- cgit v1.2.3