kmail
kmfoldermaildir.h
Go to the documentation of this file.00001 #ifndef kmfoldermaildir_h
00002 #define kmfoldermaildir_h
00003
00004 #include "kmfolderindex.h"
00005
00006 #include <QList>
00007
00008 class KJob;
00009
00010 class KMFolderMaildir;
00011 namespace KMail {
00012 class FolderJob;
00013 class MaildirJob;
00014 class AttachmentStrategy;
00015 }
00016
00017 using KMail::FolderJob;
00018 using KMail::MaildirJob;
00019 using KMail::AttachmentStrategy;
00020
00021 class KMFolderMaildir : public KMFolderIndex
00022 {
00023 Q_OBJECT
00024 friend class ::KMail::MaildirJob;
00025 public:
00029 explicit KMFolderMaildir(KMFolder* folder, const char* name=0);
00030 virtual ~KMFolderMaildir();
00031
00033 virtual KMFolderType folderType() const { return KMFolderTypeMaildir; }
00034
00036 virtual DwString getDwString(int idx);
00037
00040 virtual KMMessage* take(int idx);
00041
00048 virtual int addMsg(KMMessage* msg, int* index_return = 0);
00049
00051 virtual void removeMsg(int i, bool imapQuiet = false);
00052
00053
00054
00055 virtual void msgStatusChanged( const MessageStatus& oldStatus,
00056 const MessageStatus& newStatus,
00057 int idx);
00058
00064 virtual int open( const char *owner );
00065
00066 virtual bool canAccess() const;
00067
00069 virtual void sync();
00070
00073 virtual void close( const char *owner, bool force=false );
00074
00081 static int createMaildirFolders( const QString & folderPath );
00082
00083 static QString constructValidFileName( const QString & filename = QString(),
00084 const MessageStatus & status = MessageStatus::statusNew() );
00085
00086 static bool removeFile( const QString & folderPath,
00087 const QString & filename );
00088
00090 virtual int create();
00091
00094 int compact( unsigned int startIndex, int nbMessages, const QStringList& entryList, bool& done );
00095
00098 virtual int compact( bool silent );
00099
00101 virtual bool isReadOnly() const { return false; }
00102
00104 virtual qint64 doFolderSize() const;
00105
00109 virtual int createIndexFromContents();
00110
00111 protected:
00112 virtual FolderJob* doCreateJob( KMMessage *msg, FolderJob::JobType jt, KMFolder *folder,
00113 const QString &partSpecifier, const AttachmentStrategy *as ) const;
00114 virtual FolderJob* doCreateJob( QList<KMMessage*>& msgList, const QString& sets,
00115 FolderJob::JobType jt, KMFolder *folder ) const;
00118 virtual KMMessage* readMsg(int idx);
00119
00123 virtual int removeContents();
00124
00128 virtual int expungeContents();
00129
00139 int addMsgInternal( KMMessage* msg, int* index_return = 0, bool stripUid=false );
00140
00141 private slots:
00142 void slotDirSizeJobResult( KJob* job );
00143
00144 private:
00145 void readFileHeaderIntern( const QString& dir, const QString& file,
00146 MessageStatus& status);
00147 QString moveInternal( const QString& oldLoc, const QString& newLoc,
00148 KMMsgInfo* mi);
00149 QString moveInternal( const QString& oldLoc, const QString& newLoc,
00150 QString& aFileName, const MessageStatus& status );
00151 bool removeFile( const QString& filename );
00152
00158 virtual IndexStatus indexStatus();
00159
00160 int mIdxCount;
00161 mutable bool mCurrentlyCheckingFolderSize;
00162 };
00163 #endif