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(
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;
00138 LockType mLockType;
00139 QString mProcmailLockFileName;
00140 };
00141
00142
#endif // kmfoldermbox_h