• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi/kmime

  • sources
  • kde-4.12
  • kdepimlibs
  • akonadi
  • kmime
specialmailcollectionsrequestjob.cpp
1 /*
2  Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "specialmailcollectionsrequestjob.h"
21 
22 #include "specialmailcollections.h"
23 
24 #include <kglobal.h>
25 #include <klocalizedstring.h>
26 #include <kstandarddirs.h>
27 
28 using namespace Akonadi;
29 
30 #ifndef KDE_USE_FINAL
31 static inline QByteArray enumToType( SpecialMailCollections::Type type )
32 {
33  switch ( type ) {
34  case SpecialMailCollections::Root: return "local-mail"; break;
35  case SpecialMailCollections::Inbox: return "inbox"; break;
36  case SpecialMailCollections::Outbox: return "outbox"; break;
37  case SpecialMailCollections::SentMail: return "sent-mail"; break;
38  case SpecialMailCollections::Trash: return "trash"; break;
39  case SpecialMailCollections::Drafts: return "drafts"; break;
40  case SpecialMailCollections::Templates: return "templates"; break;
41  case SpecialMailCollections::LastType: // fallthrough
42  default: return QByteArray(); break;
43  }
44 }
45 #endif
46 
47 SpecialMailCollectionsRequestJob::SpecialMailCollectionsRequestJob( QObject *parent )
48  : SpecialCollectionsRequestJob( SpecialMailCollections::self(), parent ),
49  d( 0 )
50 {
51  static QMap<QByteArray, QString> displayNameMap;
52  displayNameMap.insert( "local-mail", i18nc( "local mail folder", "Local Folders" ) );
53  displayNameMap.insert( "inbox", /*i18nc( "local mail folder",*/QLatin1String("inbox" ) );
54  displayNameMap.insert( "outbox", /*i18nc( "local mail folder",*/ QLatin1String("outbox" ) );
55  displayNameMap.insert( "sent-mail", /*i18nc( "local mail folder",*/QLatin1String( "sent-mail" ) );
56  displayNameMap.insert( "trash", /*i18nc( "local mail folder", */QLatin1String("trash" ) );
57  displayNameMap.insert( "drafts", /*i18nc( "local mail folder", */QLatin1String("drafts" ) );
58  displayNameMap.insert( "templates", /*i18nc( "local mail folder", */QLatin1String("templates" ) );
59 
60  static QMap<QByteArray, QString> iconNameMap;
61  iconNameMap.insert( "local-mail", QLatin1String( "folder" ) );
62  iconNameMap.insert( "inbox", QLatin1String( "mail-folder-inbox" ) );
63  iconNameMap.insert( "outbox", QLatin1String( "mail-folder-outbox" ) );
64  iconNameMap.insert( "sent-mail", QLatin1String( "mail-folder-sent" ) );
65  iconNameMap.insert( "trash", QLatin1String( "user-trash" ) );
66  iconNameMap.insert( "drafts", QLatin1String( "document-properties" ) );
67  iconNameMap.insert( "templates", QLatin1String( "document-new" ) );
68 
69  QVariantMap options;
70  options.insert( QLatin1String( "Name" ), displayNameMap.value( "local-mail" ) );
71  options.insert( QLatin1String( "TopLevelIsContainer" ), true );
72  options.insert( QLatin1String( "Path" ), QString(KGlobal::dirs()->localxdgdatadir() + QLatin1String( "local-mail" )) );
73 
74  setDefaultResourceType( QLatin1String( "akonadi_maildir_resource" ) );
75  setDefaultResourceOptions( options );
76 
77  setTypes( displayNameMap.keys() );
78  setNameForTypeMap( displayNameMap );
79  setIconForTypeMap( iconNameMap );
80 }
81 
82 SpecialMailCollectionsRequestJob::~SpecialMailCollectionsRequestJob()
83 {
84 }
85 
86 void SpecialMailCollectionsRequestJob::requestDefaultCollection( SpecialMailCollections::Type type )
87 {
88  return SpecialCollectionsRequestJob::requestDefaultCollection( enumToType( type ) );
89 }
90 
91 void SpecialMailCollectionsRequestJob::requestCollection( SpecialMailCollections::Type type, const AgentInstance &instance )
92 {
93  return SpecialCollectionsRequestJob::requestCollection( enumToType( type ), instance );
94 }
95 
Akonadi::SpecialMailCollections::Trash
The trash collection.
Definition: specialmailcollections.h:85
Akonadi::SpecialMailCollectionsRequestJob::requestDefaultCollection
void requestDefaultCollection(SpecialMailCollections::Type type)
Requests a special mail collection of the given type in the default resource.
Definition: specialmailcollectionsrequestjob.cpp:86
Akonadi::SpecialMailCollections::Templates
The templates collection.
Definition: specialmailcollections.h:87
Akonadi::SpecialMailCollectionsRequestJob::~SpecialMailCollectionsRequestJob
~SpecialMailCollectionsRequestJob()
Destroys the special mail collections request job.
Definition: specialmailcollectionsrequestjob.cpp:82
Akonadi::SpecialMailCollectionsRequestJob::requestCollection
void requestCollection(SpecialMailCollections::Type type, const AgentInstance &instance)
Requests a special mail collection of the given type in the given resource instance.
Definition: specialmailcollectionsrequestjob.cpp:91
Akonadi::SpecialMailCollections::Root
The root collection containing the local folders.
Definition: specialmailcollections.h:81
Akonadi::SpecialMailCollections::Inbox
The inbox collection.
Definition: specialmailcollections.h:82
Akonadi::SpecialMailCollections::Outbox
The outbox collection.
Definition: specialmailcollections.h:83
Akonadi::SpecialMailCollections::SentMail
The sent-mail collection.
Definition: specialmailcollections.h:84
Akonadi::SpecialMailCollections
Interface to special mail collections such as inbox, outbox etc.
Definition: specialmailcollections.h:67
Akonadi::SpecialMailCollections::Type
Type
Describes the possible types of special mail collections.
Definition: specialmailcollections.h:78
Akonadi::SpecialMailCollections::Drafts
The drafts collection.
Definition: specialmailcollections.h:86
Akonadi::SpecialMailCollectionsRequestJob::SpecialMailCollectionsRequestJob
SpecialMailCollectionsRequestJob(QObject *parent=0)
Creates a new special mail collections request job.
Definition: specialmailcollectionsrequestjob.cpp:47
Akonadi::SpecialMailCollections::LastType
Definition: specialmailcollections.h:88
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:55 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi/kmime

Skip menu "akonadi/kmime"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal