summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <[email protected]>2017-08-18 13:02:07 +0200
committerDaniel Vrátil <[email protected]>2017-08-18 13:02:07 +0200
commit3d1e3ef0031ff1b63398ae86052691404f9f9b8e (patch)
tree7aa0e31d2e8480aab5f1875af04901c3d4573a89
parentddcc75438382242d03141dfe5b3cae667aed4465 (diff)
Some fixes in MailCommon::Utils
Differential Revision: https://phabricator.kde.org/D7364
-rw-r--r--src/util/mailutil.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/util/mailutil.cpp b/src/util/mailutil.cpp
index 5e1a3fe..484403c 100644
--- a/src/util/mailutil.cpp
+++ b/src/util/mailutil.cpp
@@ -69,6 +69,7 @@
#include <ItemFetchScope>
#include <Akonadi/KMime/MessageParts>
#include <AkonadiCore/NewMailNotifierAttribute>
+#include <AkonadiCore/ServerManager>
#include <KMime/KMimeMessage>
@@ -81,26 +82,29 @@
OrgKdeAkonadiPOP3SettingsInterface *MailCommon::Util::createPop3SettingsInterface(
const QString &ident)
{
- return
- new OrgKdeAkonadiPOP3SettingsInterface(
- QLatin1String("org.freedesktop.Akonadi.Resource.") + ident, QStringLiteral("/Settings"), QDBusConnection::sessionBus());
+ const auto service = Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Resource, ident);
+ return new OrgKdeAkonadiPOP3SettingsInterface(service, QStringLiteral("/Settings"), QDBusConnection::sessionBus());
}
bool MailCommon::Util::isVirtualCollection(const Akonadi::Collection &collection)
{
- return MailCommon::Util::isVirtualCollection(collection.resource());
+ return collection.isVirtual() || MailCommon::Util::isVirtualCollection(collection.resource());
}
bool MailCommon::Util::isVirtualCollection(const QString &resource)
{
- return resource == QLatin1String("akonadi_search_resource");
+ if (resource == QLatin1String("akonadi_search_resource")) {
+ return true;
+ }
+
+ const auto type = Akonadi::AgentManager::self()->type(resource);
+ return type.capabilities().contains(QStringLiteral("Virtual"));
}
bool MailCommon::Util::isLocalCollection(const QString &resource)
{
- return resource.contains(QStringLiteral("akonadi_mbox_resource"))
- || resource.contains(QStringLiteral("akonadi_maildir_resource"))
- || resource.contains(QStringLiteral("akonadi_mixedmaildir_resource"));
+ auto type = Akonadi::AgentManager::self()->type(resource);
+ return type.customProperties().value(QStringLiteral("HasLocalStorage"), false).toBool();
}
QString MailCommon::Util::fullCollectionPath(const Akonadi::Collection &collection)