kmail

KMFolderMaildir Class Reference

Inheritance diagram for KMFolderMaildir:

KMFolderIndex FolderStorage KMFolderCachedImap List of all members.

Detailed Description

Definition at line 17 of file kmfoldermaildir.h.


Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

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

Friends

class ::KMail::MaildirJob

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 52 of file kmfoldermaildir.cpp.


Member Function Documentation

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

Returns the type of this folder.

Reimplemented from FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 29 of file kmfoldermaildir.h.

QCString & KMFolderMaildir::getMsgString ( int  idx,
QCString &  mDest 
) [virtual]

Read a message and return a referece to a string.

Implements FolderStorage.

Definition at line 597 of file kmfoldermaildir.cpp.

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

Read a message and returns a DwString.

Implements FolderStorage.

Definition at line 569 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 970 of file kmfoldermaildir.cpp.

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 363 of file kmfoldermaildir.cpp.

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 959 of file kmfoldermaildir.cpp.

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 1130 of file kmfoldermaildir.cpp.

int KMFolderMaildir::open (  )  [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 100 of file kmfoldermaildir.cpp.

int KMFolderMaildir::canAccess (  )  [virtual]

Check folder for permissions Returns zero if readable and writable.

Implements FolderStorage.

Definition at line 67 of file kmfoldermaildir.cpp.

void KMFolderMaildir::sync (  )  [virtual]

fsync buffers to disk

Implements FolderStorage.

Definition at line 260 of file kmfoldermaildir.cpp.

void KMFolderMaildir::close ( bool  force = FALSE  )  [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.

Definition at line 223 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 153 of file kmfoldermaildir.cpp.

int KMFolderMaildir::create (  )  [virtual]

Implements FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 186 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 287 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 334 of file kmfoldermaildir.cpp.

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

Is the folder read-only?

Implements FolderStorage.

Reimplemented in KMFolderCachedImap.

Definition at line 100 of file kmfoldermaildir.h.

virtual 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.

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 559 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 1044 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 269 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 869 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 370 of file kmfoldermaildir.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys