kmail Library API Documentation

kmfolder.h

00001 /* -*- mode: C++ -*- 00002 * Virtual base class for mail folder 00003 * 00004 * Author: Stefan Taferner <taferner@kde.org> 00005 * This code is under GPL 00006 * 00007 */ 00008 #ifndef kmfolder_h 00009 #define kmfolder_h 00010 00011 // for large file support 00012 #include <config.h> 00013 00014 #include "kmfoldernode.h" 00015 #include "kmfoldertype.h" 00016 #include "kmmsginfo.h" 00017 #include "kmglobal.h" 00018 #include "folderjob.h" 00019 using KMail::FolderJob; 00020 #include "mailinglist-magic.h" 00021 using KMail::MailingList; 00022 00023 #include "mimelib/string.h" 00024 00025 #include <qptrvector.h> 00026 #include <sys/types.h> 00027 #include <stdio.h> 00028 00029 class KMMessage; 00030 class KMFolderDir; 00031 class KMAcctList; 00032 class KMMsgDict; 00033 class KMMsgDictREntry; 00034 class QTimer; 00035 class FolderStorage; 00036 class KMFolderTreeItem; 00037 00038 namespace KMail { 00039 class AttachmentStrategy; 00040 } 00041 using KMail::AttachmentStrategy; 00042 00043 typedef QValueList<Q_UINT32> SerNumList; 00044 00055 class KMFolder: public KMFolderNode 00056 { 00057 Q_OBJECT 00058 friend class KMFolderJob; 00059 public: 00060 00061 00065 KMFolder( KMFolderDir* parent, const QString& name, 00066 KMFolderType aFolderType ); 00067 ~KMFolder(); 00068 00070 void readConfig( KConfig* config ); 00071 00073 void writeConfig( KConfig* config ) const; 00074 00075 FolderStorage* storage() { return mStorage; } 00076 00078 KMFolderType folderType() const; 00079 00081 QString fileName() const; 00082 00084 QString location() const; 00085 00087 QString indexLocation() const; 00088 00090 QString subdirLocation() const; 00091 00094 KMFolderDir* child() const 00095 { return mChild; } 00096 00098 KMFolderDir* createChildFolder(); 00099 00101 void setChild( KMFolderDir* aChild ); 00102 00104 bool noContent() const; 00105 00107 void setNoContent(bool aNoContent); 00108 00110 bool noChildren() const; 00111 00113 void setNoChildren(bool aNoChildren); 00114 00116 KMMessage* getMsg(int idx); 00117 00119 KMMsgInfo* unGetMsg(int idx); 00120 00122 bool isMessage(int idx); 00123 00125 QCString& getMsgString(int idx, QCString& mDest); 00126 00128 DwString getDwString(int idx); 00129 00133 void ignoreJobsForMessage( KMMessage* ); 00134 00139 FolderJob* createJob( KMMessage *msg, FolderJob::JobType jt = FolderJob::tGetMessage, 00140 KMFolder *folder = 0, QString partSpecifier = QString::null, 00141 const AttachmentStrategy *as = 0 ) const; 00142 FolderJob* createJob( QPtrList<KMMessage>& msgList, const QString& sets, 00143 FolderJob::JobType jt = FolderJob::tGetMessage, 00144 KMFolder *folder = 0 ) const; 00145 00150 const KMMsgBase* getMsgBase(int idx) const; 00151 KMMsgBase* getMsgBase(int idx); 00152 00154 const KMMsgBase* operator[](int idx) const; 00155 00157 KMMsgBase* operator[](int idx); 00158 00161 KMMessage* take(int idx); 00162 void take(QPtrList<KMMessage> msgList); 00163 00170 int addMsg(KMMessage* msg, int* index_return = 0); 00171 00175 int addMsgKeepUID(KMMessage* msg, int* index_return = 0); 00176 00179 void emitMsgAddedSignals(int idx); 00180 00182 void removeMsg(int i, bool imapQuiet = FALSE); 00183 void removeMsg(QPtrList<KMMessage> msgList, bool imapQuiet = FALSE); 00184 00187 int expungeOldMsg(int days); 00188 00193 int moveMsg(KMMessage* msg, int* index_return = 0); 00194 int moveMsg(QPtrList<KMMessage>, int* index_return = 0); 00195 00197 int find(const KMMsgBase* msg) const; 00198 int find( const KMMessage * msg ) const; 00199 00201 int count(bool cache = false) const; 00202 00204 int countUnread(); 00205 00208 int countUnreadRecursive(); 00209 00212 void msgStatusChanged( const KMMsgStatus oldStatus, 00213 const KMMsgStatus newStatus, 00214 int idx); 00215 00221 int open(); 00222 00225 int canAccess(); 00226 00229 void close(bool force=FALSE); 00230 00232 void sync(); 00233 00235 bool isOpened() const; 00236 00238 void markNewAsUnread(); 00239 00241 void markUnreadAsRead(); 00242 00246 int create(bool imap = FALSE); 00247 00252 void remove(); 00253 00257 int expunge(); 00258 00259 enum CompactOptions { CompactLater, CompactNow, CompactSilentlyNow }; 00266 void compact( CompactOptions options ); 00267 00270 int rename(const QString& newName, KMFolderDir *aParent = 0); 00271 00273 bool autoCreateIndex() const; 00274 00277 void setAutoCreateIndex(bool); 00278 00282 bool dirty() const; 00283 00285 void setDirty(bool f); 00286 00288 bool needsCompacting() const; 00289 void setNeedsCompacting(bool f); 00290 00299 void quiet(bool beQuiet); 00300 00302 bool isReadOnly() const; 00303 00308 bool isSystemFolder() const { return mIsSystemFolder; } 00309 void setSystemFolder(bool itIs) { mIsSystemFolder=itIs; } 00310 00312 virtual QString label() const; 00313 void setLabel( const QString& l ) { mLabel = l; } 00314 00316 virtual QString systemLabel() const { return mSystemLabel; } 00317 void setSystemLabel( const QString& l ) { mSystemLabel = l; } 00318 00320 virtual QString prettyURL() const; 00321 00323 const char* type() const; 00324 00326 bool hasAccounts() const; 00327 00329 void setMailingListEnabled( bool enabled ); 00330 bool isMailingListEnabled() const { return mMailingListEnabled; } 00331 00332 void setMailingList( const MailingList& mlist ); 00333 MailingList mailingList() const 00334 { return mMailingList; } 00335 QString mailingListPostAddress() const; 00336 00337 void setIdentity(uint identity); 00338 uint identity() const { return mIdentity; } 00339 00341 QString whoField() const { return mWhoField; } 00342 void setWhoField(const QString& aWhoField); 00343 00345 QString userWhoField(void) { return mUserWhoField; } 00346 void setUserWhoField(const QString &whoField,bool writeConfig=true); 00347 00349 void correctUnreadMsgsCount(); 00350 00352 QString idString() const; 00353 00357 void setAutoExpire(bool enabled); 00358 00362 bool isAutoExpire() const { return mExpireMessages; } 00363 00369 void setUnreadExpireAge(int age); 00370 00375 void setUnreadExpireUnits(ExpireUnits units); 00376 00382 void setReadExpireAge(int age); 00383 00388 void setReadExpireUnits(ExpireUnits units); 00389 00394 int getUnreadExpireAge() const { return mUnreadExpireAge; } 00395 00400 int getReadExpireAge() const { return mReadExpireAge; } 00401 00406 ExpireUnits getUnreadExpireUnits() const { return mUnreadExpireUnits; } 00407 00412 ExpireUnits getReadExpireUnits() const { return mReadExpireUnits; } 00413 00414 enum ExpireAction { ExpireDelete, ExpireMove }; 00418 ExpireAction expireAction() const { return mExpireAction; } 00419 void setExpireAction( ExpireAction a ); 00420 00424 QString expireToFolderId() const { return mExpireToFolderId; } 00425 void setExpireToFolderId( const QString& id ); 00426 00431 void expireOldMessages( bool immediate ); 00432 00435 int writeIndex( bool createEmptyIndex = false ); 00436 00439 void fillMsgDict(KMMsgDict *dict); 00440 00442 int writeMsgDict(KMMsgDict *dict = 0); 00443 00445 int touchMsgDict(); 00446 00448 int appendtoMsgDict(int idx = -1); 00449 00451 void setRDict(KMMsgDictREntry *rentry); 00452 00454 KMMsgDictREntry *rDict() const; 00455 00457 void setStatus(int idx, KMMsgStatus status, bool toggle=false); 00458 00460 void setStatus(QValueList<int>& ids, KMMsgStatus status, bool toggle=false); 00461 00463 bool useCustomIcons() const { return mUseCustomIcons; } 00464 void setUseCustomIcons(bool useCustomIcons) { mUseCustomIcons = useCustomIcons; } 00465 QString normalIconPath() const { return mNormalIconPath; } 00466 QString unreadIconPath() const { return mUnreadIconPath; } 00467 void setIconPaths(const QString &normalPath, const QString &unreadPath); 00468 00469 void removeJobs(); 00470 00474 static size_t crlf2lf( char* str, const size_t strLen ); 00475 00476 void daysToExpire( int& unreadDays, int& readDays ); 00477 00482 KMFolder* trashFolder() const; 00483 00488 bool putRepliesInSameFolder() const { return mPutRepliesInSameFolder; } 00489 void setPutRepliesInSameFolder( bool b ) { mPutRepliesInSameFolder = b; } 00490 00495 bool ignoreNewMail() const { return mIgnoreNewMail; } 00496 void setIgnoreNewMail( bool b ) { mIgnoreNewMail = b; } 00497 00498 signals: 00501 void changed(); 00502 00505 void cleared(); 00506 00509 void expunged(); 00510 00512 void iconsChanged(); 00513 00515 void nameChanged(); 00516 00518 void msgRemoved(KMFolder*, Q_UINT32 sernum); 00519 00521 void msgRemoved(int idx,QString msgIdMD5, QString strippedSubjMD5); 00522 void msgRemoved(KMFolder*); 00523 00525 void msgAdded(int idx); 00526 void msgAdded(KMFolder*, Q_UINT32 sernum); 00527 00529 void msgChanged(KMFolder*, Q_UINT32 sernum, int delta); 00530 00532 void msgHeaderChanged(KMFolder*, int); 00533 00535 void statusMsg(const QString&); 00536 00538 void numUnreadMsgsChanged( KMFolder* ); 00539 00541 void removed(KMFolder*, bool); 00542 00543 public slots: 00545 int updateIndex(); 00546 00549 void reallyAddMsg(KMMessage* aMsg); 00550 00553 void reallyAddCopyOfMsg(KMMessage* aMsg); 00554 00555 private: 00556 FolderStorage* mStorage; 00557 KMFolderDir* mParent; 00558 KMFolderDir* mChild; 00559 bool mIsSystemFolder; 00560 00562 QString mLabel; 00563 QString mSystemLabel; 00564 00566 bool mExpireMessages; // TRUE if old messages are expired 00567 int mUnreadExpireAge; // Given in unreadExpireUnits 00568 int mReadExpireAge; // Given in readExpireUnits 00569 ExpireUnits mUnreadExpireUnits; 00570 ExpireUnits mReadExpireUnits; 00571 ExpireAction mExpireAction; 00572 QString mExpireToFolderId; 00573 00575 bool mUseCustomIcons; 00576 QString mNormalIconPath; 00577 QString mUnreadIconPath; 00578 00580 bool mMailingListEnabled; 00581 MailingList mMailingList; 00582 00583 uint mIdentity; 00584 00586 QString mWhoField, mUserWhoField; 00587 00589 bool mPutRepliesInSameFolder; 00590 00592 bool mIgnoreNewMail; 00593 }; 00594 00595 #endif /*kmfolder_h*/
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:52:31 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003