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

akonadi

specialmailcollectionsrequestjob.cpp
00001 /*
00002     Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
00003 
00004     This library is free software; you can redistribute it and/or modify it
00005     under the terms of the GNU Library General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or (at your
00007     option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful, but WITHOUT
00010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012     License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to the
00016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301, USA.
00018 */
00019 
00020 #include "specialmailcollectionsrequestjob.h"
00021 
00022 #include "specialmailcollections.h"
00023 
00024 #include <kglobal.h>
00025 #include <klocale.h>
00026 #include <kstandarddirs.h>
00027 
00028 using namespace Akonadi;
00029 
00030 #ifndef KDE_USE_FINAL
00031 static inline QByteArray enumToType( SpecialMailCollections::Type type )
00032 {
00033   switch ( type ) {
00034     case SpecialMailCollections::Root: return "local-mail"; break;
00035     case SpecialMailCollections::Inbox: return "inbox"; break;
00036     case SpecialMailCollections::Outbox: return "outbox"; break;
00037     case SpecialMailCollections::SentMail: return "sent-mail"; break;
00038     case SpecialMailCollections::Trash: return "trash"; break;
00039     case SpecialMailCollections::Drafts: return "drafts"; break;
00040     case SpecialMailCollections::Templates: return "templates"; break;
00041     case SpecialMailCollections::LastType: // fallthrough
00042     default: return QByteArray(); break;
00043   }
00044 }
00045 #endif
00046 
00047 SpecialMailCollectionsRequestJob::SpecialMailCollectionsRequestJob( QObject *parent )
00048   : SpecialCollectionsRequestJob( SpecialMailCollections::self(), parent ),
00049     d( 0 )
00050 {
00051   static QMap<QByteArray, QString> displayNameMap;
00052   displayNameMap.insert( "local-mail", i18nc( "local mail folder", "Local Folders" ) );
00053   displayNameMap.insert( "inbox", i18nc( "local mail folder", "inbox" ) );
00054   displayNameMap.insert( "outbox", i18nc( "local mail folder", "outbox" ) );
00055   displayNameMap.insert( "sent-mail", i18nc( "local mail folder", "sent-mail" ) );
00056   displayNameMap.insert( "trash", i18nc( "local mail folder", "trash" ) );
00057   displayNameMap.insert( "drafts", i18nc( "local mail folder", "drafts" ) );
00058   displayNameMap.insert( "templates", i18nc( "local mail folder", "templates" ) );
00059 
00060   static QMap<QByteArray, QString> iconNameMap;
00061   iconNameMap.insert( "local-mail", QLatin1String( "folder" ) );
00062   iconNameMap.insert( "inbox", QLatin1String( "mail-folder-inbox" ) );
00063   iconNameMap.insert( "outbox", QLatin1String( "mail-folder-outbox" ) );
00064   iconNameMap.insert( "sent-mail", QLatin1String( "mail-folder-sent" ) );
00065   iconNameMap.insert( "trash", QLatin1String( "user-trash" ) );
00066   iconNameMap.insert( "drafts", QLatin1String( "document-properties" ) );
00067   iconNameMap.insert( "templates", QLatin1String( "document-new" ) );
00068 
00069   QVariantMap options;
00070   options.insert( QLatin1String( "Name" ), displayNameMap.value( "local-mail" ) );
00071   options.insert( QLatin1String( "TopLevelIsContainer" ), true );
00072   options.insert( QLatin1String( "Path" ), QString(KGlobal::dirs()->localxdgdatadir() + QLatin1String( "local-mail" )) );
00073 
00074   setDefaultResourceType( QLatin1String( "akonadi_maildir_resource" ) );
00075   setDefaultResourceOptions( options );
00076 
00077   setTypes( displayNameMap.keys() );
00078   setNameForTypeMap( displayNameMap );
00079   setIconForTypeMap( iconNameMap );
00080 }
00081 
00082 SpecialMailCollectionsRequestJob::~SpecialMailCollectionsRequestJob()
00083 {
00084 }
00085 
00086 void SpecialMailCollectionsRequestJob::requestDefaultCollection( SpecialMailCollections::Type type )
00087 {
00088   return SpecialCollectionsRequestJob::requestDefaultCollection( enumToType( type ) );
00089 }
00090 
00091 void SpecialMailCollectionsRequestJob::requestCollection( SpecialMailCollections::Type type, const AgentInstance &instance )
00092 {
00093   return SpecialCollectionsRequestJob::requestCollection( enumToType( type ), instance );
00094 }
00095 
00096 #include "specialmailcollectionsrequestjob.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu Aug 2 2012 15:25:19 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs-4.8.5 API Reference

Skip menu "kdepimlibs-4.8.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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