kmail
kmfoldermbox.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef kmfoldermbox_h
00021 #define kmfoldermbox_h
00022
00023 #include "kmfolderindex.h"
00024 #include "mboxjob.h"
00025
00026 #include <sys/types.h>
00027
00028 namespace KMail {
00029 class FolderJob;
00030 class MboxJob;
00031 class AttachmentStrategy;
00032 }
00033 using KMail::FolderJob;
00034 using KMail::MboxJob;
00035 using KMail::AttachmentStrategy;
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 class KMFolderMbox : public KMFolderIndex
00048 {
00049 Q_OBJECT
00050 TQ_OBJECT
00051 friend class ::KMail::MboxJob;
00052 public:
00053
00054
00058 KMFolderMbox(KMFolder* folder, const char* name=0);
00059 virtual ~KMFolderMbox();
00060
00062 virtual KMFolderType folderType() const { return KMFolderTypeMbox; }
00063
00065 DwString getDwString(int idx);
00066
00073 virtual int addMsg( KMMessage* msg, int* index_return = 0 );
00074
00080 virtual int open(const char *owner);
00081
00083 virtual void reallyDoClose(const char *owner);
00084
00085 virtual int canAccess();
00086
00088 virtual void sync();
00089
00091 virtual int create();
00092
00095 virtual int compact( bool silent );
00096
00099 int compact( unsigned int startIndex, int nbMessages, FILE* tmpFile, off_t& offs, bool& done );
00100
00102 virtual bool isReadOnly() const { return mReadOnly; }
00103
00105 bool isLocked() const { return mFilesLocked; }
00106
00107 void setLockType( LockType ltype=FCNTL );
00108
00109 void setProcmailLockFileName( const TQString& );
00110
00111 static TQByteArray escapeFrom( const DwString & str );
00112
00113 virtual IndexStatus indexStatus();
00114
00116 virtual TQ_INT64 doFolderSize() const;
00117
00118 protected:
00119 virtual FolderJob* doCreateJob( KMMessage *msg, FolderJob::JobType jt, KMFolder *folder,
00120 TQString partSpecifier, const AttachmentStrategy *as ) const;
00121 virtual FolderJob* doCreateJob( TQPtrList<KMMessage>& msgList, const TQString& sets,
00122 FolderJob::JobType jt, KMFolder *folder ) const;
00125 virtual KMMessage* readMsg(int idx);
00126
00130 virtual int createIndexFromContents();
00131
00134 virtual int lock();
00135
00138 virtual int unlock();
00139
00143 virtual int removeContents();
00144
00148 virtual int expungeContents();
00149
00150 private:
00151 FILE *mStream;
00152 bool mFilesLocked;
00153 bool mReadOnly;
00154 LockType mLockType;
00155 TQString mProcmailLockFileName;
00156 };
00157
00158 #endif // kmfoldermbox_h
|