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 using KMail::FolderJob;
00014 using KMail::MaildirJob;
00015 using KMail::AttachmentStrategy;
00016 
00017 class KMFolderMaildir : public KMFolderIndex
00018 {
00019   Q_OBJECT
00020   friend class ::KMail::MaildirJob;
00021 public:
00025   KMFolderMaildir(KMFolder* folder, const char* name=0);
00026   virtual ~KMFolderMaildir();
00027 
00029   virtual KMFolderType folderType() const { return KMFolderTypeMaildir; }
00030 
00032   virtual DwString getDwString(int idx);
00033 
00036   virtual KMMessage* take(int idx);
00037 
00044   virtual int addMsg(KMMessage* msg, int* index_return = 0);
00045 
00047   virtual void removeMsg(int i, bool imapQuiet = FALSE);
00048   virtual void removeMsg(QPtrList<KMMessage> msgList, bool imapQuiet = FALSE)
00049   { return KMFolderIndex::removeMsg(msgList, imapQuiet); }
00050 
00051   // Called by KMMsgBase::setStatus when status of a message has changed
00052   // required to keep the number unread messages variable current.
00053   virtual void msgStatusChanged( const KMMsgStatus oldStatus,
00054                                  const KMMsgStatus newStatus,
00055                  int idx);
00056 
00062   virtual int open(const char *owner);
00063 
00064   virtual int canAccess();
00065 
00067   virtual void sync();
00068 
00071   virtual void reallyDoClose(const char *owner);
00072 
00079   static int createMaildirFolders( const QString & folderPath );
00080 
00081   static QString constructValidFileName( const QString & filename = QString(),
00082                                          KMMsgStatus status = KMMsgStatusNew );
00083 
00084   static bool removeFile( const QString & folderPath,
00085                           const QString & filename );
00086 
00088   virtual int create();
00089 
00092   int compact( unsigned int startIndex, int nbMessages, const QStringList& entryList, bool& done );
00093 
00096   virtual int compact( bool silent );
00097 
00099   virtual bool isReadOnly() const { return false; }
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 removeContents();
00114 
00118   virtual int expungeContents();
00119 
00123   virtual int createIndexFromContents();
00124 
00134   int addMsgInternal( KMMessage* msg, int* index_return = 0, bool stripUid=false );
00135 
00136 private:
00137   void readFileHeaderIntern(const QString& dir, const QString& file, KMMsgStatus status);
00138   QString moveInternal(const QString& oldLoc, const QString& newLoc, KMMsgInfo* mi);
00139   QString moveInternal(const QString& oldLoc, const QString& newLoc, QString& aFileName, KMMsgStatus status);
00140   bool removeFile(const QString& filename);
00141 
00147   virtual IndexStatus indexStatus();
00148 
00149   QStrList mIdxToFileList;
00150   int mIdxCount;
00151 };
00152 #endif /*kmfoldermaildir_h*/
KDE Home | KDE Accessibility Home | Description of Access Keys