• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kmail

scalix.cpp

Go to the documentation of this file.
00001 /*
00002  *   This file is part of KMail.
00003  *
00004  *   Copyright (C) 2007 Trolltech ASA. All rights reserved.
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   This program is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License along
00017  *   with this program; if not, write to the Free Software Foundation, Inc.,
00018  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 #include "scalix.h"
00021 #include "kmfolder.h"
00022 #include "kmfolderdir.h"
00023 
00024 #include <QtCore/QMap>
00025 
00026 using namespace Scalix;
00027 
00028 FolderAttributeParser::FolderAttributeParser( const QString &attribute )
00029 {
00030   QStringList parts = attribute.split( ',', QString::SkipEmptyParts );
00031 
00032   for ( int i = 0; i < parts.count(); ++i ) {
00033     if ( parts[i].startsWith( "\\X-SpecialFolder=" ) )
00034       mFolderName = parts[i].mid( 17 );
00035     else if ( parts[i].startsWith( "\\X-FolderClass=" ) )
00036       mFolderClass = parts[i].mid( 15 );
00037   }
00038 }
00039 
00040 QString FolderAttributeParser::folderClass() const
00041 {
00042   return mFolderClass;
00043 }
00044 
00045 QString FolderAttributeParser::folderName() const
00046 {
00047   return mFolderName;
00048 }
00049 
00050 KMFolder* Utils::findStandardResourceFolder( KMFolderDir* folderParentDir,
00051                                              KMail::FolderContentsType contentsType,
00052                                              const QStringList &attributes )
00053 {
00054   QMap<int, QString> typeMap;
00055   typeMap.insert( KMail::ContentsTypeCalendar, "IPF.Appointment" );
00056   typeMap.insert( KMail::ContentsTypeContact, "IPF.Contact" );
00057   typeMap.insert( KMail::ContentsTypeNote, "IPF.StickyNote" );
00058   typeMap.insert( KMail::ContentsTypeTask, "IPF.Task" );
00059 
00060   if ( !typeMap.contains( contentsType ) )
00061     return 0;
00062 
00063   for ( int i = 0; i < attributes.count(); ++i ) {
00064     FolderAttributeParser parser( attributes[ i ] );
00065     if ( parser.folderClass() == typeMap[ contentsType ] ) {
00066       KMFolderNode* node = folderParentDir->hasNamedFolder( parser.folderName() );
00067       if ( node && !node->isDir() )
00068         return static_cast<KMFolder*>( node );
00069     }
00070   }
00071 
00072   return 0;
00073 }
00074 
00075 KMail::FolderContentsType Utils::scalixIdToContentsType( const QString &name )
00076 {
00077   if ( name == "IPF.Appointment" )
00078     return KMail::ContentsTypeCalendar;
00079   else if ( name == "IPF.Contact" )
00080     return KMail::ContentsTypeContact;
00081   else if ( name == "IPF.StickyNote" )
00082     return KMail::ContentsTypeNote;
00083   else if ( name == "IPF.Task" )
00084     return KMail::ContentsTypeTask;
00085   else
00086     return KMail::ContentsTypeMail;
00087 }
00088 
00089 QString Utils::contentsTypeToScalixId( KMail::FolderContentsType type )
00090 {
00091   if ( type == KMail::ContentsTypeCalendar )
00092     return "IPF.Appointment";
00093   else if ( type == KMail::ContentsTypeContact )
00094     return "IPF.Contact";
00095   else if ( type == KMail::ContentsTypeNote )
00096     return "IPF.StickyNote";
00097   else if ( type == KMail::ContentsTypeTask )
00098     return "IPF.Task";
00099   else
00100     return "IPF.Note";
00101 }

kmail

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal