kmail

#include <folderstorage.h>

Inheritance diagram for FolderStorage:
KMFolderIndex

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 TQString &, const TQString &)
 
void contentsTypeChanged (KMail::FolderContentsType type)
 
void readOnlyChanged (KMFolder *)
 
void noContentChanged ()
 
void msgRemoved (KMFolder *, TQ_UINT32 sernum)
 
void msgRemoved (int idx, TQString msgIdMD5)
 
void msgRemoved (KMFolder *)
 
void msgAdded (int idx)
 
void msgAdded (KMFolder *, TQ_UINT32 sernum)
 
void msgChanged (KMFolder *, TQ_UINT32 sernum, int delta)
 
void msgHeaderChanged (KMFolder *, int)
 
void statusMsg (const TQString &)
 
void numUnreadMsgsChanged (KMFolder *)
 
void removed (KMFolder *, bool)
 
void searchResult (KMFolder *, TQValueList< TQ_UINT32 >, const KMSearchPattern *, bool complete)
 
void searchDone (KMFolder *, TQ_UINT32, const KMSearchPattern *, bool)
 
void folderSizeChanged ()
 
void syncStateChanged ()
 

Public Member Functions

 FolderStorage (KMFolder *folder, const char *name=0)
 
KMFolderfolder () const
 
virtual KMFolderType folderType () const
 
virtual TQString fileName () const
 
TQString location () const
 
virtual TQString 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 KMMsgInfo * unGetMsg (int idx)
 
virtual bool isMessage (int idx)
 
virtual KMMessagereadTemporaryMsg (int idx)
 
virtual DwString getDwString (int idx)=0
 
virtual void ignoreJobsForMessage (KMMessage *)
 
virtual FolderJob * createJob (KMMessage *msg, FolderJob::JobType jt=FolderJob::tGetMessage, KMFolder *folder=0, TQString partSpecifier=TQString(), const AttachmentStrategy *as=0) const
 
virtual FolderJob * createJob (TQPtrList< KMMessage > &msgList, const TQString &sets, FolderJob::JobType jt=FolderJob::tGetMessage, KMFolder *folder=0) const
 
virtual const KMMsgBase * getMsgBase (int idx) const =0
 
virtual KMMsgBase * getMsgBase (int idx)=0
 
virtual const KMMsgBase * operator[] (int idx) const
 
virtual KMMsgBase * operator[] (int idx)
 
virtual KMMessagetake (int idx)
 
virtual void take (TQPtrList< KMMessage > msgList)
 
virtual int addMsg (KMMessage *msg, int *index_return=0)=0
 
virtual int addMsgKeepUID (KMMessage *msg, int *index_return=0)
 
virtual int addMsg (TQPtrList< KMMessage > &, TQValueList< 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 TQPtrList< KMMsgBase > &msgList, bool imapQuiet=false)
 
virtual void removeMsg (const TQPtrList< KMMessage > &msgList, bool imapQuiet=false)
 
virtual int expungeOldMsg (int days)
 
virtual int moveMsg (KMMessage *msg, int *index_return=0)
 
virtual int moveMsg (TQPtrList< 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 ()
 
TQ_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 TQString &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
 
TQString 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 (TQValueList< 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 *, TQ_UINT32 serNum)
 
virtual bool isMoveable () const
 
virtual KMAccount * account () const
 
virtual bool mailCheckInProgress () const
 

Static Public Member Functions

static TQString dotEscape (const TQString &)
 

Protected Types

enum  { mDirtyTimerInterval = 600000 }
 

Protected Slots

virtual void removeJob (TQObject *)
 
void slotProcessNextSearchBatch ()
 

Protected Member Functions

virtual FolderJob * doCreateJob (KMMessage *msg, FolderJob::JobType jt, KMFolder *folder, TQString partSpecifier, const AttachmentStrategy *as) const =0
 
virtual FolderJob * doCreateJob (TQPtrList< KMMessage > &msgList, const TQString &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 KMMsgBase * takeIndexEntry (int idx)=0
 
virtual KMMsgInfo * setIndexEntry (int idx, KMMessage *msg)=0
 
virtual void clearIndex (bool autoDelete=true, bool syncDict=false)=0
 
virtual void truncateIndex ()=0
 
virtual TQ_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
 
TQ_INT64 mSize
 
bool mWriteConfigEnabled:1
 
bool needsCompact:1
 
bool mCompactable:1
 
bool mNoContent:1
 
bool mNoChildren:1
 
bool mConvertToUtf8:1
 
KMMsgDictREntry * mRDict
 
TQPtrList< FolderJob > mJobList
 
TQTimer * mDirtyTimer
 
ChildrenState mHasChildren
 
KMail::FolderContentsType mContentsType
 
KMFoldermFolder
 
TQTimer * mEmitChangedTimer
 
int mCurrentSearchedMsg
 
const KMSearchPatternmSearchPattern
 

Friends

class KMMsgDict
 

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.

Constructor & Destructor Documentation

◆ FolderStorage()

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

◆ addJob()

void FolderStorage::addJob ( FolderJob *  job) const

Add job for this folder.

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

Definition at line 119 of file folderstorage.cpp.

◆ addMsg() [1/2]

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

◆ addMsg() [2/2]

int FolderStorage::addMsg ( TQPtrList< KMMessage > &  msgList,
TQValueList< int > &  index_return 
)
virtual

Adds the given messages to the folder.

Behaviour is identical to addMsg(msg)

Definition at line 1162 of file folderstorage.cpp.

◆ addMsgKeepUID()

virtual int FolderStorage::addMsgKeepUID ( KMMessage msg,
int *  index_return = 0 
)
inlinevirtual

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

Definition at line 197 of file folderstorage.h.

◆ appendToFolderIdsFile()

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

Append message to end of message serial number file.

Definition at line 1013 of file folderstorage.cpp.

◆ autoCreateIndex()

bool FolderStorage::autoCreateIndex ( ) const
inline

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

Definition at line 314 of file folderstorage.h.

◆ canAccess()

virtual int FolderStorage::canAccess ( )
pure virtual

Check folder for permissions Returns zero if readable and writable.

◆ canAddMsgNow()

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.

◆ canDeleteMessages()

bool FolderStorage::canDeleteMessages ( ) const
virtual

Can messages in this folder be deleted?

Definition at line 1194 of file folderstorage.cpp.

◆ changed

void FolderStorage::changed ( )
signal

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

◆ cleared

void FolderStorage::cleared ( )
signal

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

◆ close()

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.

◆ closed

void FolderStorage::closed ( KMFolder )
signal

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

◆ compact()

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.

◆ compactable()

bool FolderStorage::compactable ( ) const
inline

false if index file is out of sync with mbox file

Definition at line 396 of file folderstorage.h.

◆ contentsType()

KMail::FolderContentsType FolderStorage::contentsType ( ) const
inline
Returns
the type of contents held in this folder (mail, calendar, etc.)

Definition at line 404 of file folderstorage.h.

◆ contentsTypeChanged

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

Emitted when the contents type (calendar, mail, tasks, ..) of the folderstorage changes.

◆ correctUnreadMsgsCount()

void FolderStorage::correctUnreadMsgsCount ( )
virtual

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

Definition at line 957 of file folderstorage.cpp.

◆ count()

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

Number of messages in this folder.

Reimplemented in KMFolderIndex.

Definition at line 820 of file folderstorage.cpp.

◆ countUnread()

int FolderStorage::countUnread ( )
virtual

Number of new or unread messages in this folder.

Definition at line 829 of file folderstorage.cpp.

◆ create()

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.

◆ createJob()

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

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

Definition at line 600 of file folderstorage.cpp.

◆ deregisterFromMessageDict()

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 970 of file folderstorage.cpp.

◆ dirty()

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 323 of file folderstorage.h.

◆ doCreateJob()

virtual FolderJob* FolderStorage::doCreateJob ( KMMessage msg,
FolderJob::JobType  jt,
KMFolder folder,
TQString  partSpecifier,
const AttachmentStrategy *  as 
) const
protectedpure virtual

These two methods actually create the jobs.

They have to be implemented in all folders.

See also
createJob

◆ dotEscape()

TQString FolderStorage::dotEscape ( const TQString &  aStr)
static

Escape a leading dot.

Definition at line 113 of file folderstorage.cpp.

◆ emitMsgAddedSignals()

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.

◆ expunge()

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 783 of file folderstorage.cpp.

◆ expungeContents()

virtual int FolderStorage::expungeContents ( )
protectedpure 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.

◆ expunged

void FolderStorage::expunged ( KMFolder )
signal

Emitted after an expunge.

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

◆ expungeOldMsg()

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.

◆ fileName()

TQString FolderStorage::fileName ( ) const
virtual

Returns the filename of the folder (reimplemented in KMFolderImap)

Definition at line 143 of file folderstorage.cpp.

◆ fillMessageDict()

virtual void FolderStorage::fillMessageDict ( )
inlineprotectedvirtual

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 558 of file folderstorage.h.

◆ find()

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.

◆ folderSize()

TQ_INT64 FolderStorage::folderSize ( ) const

Total size of the contents of this folder.

Definition at line 847 of file folderstorage.cpp.

◆ folderSizeChanged

void FolderStorage::folderSizeChanged ( )
signal

Emitted when the folder's size changes.

◆ folderType()

virtual KMFolderType FolderStorage::folderType ( ) const
inlinevirtual

Returns the type of this folder.

Definition at line 96 of file folderstorage.h.

◆ getDwString()

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

Read a message and returns a DwString.

◆ getMsg()

KMMessage * FolderStorage::getMsg ( int  idx)
virtual

Read message at given index.

Indexing starts at zero

Definition at line 477 of file folderstorage.cpp.

◆ getMsgBase()

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.

◆ hasChildren()

virtual ChildrenState FolderStorage::hasChildren ( ) const
inlinevirtual

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

Definition at line 125 of file folderstorage.h.

◆ headerOfMsgChanged()

void FolderStorage::headerOfMsgChanged ( const KMMsgBase *  aMsg,
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 898 of file folderstorage.cpp.

◆ ignoreJobsForMessage()

void FolderStorage::ignoreJobsForMessage ( KMMessage msg)
virtual

Removes and deletes all jobs associated with the particular message.

Definition at line 1064 of file folderstorage.cpp.

◆ indexLocation()

virtual TQString FolderStorage::indexLocation ( ) const
pure virtual

Returns full path to index file.

Implemented in KMFolderIndex.

◆ invalidated

void FolderStorage::invalidated ( KMFolder )
signal

Emitted when the serial numbers of this folder were invalidated.

◆ invalidateFolder()

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 987 of file folderstorage.cpp.

◆ isCloseToQuota()

bool FolderStorage::isCloseToQuota ( ) const
virtual

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


Definition at line 858 of file folderstorage.cpp.

◆ isMessage()

bool FolderStorage::isMessage ( int  idx)
virtual

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

Definition at line 591 of file folderstorage.cpp.

◆ isMoveable()

bool FolderStorage::isMoveable ( ) const
virtual

Returns true if this folder can be moved.

Definition at line 1177 of file folderstorage.cpp.

◆ isOpened()

bool FolderStorage::isOpened ( ) const
inline

Test if folder is opened, i.e.

its reference count is greater than zero.

Definition at line 279 of file folderstorage.h.

◆ isReadOnly()

virtual bool FolderStorage::isReadOnly ( ) const
pure virtual

Is the folder read-only?

◆ label()

TQString FolderStorage::label ( ) const

Returns the label of the folder for visualization.

Definition at line 815 of file folderstorage.cpp.

◆ location()

TQString FolderStorage::location ( ) const

Returns full path to folder file.

Definition at line 133 of file folderstorage.cpp.

◆ locationChanged

void FolderStorage::locationChanged ( const TQString &  ,
const TQString &   
)
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.

◆ markNewAsUnread()

void FolderStorage::markNewAsUnread ( )
virtual

Mark all new messages as unread.

Definition at line 167 of file folderstorage.cpp.

◆ markUnreadAsRead()

void FolderStorage::markUnreadAsRead ( )
virtual

Mark all new and unread messages as read.

Definition at line 183 of file folderstorage.cpp.

◆ moveMsg()

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 621 of file folderstorage.cpp.

◆ msgAdded

void FolderStorage::msgAdded ( int  idx)
signal

Emitted when a message is added from the folder.

◆ msgChanged

void FolderStorage::msgChanged ( KMFolder ,
TQ_UINT32  sernum,
int  delta 
)
signal

Emitted, when the status of a message is changed.

◆ msgHeaderChanged

void FolderStorage::msgHeaderChanged ( KMFolder ,
int   
)
signal

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

◆ msgRemoved [1/2]

void FolderStorage::msgRemoved ( int  idx,
TQString  msgIdMD5 
)
signal

Emitted after a message is removed from the folder.

◆ msgRemoved [2/2]

void FolderStorage::msgRemoved ( KMFolder ,
TQ_UINT32  sernum 
)
signal

Emitted before a message is removed from the folder.

◆ msgStatusChanged()

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.

Definition at line 864 of file folderstorage.cpp.

◆ nameChanged

void FolderStorage::nameChanged ( )
signal

Emitted when the name of the folder changes.

◆ needsCompacting()

bool FolderStorage::needsCompacting ( ) const
inline

Returns TRUE if the folder contains deleted messages.

Definition at line 329 of file folderstorage.h.

◆ noChildren()

virtual bool FolderStorage::noChildren ( ) const
inlinevirtual

Returns, if the folder can't have children.

Definition at line 113 of file folderstorage.h.

◆ noContent()

virtual bool FolderStorage::noContent ( ) const
inlinevirtual

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

Definition at line 107 of file folderstorage.h.

◆ noContentChanged

void FolderStorage::noContentChanged ( )
signal

Emitted when the no content state of the folder changes.

◆ numUnreadMsgsChanged

void FolderStorage::numUnreadMsgsChanged ( KMFolder )
signal

Emitted when number of unread messages has changed.

◆ open()

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

◆ operator[]() [1/2]

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

Same as getMsgBase(int).

This time non-const.

Definition at line 179 of file folderstorage.h.

◆ operator[]() [2/2]

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

Same as getMsgBase(int).

Definition at line 176 of file folderstorage.h.

◆ quiet()

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.

◆ rDict()

KMMsgDictREntry* FolderStorage::rDict ( ) const
inlineprotected

Returns the reverse-dictionary for this folder.

Definition at line 580 of file folderstorage.h.

◆ readConfig()

void FolderStorage::readConfig ( void  )
virtual

Read the config file.

Definition at line 918 of file folderstorage.cpp.

◆ readFolderIdsFile()

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 976 of file folderstorage.cpp.

◆ readIndex()

virtual bool FolderStorage::readIndex ( )
protectedpure virtual

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

Implemented in KMFolderIndex.

◆ readMsg()

virtual KMMessage* FolderStorage::readMsg ( int  idx)
protectedpure virtual

Load message from file and store it at given index.

Returns 0 on failure.

◆ readOnlyChanged

void FolderStorage::readOnlyChanged ( KMFolder )
signal

Emitted when the readonly status of the folder changes.

◆ readTemporaryMsg()

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 527 of file folderstorage.cpp.

◆ reallyAddCopyOfMsg

void FolderStorage::reallyAddCopyOfMsg ( KMMessage aMsg)
virtualslot

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.

◆ reallyAddMsg

void FolderStorage::reallyAddMsg ( KMMessage aMsg)
virtualslot

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

Definition at line 323 of file folderstorage.cpp.

◆ registerWithMessageDict()

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 964 of file folderstorage.cpp.

◆ remove()

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

Definition at line 755 of file folderstorage.cpp.

◆ removeContents()

virtual int FolderStorage::removeContents ( )
protectedpure 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.

◆ removed

void FolderStorage::removed ( KMFolder ,
bool   
)
signal

Emitted when a folder was removed.

◆ removeMsg()

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

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

Definition at line 380 of file folderstorage.cpp.

◆ rename()

int FolderStorage::rename ( const TQString &  newName,
KMFolderDir aParent = 0 
)
virtual

Physically rename the folder.

Returns zero on success and an errno on failure.

Definition at line 665 of file folderstorage.cpp.

◆ replaceMsgSerNum()

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 1025 of file folderstorage.cpp.

◆ search() [1/2]

void FolderStorage::search ( const KMSearchPattern pattern)
virtual

Search for messages The end is signaled with searchDone()

Definition at line 1126 of file folderstorage.cpp.

◆ search() [2/2]

void FolderStorage::search ( const KMSearchPattern pattern,
TQ_UINT32  serNum 
)
virtual

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

Definition at line 1154 of file folderstorage.cpp.

◆ searchDone

void FolderStorage::searchDone ( KMFolder ,
TQ_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.

◆ searchResult

void FolderStorage::searchResult ( KMFolder ,
TQValueList< TQ_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.

◆ setAutoCreateIndex()

void FolderStorage::setAutoCreateIndex ( bool  autoIndex)
virtual

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

Default is TRUE.

Definition at line 151 of file folderstorage.cpp.

◆ setContentsType()

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 1116 of file folderstorage.cpp.

◆ setDirty()

void FolderStorage::setDirty ( bool  f)

Change the dirty flag.

Definition at line 157 of file folderstorage.cpp.

◆ setHasChildren()

virtual void FolderStorage::setHasChildren ( ChildrenState  state)
inlinevirtual

Specify if the folder has children.

Definition at line 128 of file folderstorage.h.

◆ setNoChildren()

void FolderStorage::setNoChildren ( bool  aNoChildren)
virtual

Specify, that the folder can't have children.

Definition at line 1108 of file folderstorage.cpp.

◆ setNoContent()

void FolderStorage::setNoContent ( bool  aNoContent)
virtual

Specify, that the folder can't contain mails.

Definition at line 1199 of file folderstorage.cpp.

◆ setRDict()

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 1031 of file folderstorage.cpp.

◆ setStatus() [1/2]

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

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

Definition at line 1043 of file folderstorage.cpp.

◆ setStatus() [2/2]

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

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

Definition at line 1056 of file folderstorage.cpp.

◆ slotEmitChangedTimer

void FolderStorage::slotEmitChangedTimer ( )
slot

Emit changed signal if mQuite <=0.

Definition at line 278 of file folderstorage.cpp.

◆ slotProcessNextSearchBatch

void FolderStorage::slotProcessNextSearchBatch ( )
protectedslot

Process the next search batch.

Definition at line 1134 of file folderstorage.cpp.

◆ statusMsg

void FolderStorage::statusMsg ( const TQString &  )
signal

Emmited to display a message somewhere in a status line.

◆ sync()

virtual void FolderStorage::sync ( )
pure virtual

fsync buffers to disk

◆ syncStateChanged

void FolderStorage::syncStateChanged ( )
signal

Emiitted when the sync state, i.e.

mailCheckInProgress(), changes. Currently only supported for disconnected IMAP.

◆ take()

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.

Definition at line 423 of file folderstorage.cpp.

◆ touchFolderIdsFile()

int FolderStorage::touchFolderIdsFile ( )
protected

Touches the message serial number file.

Definition at line 1006 of file folderstorage.cpp.

◆ trashFolder()

virtual KMFolder* FolderStorage::trashFolder ( ) const
inlinevirtual

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

Otherwise return 0.

Definition at line 387 of file folderstorage.h.

◆ tryReleasingFolder()

virtual void FolderStorage::tryReleasingFolder ( KMFolder )
inlinevirtual

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

Currently used for KMFolderSearch and the background tasks like expiry.

Definition at line 273 of file folderstorage.h.

◆ unGetMsg()

KMMsgInfo * FolderStorage::unGetMsg ( int  idx)
virtual

Replace KMMessage with KMMsgInfo and delete KMMessage

Definition at line 566 of file folderstorage.cpp.

◆ updateChildrenState()

void FolderStorage::updateChildrenState ( )
virtual

Updates the hasChildren() state.

Definition at line 1096 of file folderstorage.cpp.

◆ updateIndex

virtual int FolderStorage::updateIndex ( )
pure virtualslot

Incrementally update the index if possible else call writeIndex.

◆ writeConfig()

void FolderStorage::writeConfig ( )
virtual

Write the config file.

Definition at line 939 of file folderstorage.cpp.

◆ writeFolderIdsFile()

int FolderStorage::writeFolderIdsFile ( ) const
protected

Writes the message serial number file.

Definition at line 999 of file folderstorage.cpp.

◆ writeIndex()

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.

Member Data Documentation

◆ mAutoCreateIndex

bool FolderStorage::mAutoCreateIndex
protected

is the automatic creation of a index file allowed ?

Definition at line 615 of file folderstorage.h.

◆ mCompactable

bool FolderStorage::mCompactable
protected

false if index file is out of sync with mbox file

Definition at line 632 of file folderstorage.h.

◆ mContentsType

KMail::FolderContentsType FolderStorage::mContentsType
protected

Type of contents in this folder.

Definition at line 648 of file folderstorage.h.

◆ mDirty

bool FolderStorage::mDirty
protected

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

Definition at line 620 of file folderstorage.h.

◆ mExportsSernums

bool FolderStorage::mExportsSernums
protected

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

Definition at line 618 of file folderstorage.h.

◆ mFilesLocked

bool FolderStorage::mFilesLocked
protected

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

Definition at line 622 of file folderstorage.h.

◆ mJobList

TQPtrList<FolderJob> FolderStorage::mJobList
mutableprotected

List of jobs created by this folder.

Definition at line 640 of file folderstorage.h.

◆ mRDict

KMMsgDictREntry* FolderStorage::mRDict
mutableprotected

Points at the reverse dictionary for this folder.

Definition at line 638 of file folderstorage.h.

◆ mUnreadMsgs

int FolderStorage::mUnreadMsgs
protected

number of unread messages, -1 if not yet set

Definition at line 625 of file folderstorage.h.

◆ needsCompact

bool FolderStorage::needsCompact
protected

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

Definition at line 630 of file folderstorage.h.


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