From 4999ec5da028e3b11d9c7b7bc0fe25acdf0a8ddd Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 9 May 2016 22:17:28 +0200 Subject: Resource factory methods and capability filter. --- common/domain/applicationdomaintype.cpp | 22 ++++++++++++++++++++++ common/domain/applicationdomaintype.h | 7 +++++++ 2 files changed, 29 insertions(+) (limited to 'common/domain') diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 27f94ce..166d3e6 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -239,6 +239,28 @@ Identity::~Identity() } +namespace MaildirResource { + SinkResource create(const QByteArray &account) + { + auto &&resource = ApplicationDomainType::createEntity(); + resource.setProperty("type", "org.kde.maildir"); + resource.setProperty("account", account); + resource.setProperty("capabilities", QVariant::fromValue(QByteArrayList() << "storage" << "drafts")); + return resource; + } +} + +namespace MailtransportResource { + SinkResource create(const QByteArray &account) + { + auto &&resource = ApplicationDomainType::createEntity(); + resource.setProperty("type", "org.kde.mailtransport"); + resource.setProperty("account", account); + resource.setProperty("capabilities", QVariant::fromValue(QByteArrayList() << "transport")); + return resource; + } +} + template<> QByteArray getTypeName() { diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 1486f00..eadad00 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h @@ -187,6 +187,13 @@ struct SINK_EXPORT Identity : public ApplicationDomainType { virtual ~Identity(); }; +namespace MaildirResource { + SinkResource SINK_EXPORT create(const QByteArray &account); +}; +namespace MailtransportResource { + SinkResource SINK_EXPORT create(const QByteArray &account); +}; + /** * All types need to be registered here an MUST return a different name. * -- cgit v1.2.3