22 #include <tqstringlist.h>
27 #include "kmfolderdir.h"
29 using namespace Scalix;
31 FolderAttributeParser::FolderAttributeParser(
const TQString &attribute )
33 TQStringList parts = TQStringList::split(
",", attribute,
false );
35 for ( uint i = 0; i < parts.count(); ++i ) {
36 if ( parts[i].startsWith(
"\\X-SpecialFolder=" ) )
37 mFolderName = parts[i].mid( 17 );
38 else if ( parts[i].startsWith(
"\\X-FolderClass=" ) )
39 mFolderClass = parts[i].mid( 15 );
43 TQString FolderAttributeParser::folderClass()
const
48 TQString FolderAttributeParser::folderName()
const
54 KMail::FolderContentsType contentsType,
55 const TQStringList &attributes )
57 TQMap<int, TQString> typeMap;
58 typeMap.insert( KMail::ContentsTypeCalendar,
"IPF.Appointment" );
59 typeMap.insert( KMail::ContentsTypeContact,
"IPF.Contact" );
60 typeMap.insert( KMail::ContentsTypeNote,
"IPF.StickyNote" );
61 typeMap.insert( KMail::ContentsTypeTask,
"IPF.Task" );
63 if ( !typeMap.contains( contentsType ) )
66 for ( uint i = 0; i < attributes.count(); ++i ) {
68 if ( parser.folderClass() == typeMap[ contentsType ] ) {
69 KMFolderNode* node = folderParentDir->
hasNamedFolder( parser.folderName() );
70 if ( node && !node->isDir() )
71 return static_cast<KMFolder*
>( node );
78 KMail::FolderContentsType Utils::scalixIdToContentsType(
const TQString &name )
80 if ( name ==
"IPF.Appointment" )
81 return KMail::ContentsTypeCalendar;
82 else if ( name ==
"IPF.Contact" )
83 return KMail::ContentsTypeContact;
84 else if ( name ==
"IPF.StickyNote" )
85 return KMail::ContentsTypeNote;
86 else if ( name ==
"IPF.Task" )
87 return KMail::ContentsTypeTask;
89 return KMail::ContentsTypeMail;
92 TQString Utils::contentsTypeToScalixId( KMail::FolderContentsType type )
94 if ( type == KMail::ContentsTypeCalendar )
95 return "IPF.Appointment";
96 else if ( type == KMail::ContentsTypeContact )
98 else if ( type == KMail::ContentsTypeNote )
99 return "IPF.StickyNote";
100 else if ( type == KMail::ContentsTypeTask )
KMail list that manages the contents of one directory that may contain folders and/or other directori...
virtual KMFolderNode * hasNamedFolder(const TQString &name)
Returns folder with given name or zero if it does not exist.
This class takes a folder attribute string as argument and provides access to the single parts.