1 #ifndef kmfoldermaildir_h
2 #define kmfoldermaildir_h
4 #include "kmfolderindex.h"
6 #include <tdefileitem.h>
8 #include <tqguardedptr.h>
10 class KMFolderMaildir;
14 class AttachmentStrategy;
20 using KMail::FolderJob;
21 using KMail::MaildirJob;
22 using KMail::AttachmentStrategy;
28 friend class ::KMail::MaildirJob;
33 KMFolderMaildir(
KMFolder* folder,
const char* name=0);
34 virtual ~KMFolderMaildir();
37 virtual KMFolderType
folderType()
const {
return KMFolderTypeMaildir; }
55 virtual void removeMsg(
int i,
bool imapQuiet = FALSE);
56 virtual void removeMsg(TQPtrList<KMMessage> msgList,
bool imapQuiet = FALSE)
62 const KMMsgStatus newStatus,
70 virtual int open(
const char *owner);
79 virtual void reallyDoClose(
const char *owner);
87 static int createMaildirFolders(
const TQString & folderPath );
89 static TQString constructValidFileName(
const TQString & filename = TQString(),
90 KMMsgStatus status = KMMsgStatusNew );
92 static bool removeFile(
const TQString & folderPath,
93 const TQString & filename );
100 int compact(
unsigned int startIndex,
int nbMessages,
const TQStringList& entryList,
bool& done );
104 virtual int compact(
bool silent );
107 virtual bool isReadOnly()
const {
return false; }
110 virtual TQ_INT64 doFolderSize()
const;
114 TQString partSpecifier,
const AttachmentStrategy *as )
const;
115 virtual FolderJob*
doCreateJob( TQPtrList<KMMessage>& msgList,
const TQString& sets,
116 FolderJob::JobType jt,
KMFolder *folder )
const;
145 int addMsgInternal(
KMMessage* msg,
int* index_return = 0,
bool stripUid=
false );
148 void slotDirSizeJobResult( TDEIO::Job* job );
151 void readFileHeaderIntern(
const TQString& dir,
const TQString& file, KMMsgStatus status);
152 TQString moveInternal(
const TQString& oldLoc,
const TQString& newLoc, KMMsgInfo* mi);
153 TQString moveInternal(
const TQString& oldLoc,
const TQString& newLoc, TQString& aFileName, KMMsgStatus status);
154 bool removeFile(
const TQString& filename);
163 typedef TQPair<TQGuardedPtr<const KMFolderMaildir>,KFileItemList> DirSizeJobQueueEntry;
164 static TQValueList<DirSizeJobQueueEntry> s_DirSizeJobQueue;
166 TQStrList mIdxToFileList;
168 mutable bool mCurrentlyCheckingFolderSize;
virtual FolderJob * doCreateJob(KMMessage *msg, FolderJob::JobType jt, KMFolder *folder, TQString partSpecifier, const AttachmentStrategy *as) const =0
These two methods actually create the jobs.
virtual int create()=0
Create a new folder with the name of this object and open it.
virtual DwString getDwString(int idx)=0
Read a message and returns a DwString.
virtual int open(const char *owner)=0
Open folder for access.
virtual KMMessage * take(int idx)
Detach message from this folder.
virtual void msgStatusChanged(const KMMsgStatus oldStatus, const KMMsgStatus newStatus, int idx)
Called by KMMsgBase::setStatus when status of a message has changed required to keep the number unrea...
virtual KMMessage * readMsg(int idx)=0
Load message from file and store it at given index.
virtual KMFolderType folderType() const
Returns the type of this folder.
virtual int expungeContents()=0
Called by KMFolder::expunge() to delete the actual contents.
virtual void removeMsg(int i, bool imapQuiet=false)
Remove (first occurrence of) given message from the folder.
virtual int removeContents()=0
Called by KMFolder::remove() to delete the actual contents.
virtual void sync()=0
fsync buffers to disk
virtual int addMsg(KMMessage *msg, int *index_return=0)=0
Add the given message to the folder.
virtual int canAccess()=0
Check folder for permissions Returns zero if readable and writable.
virtual bool isReadOnly() const =0
Is the folder read-only?
virtual int compact(bool silent)=0
Remove deleted messages from the folder.
A FolderStorage with an index for faster access to often used message properties.
IndexStatus
This enum indicates the status of the index file.
virtual IndexStatus indexStatus()=0
Tests whether the contents of this folder is newer than the index.
virtual int createIndexFromContents()=0
Create index file from messages file and fill the message-info list mMsgList.