kmail Library API Documentation

kmfoldermbox.h

00001 /* Local Mail folder
00002  *
00003  * Author: Stefan Taferner <taferner@kde.org>
00004  * This code is under GPL
00005  *
00006 */
00007 #ifndef kmfoldermbox_h
00008 #define kmfoldermbox_h
00009 
00010 #include "kmfolderindex.h"
00011 #include "mboxjob.h"
00012 
00013 #include <sys/types.h> // for size_t
00014 
00015 namespace KMail {
00016   class FolderJob;
00017   class MboxJob;
00018   class AttachmentStrategy;
00019 }
00020 using KMail::FolderJob;
00021 using KMail::MboxJob;
00022 using KMail::AttachmentStrategy;
00023 
00024 class KMFolderMbox;
00025 
00026 
00027 /* Mail folder.
00028  * (description will be here).
00029  *
00030  * Accounts:
00031  *   The accounts (of KMail) that are fed into the folder are
00032  *   represented as the children of the folder. They are only stored here
00033  *   during runtime to have a reference for which accounts point to a
00034  *   specific folder.
00035  */
00036 
00037 class KMFolderMbox : public KMFolderIndex
00038 {
00039   Q_OBJECT
00040   friend class MboxJob;
00041 public:
00042 
00043 
00047   KMFolderMbox(KMFolder* folder, const char* name=0);
00048   virtual ~KMFolderMbox();
00049 
00051   virtual KMFolderType folderType() const { return KMFolderTypeMbox; }
00052 
00054   virtual QCString& getMsgString(int idx, QCString& mDest);
00055   DwString getDwString(int idx);
00056 
00063   virtual int addMsg( KMMessage* msg, int* index_return = 0 );
00064 
00070   virtual int open();
00071 
00074   virtual void close(bool force=FALSE);
00075 
00076   virtual int canAccess();
00077 
00079   virtual void sync();
00080 
00084   virtual int create(bool imap = FALSE);
00085 
00088   virtual int compact( bool silent );
00089 
00092   int compact( unsigned int startIndex, int nbMessages, FILE* tmpFile, off_t& offs, bool& done );
00093 
00095   virtual bool isReadOnly() const { return mReadOnly; }
00096 
00098   bool isLocked() const { return mFilesLocked; }
00099 
00100   void setLockType( LockType ltype=FCNTL );
00101 
00102   void setProcmailLockFileName( const QString& );
00103 
00104   static QCString escapeFrom( const QCString & str );
00105 
00106   virtual IndexStatus indexStatus();
00107 
00108 protected:
00109   virtual FolderJob* doCreateJob( KMMessage *msg, FolderJob::JobType jt, KMFolder *folder,
00110                                   QString partSpecifier, const AttachmentStrategy *as ) const;
00111   virtual FolderJob* doCreateJob( QPtrList<KMMessage>& msgList, const QString& sets,
00112                                   FolderJob::JobType jt, KMFolder *folder ) const;
00115   virtual KMMessage* readMsg(int idx);
00116 
00120   virtual int createIndexFromContents();
00121 
00124   virtual int lock();
00125 
00128   virtual int unlock();
00129 
00133   virtual int removeContents();
00134 
00138   virtual int expungeContents();
00139 
00140 private:
00141   FILE *mStream;
00142   bool mFilesLocked; // TRUE if the files of the folder are locked (writable)
00143   bool mReadOnly; // true if locking failed
00144   LockType mLockType;
00145   QString mProcmailLockFileName;
00146 };
00147 
00148 #endif // kmfoldermbox_h
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Aug 23 18:21:22 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003