kmail
FolderStorage Class Reference
#include <folderstorage.h>
Inheritance diagram for FolderStorage:

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 78 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 | invalidated (KMFolder *) |
void | nameChanged () |
void | locationChanged (const QString &, const QString &) |
void | contentsTypeChanged (KMail::FolderContentsType type) |
void | readOnlyChanged (KMFolder *) |
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) |
Public Member Functions | |
FolderStorage (KMFolder *folder, const char *name=0) | |
KMFolder * | folder () 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 KMMessage * | getMsg (int idx) |
virtual KMMsgInfo * | unGetMsg (int idx) |
virtual bool | isMessage (int idx) |
virtual KMMessage * | readTemporaryMsg (int idx) |
virtual QCString & | getMsgString (int idx, QCString &mDest)=0 |
virtual DwString | getDwString (int idx)=0 |
virtual void | ignoreJobsForMessage (KMMessage *) |
virtual FolderJob * | createJob (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 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 KMMessage * | take (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 () |
virtual void | msgStatusChanged (const KMMsgStatus oldStatus, const KMMsgStatus newStatus, int idx) |
virtual int | open ()=0 |
virtual int | canAccess ()=0 |
virtual void | close (bool force=FALSE)=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 |
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 KMFolder * | trashFolder () const |
void | addJob (FolderJob *) const |
bool | compactable () const |
virtual void | setContentsType (KMail::FolderContentsType type) |
KMail::FolderContentsType | contentsType () const |
virtual void | search (const KMSearchPattern *) |
virtual void | search (const KMSearchPattern *, Q_UINT32 serNum) |
virtual bool | isMoveable () 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 FolderJob * | doCreateJob (KMMessage *msg, FolderJob::JobType jt, KMFolder *folder, QString partSpecifier, const AttachmentStrategy *as) const =0 |
virtual FolderJob * | doCreateJob (QPtrList< KMMessage > &msgList, const QString &sets, FolderJob::JobType jt, KMFolder *folder) const =0 |
void | headerOfMsgChanged (const KMMsgBase *, int idx) |
virtual KMMessage * | readMsg (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 |
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 |
bool | mWriteConfigEnabled:1 |
bool | needsCompact:1 |
bool | mCompactable:1 |
bool | mNoContent:1 |
bool | mNoChildren:1 |
bool | mConvertToUtf8:1 |
KMMsgDictREntry * | mRDict |
QPtrList< FolderJob > | mJobList |
QTimer * | mDirtyTimer |
ChildrenState | mHasChildren |
KMail::FolderContentsType | mContentsType |
KMFolder * | mFolder |
QTimer * | mEmitChangedTimer |
int | mCurrentSearchedMsg |
const KMSearchPattern * | mSearchPattern |
Friends | |
class | KMMsgDict |
Constructor & Destructor Documentation
|
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
|
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 106 of file folderstorage.cpp. |
|
Adds the given messages to the folder. Behaviour is identical to addMsg(msg) Definition at line 1109 of file folderstorage.cpp. |
|
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). |
|
(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 199 of file folderstorage.h. |
|
Append message to end of message serial number file.
Definition at line 962 of file folderstorage.cpp. |
|
Returns TRUE if a table of contents file is automatically created.
Definition at line 307 of file folderstorage.h. |
|
Check folder for permissions Returns zero if readable and writable.
|
|
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 288 of file folderstorage.cpp. |
|
Emitted when the status, name, or associated accounts of this folder changed.
|
|
Emitted when the contents of a folder have been cleared (new search in a search folder, for example).
|
|
Close folder. If force is TRUE the files are closed even if others still use it (e.g. other mail reader windows). |
|
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 |
|
false if index file is out of sync with mbox file
Definition at line 386 of file folderstorage.h. |
|
Definition at line 391 of file folderstorage.h. |
|
Emitted when the contents type (calendar, mail, tasks, . .) of the folderstorage changes. |
|
A cludge to help make sure the count of unread messges is kept in sync.
Definition at line 906 of file folderstorage.cpp. |
|
Number of messages in this folder.
Reimplemented in KMFolderIndex. Definition at line 788 of file folderstorage.cpp. |
|
Number of new or unread messages in this folder.
Definition at line 797 of file folderstorage.cpp. |
|
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. |
|
These methods create respective FolderJob (You should derive FolderJob for each derived KMFolder).
Definition at line 560 of file folderstorage.cpp. |
|
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 919 of file folderstorage.cpp. |
|
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 316 of file folderstorage.h. |
|
These two methods actually create the jobs. They have to be implemented in all folders.
|
|
Escape a leading dot.
Definition at line 100 of file folderstorage.cpp. |
|
Called by derived classes implementation of addMsg. Emits msgAdded signals Definition at line 271 of file folderstorage.cpp. |
|
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 744 of file folderstorage.cpp. |
|
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. |
|
Emitted after an expunge. If not quiet, changed() will be emmitted first. |
|
Delete messages in the folder that are older than days. Return the number of deleted messages. Definition at line 241 of file folderstorage.cpp. |
|
Returns the filename of the folder (reimplemented in KMFolderImap).
Definition at line 130 of file folderstorage.cpp. |
|
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 527 of file folderstorage.h. |
|
Returns the index of the given message or -1 if not found.
Implemented in KMFolderIndex. |
|
Returns the type of this folder.
Definition at line 94 of file folderstorage.h. |
|
Read a message and returns a DwString.
|
|
Read message at given index. Indexing starts at zero Definition at line 461 of file folderstorage.cpp. |
|
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. |
|
Read a message and return a referece to a string.
|
|
Returns if the folder has children, has no children or we don't know.
Definition at line 124 of file folderstorage.h. |
|
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 850 of file folderstorage.cpp. |
|
Removes and deletes all jobs associated with the particular message.
Definition at line 1013 of file folderstorage.cpp. |
|
Returns full path to index file.
Implemented in KMFolderIndex. |
|
Emitted when the serial numbers of this folder were invalidated.
|
|
Called when serial numbers for a folder are invalidated, invalidates/recreates data structures dependent on the serial numbers for this folder.
Definition at line 936 of file folderstorage.cpp. |
|
Checks if the message is already "gotten" with getMsg.
Definition at line 551 of file folderstorage.cpp. |
|
Returns true if this folder can be moved.
Definition at line 1124 of file folderstorage.cpp. |
|
Test if folder is opened.
Definition at line 272 of file folderstorage.h. |
|
Is the folder read-only?
|
|
Returns the label of the folder for visualization.
Definition at line 783 of file folderstorage.cpp. |
|
Returns full path to folder file.
Definition at line 120 of file folderstorage.cpp. |
|
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. |
|
Mark all new messages as unread.
Definition at line 154 of file folderstorage.cpp. |
|
Mark all new and unread messages as read.
Definition at line 170 of file folderstorage.cpp. |
|
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 581 of file folderstorage.cpp. |
|
Emitted when a message is added from the folder.
|
|
Emitted, when the status of a message is changed.
|
|
Emitted when a field of the header of a specific message changed.
|
|
Emitted after a message is removed from the folder.
|
|
Emitted before a message is removed from the folder.
|
|
Called by KMMsgBase::setStatus when status of a message has changed required to keep the number unread messages variable current.
Definition at line 816 of file folderstorage.cpp. |
|
Emitted when the name of the folder changes.
|
|
Returns TRUE if the folder contains deleted messages.
Definition at line 322 of file folderstorage.h. |
|
Returns, if the folder can't have children.
Definition at line 112 of file folderstorage.h. |
|
Returns, if the folder can't contain mails, but only subfolder.
Definition at line 105 of file folderstorage.h. |
|
Emitted when number of unread messages has changed.
|
|
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). |
|
Same as getMsgBase(int). This time non-const. Definition at line 181 of file folderstorage.h. |
|
Same as getMsgBase(int).
Definition at line 178 of file folderstorage.h. |
|
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 192 of file folderstorage.cpp. |
|
Returns the reverse-dictionary for this folder.
Definition at line 549 of file folderstorage.h. |
|
Read the config file.
Definition at line 870 of file folderstorage.cpp. |
|
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 925 of file folderstorage.cpp. |
|
Read index file and fill the message-info list mMsgList.
Implemented in KMFolderIndex. |
|
Load message from file and store it at given index. Returns 0 on failure. |
|
Emitted when the readonly status of the folder changes.
|
|
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 496 of file folderstorage.cpp. |
|
Add a copy of the message to the folder after it has been retrieved from an IMAP server.
Definition at line 331 of file folderstorage.cpp. |
|
Add the message to the folder after it has been retrieved from an IMAP server.
Definition at line 310 of file folderstorage.cpp. |
|
Triggers registration with the message dict, which will cause the dict to ask the FolderStorage to fill itself into it.
Definition at line 913 of file folderstorage.cpp. |
|
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.
Definition at line 719 of file folderstorage.cpp. |
|
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. |
|
Emitted when a folder was removed.
|
|
Remove (first occurrence of) given message from the folder.
Definition at line 367 of file folderstorage.cpp. |
|
Physically rename the folder. Returns zero on success and an errno on failure. Definition at line 625 of file folderstorage.cpp. |
|
Replaces the serial number for the message
Definition at line 974 of file folderstorage.cpp. |
|
Check if the message matches the search criteria The end is signaled with searchDone().
Definition at line 1101 of file folderstorage.cpp. |
|
Search for messages The end is signaled with searchDone().
Definition at line 1074 of file folderstorage.cpp. |
|
Emitted when a search for a single message is completed The serial number and a bool matching yes/no is included.
|
|
Emitted when a search delivers results The matching serial numbers are included If
|
|
Allow/disallow automatic creation of a table of contents file. Default is TRUE. Definition at line 138 of file folderstorage.cpp. |
|
Set the type of contents held in this folder (mail, calendar, etc.).
Definition at line 1065 of file folderstorage.cpp. |
|
Change the dirty flag.
Definition at line 144 of file folderstorage.cpp. |
|
Specify if the folder has children.
Definition at line 127 of file folderstorage.h. |
|
Specify, that the folder can't have children.
Definition at line 1057 of file folderstorage.cpp. |
|
Specify, that the folder can't contain mails.
Definition at line 108 of file folderstorage.h. |
|
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 980 of file folderstorage.cpp. |
|
Set the status of the message(s) in the QValueList
Definition at line 1005 of file folderstorage.cpp. |
|
Set the status of the message at index
Definition at line 992 of file folderstorage.cpp. |
|
Emit changed signal if mQuite <=0.
Definition at line 265 of file folderstorage.cpp. |
|
Process the next search batch.
Definition at line 1082 of file folderstorage.cpp. |
|
Emmited to display a message somewhere in a status line.
|
|
fsync buffers to disk
|
|
Detach message from this folder. Usable to call addMsg() afterwards. Loads the message if it is not loaded up to now. Definition at line 409 of file folderstorage.cpp. |
|
Touches the message serial number file.
Definition at line 955 of file folderstorage.cpp. |
|
If this folder has a special trash folder set, return it. Otherwise return 0. Definition at line 377 of file folderstorage.h. |
|
Try releasing Currently used for KMFolderSearch and the background tasks like expiry. Definition at line 266 of file folderstorage.h. |
|
Replace KMMessage with KMMsgInfo and delete KMMessage.
Definition at line 526 of file folderstorage.cpp. |
|
Updates the hasChildren() state.
Definition at line 1045 of file folderstorage.cpp. |
|
Incrementally update the index if possible else call writeIndex.
Implemented in KMFolderIndex. |
|
Write the config file.
Definition at line 889 of file folderstorage.cpp. |
|
Writes the message serial number file.
Definition at line 948 of file folderstorage.cpp. |
|
Write index to index-file. Returns 0 on success and errno error on failure. Implemented in KMFolderIndex. |
Member Data Documentation
|
is the automatic creation of a index file allowed ?
Definition at line 582 of file folderstorage.h. |
|
false if index file is out of sync with mbox file
Definition at line 598 of file folderstorage.h. |
|
Type of contents in this folder.
Definition at line 614 of file folderstorage.h. |
|
if the index is dirty it will be recreated upon close()
Definition at line 587 of file folderstorage.h. |
|
Has this storage exported its serial numbers to the global message dict for lookup?
Definition at line 585 of file folderstorage.h. |
|
TRUE if the files of the folder are locked (writable).
Definition at line 589 of file folderstorage.h. |
|
number of unread messages, -1 if not yet set
Definition at line 592 of file folderstorage.h. |
|
List of jobs created by this folder.
Definition at line 606 of file folderstorage.h. |
|
Points at the reverse dictionary for this folder.
Definition at line 604 of file folderstorage.h. |
|
number of unread messages, -1 if not yet set
Definition at line 592 of file folderstorage.h. |
|
sven: true if on destruct folder needs to be compacted.
Definition at line 596 of file folderstorage.h. |
The documentation for this class was generated from the following files: