38 #ifndef KMAILICALIFACEIMPL_H
39 #define KMAILICALIFACEIMPL_H
41 #include "kmailicalIface.h"
42 #include "kmfoldertype.h"
43 #include <kfoldertree.h>
46 #include <tqguardedptr.h>
52 class KMFolderTreeItem;
61 TQGuardedPtr<KMFolder> folder;
66 Accumulator(
const TQString& t,
const TQString& f,
int c )
67 :type( t ), folder( f ), count( c ) {}
69 void add(
const TQString& incidence ) {
70 incidences << incidence;
73 bool isFull() {
return count == 0; }
76 const TQString folder;
77 TQStringList incidences;
90 bool isWritableFolder(
const TQString& type,
const TQString& resource );
92 StorageFormat storageFormat(
const TQString &resource );
99 TQ_UINT32
update(
const TQString& resource,
101 const TQString& subject,
102 const TQString& plainTextBody,
103 const TQMap<TQCString, TQString>& customHeaders,
104 const TQStringList& attachmentURLs,
105 const TQStringList& attachmentMimetypes,
106 const TQStringList& attachmentNames,
107 const TQStringList& deletedAttachments );
109 bool deleteIncidenceKolab(
const TQString& resource,
111 int incidencesKolabCount(
const TQString& mimetype,
112 const TQString& resource );
114 const TQString& resource,
119 TQValueList<SubResource> subresourcesKolab(
const TQString& contentsType );
121 bool triggerSync(
const TQString& contentsType );
125 KURL getAttachment(
const TQString& resource,
127 const TQString& filename );
129 TQString attachmentMimetype(
const TQString &resource,
131 const TQString &filename );
133 TQStringList listAttachments(
const TQString &resource, TQ_UINT32 sernum );
136 bool removeSubresource(
const TQString& );
138 bool addSubresource(
const TQString& resource,
139 const TQString& parent,
140 const TQString& contentsType );
159 bool isStandardResourceFolder(
KMFolder* folder )
const;
184 TQString
folderPixmap( KFolderTreeItem::Type type )
const;
188 TQString
folderName( KFolderTreeItem::Type type,
int language = -1 )
const;
204 bool isEnabled()
const {
return mUseResourceIMAP; }
210 StorageFormat storageFormat(
KMFolder* folder )
const;
215 static const char* annotationForContentsType( KMail::FolderContentsType type );
218 void folderSynced(
KMFolder* folder,
const KURL& folderURL );
221 void folderDeletedOnServer(
const KURL& folderURL );
222 void addFolderChange(
KMFolder* folder, FolderChanges changes );
225 bool isResourceQuiet()
const;
226 void setResourceQuiet(
bool q);
228 static TQMap<TQString, TQString>* getResourceMap() {
return mSubResourceUINamesMap; }
233 void slotFolderRemoved(
KMFolder* folder );
235 void slotIncidenceAdded(
KMFolder* folder, TQ_UINT32 sernum );
236 void slotIncidenceDeleted(
KMFolder* folder, TQ_UINT32 sernum );
237 void slotRefresh(
const TQString& type);
241 void slotFolderPropertiesChanged(
KMFolder* folder );
242 void changeResourceUIName(
const TQString &folderPath,
const TQString &newName );
245 void slotRefreshFolder(
KMFolder* );
246 void slotCheckDone();
247 void slotFolderLocationChanged(
const TQString&,
const TQString& );
248 void slotFolderRenamed();
253 KMFolder* initFolder( KMail::FolderContentsType contentsType );
254 KMFolder* initScalixFolder( KMail::FolderContentsType contentsType );
256 void connectFolder(
KMFolder* folder );
258 KMFolder* extraFolder(
const TQString& type,
const TQString& folder );
260 void syncFolder(
KMFolder* folder )
const;
262 struct StandardFolderSearchResult
264 enum FoundEnum { FoundAndStandard, NotFound, FoundByType, FoundByName };
265 StandardFolderSearchResult() : folder( 0 ) {}
266 StandardFolderSearchResult(
KMFolder* f, FoundEnum e ) : folder( f ), found( e ) {}
267 StandardFolderSearchResult(
const TQValueList<KMFolder*> &f, FoundEnum e ) :
268 folder( f.first() ), folders( f ), found( e ) {}
270 TQValueList<KMFolder*> folders;
274 StandardFolderSearchResult findStandardResourceFolder(
KMFolderDir* folderParentDir, KMail::FolderContentsType contentsType );
275 KMFolder* findResourceFolder(
const TQString& resource );
279 const TQString& attachmentURL,
280 const TQString& attachmentName,
281 const TQString& attachmentMimetype,
284 const TQString& attachmentURL );
285 TQ_UINT32 addIncidenceKolab(
KMFolder& folder,
286 const TQString& subject,
287 const TQString& plainTextBody,
288 const TQMap<TQCString, TQString>& customHeaders,
289 const TQStringList& attachmentURLs,
290 const TQStringList& attachmentNames,
291 const TQStringList& attachmentMimetypes );
292 static bool kolabXMLFoundAndDecoded(
const KMMessage& msg,
const TQString& mimetype, TQString& s );
294 void handleFolderSynced(
KMFolder* folder,
295 const KURL& folderURL,
297 void triggerKolabFreeBusy(
const KURL& folderURL );
299 StorageFormat globalStorageFormat()
const;
301 static bool folderIsAlarmRelevant(
const KMFolder * );
304 TQGuardedPtr<KMFolder> mContacts;
305 TQGuardedPtr<KMFolder> mCalendar;
306 TQGuardedPtr<KMFolder> mNotes;
307 TQGuardedPtr<KMFolder> mTasks;
308 TQGuardedPtr<KMFolder> mJournals;
312 TQDict<KMail::ExtraFolder> mExtraFolders;
314 TQDict<KMail::Accumulator> mAccumulators;
320 FolderInfo( StorageFormat f, FolderChanges c ) :
321 mStorageFormat( f ), mChanges( c ) {}
322 StorageFormat mStorageFormat;
323 FolderChanges mChanges;
326 typedef TQMap<KMFolder*, FolderInfo> FolderInfoMap;
328 FolderInfo readFolderInfo(
const KMFolder *
const folder )
const;
330 FolderInfoMap mFolderInfoMap;
332 unsigned int mFolderLanguage;
336 KMFolderType mFolderType;
338 bool mUseResourceIMAP;
348 TQMap<TQString, TQ_UINT32> mUIDToSerNum;
349 TQMap<TQ_UINT32, bool> mTheUnGetMes;
350 TQMap<TQString, TQString> mPendingUpdates;
351 TQMap<TQString, bool> mInTransit;
352 static TQMap<TQString, TQString> *mSubResourceUINamesMap;
KMail list that manages the contents of one directory that may contain folders and/or other directori...
The implementation of the interface.
static KMMessage * findMessageBySerNum(TQ_UINT32 serNum, KMFolder *folder)
Find message matching a given serial number.
bool isResourceFolder(KMFolder *folder) const
Returns true if resource mode is enabled and folder is one of the resource folders.
void initFolders()
Initialize all folders.
KMFolder * folderFromType(const TQString &type, const TQString &folder)
Get the folder that holds type entries.
TQString icalFolderType(KMFolder *folder) const
Return the ical type of a folder.
TQ_UINT32 update(const TQString &resource, TQ_UINT32 sernum, const TQString &subject, const TQString &plainTextBody, const TQMap< TQCString, TQString > &customHeaders, const TQStringList &attachmentURLs, const TQStringList &attachmentMimetypes, const TQStringList &attachmentNames, const TQStringList &deletedAttachments)
Update a kolab storage entry.
bool hideResourceAccountRoot(KMFolder *folder) const
Returns true if the given folder is the root of the groupware account, groupware folders are hidden,...
TQString folderPixmap(KFolderTreeItem::Type type) const
Returns the name of the standard icon for a folder of given type or TQString() if the type is no grou...
KMMessage * findMessageByUID(const TQString &uid, KMFolder *folder)
Find message matching a given UID.
KFolderTreeItem::Type folderType(KMFolder *folder) const
Returns the resource folder type.
void deleteMsg(KMMessage *msg)
Convenience function to delete a message.
void cleanup()
Disconnect all slots and close the dirs.
TQMap< TQ_UINT32, TQString > incidencesKolab(const TQString &mimetype, const TQString &resource, int startIndex, int nbMessages)
bool hideResourceFolder(KMFolder *folder) const
Returns true if isResourceFolder( folder ) returns true, and imap folders should be hidden.
TQString folderName(KFolderTreeItem::Type type, int language=-1) const
Returns the localized name of a folder of given type.
void folderContentsTypeChanged(KMFolder *, KMail::FolderContentsType)
Called when a folders contents have changed.
void setStorageFormat(KMFolder *folder, StorageFormat format)
Set the storage format of a given folder. Called when seeing the kolab annotation.