00001
00002
00003
00004
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>
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
00028
00029
00030
00031
00032
00033
00034
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;
00143
bool mReadOnly;
00144 LockType mLockType;
00145
QString mProcmailLockFileName;
00146 };
00147
00148
#endif // kmfoldermbox_h