Akonadi Mime

specialmailcollectionsrequestjob.cpp
1/*
2 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "specialmailcollectionsrequestjob.h"
8
9#include <KLocalizedString>
10#include <QStandardPaths>
11
12using namespace Akonadi;
13
14class Akonadi::SpecialMailCollectionsRequestJobPrivate
15{
16};
17
18static inline QByteArray enumToType(SpecialMailCollections::Type type)
19{
20 switch (type) {
22 return "local-mail";
24 return "inbox";
26 return "outbox";
28 return "sent-mail";
30 return "trash";
32 return "drafts";
34 return "templates";
36 return "spam";
37 case SpecialMailCollections::LastType: // fallthrough
38 default:
39 return {};
40 }
41}
42
45 , d(nullptr)
46{
47 static QMap<QByteArray, QString> displayNameMap;
48 displayNameMap.insert("local-mail", i18nc("local mail folder", "Local Folders"));
49 displayNameMap.insert("inbox", /*i18nc( "local mail folder",*/ QStringLiteral("inbox"));
50 displayNameMap.insert("outbox", /*i18nc( "local mail folder",*/ QStringLiteral("outbox"));
51 displayNameMap.insert("sent-mail", /*i18nc( "local mail folder",*/ QStringLiteral("sent-mail"));
52 displayNameMap.insert("trash", /*i18nc( "local mail folder", */ QStringLiteral("trash"));
53 displayNameMap.insert("drafts", /*i18nc( "local mail folder", */ QStringLiteral("drafts"));
54 displayNameMap.insert("templates", /*i18nc( "local mail folder", */ QStringLiteral("templates"));
55
56 static QMap<QByteArray, QString> iconNameMap;
57 iconNameMap.insert("local-mail", QStringLiteral("folder"));
58 iconNameMap.insert("inbox", QStringLiteral("mail-folder-inbox"));
59 iconNameMap.insert("outbox", QStringLiteral("mail-folder-outbox"));
60 iconNameMap.insert("sent-mail", QStringLiteral("mail-folder-sent"));
61 iconNameMap.insert("trash", QStringLiteral("user-trash"));
62 iconNameMap.insert("drafts", QStringLiteral("document-properties"));
63 iconNameMap.insert("templates", QStringLiteral("document-new"));
64
65 QVariantMap options;
66 options.insert(QStringLiteral("Name"), displayNameMap.value("local-mail"));
67 options.insert(QStringLiteral("TopLevelIsContainer"), true);
68 options.insert(QStringLiteral("Path"),
70
71 setDefaultResourceType(QStringLiteral("akonadi_maildir_resource"));
73
74 setTypes(displayNameMap.keys());
75 setNameForTypeMap(displayNameMap);
76 setIconForTypeMap(iconNameMap);
77}
78
80
85
90
91#include "moc_specialmailcollectionsrequestjob.cpp"
void requestCollection(const QByteArray &type, const AgentInstance &instance)
void setIconForTypeMap(const QMap< QByteArray, QString > &map)
void setTypes(const QList< QByteArray > &types)
void setNameForTypeMap(const QMap< QByteArray, QString > &map)
void setDefaultResourceOptions(const QVariantMap &options)
void requestDefaultCollection(const QByteArray &type)
void setDefaultResourceType(const QString &type)
void requestCollection(SpecialMailCollections::Type type, const AgentInstance &instance)
Requests a special mail collection of the given type in the given resource instance.
~SpecialMailCollectionsRequestJob() override
Destroys the special mail collections request job.
void requestDefaultCollection(SpecialMailCollections::Type type)
Requests a special mail collection of the given type in the default resource.
SpecialMailCollectionsRequestJob(QObject *parent=nullptr)
Creates a new special mail collections request job.
Interface to special mail collections such as inbox, outbox etc.
Type
Describes the possible types of special mail collections.
@ Root
The root collection containing the local folders.
@ SentMail
The sent-mail collection.
@ Templates
The templates collection.
QString i18nc(const char *context, const char *text, const TYPE &arg...)
iterator insert(const Key &key, const T &value)
QList< Key > keys() const const
T value(const Key &key, const T &defaultValue) const const
QString writableLocation(StandardLocation type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:31 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.