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";
35 case SpecialMailCollections::LastType: // fallthrough
36 default:
37 return {};
38 }
39}
40
43 , d(nullptr)
44{
45 static QMap<QByteArray, QString> displayNameMap;
46 displayNameMap.insert("local-mail", i18nc("local mail folder", "Local Folders"));
47 displayNameMap.insert("inbox", /*i18nc( "local mail folder",*/ QStringLiteral("inbox"));
48 displayNameMap.insert("outbox", /*i18nc( "local mail folder",*/ QStringLiteral("outbox"));
49 displayNameMap.insert("sent-mail", /*i18nc( "local mail folder",*/ QStringLiteral("sent-mail"));
50 displayNameMap.insert("trash", /*i18nc( "local mail folder", */ QStringLiteral("trash"));
51 displayNameMap.insert("drafts", /*i18nc( "local mail folder", */ QStringLiteral("drafts"));
52 displayNameMap.insert("templates", /*i18nc( "local mail folder", */ QStringLiteral("templates"));
53
54 static QMap<QByteArray, QString> iconNameMap;
55 iconNameMap.insert("local-mail", QStringLiteral("folder"));
56 iconNameMap.insert("inbox", QStringLiteral("mail-folder-inbox"));
57 iconNameMap.insert("outbox", QStringLiteral("mail-folder-outbox"));
58 iconNameMap.insert("sent-mail", QStringLiteral("mail-folder-sent"));
59 iconNameMap.insert("trash", QStringLiteral("user-trash"));
60 iconNameMap.insert("drafts", QStringLiteral("document-properties"));
61 iconNameMap.insert("templates", QStringLiteral("document-new"));
62
63 QVariantMap options;
64 options.insert(QStringLiteral("Name"), displayNameMap.value("local-mail"));
65 options.insert(QStringLiteral("TopLevelIsContainer"), true);
66 options.insert(QStringLiteral("Path"),
68
69 setDefaultResourceType(QStringLiteral("akonadi_maildir_resource"));
71
72 setTypes(displayNameMap.keys());
73 setNameForTypeMap(displayNameMap);
74 setIconForTypeMap(iconNameMap);
75}
76
78
83
88
89#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 Mon Nov 4 2024 16:32:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.