FolderStorage Class Reference
Mail folder. More...
#include <folderstorage.h>
Inherits QObject.
Inherited by KMFolderIndex, and KMFolderSearch.
Public Types
- enum ChildrenState { HasChildren, HasNoChildren, ChildrenUnknown }
Public Slots
- virtual int updateIndex ()=0
- virtual void reallyAddMsg (KMMessage *aMsg)
- virtual void reallyAddCopyOfMsg (KMMessage *aMsg)
Signals
- void changed ()
- void cleared ()
- void expunged (KMFolder *)
- void nameChanged ()
- void locationChanged (const QString &, const QString &)
- 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 >, KMSearchPattern *, bool complete)
- void searchDone (KMFolder *, Q_UINT32, KMSearchPattern *)
Public Member Functions
- FolderStorage (KMFolder *folder, const char *name=0)
- KMFolder * folder () const
- void setAcctList (KMAcctList *list)
- KMAcctList * acctList () 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 (bool imap=FALSE)=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 const char * type () const
- bool hasAccounts () const
- virtual void correctUnreadMsgsCount ()
- virtual int writeIndex (bool createEmptyIndex=false)=0
- void fillMsgDict (KMMsgDict *dict)
- int writeMsgDict (KMMsgDict *dict=0)
- int touchMsgDict ()
- int appendtoMsgDict (int idx=-1)
- void setRDict (KMMsgDictREntry *rentry)
- KMMsgDictREntry * rDict () const
- 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 (KMSearchPattern *)
- virtual void search (KMSearchPattern *, Q_UINT32 serNum)
- virtual bool isMoveable () const
Static Public Member Functions
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 bool readIndex ()=0
- virtual int removeContents ()=0
- virtual int expungeContents ()=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 fillDictFromIndex (KMMsgDict *dict)=0
- virtual void truncateIndex ()=0
Protected Attributes
- int mOpenCount
- int mQuiet
- bool mChanged
- bool mAutoCreateIndex
- bool mDirty
- bool mFilesLocked
- KMAcctList * mAcctList
- int mUnreadMsgs
- int mGuessedUnreadMsgs
- int mTotalMsgs
- bool mWriteConfigEnabled
- bool needsCompact
- bool mCompactable
- bool mNoContent
- bool mNoChildren
- bool mConvertToUtf8
- bool mContentsTypeChanged
- KMMsgDictREntry * mRDict
- QPtrList< FolderJob > mJobList
- QTimer * mDirtyTimer
- ChildrenState mHasChildren
- KMail::FolderContentsType mContentsType
- KMFolder * mFolder
- int mCurrentSearchedMsg
- KMSearchPattern * mSearchPattern
Detailed Description
Mail folder.(description will be here).
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. 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. |
Member Function Documentation
|
Returns the type of this folder.
|
|
Returns the filename of the folder (reimplemented in KMFolderImap).
|
|
Returns full path to folder file.
|
|
Returns full path to index file.
|
|
Returns, if the folder can't contain mails, but only subfolder.
|
|
Specify, that the folder can't contain mails.
|
|
Returns, if the folder can't have children.
|
|
Specify, that the folder can't have children.
|
|
Returns if the folder has children, has no children or we don't know.
|
|
Specify if the folder has children.
|
|
Updates the hasChildren() state.
|
|
Read message at given index. Indexing starts at zero |
|
Replace KMMessage with KMMsgInfo and delete KMMessage.
|
|
Checks if the message is already "gotten" with getMsg.
|
|
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! |
|
Read a message and return a referece to a string.
|
|
Read a message and returns a DwString.
|
|
Removes and deletes all jobs associated with the particular message.
|
|
These methods create respective FolderJob (You should derive FolderJob for each derived KMFolder).
|
|
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. |
|
Same as getMsgBase(int).
|
|
Same as getMsgBase(int). This time non-const. |
|
Detach message from this folder. Usable to call addMsg() afterwards. Loads the message if it is not loaded up to now. |
|
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.
|
|
Adds the given messages to the folder. Behaviour is identical to addMsg(msg) |
|
Called by derived classes implementation of addMsg. Emits msgAdded signals |
|
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 |
|
Remove (first occurrence of) given message from the folder.
|
|
Delete messages in the folder that are older than days. Return the number of deleted messages. |
|
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. |
|
Returns the index of the given message or -1 if not found.
|
|
Number of messages in this folder.
|
|
Number of new or unread messages in this folder.
|
|
Called by KMMsgBase::setStatus when status of a message has changed required to keep the number unread messages variable current.
|
|
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). |
|
Check folder for permissions Returns zero if readable and writable.
|
|
Close folder. If force is TRUE the files are closed even if others still use it (e.g. other mail reader windows). |
|
Try releasing Currently used for KMFolderSearch and the background tasks like expiry. |
|
fsync buffers to disk
|
|
Test if folder is opened.
|
|
Mark all new messages as unread.
|
|
Mark all new and unread messages as read.
|
|
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. |
|
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.
|
|
Delete entire folder. Forces a close *but* opens the folder again afterwards. Returns errno(3) error code or zero on success.
|
|
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 |
|
Physically rename the folder. Returns zero on success and an errno on failure. |
|
Returns TRUE if a table of contents file is automatically created.
|
|
Allow/disallow automatic creation of a table of contents file. Default is TRUE. |
|
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. |
|
Change the dirty flag.
|
|
Returns TRUE if the folder contains deleted messages.
|
|
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. |
|
Is the folder read-only?
|
|
Returns the label of the folder for visualization.
|
|
Type of the folder. Inherited. |
|
Returns TRUE if accounts are associated with this folder.
|
|
A cludge to help make sure the count of unread messges is kept in sync.
|
|
Write index to index-file. Returns 0 on success and errno error on failure. |
|
Inserts messages into the message dictionary. Might be called during kernel initialization. |
|
Writes the message serial number file.
|
|
Touches the message serial number file.
|
|
Append message to end of message serial number file.
|
|
Sets the reverse-dictionary for this folder.
|
|
Returns the reverse-dictionary for this folder.
|
|
Set the status of the message at index
|
|
Set the status of the message(s) in the QValueList
|
|
Convert "\r\n" line endings in "\n" line endings. The conversion happens in place. Returns the length of the resulting string. |
|
Escape a leading dot.
|
|
Read the config file.
|
|
Write the config file.
|
|
If this folder has a special trash folder set, return it. Otherwise return 0. |
|
Add job for this folder. This is done automatically by createJob. This method is public only for other kind of FolderJob like ExpireJob. |
|
false if index file is out of sync with mbox file
|
|
Set the type of contents held in this folder (mail, calendar, etc.).
|
|
the type of contents held in this folder (mail, calendar, etc.)
|
|
Search for messages The end is signaled with searchDone().
|
|
Check if the message matches the search criteria The end is signaled with searchDone().
|
|
Returns true if this folder can be moved.
|
|
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).
|
|
Emitted after an expunge. If not quiet, changed() will be emmitted first. |
|
Emitted when the name of the folder changes.
|
|
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. |
|
Emitted when the readonly status of the folder changes.
|
|
Emitted before a message is removed from the folder.
|
|
Emitted after a message is removed from the folder.
|
|
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.
|
|
Emmited to display a message somewhere in a status line.
|
|
Emitted when number of unread messages has changed.
|
|
Emitted when a folder was removed.
|
|
Emitted when a search delivers results The matching serial numbers are included If
|
|
Emitted when a search for a single message is completed The matching serial number is included.
|
|
Incrementally update the index if possible else call writeIndex.
|
|
Add the message to the folder after it has been retrieved from an IMAP server.
|
|
Add a copy of the message to the folder after it has been retrieved from an IMAP server.
|
|
Process the next search batch.
|
|
These two methods actually create the jobs. They have to be implemented in all folders.
|
|
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... |
|
Load message from file and store it at given index. Returns 0 on failure. |
|
Read index file and fill the message-info list mMsgList.
|
|
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. |
|
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. |
Member Data Documentation
|
is the automatic creation of a index file allowed ?
|
|
if the index is dirty it will be recreated upon close()
|
|
TRUE if the files of the folder are locked (writable).
|
|
number of unread messages, -1 if not yet set
|
|
number of unread messages, -1 if not yet set
|
|
sven: true if on destruct folder needs to be compacted.
|
|
false if index file is out of sync with mbox file
|
|
Points at the reverse dictionary for this folder.
|
|
List of jobs created by this folder.
|
|
Type of contents in this folder.
|
The documentation for this class was generated from the following files:
- folderstorage.h
- folderstorage.cpp