kmail

kmfoldermaildir.h
1#ifndef kmfoldermaildir_h
2#define kmfoldermaildir_h
3
4#include "kmfolderindex.h"
5
6#include <tdefileitem.h>
7
8#include <tqguardedptr.h>
9
10class KMFolderMaildir;
11namespace KMail {
12 class FolderJob;
13 class MaildirJob;
14 class AttachmentStrategy;
15}
16namespace TDEIO {
17 class Job;
18}
19
20using KMail::FolderJob;
21using KMail::MaildirJob;
22using KMail::AttachmentStrategy;
23
24class KMFolderMaildir : public KMFolderIndex
25{
26 TQ_OBJECT
27
28 friend class ::KMail::MaildirJob;
29public:
33 KMFolderMaildir(KMFolder* folder, const char* name=0);
34 virtual ~KMFolderMaildir();
35
37 virtual KMFolderType folderType() const { return KMFolderTypeMaildir; }
38
40 virtual DwString getDwString(int idx);
41
44 virtual KMMessage* take(int idx);
45
52 virtual int addMsg(KMMessage* msg, int* index_return = 0);
53
55 virtual void removeMsg(int i, bool imapQuiet = FALSE);
56 virtual void removeMsg(TQPtrList<KMMessage> msgList, bool imapQuiet = FALSE)
57 { return KMFolderIndex::removeMsg(msgList, imapQuiet); }
58
59 // Called by KMMsgBase::setStatus when status of a message has changed
60 // required to keep the number unread messages variable current.
61 virtual void msgStatusChanged( const KMMsgStatus oldStatus,
62 const KMMsgStatus newStatus,
63 int idx);
64
70 virtual int open(const char *owner);
71
72 virtual int canAccess();
73
75 virtual void sync();
76
79 virtual void reallyDoClose(const char *owner);
80
87 static int createMaildirFolders( const TQString & folderPath );
88
89 static TQString constructValidFileName( const TQString & filename = TQString(),
90 KMMsgStatus status = KMMsgStatusNew );
91
92 static bool removeFile( const TQString & folderPath,
93 const TQString & filename );
94
96 virtual int create();
97
100 int compact( unsigned int startIndex, int nbMessages, const TQStringList& entryList, bool& done );
101
104 virtual int compact( bool silent );
105
107 virtual bool isReadOnly() const { return false; }
108
110 virtual TQ_INT64 doFolderSize() const;
111
112protected:
113 virtual FolderJob* doCreateJob( KMMessage *msg, FolderJob::JobType jt, KMFolder *folder,
114 TQString partSpecifier, const AttachmentStrategy *as ) const;
115 virtual FolderJob* doCreateJob( TQPtrList<KMMessage>& msgList, const TQString& sets,
116 FolderJob::JobType jt, KMFolder *folder ) const;
119 virtual KMMessage* readMsg(int idx);
120
124 virtual int removeContents();
125
129 virtual int expungeContents();
130
134 virtual int createIndexFromContents();
135
145 int addMsgInternal( KMMessage* msg, int* index_return = 0, bool stripUid=false );
146
147private slots:
148 void slotDirSizeJobResult( TDEIO::Job* job );
149
150private:
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);
155
161 virtual IndexStatus indexStatus();
162
163 typedef TQPair<TQGuardedPtr<const KMFolderMaildir>,KFileItemList> DirSizeJobQueueEntry;
164 static TQValueList<DirSizeJobQueueEntry> s_DirSizeJobQueue;
165
166 TQStrList mIdxToFileList;
167 int mIdxCount;
168 mutable bool mCurrentlyCheckingFolderSize;
169};
170#endif /*kmfoldermaildir_h*/
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 FolderJob * doCreateJob(KMMessage *msg, FolderJob::JobType jt, KMFolder *folder, TQString partSpecifier, const AttachmentStrategy *as) const =0
These two methods actually create the jobs.
virtual KMFolderType folderType() const
Returns the type of this folder.
Definition: folderstorage.h:96
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.
Definition: kmfolderindex.h:38
IndexStatus
This enum indicates the status of the index file.
Definition: kmfolderindex.h:50
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.
Mail folder.
Definition: kmfolder.h:69
This is a Mime Message.
Definition: kmmessage.h:68
folderdiaquotatab.h
Definition: aboutdata.cpp:40