From bbbda3fe9444eba6795a5490da0425cdf8f26361 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 8 Sep 2015 21:08:54 +0200 Subject: Added support for mails to akonadi and the dummyresource. Adding new types definitely needs to become easier. --- common/domain/mail.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 common/domain/mail.h (limited to 'common/domain/mail.h') diff --git a/common/domain/mail.h b/common/domain/mail.h new file mode 100644 index 0000000..b58ce44 --- /dev/null +++ b/common/domain/mail.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2015 Christian Mollekopf + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#pragma once + +#include "applicationdomaintype.h" + +#include "storage.h" + +class ResultSet; +class QByteArray; + +template +class ReadPropertyMapper; +template +class WritePropertyMapper; + +namespace Akonadi2 { + class Query; + +namespace ApplicationDomain { + namespace Buffer { + struct Mail; + struct MailBuilder; + } + +template<> +class TypeImplementation { +public: + typedef Akonadi2::ApplicationDomain::Buffer::Mail Buffer; + typedef Akonadi2::ApplicationDomain::Buffer::MailBuilder BufferBuilder; + static QSet indexedProperties(); + /** + * Returns the potential result set based on the indexes. + * + * An empty result set indicates that a full scan is required. + */ + static ResultSet queryIndexes(const Akonadi2::Query &query, const QByteArray &resourceInstanceIdentifier, QSet &appliedFilters, Akonadi2::Storage::Transaction &transaction); + static void index(const Mail &type, Akonadi2::Storage::Transaction &transaction); + static QSharedPointer > initializeReadPropertyMapper(); + static QSharedPointer > initializeWritePropertyMapper(); +}; + +} +} -- cgit v1.2.3