kmail

kmfoldermaildir.h

00001 #ifndef kmfoldermaildir_h
00002 #define kmfoldermaildir_h
00003 
00004 #include "kmfolderindex.h"
00005 
00006 
00007 class KMFolderMaildir;
00008 namespace KMail {
00009   class FolderJob;
00010   class MaildirJob;
00011   class AttachmentStrategy;
00012 }
00013 namespace KIO {
00014     class Job;
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   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   virtual void removeMsg(QPtrList<KMMessage> msgList, bool imapQuiet = FALSE)
00053   { return KMFolderIndex::removeMsg(msgList, imapQuiet); }
00054 
00055   // Called by KMMsgBase::setStatus when status of a message has changed
00056   // required to keep the number unread messages variable current.
00057   virtual void msgStatusChanged( const KMMsgStatus oldStatus,
00058                                  const KMMsgStatus newStatus,
00059                  int idx);
00060 
00066   virtual int open(const char *owner);
00067 
00068   virtual int canAccess();
00069 
00071   virtual void sync();
00072 
00075   virtual void reallyDoClose(const char *owner);
00076 
00083   static int createMaildirFolders( const QString & folderPath );
00084 
00085   static QString constructValidFileName( const QString & filename = QString(),
00086                                          KMMsgStatus status = KMMsgStatusNew );
00087 
00088   static bool removeFile( const QString & folderPath,
00089                           const QString & filename );
00090 
00092   virtual int create();
00093 
00096   int compact( unsigned int startIndex, int nbMessages, const QStringList& entryList, bool& done );
00097 
00100   virtual int compact( bool silent );
00101 
00103   virtual bool isReadOnly() const { return false; }
00104  
00106   size_t doFolderSize() const;
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 removeContents();
00121 
00125   virtual int expungeContents();
00126 
00130   virtual int createIndexFromContents();
00131 
00141   int addMsgInternal( KMMessage* msg, int* index_return = 0, bool stripUid=false );
00142 
00143 private slots:
00144   void slotDirSizeJobResult( KIO::Job* job );
00145 
00146 private:
00147   void readFileHeaderIntern(const QString& dir, const QString& file, KMMsgStatus status);
00148   QString moveInternal(const QString& oldLoc, const QString& newLoc, KMMsgInfo* mi);
00149   QString moveInternal(const QString& oldLoc, const QString& newLoc, QString& aFileName, KMMsgStatus status);
00150   bool removeFile(const QString& filename);
00151 
00157   virtual IndexStatus indexStatus();
00158 
00159   QStrList mIdxToFileList;
00160   int mIdxCount;
00161   mutable bool mCurrentlyCheckingFolderSize;
00162 };
00163 #endif /*kmfoldermaildir_h*/
KDE Home | KDE Accessibility Home | Description of Access Keys