kmail

KMFolderMaildir Class Reference

#include <kmfoldermaildir.h>

Inheritance diagram for KMFolderMaildir:

List of all members.


Public Member Functions

virtual int addMsg (KMMessage *msg, int *index_return=0)
virtual int canAccess ()
virtual int compact (bool silent)
int compact (unsigned int startIndex, int nbMessages, const QStringList &entryList, bool &done)
virtual int create ()
virtual Q_INT64 doFolderSize () const
virtual KMFolderType folderType () const
virtual DwString getDwString (int idx)
virtual bool isReadOnly () const
 KMFolderMaildir (KMFolder *folder, const char *name=0)
virtual void msgStatusChanged (const KMMsgStatus oldStatus, const KMMsgStatus newStatus, int idx)
virtual int open (const char *owner)
virtual void reallyDoClose (const char *owner)
virtual void removeMsg (QPtrList< KMMessage > msgList, bool imapQuiet=FALSE)
virtual void removeMsg (int i, bool imapQuiet=FALSE)
virtual void sync ()
virtual KMMessagetake (int idx)
virtual ~KMFolderMaildir ()

Static Public Member Functions

static QString constructValidFileName (const QString &filename=QString(), KMMsgStatus status=KMMsgStatusNew)
static int createMaildirFolders (const QString &folderPath)
static bool removeFile (const QString &folderPath, const QString &filename)

Protected Member Functions

int addMsgInternal (KMMessage *msg, int *index_return=0, bool stripUid=false)
virtual int createIndexFromContents ()
virtual FolderJobdoCreateJob (QPtrList< KMMessage > &msgList, const QString &sets, FolderJob::JobType jt, KMFolder *folder) const
virtual FolderJobdoCreateJob (KMMessage *msg, FolderJob::JobType jt, KMFolder *folder, QString partSpecifier, const AttachmentStrategy *as) const
virtual int expungeContents ()
virtual KMMessagereadMsg (int idx)
virtual int removeContents ()

Detailed Description

Definition at line 24 of file kmfoldermaildir.h.


Constructor & Destructor Documentation

KMFolderMaildir::KMFolderMaildir ( KMFolder folder,
const char *  name = 0 
)

Usually a parent is given.

But in some cases there is no fitting parent object available. Then the name of the folder is used as the absolute path to the folder file.

Definition at line 54 of file kmfoldermaildir.cpp.

KMFolderMaildir::~KMFolderMaildir (  )  [virtual]

Definition at line 62 of file kmfoldermaildir.cpp.


Member Function Documentation

int KMFolderMaildir::addMsg ( KMMessage msg,
int *  index_return = 0 
) [virtual]

Add the given message to the folder.

Usually the message is added at the end of the folder. Returns zero on success and an errno error code on failure. The index of the new message is stored in index_return if given. Please note that the message is added as is to the folder and the folder takes ownership of the message (deleting it in the destructor).

Implements FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 351 of file kmfoldermaildir.cpp.

int KMFolderMaildir::addMsgInternal ( KMMessage msg,
int *  index_return = 0,
bool  stripUid = false 
) [protected]

Internal helper called by addMsg.

If stripUid is true it will remove any uid headers and uid index setting before writing. KMFolderCachedImap needs this but can't do it itself, since the final take() which removes the original mail from the source folder, in moves, needs to happen after the adding, for safety reasons, but needs the uid, in case the source folder was an imap folder, to delete the original. TODO: Avoid this by moving the take() out of the addMsg() methods and moving it into the KMMoveCommand, where it can safely happen at a much higher level.

Definition at line 358 of file kmfoldermaildir.cpp.

int KMFolderMaildir::canAccess (  )  [virtual]

Check folder for permissions Returns zero if readable and writable.

Implements FolderStorage.

Definition at line 69 of file kmfoldermaildir.cpp.

int KMFolderMaildir::compact ( bool  silent  )  [virtual]

Remove deleted messages from the folder.

Returns zero on success and an errno on failure.

Implements FolderStorage.

Definition at line 322 of file kmfoldermaildir.cpp.

int KMFolderMaildir::compact ( unsigned int  startIndex,
int  nbMessages,
const QStringList entryList,
bool &  done 
)

Remove some deleted messages from the folder.

Returns zero on success and an errno on failure. This is only for use from MaildirCompactionJob.

Definition at line 275 of file kmfoldermaildir.cpp.

QString KMFolderMaildir::constructValidFileName ( const QString filename = QString(),
KMMsgStatus  status = KMMsgStatusNew 
) [static]

Definition at line 1028 of file kmfoldermaildir.cpp.

int KMFolderMaildir::create (  )  [virtual]

Implements FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 188 of file kmfoldermaildir.cpp.

int KMFolderMaildir::createIndexFromContents (  )  [protected, virtual]

Create index file from messages file and fill the message-info list mMsgList.

Returns 0 on success and an errno value (see fopen) on failure.

Implements KMFolderIndex.

Reimplemented in KMFolderCachedImap.

Definition at line 831 of file kmfoldermaildir.cpp.

int KMFolderMaildir::createMaildirFolders ( const QString folderPath  )  [static]

Create the necessary folders for a maildir folder.

Usually you will want to use create() instead.

Parameters:
folderPath the full path of the folder as returned by location()
Returns:
0 on success and an error code (cf. man 3 errno) otherwise

Definition at line 155 of file kmfoldermaildir.cpp.

FolderJob * KMFolderMaildir::doCreateJob ( QPtrList< KMMessage > &  msgList,
const QString sets,
FolderJob::JobType  jt,
KMFolder folder 
) const [protected, virtual]

Implements FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 342 of file kmfoldermaildir.cpp.

FolderJob * KMFolderMaildir::doCreateJob ( KMMessage msg,
FolderJob::JobType  jt,
KMFolder folder,
QString  partSpecifier,
const AttachmentStrategy as 
) const [protected, virtual]

These two methods actually create the jobs.

They have to be implemented in all folders.

See also:
createJob

Implements FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 332 of file kmfoldermaildir.cpp.

Q_INT64 KMFolderMaildir::doFolderSize (  )  const [virtual]

reimp

Reimplemented from FolderStorage.

Definition at line 1102 of file kmfoldermaildir.cpp.

int KMFolderMaildir::expungeContents (  )  [protected, virtual]

Called by KMFolder::expunge() to delete the actual contents.

At the time of the call the folder has already been closed, and the various index files deleted. Returns 0 on success.

Implements FolderStorage.

Definition at line 257 of file kmfoldermaildir.cpp.

virtual KMFolderType KMFolderMaildir::folderType (  )  const [inline, virtual]

Returns the type of this folder.

Reimplemented from FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 36 of file kmfoldermaildir.h.

DwString KMFolderMaildir::getDwString ( int  idx  )  [virtual]

Read a message and return it as a string.

Implements FolderStorage.

Definition at line 554 of file kmfoldermaildir.cpp.

virtual bool KMFolderMaildir::isReadOnly (  )  const [inline, virtual]

Is the folder read-only?

Implements FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 106 of file kmfoldermaildir.h.

void KMFolderMaildir::msgStatusChanged ( const KMMsgStatus  oldStatus,
const KMMsgStatus  newStatus,
int  idx 
) [virtual]

Called by KMMsgBase::setStatus when status of a message has changed required to keep the number unread messages variable current.

Reimplemented from FolderStorage.

Definition at line 1092 of file kmfoldermaildir.cpp.

int KMFolderMaildir::open ( const char *  owner  )  [virtual]

Open folder for access.

Does nothing if the folder is already opened. To reopen a folder call close() first. Returns zero on success and an error code equal to the c-library fopen call otherwise (errno).

Implements FolderStorage.

Definition at line 102 of file kmfoldermaildir.cpp.

KMMessage * KMFolderMaildir::readMsg ( int  idx  )  [protected, virtual]

Load message from file and store it at given index.

Returns 0 on failure.

Implements FolderStorage.

Definition at line 543 of file kmfoldermaildir.cpp.

void KMFolderMaildir::reallyDoClose ( const char *  owner  )  [virtual]

Close folder.

If force is TRUE the files are closed even if others still use it (e.g. other mail reader windows).

Implements FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 225 of file kmfoldermaildir.cpp.

int KMFolderMaildir::removeContents (  )  [protected, virtual]

Called by KMFolder::remove() to delete the actual contents.

At the time of the call the folder has already been closed, and the various index files deleted. Returns 0 on success.

Implements FolderStorage.

Definition at line 1006 of file kmfoldermaildir.cpp.

bool KMFolderMaildir::removeFile ( const QString folderPath,
const QString filename 
) [static]

Definition at line 949 of file kmfoldermaildir.cpp.

virtual void KMFolderMaildir::removeMsg ( QPtrList< KMMessage msgList,
bool  imapQuiet = FALSE 
) [inline, virtual]

Reimplemented in KMFolderCachedImap.

Definition at line 55 of file kmfoldermaildir.h.

void KMFolderMaildir::removeMsg ( int  i,
bool  imapQuiet = FALSE 
) [virtual]

Remove (first occurrence of) given message from the folder.

Reimplemented from FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 921 of file kmfoldermaildir.cpp.

void KMFolderMaildir::sync (  )  [virtual]

fsync buffers to disk

Implements FolderStorage.

Definition at line 248 of file kmfoldermaildir.cpp.

KMMessage * KMFolderMaildir::take ( int  idx  )  [virtual]

Detach message from this folder.

Usable to call addMsg() afterwards. Loads the message if it is not loaded up to now.

Reimplemented from FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 932 of file kmfoldermaildir.cpp.


The documentation for this class was generated from the following files: