00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KMBOX_MBOX_H
00021 #define KMBOX_MBOX_H
00022
00023 #include "kmbox_export.h"
00024 #include "mboxentry.h"
00025
00026 #include <kmime/kmime_message.h>
00027
00028 namespace KMBox {
00029
00030 class MBoxPrivate;
00031
00038 class KMBOX_EXPORT MBox
00039 {
00040 public:
00044 enum LockType {
00045 ProcmailLockfile,
00046 MuttDotlock,
00047 MuttDotlockPrivileged,
00048 None
00049 };
00050
00054 MBox();
00055
00061 ~MBox();
00062
00073 MBoxEntry appendMessage( const KMime::Message::Ptr &message );
00074
00082 MBoxEntry::List entries( const MBoxEntry::List &deletedEntries = MBoxEntry::List() ) const;
00083
00087 QString fileName() const;
00088
00101 bool load( const QString &fileName );
00102
00115 bool lock();
00116
00120 bool locked() const;
00121
00141 bool purge( const MBoxEntry::List &deletedEntries, QList<MBoxEntry::Pair> *movedEntries = 0 );
00142
00155 KMime::Message *readMessage( const MBoxEntry &entry );
00156
00168 QByteArray readMessageHeaders( const MBoxEntry &entry );
00169
00181 QByteArray readRawMessage( const MBoxEntry &entry );
00182
00194 bool save( const QString &fileName = QString() );
00195
00205 bool setLockType( LockType ltype );
00206
00213 void setLockFile( const QString &lockFile );
00214
00221 void setUnlockTimeout( int msec );
00222
00230 bool unlock();
00231
00232 private:
00233
00234 friend class MBoxPrivate;
00235 MBoxPrivate * const d;
00236
00237 };
00238
00239 }
00240
00241 #endif // KMBOX_MBOX_H