kmail

FolderStorage Class Reference

#include <folderstorage.h>

Inheritance diagram for FolderStorage:

KMFolderIndex KMFolderSearch KMFolderMaildir KMFolderMbox KMFolderCachedImap KMFolderImap List of all members.

Detailed Description

The FolderStorage class is the bass class for the storage related aspects of a collection of mail (a folder).

Accounts

The accounts (of KMail) that are fed into the folder are represented as the children of the folder. They are only stored here during runtime to have a reference for which accounts point to a specific folder.

Definition at line 79 of file folderstorage.h.


Public Types

enum  ChildrenState { HasChildren, HasNoChildren, ChildrenUnknown }

Public Slots

virtual int updateIndex ()=0
virtual void reallyAddMsg (KMMessage *aMsg)
virtual void reallyAddCopyOfMsg (KMMessage *aMsg)
void slotEmitChangedTimer ()

Signals

void changed ()
void cleared ()
void expunged (KMFolder *)
void closed (KMFolder *)
void invalidated (KMFolder *)
void nameChanged ()
void locationChanged (const QString &, const QString &)
void contentsTypeChanged (KMail::FolderContentsType type)
void readOnlyChanged (KMFolder *)
void noContentChanged ()
void msgRemoved (KMFolder *, Q_UINT32 sernum)
void msgRemoved (int idx, QString msgIdMD5)
void msgRemoved (KMFolder *)
void msgAdded (int idx)
void msgAdded (KMFolder *, Q_UINT32 sernum)
void msgChanged (KMFolder *, Q_UINT32 sernum, int delta)
void msgHeaderChanged (KMFolder *, int)
void statusMsg (const QString &)
void numUnreadMsgsChanged (KMFolder *)
void removed (KMFolder *, bool)
void searchResult (KMFolder *, QValueList< Q_UINT32 >, const KMSearchPattern *, bool complete)
void searchDone (KMFolder *, Q_UINT32, const KMSearchPattern *, bool)
void folderSizeChanged ()

Public Member Functions

 FolderStorage (KMFolder *folder, const char *name=0)
virtual ~FolderStorage ()
KMFolderfolder () const
virtual KMFolderType folderType () const
virtual QString fileName () const
QString location () const
virtual QString indexLocation () const=0
virtual bool noContent () const
virtual void setNoContent (bool aNoContent)
virtual bool noChildren () const
virtual void setNoChildren (bool aNoChildren)
virtual ChildrenState hasChildren () const
virtual void setHasChildren (ChildrenState state)
virtual void updateChildrenState ()
virtual KMMessagegetMsg (int idx)
virtual KMMsgInfounGetMsg (int idx)
virtual bool isMessage (int idx)
virtual KMMessagereadTemporaryMsg (int idx)
virtual DwString getDwString (int idx)=0
virtual void ignoreJobsForMessage (KMMessage *)
virtual FolderJobcreateJob (KMMessage *msg, FolderJob::JobType jt=FolderJob::tGetMessage, KMFolder *folder=0, QString partSpecifier=QString::null, const AttachmentStrategy *as=0) const
virtual FolderJob * createJob (QPtrList< KMMessage > &msgList, const QString &sets, FolderJob::JobType jt=FolderJob::tGetMessage, KMFolder *folder=0) const
virtual const KMMsgBasegetMsgBase (int idx) const=0
virtual KMMsgBasegetMsgBase (int idx)=0
virtual const KMMsgBaseoperator[] (int idx) const
virtual KMMsgBaseoperator[] (int idx)
virtual KMMessagetake (int idx)
virtual void take (QPtrList< KMMessage > msgList)
virtual int addMsg (KMMessage *msg, int *index_return=0)=0
virtual int addMsgKeepUID (KMMessage *msg, int *index_return=0)
virtual int addMsg (QPtrList< KMMessage > &, QValueList< int > &index_return)
void emitMsgAddedSignals (int idx)
virtual bool canAddMsgNow (KMMessage *aMsg, int *aIndex_ret)
virtual void removeMsg (int i, bool imapQuiet=false)
virtual void removeMsg (const QPtrList< KMMsgBase > &msgList, bool imapQuiet=false)
virtual void removeMsg (const QPtrList< KMMessage > &msgList, bool imapQuiet=false)
virtual int expungeOldMsg (int days)
virtual int moveMsg (KMMessage *msg, int *index_return=0)
virtual int moveMsg (QPtrList< KMMessage >, int *index_return=0)
virtual int find (const KMMsgBase *msg) const =0
int find (const KMMessage *msg) const
virtual int count (bool cache=false) const
virtual int countUnread ()
Q_INT64 folderSize () const
virtual bool isCloseToQuota () const
virtual void msgStatusChanged (const KMMsgStatus oldStatus, const KMMsgStatus newStatus, int idx)
virtual int open (const char *owner)=0
virtual int canAccess ()=0
void close (const char *owner, bool force=false)
virtual void reallyDoClose (const char *owner)=0
virtual void tryReleasingFolder (KMFolder *)
virtual void sync ()=0
bool isOpened () const
virtual void markNewAsUnread ()
virtual void markUnreadAsRead ()
virtual int create ()=0
virtual void remove ()
virtual int expunge ()
virtual int compact (bool silent)=0
virtual int rename (const QString &newName, KMFolderDir *aParent=0)
bool autoCreateIndex () const
virtual void setAutoCreateIndex (bool)
bool dirty () const
void setDirty (bool f)
bool needsCompacting () const
virtual void setNeedsCompacting (bool f)
virtual void quiet (bool beQuiet)
virtual bool isReadOnly () const=0
virtual bool canDeleteMessages () const
QString label () const
virtual void correctUnreadMsgsCount ()
virtual int writeIndex (bool createEmptyIndex=false)=0
void registerWithMessageDict ()
void deregisterFromMessageDict ()
virtual void setStatus (int idx, KMMsgStatus status, bool toggle=false)
virtual void setStatus (QValueList< int > &ids, KMMsgStatus status, bool toggle=false)
void removeJobs ()
virtual void readConfig ()
virtual void writeConfig ()
virtual KMFoldertrashFolder () const
void addJob (FolderJob *) const
bool compactable () const
virtual void setContentsType (KMail::FolderContentsType type, bool quiet=false)
KMail::FolderContentsType contentsType () const
virtual void search (const KMSearchPattern *)
virtual void search (const KMSearchPattern *, Q_UINT32 serNum)
virtual bool isMoveable () const
virtual KMAccountaccount () const

Static Public Member Functions

static QString dotEscape (const QString &)

Protected Types

enum  { mDirtyTimerInterval = 600000 }

Protected Slots

virtual void removeJob (QObject *)
void slotProcessNextSearchBatch ()

Protected Member Functions

virtual FolderJobdoCreateJob (KMMessage *msg, FolderJob::JobType jt, KMFolder *folder, QString partSpecifier, const AttachmentStrategy *as) const=0
virtual FolderJobdoCreateJob (QPtrList< KMMessage > &msgList, const QString &sets, FolderJob::JobType jt, KMFolder *folder) const=0
void headerOfMsgChanged (const KMMsgBase *, int idx)
virtual KMMessagereadMsg (int idx)=0
virtual void fillMessageDict ()
void readFolderIdsFile ()
int writeFolderIdsFile () const
int touchFolderIdsFile ()
int appendToFolderIdsFile (int idx=-1)
void setRDict (KMMsgDictREntry *rentry) const
KMMsgDictREntry * rDict () const
void replaceMsgSerNum (unsigned long sernum, KMMsgBase *msg, int idx)
void invalidateFolder ()
virtual int removeContents ()=0
virtual int expungeContents ()=0
virtual bool readIndex ()=0
virtual KMMsgBasetakeIndexEntry (int idx)=0
virtual KMMsgInfosetIndexEntry (int idx, KMMessage *msg)=0
virtual void clearIndex (bool autoDelete=true, bool syncDict=false)=0
virtual void truncateIndex ()=0
virtual Q_INT64 doFolderSize () const

Protected Attributes

int mOpenCount
int mQuiet
bool mChanged:1
bool mAutoCreateIndex:1
bool mExportsSernums:1
bool mDirty:1
bool mFilesLocked:1
int mUnreadMsgs
int mGuessedUnreadMsgs
int mTotalMsgs
Q_INT64 mSize
bool mWriteConfigEnabled:1
bool needsCompact:1
bool mCompactable:1
bool mNoContent:1
bool mNoChildren:1
bool mConvertToUtf8:1
KMMsgDictREntry * mRDict
QPtrList< FolderJobmJobList
QTimer * mDirtyTimer
ChildrenState mHasChildren
KMail::FolderContentsType mContentsType
KMFoldermFolder
QTimer * mEmitChangedTimer
int mCurrentSearchedMsg
const KMSearchPatternmSearchPattern

Friends

class KMMsgDict

Constructor & Destructor Documentation

FolderStorage::FolderStorage ( 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 63 of file folderstorage.cpp.


Member Function Documentation

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

Returns the type of this folder.

Reimplemented in KMFolderCachedImap, KMFolderImap, KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

Definition at line 95 of file folderstorage.h.

QString FolderStorage::fileName (  )  const [virtual]

Returns the filename of the folder (reimplemented in KMFolderImap).

Reimplemented in KMFolderImap.

Definition at line 143 of file folderstorage.cpp.

QString FolderStorage::location (  )  const

Returns full path to folder file.

Definition at line 133 of file folderstorage.cpp.

virtual QString FolderStorage::indexLocation (  )  const [pure virtual]

Returns full path to index file.

Implemented in KMFolderIndex, and KMFolderSearch.

virtual bool FolderStorage::noContent (  )  const [inline, virtual]

Returns, if the folder can't contain mails, but only subfolder.

Definition at line 106 of file folderstorage.h.

void FolderStorage::setNoContent ( bool  aNoContent  )  [virtual]

Specify, that the folder can't contain mails.

Definition at line 1181 of file folderstorage.cpp.

virtual bool FolderStorage::noChildren (  )  const [inline, virtual]

Returns, if the folder can't have children.

Definition at line 112 of file folderstorage.h.

void FolderStorage::setNoChildren ( bool  aNoChildren  )  [virtual]

Specify, that the folder can't have children.

Definition at line 1095 of file folderstorage.cpp.

virtual ChildrenState FolderStorage::hasChildren (  )  const [inline, virtual]

Returns if the folder has children, has no children or we don't know.

Definition at line 124 of file folderstorage.h.

virtual void FolderStorage::setHasChildren ( ChildrenState  state  )  [inline, virtual]

Specify if the folder has children.

Definition at line 127 of file folderstorage.h.

void FolderStorage::updateChildrenState (  )  [virtual]

Updates the hasChildren() state.

Definition at line 1083 of file folderstorage.cpp.

KMMessage * FolderStorage::getMsg ( int  idx  )  [virtual]

Read message at given index.

Indexing starts at zero

Reimplemented in KMFolderImap, and KMFolderSearch.

Definition at line 477 of file folderstorage.cpp.

KMMsgInfo * FolderStorage::unGetMsg ( int  idx  )  [virtual]

Replace KMMessage with KMMsgInfo and delete KMMessage.

Definition at line 553 of file folderstorage.cpp.

bool FolderStorage::isMessage ( int  idx  )  [virtual]

Checks if the message is already "gotten" with getMsg.

Definition at line 578 of file folderstorage.cpp.

KMMessage * FolderStorage::readTemporaryMsg ( int  idx  )  [virtual]

Load message from file and do NOT store it, only return it.

This is equivalent to, but faster than, getMsg+unGetMsg WARNING: the caller has to delete the returned value!

Definition at line 523 of file folderstorage.cpp.

virtual DwString FolderStorage::getDwString ( int  idx  )  [pure virtual]

Read a message and returns a DwString.

Implemented in KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

void FolderStorage::ignoreJobsForMessage ( KMMessage  )  [virtual]

Removes and deletes all jobs associated with the particular message.

Reimplemented in KMFolderImap, and KMFolderSearch.

Definition at line 1051 of file folderstorage.cpp.

virtual FolderJob* FolderStorage::createJob ( KMMessage msg,
FolderJob::JobType  jt = FolderJob::tGetMessage,
KMFolder folder = 0,
QString  partSpecifier = QString::null,
const AttachmentStrategy as = 0 
) const [virtual]

These methods create respective FolderJob (You should derive FolderJob for each derived KMFolder).

virtual const KMMsgBase* FolderStorage::getMsgBase ( int  idx  )  const [pure virtual]

Provides access to the basic message fields that are also stored in the index.

Whenever you only need subject, from, date, status you should use this method instead of getMsg() because getMsg() will load the message if necessary and this method does not.

Implemented in KMFolderIndex, and KMFolderSearch.

virtual const KMMsgBase* FolderStorage::operator[] ( int  idx  )  const [inline, virtual]

Same as getMsgBase(int).

Definition at line 175 of file folderstorage.h.

virtual KMMsgBase* FolderStorage::operator[] ( int  idx  )  [inline, virtual]

Same as getMsgBase(int).

This time non-const.

Definition at line 178 of file folderstorage.h.

KMMessage * FolderStorage::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 in KMFolderCachedImap, KMFolderImap, and KMFolderMaildir.

Definition at line 423 of file folderstorage.cpp.

virtual int FolderStorage::addMsg ( KMMessage msg,
int *  index_return = 0 
) [pure 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).

Implemented in KMFolderCachedImap, KMFolderImap, KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

virtual int FolderStorage::addMsgKeepUID ( KMMessage msg,
int *  index_return = 0 
) [inline, virtual]

(Note(bo): This needs to be fixed better at a later point.

) This is overridden by dIMAP because addMsg strips the X-UID header from the mail.

Reimplemented in KMFolderCachedImap.

Definition at line 196 of file folderstorage.h.

int FolderStorage::addMsg ( QPtrList< KMMessage > &  ,
QValueList< int > &  index_return 
) [virtual]

Adds the given messages to the folder.

Behaviour is identical to addMsg(msg)

Reimplemented in KMFolderImap.

Definition at line 1149 of file folderstorage.cpp.

void FolderStorage::emitMsgAddedSignals ( int  idx  ) 

Called by derived classes implementation of addMsg.

Emits msgAdded signals

Restart always the timer or not. BTW we get a kmheaders refresh each 3 seg.?

Definition at line 284 of file folderstorage.cpp.

bool FolderStorage::canAddMsgNow ( KMMessage aMsg,
int *  aIndex_ret 
) [virtual]

Returns FALSE, if the message has to be retrieved from an IMAP account first.

In this case this function does this and cares for the rest

Definition at line 301 of file folderstorage.cpp.

void FolderStorage::removeMsg ( int  i,
bool  imapQuiet = false 
) [virtual]

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

Reimplemented in KMFolderCachedImap, KMFolderImap, and KMFolderMaildir.

Definition at line 380 of file folderstorage.cpp.

int FolderStorage::expungeOldMsg ( int  days  )  [virtual]

Delete messages in the folder that are older than days.

Return the number of deleted messages.

Definition at line 254 of file folderstorage.cpp.

int FolderStorage::moveMsg ( KMMessage msg,
int *  index_return = 0 
) [virtual]

Detaches the given message from it's current folder and adds it to this 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.

Definition at line 608 of file folderstorage.cpp.

virtual int FolderStorage::find ( const KMMsgBase msg  )  const [pure virtual]

Returns the index of the given message or -1 if not found.

Implemented in KMFolderIndex, and KMFolderSearch.

int FolderStorage::count ( bool  cache = false  )  const [virtual]

Number of messages in this folder.

Reimplemented in KMFolderIndex, and KMFolderSearch.

Definition at line 807 of file folderstorage.cpp.

int FolderStorage::countUnread (  )  [virtual]

Number of new or unread messages in this folder.

Definition at line 816 of file folderstorage.cpp.

Q_INT64 FolderStorage::folderSize (  )  const

Total size of the contents of this folder.

Definition at line 834 of file folderstorage.cpp.

bool FolderStorage::isCloseToQuota (  )  const [virtual]

Return whether the folder is close to its quota limit, which can be reflected in the UI.

Reimplemented in KMFolderCachedImap.

Definition at line 845 of file folderstorage.cpp.

void FolderStorage::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 in KMFolderMaildir.

Definition at line 851 of file folderstorage.cpp.

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

Open folder for access.

open() and close() use reference counting. Returns zero on success and an error code equal to the c-library fopen call otherwise (errno).

See also:
KMFolderOpener

Implemented in KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

virtual int FolderStorage::canAccess (  )  [pure virtual]

Check folder for permissions Returns zero if readable and writable.

Implemented in KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

void FolderStorage::close ( const char *  owner,
bool  force = false 
)

Close folder.

open() and close() use reference counting. If force is true the files are closed regardless of reference count, and the reference count will be set to zero.

Definition at line 102 of file folderstorage.cpp.

virtual void FolderStorage::tryReleasingFolder ( KMFolder  )  [inline, virtual]

Try releasing folder if possible, something is attempting an exclusive access to it.

Currently used for KMFolderSearch and the background tasks like expiry.

Reimplemented in KMFolderSearch.

Definition at line 272 of file folderstorage.h.

virtual void FolderStorage::sync (  )  [pure virtual]

fsync buffers to disk

Implemented in KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

bool FolderStorage::isOpened (  )  const [inline]

Test if folder is opened, i.e.

its reference count is greater than zero.

Definition at line 278 of file folderstorage.h.

void FolderStorage::markNewAsUnread (  )  [virtual]

Mark all new messages as unread.

Definition at line 167 of file folderstorage.cpp.

void FolderStorage::markUnreadAsRead (  )  [virtual]

Mark all new and unread messages as read.

Definition at line 183 of file folderstorage.cpp.

virtual int FolderStorage::create (  )  [pure virtual]

Create a new folder with the name of this object and open it.

Returns zero on success and an error code equal to the c-library fopen call otherwise.

Implemented in KMFolderCachedImap, KMFolderImap, KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

void FolderStorage::remove (  )  [virtual]

Removes the folder physically from disk and empties the contents of the folder in memory.

Note that the folder is closed during this process, whether there are others using it or not.

See also:
KMFolder::removeContents

Reimplemented in KMFolderCachedImap, and KMFolderImap.

Definition at line 742 of file folderstorage.cpp.

int FolderStorage::expunge (  )  [virtual]

Delete entire folder.

Forces a close *but* opens the folder again afterwards. Returns errno(3) error code or zero on success. see KMFolder::expungeContents

Definition at line 770 of file folderstorage.cpp.

virtual int FolderStorage::compact ( bool  silent  )  [pure virtual]

Remove deleted messages from the folder.

Returns zero on success and an errno on failure. A statusbar message will inform the user that the compaction worked, unless silent is set.

Implemented in KMFolderImap, KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

int FolderStorage::rename ( const QString &  newName,
KMFolderDir aParent = 0 
) [virtual]

Physically rename the folder.

Returns zero on success and an errno on failure.

Reimplemented in KMFolderCachedImap, and KMFolderImap.

Definition at line 652 of file folderstorage.cpp.

bool FolderStorage::autoCreateIndex (  )  const [inline]

Returns TRUE if a table of contents file is automatically created.

Definition at line 313 of file folderstorage.h.

void FolderStorage::setAutoCreateIndex ( bool   )  [virtual]

Allow/disallow automatic creation of a table of contents file.

Default is TRUE.

Definition at line 151 of file folderstorage.cpp.

bool FolderStorage::dirty (  )  const [inline]

Returns TRUE if the table of contents is dirty.

This happens when a message is deleted from the folder. The toc will then be re-created when the folder is closed.

Definition at line 322 of file folderstorage.h.

void FolderStorage::setDirty ( bool  f  ) 

Change the dirty flag.

Definition at line 157 of file folderstorage.cpp.

bool FolderStorage::needsCompacting (  )  const [inline]

Returns TRUE if the folder contains deleted messages.

Definition at line 328 of file folderstorage.h.

void FolderStorage::quiet ( bool  beQuiet  )  [virtual]

If set to quiet the folder will not emit msgAdded(idx) signal.

This is necessary because adding the messages to the listview one by one as they come in ( as happens on msgAdded(idx) ) is very slow for large ( >10000 ) folders. For pop, where whole bodies are downloaded this is not an issue, but for imap, where we only download headers it becomes a bottleneck. We therefore set the folder quiet() and rebuild the listview completely once the complete folder has been checked.

Definition at line 205 of file folderstorage.cpp.

virtual bool FolderStorage::isReadOnly (  )  const [pure virtual]

Is the folder read-only?

Implemented in KMFolderCachedImap, KMFolderImap, KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

bool FolderStorage::canDeleteMessages (  )  const [virtual]

Can messages in this folder be deleted?

Reimplemented in KMFolderCachedImap, and KMFolderImap.

Definition at line 1176 of file folderstorage.cpp.

QString FolderStorage::label (  )  const

Returns the label of the folder for visualization.

Definition at line 802 of file folderstorage.cpp.

void FolderStorage::correctUnreadMsgsCount (  )  [virtual]

A cludge to help make sure the count of unread messges is kept in sync.

Definition at line 944 of file folderstorage.cpp.

virtual int FolderStorage::writeIndex ( bool  createEmptyIndex = false  )  [pure virtual]

Write index to index-file.

Returns 0 on success and errno error on failure.

Implemented in KMFolderIndex, and KMFolderSearch.

void FolderStorage::registerWithMessageDict (  ) 

Triggers registration with the message dict, which will cause the dict to ask the FolderStorage to fill itself into it.

Definition at line 951 of file folderstorage.cpp.

void FolderStorage::deregisterFromMessageDict (  ) 

Triggers deregistration from the message dict, which will cause the dict to ask the FolderStorage to write the relevant data structures to disk.

Definition at line 957 of file folderstorage.cpp.

void FolderStorage::setStatus ( int  idx,
KMMsgStatus  status,
bool  toggle = false 
) [virtual]

Set the status of the message at index idx to status.

Reimplemented in KMFolderCachedImap, and KMFolderImap.

Definition at line 1030 of file folderstorage.cpp.

void FolderStorage::setStatus ( QValueList< int > &  ids,
KMMsgStatus  status,
bool  toggle = false 
) [virtual]

Set the status of the message(s) in the QValueList ids to status.

Reimplemented in KMFolderCachedImap, and KMFolderImap.

Definition at line 1043 of file folderstorage.cpp.

QString FolderStorage::dotEscape ( const QString &   )  [static]

Escape a leading dot.

Definition at line 113 of file folderstorage.cpp.

void FolderStorage::readConfig (  )  [virtual]

Read the config file.

Reimplemented in KMFolderCachedImap, and KMFolderImap.

Definition at line 905 of file folderstorage.cpp.

void FolderStorage::writeConfig (  )  [virtual]

Write the config file.

Reimplemented in KMFolderCachedImap, and KMFolderImap.

Definition at line 926 of file folderstorage.cpp.

virtual KMFolder* FolderStorage::trashFolder (  )  const [inline, virtual]

If this folder has a special trash folder set, return it.

Otherwise return 0.

Reimplemented in KMFolderCachedImap, and KMFolderImap.

Definition at line 386 of file folderstorage.h.

void FolderStorage::addJob ( FolderJob  )  const

Add job for this folder.

This is done automatically by createJob. This method is public only for other kind of FolderJob like ExpireJob.

bool FolderStorage::compactable (  )  const [inline]

false if index file is out of sync with mbox file

Definition at line 395 of file folderstorage.h.

void FolderStorage::setContentsType ( KMail::FolderContentsType  type,
bool  quiet = false 
) [virtual]

Set the type of contents held in this folder (mail, calendar, etc.).

Definition at line 1103 of file folderstorage.cpp.

KMail::FolderContentsType FolderStorage::contentsType (  )  const [inline]

Returns:
the type of contents held in this folder (mail, calendar, etc.)

Definition at line 403 of file folderstorage.h.

void FolderStorage::search ( const KMSearchPattern  )  [virtual]

Search for messages The end is signaled with searchDone().

Reimplemented in KMFolderImap.

Definition at line 1113 of file folderstorage.cpp.

void FolderStorage::search ( const KMSearchPattern ,
Q_UINT32  serNum 
) [virtual]

Check if the message matches the search criteria The end is signaled with searchDone().

Reimplemented in KMFolderImap.

Definition at line 1141 of file folderstorage.cpp.

bool FolderStorage::isMoveable (  )  const [virtual]

Returns true if this folder can be moved.

Reimplemented in KMFolderCachedImap, KMFolderImap, and KMFolderSearch.

Definition at line 1164 of file folderstorage.cpp.

void FolderStorage::changed (  )  [signal]

Emitted when the status, name, or associated accounts of this folder changed.

void FolderStorage::cleared (  )  [signal]

Emitted when the contents of a folder have been cleared (new search in a search folder, for example).

void FolderStorage::expunged ( KMFolder  )  [signal]

Emitted after an expunge.

If not quiet, changed() will be emmitted first.

void FolderStorage::closed ( KMFolder  )  [signal]

Emitted when the folder was closed and ticket owners have to reopen.

void FolderStorage::invalidated ( KMFolder  )  [signal]

Emitted when the serial numbers of this folder were invalidated.

void FolderStorage::nameChanged (  )  [signal]

Emitted when the name of the folder changes.

void FolderStorage::locationChanged ( const QString &  ,
const QString &   
) [signal]

Emitted when the location on disk of the folder changes.

This is used by all code which uses the locatio on disk of the folder storage ( or the cache storage ) as an identifier for the folder.

void FolderStorage::contentsTypeChanged ( KMail::FolderContentsType  type  )  [signal]

Emitted when the contents type (calendar, mail, tasks, .

.) of the folderstorage changes.

void FolderStorage::readOnlyChanged ( KMFolder  )  [signal]

Emitted when the readonly status of the folder changes.

void FolderStorage::noContentChanged (  )  [signal]

Emitted when the no content state of the folder changes.

void FolderStorage::msgRemoved ( KMFolder ,
Q_UINT32  sernum 
) [signal]

Emitted before a message is removed from the folder.

void FolderStorage::msgRemoved ( int  idx,
QString  msgIdMD5 
) [signal]

Emitted after a message is removed from the folder.

void FolderStorage::msgAdded ( int  idx  )  [signal]

Emitted when a message is added from the folder.

void FolderStorage::msgChanged ( KMFolder ,
Q_UINT32  sernum,
int  delta 
) [signal]

Emitted, when the status of a message is changed.

void FolderStorage::msgHeaderChanged ( KMFolder ,
int   
) [signal]

Emitted when a field of the header of a specific message changed.

void FolderStorage::statusMsg ( const QString &   )  [signal]

Emmited to display a message somewhere in a status line.

void FolderStorage::numUnreadMsgsChanged ( KMFolder  )  [signal]

Emitted when number of unread messages has changed.

void FolderStorage::removed ( KMFolder ,
bool   
) [signal]

Emitted when a folder was removed.

void FolderStorage::searchResult ( KMFolder ,
QValueList< Q_UINT32 >  ,
const KMSearchPattern ,
bool  complete 
) [signal]

Emitted when a search delivers results The matching serial numbers are included If complete is true the search is done.

void FolderStorage::searchDone ( KMFolder ,
Q_UINT32  ,
const KMSearchPattern ,
bool   
) [signal]

Emitted when a search for a single message is completed The serial number and a bool matching yes/no is included.

void FolderStorage::folderSizeChanged (  )  [signal]

Emitted when the folder's size changes.

virtual int FolderStorage::updateIndex (  )  [pure virtual, slot]

Incrementally update the index if possible else call writeIndex.

Implemented in KMFolderIndex, and KMFolderSearch.

void FolderStorage::reallyAddMsg ( KMMessage aMsg  )  [virtual, slot]

Add the message to the folder after it has been retrieved from an IMAP server.

Definition at line 323 of file folderstorage.cpp.

void FolderStorage::reallyAddCopyOfMsg ( KMMessage aMsg  )  [virtual, slot]

Add a copy of the message to the folder after it has been retrieved from an IMAP server.

Definition at line 344 of file folderstorage.cpp.

void FolderStorage::slotEmitChangedTimer (  )  [slot]

Emit changed signal if mQuite <=0.

Definition at line 278 of file folderstorage.cpp.

void FolderStorage::slotProcessNextSearchBatch (  )  [protected, slot]

Process the next search batch.

Definition at line 1121 of file folderstorage.cpp.

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

These two methods actually create the jobs.

They have to be implemented in all folders.

See also:
createJob

Implemented in KMFolderCachedImap, KMFolderImap, KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

void FolderStorage::headerOfMsgChanged ( const KMMsgBase ,
int  idx 
) [protected]

Tell the folder that a header field that is usually used for the index (subject, from, .

..) has changed of given message. This method is usually called from within KMMessage::setSubject/set...

Definition at line 885 of file folderstorage.cpp.

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

Load message from file and store it at given index.

Returns 0 on failure.

Implemented in KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

virtual void FolderStorage::fillMessageDict (  )  [inline, protected, virtual]

Inserts messages into the message dictionary.

The messages will get new serial numbers. This is only used on newly appeared folders, where there is no .ids file yet, or when that has been invalidated.

Reimplemented in KMFolderIndex.

Definition at line 550 of file folderstorage.h.

void FolderStorage::readFolderIdsFile (  )  [protected]

Read the on-disk cache of serial numbers of messages in this store and fill those into the global message dict, such that the messages we hold can be looked up there.

Definition at line 963 of file folderstorage.cpp.

int FolderStorage::writeFolderIdsFile (  )  const [protected]

Writes the message serial number file.

Definition at line 986 of file folderstorage.cpp.

int FolderStorage::touchFolderIdsFile (  )  [protected]

Touches the message serial number file.

Definition at line 993 of file folderstorage.cpp.

int FolderStorage::appendToFolderIdsFile ( int  idx = -1  )  [protected]

Append message to end of message serial number file.

Definition at line 1000 of file folderstorage.cpp.

void FolderStorage::setRDict ( KMMsgDictREntry *  rentry  )  const [protected]

Sets the reverse-dictionary for this folder.

const, because the mRDict is mutable, since it is not part of the (conceptually) const-relevant state of the object.

Definition at line 1018 of file folderstorage.cpp.

KMMsgDictREntry* FolderStorage::rDict (  )  const [inline, protected]

Returns the reverse-dictionary for this folder.

Definition at line 572 of file folderstorage.h.

void FolderStorage::replaceMsgSerNum ( unsigned long  sernum,
KMMsgBase msg,
int  idx 
) [protected]

Replaces the serial number for the message msg at index idx with sernum.

Definition at line 1012 of file folderstorage.cpp.

void FolderStorage::invalidateFolder (  )  [protected]

Called when serial numbers for a folder are invalidated, invalidates/recreates data structures dependent on the serial numbers for this folder.

Definition at line 974 of file folderstorage.cpp.

virtual int FolderStorage::removeContents (  )  [protected, pure 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.

Implemented in KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

virtual int FolderStorage::expungeContents (  )  [protected, pure 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.

Implemented in KMFolderImap, KMFolderMaildir, KMFolderMbox, and KMFolderSearch.

virtual bool FolderStorage::readIndex (  )  [protected, pure virtual]

Read index file and fill the message-info list mMsgList.

Implemented in KMFolderIndex, and KMFolderSearch.


Member Data Documentation

is the automatic creation of a index file allowed ?

Definition at line 607 of file folderstorage.h.

Has this storage exported its serial numbers to the global message dict for lookup?

Definition at line 610 of file folderstorage.h.

bool FolderStorage::mDirty [protected]

if the index is dirty it will be recreated upon close()

Definition at line 612 of file folderstorage.h.

bool FolderStorage::mFilesLocked [protected]

TRUE if the files of the folder are locked (writable).

Definition at line 614 of file folderstorage.h.

int FolderStorage::mUnreadMsgs [protected]

number of unread messages, -1 if not yet set

Definition at line 617 of file folderstorage.h.

bool FolderStorage::needsCompact [protected]

sven: true if on destruct folder needs to be compacted.

Definition at line 622 of file folderstorage.h.

bool FolderStorage::mCompactable [protected]

false if index file is out of sync with mbox file

Definition at line 624 of file folderstorage.h.

KMMsgDictREntry* FolderStorage::mRDict [mutable, protected]

Points at the reverse dictionary for this folder.

Definition at line 630 of file folderstorage.h.

QPtrList<FolderJob> FolderStorage::mJobList [mutable, protected]

List of jobs created by this folder.

Definition at line 632 of file folderstorage.h.

Type of contents in this folder.

Definition at line 640 of file folderstorage.h.


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