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(KMFolderDir* parent=0, const QString& name=QString::null);
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();
00089 
00091   virtual bool isReadOnly() const { return !mFilesLocked; }
00092 
00093   void setLockType( LockType ltype=FCNTL );
00094 
00095   void setProcmailLockFileName( const QString& );
00096 
00097   virtual QCString protocol() const { return "mbox"; }
00098 
00099   static QCString escapeFrom( const QCString & str );
00100 
00101 protected:
00102   virtual FolderJob* doCreateJob( KMMessage *msg, FolderJob::JobType jt, KMFolder *folder,
00103                                   QString partSpecifier, const AttachmentStrategy *as ) const;
00104   virtual FolderJob* doCreateJob( QPtrList<KMMessage>& msgList, const QString& sets,
00105                                   FolderJob::JobType jt, KMFolder *folder ) const;
00108   virtual KMMessage* readMsg(int idx);
00109 
00113   virtual int createIndexFromContents();
00114 
00117   virtual int lock();
00118 
00121   virtual int unlock();
00122 
00123   virtual IndexStatus indexStatus();
00124 
00128   virtual int removeContents();
00129 
00133   virtual int expungeContents();
00134 
00135 private:
00136   FILE *mStream;
00137   bool mFilesLocked; // TRUE if the files of the folder are locked (writable)
00138   LockType mLockType;
00139   QString mProcmailLockFileName;
00140 };
00141 
00142 #endif // kmfoldermbox_h
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:27 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003