|  | Home |

# QMailFolder Class Reference

The QMailFolder class represents a folder for mail messages in the mail store. More...

        #include <QMailFolder>

This class is under development and is subject to change.

Inherits QMailFolderFwd.

- List of all members, including inherited members

## Public Types

enum | StandardFolder { InboxFolder, OutboxFolder, DraftsFolder, SentFolder, TrashFolder, JunkFolder }

## Public Functions

| QMailFolder ()
| QMailFolder ( const QString & path, const QMailFolderId & parentFolderId = QMailFolderId(), const QMailAccountId & parentAccountId = QMailAccountId() )
| QMailFolder ( const QMailFolderId & id )
| QMailFolder ( const QMailFolder & other )
virtual | ~QMailFolder ()
QString | customField ( const QString & name ) const
const QMap<QString, QString> & | customFields () const
QString | displayName () const
QMailFolderId | id () const
QMailAccountId | parentAccountId () const
QMailFolderId | parentFolderId () const
QString | path () const
void | removeCustomField ( const QString & name )
uint | serverCount () const
uint | serverUndiscoveredCount () const
uint | serverUnreadCount () const
void | setCustomField ( const QString & name, const QString & value )
void | setCustomFields ( const QMap<QString, QString> & fields )
void | setDisplayName ( const QString & displayName )
void | setId ( const QMailFolderId & id )
void | setParentAccountId ( const QMailAccountId & id )
void | setParentFolderId ( const QMailFolderId & id )
void | setPath ( const QString & path )
void | setServerCount ( uint count )
void | setServerUndiscoveredCount ( uint count )
void | setServerUnreadCount ( uint count )
void | setStatus ( quint64 newStatus )
void | setStatus ( quint64 mask, bool set )
quint64 | status () const
QMailFolder & | operator= ( const QMailFolder & other )

## Static Public Members

const quint64 & | ChildCreationPermitted
const quint64 & | DeletionPermitted
const quint64 & | Drafts
const quint64 & | Incoming
const quint64 & | Junk
const quint64 & | MessagesPermitted
const quint64 & | NonMail
const quint64 & | Outgoing
const quint64 & | PartialContent
const quint64 & | Removed
const quint64 & | RenamePermitted
const quint64 & | Sent
const quint64 & | SynchronizationEnabled
const quint64 & | Synchronized
const quint64 & | Trash
quint64 | statusMask ( const QString & flagName )

## Detailed Description

The QMailFolder class represents a folder for mail messages in the mail store.

QMailFolder represents a folder of mail messages, either defined internally for application use, or to represent a folder object held by an external message service, such as an IMAP account.

A QMailFolder object has an optional parent of the same type, allowing folders to be arranged in tree structures. Messages may be associated with folders, allowing for simple classification and access by their parentFolderId property.

See also QMailMessage and QMailStore::folder().

## Member Type Documentation

### enum QMailFolder::StandardFolder

This enum type describes the standard folders pertinent to many account types.

Constant | Value | Description
--- | --- | ---
`QMailFolder::InboxFolder` | `1` | Represents the standard inbox folder.
`QMailFolder::OutboxFolder` | `2` | Represents the standard outbox folder.
`QMailFolder::DraftsFolder` | `3` | Represents the standard drafts folder.
`QMailFolder::SentFolder` | `4` | Represents the standard sent folder.
`QMailFolder::TrashFolder` | `5` | Represents the standard trash folder.
`QMailFolder::JunkFolder` | `6` | Represents the standard junk folder.

## Member Function Documentation

### QMailFolder::QMailFolder ()

Constructor that creates an empty and invalid `QMailFolder`. An empty folder is one which has no path, no parent folder and no parent account. An invalid folder does not exist in the database and has an invalid id.

### QMailFolder::QMailFolder ( const QString & path, const QMailFolderId & parentFolderId = QMailFolderId(), const QMailAccountId & parentAccountId = QMailAccountId() )

Creates a QMailFolder object with path path and parent folder ID parentFolderId, that is linked to a parent account parentAccountId.

### QMailFolder::QMailFolder ( const QMailFolderId & id )

Constructor that creates a QMailFolder by loading the data from the message store as specified by the QMailFolderId id. If the folder does not exist in the message store, then this constructor will create an empty and invalid QMailFolder.

### QMailFolder::QMailFolder ( const QMailFolder & other )

Creates a copy of the `QMailFolder` object other.

### QMailFolder::~QMailFolder () `[virtual]`

Destroys the `QMailFolder` object.

### QString QMailFolder::customField ( const QString & name ) const

Returns the value recorded in the custom field named name.

See also setCustomField() and customFields().

### const QMap<QString, QString> & QMailFolder::customFields () const

Returns the map of custom fields stored in the folder.

See also setCustomFields(), customField(), and setCustomField().

### QString QMailFolder::displayName () const

Returns the display name of the folder.

See also setDisplayName().

### QMailFolderId QMailFolder::id () const

Returns the `ID` of the `QMailFolder` object. A `QMailFolder` with an invalid ID is one which does not yet exist on the message store.

See also setId().

### QMailAccountId QMailFolder::parentAccountId () const

Returns the id of the account which owns the folder. If the folder is not linked to an account an invalid id is returned.

See also setParentAccountId().

### QMailFolderId QMailFolder::parentFolderId () const

Returns the ID of the parent folder. This folder is a root folder if the parent ID is invalid.

See also setParentFolderId().

### QString QMailFolder::path () const

Returns the path of the folder.

See also setPath().

### void QMailFolder::removeCustomField ( const QString & name )

Removes the custom field named name.

See also customField() and customFields().

### uint QMailFolder::serverCount () const

Returns the count of messages on the server for the folder.

The count is updated when an operation involving the folder is performed on the server, such as that requested by QMailRetrievalAction::retrieveFolderList().

See also setServerCount(), serverUnreadCount(), and serverUndiscoveredCount().

### uint QMailFolder::serverUndiscoveredCount () const

Returns the count of undiscovered messages on the server for the folder. Undiscovered messages are available at the server, but their meta data is not yet available on this client.

The count is updated when an operation involving the folder is performed on the server, such as that requested by QMailRetrievalAction::retrieveFolderList().

See also setServerUndiscoveredCount(), serverCount(), and serverUnreadCount().

### uint QMailFolder::serverUnreadCount () const

Returns the count of unread messages on the server for the folder. Unread messages have not had their content displayed by any client.

The count is updated when an operation involving the folder is performed on the server, such as that requested by QMailRetrievalAction::retrieveFolderList().

See also setServerUnreadCount(), serverCount(), and serverUndiscoveredCount().

### void QMailFolder::setCustomField ( const QString & name, const QString & value )

Sets the value of the custom field named name to value.

See also customField() and customFields().

### void QMailFolder::setCustomFields ( const QMap<QString, QString> & fields )

Sets the folder to contain the custom fields in fields.

See also setCustomField() and customFields().

### void QMailFolder::setDisplayName ( const QString & displayName )

Sets the display name of this folder to displayName.

See also displayName().

### void QMailFolder::setId ( const QMailFolderId & id )

Sets the ID of this folder to id

See also id().

### void QMailFolder::setParentAccountId ( const QMailAccountId & id )

Sets the id of the account which owns the folder to id.

See also parentAccountId().

### void QMailFolder::setParentFolderId ( const QMailFolderId & id )

Sets the parent folder ID to id. Warning: it is the responsibility of the application to make sure that no circular folder refernces are created.

See also parentFolderId().

### void QMailFolder::setPath ( const QString & path )

Sets the path of this folder within the parent account to path.

See also path().

### void QMailFolder::setServerCount ( uint count )

Sets the count of messages on the server for the folder to count.

See also serverCount(), setServerUnreadCount(), and setServerUndiscoveredCount().

### void QMailFolder::setServerUndiscoveredCount ( uint count )

Sets the count of undiscovered messages on the server for the folder to count. Undiscovered messages are available at the server, but their meta data is not yet available on this client.

See also serverUndiscoveredCount(), setServerCount(), and setServerUnreadCount().

### void QMailFolder::setServerUnreadCount ( uint count )

Sets the count of unread messages on the server for the folder to count. Unread messages have not had their content displayed by any client.

See also serverUnreadCount(), setServerCount(), and setServerUndiscoveredCount().

### void QMailFolder::setStatus ( quint64 newStatus )

Sets the status value for the folder to newStatus.

See also status() and statusMask().

### void QMailFolder::setStatus ( quint64 mask, bool set )

Sets the status flags indicated in mask to set.

See also status() and statusMask().

### quint64 QMailFolder::status () const

Returns the status value for the folder.

See also setStatus() and statusMask().

### quint64 QMailFolder::statusMask ( const QString & flagName ) `[static]`

Returns the status bitmask needed to test the result of QMailFolder::status() against the QMailFolder status flag registered with the identifier flagName.

See also status() and QMailStore::folderStatusMask().

### QMailFolder & QMailFolder::operator= ( const QMailFolder & other )

Assigns the value of the `QMailFolder` object other to this.

## Member Variable Documentation

### const quint64 & QMailFolder::ChildCreationPermitted

The status mask needed for testing the value of the registered status flag named `"ChildCreationPermitted"` against the result of QMailFolder::status().

This flag indicates that creation of child folders of this folder is allowed.

### const quint64 & QMailFolder::DeletionPermitted

The status mask needed for testing the value of the registered status flag named `"DeletionPermitted"` against the result of QMailFolder::status().

This flag indicates that the folder may be deleted.

### const quint64 & QMailFolder::Drafts

The status mask needed for testing the value of the registered status flag named `"Drafts"` against the result of QMailFolder::status().

This flag indicates that a folder contains messages that are drafts for potential transmission.

### const quint64 & QMailFolder::Incoming

The status mask needed for testing the value of the registered status flag named `"Incoming"` against the result of QMailFolder::status().

This flag indicates that a folder contains messages that are incoming from the point of view of the account owner.

### const quint64 & QMailFolder::Junk

The status mask needed for testing the value of the registered status flag named `"Junk"` against the result of QMailFolder::status().

This flag indicates that a folder contains messages that have been marked as junk.

### const quint64 & QMailFolder::MessagesPermitted

The status mask needed for testing the value of the registered status flag named `"MessagesPermitted"` against the result of QMailFolder::status().

This flag indicates that the folder is allowed to contain messages.

### const quint64 & QMailFolder::NonMail

The status mask needed for testing the value of the registered status flag named `"NonMail"` against the result of QMailFolder::status().

This flag indicates that the folder contains only non mail items such as calendar and/or contacts items.

### const quint64 & QMailFolder::Outgoing

The status mask needed for testing the value of the registered status flag named `"Outgoing"` against the result of QMailFolder::status().

This flag indicates that a folder contains messages that are outgoing from the point of view of the account owner.

### const quint64 & QMailFolder::PartialContent

The status mask needed for testing the value of the registered status flag named `"PartialContent"` against the result of QMailFolder::status().

This flag indicates that a folder contains a metadata record for only some of the messages known to exist at the external server.

### const quint64 & QMailFolder::Removed

The status mask needed for testing the value of the registered status flag named `"Removed"` against the result of QMailFolder::status().

This flag indicates that a folder has been removed from the external server.

### const quint64 & QMailFolder::RenamePermitted

The status mask needed for testing the value of the registered status flag named `"RenamePermitted"` against the result of QMailFolder::status().

This flag indicates that the folder may be renamed.

### const quint64 & QMailFolder::Sent

The status mask needed for testing the value of the registered status flag named `"Sent"` against the result of QMailFolder::status().

This flag indicates that a folder contains messages that were sent by the account owner.

### const quint64 & QMailFolder::SynchronizationEnabled

The status mask needed for testing the value of the registered status flag named `"SynchronizationEnabled"` against the result of QMailFolder::status().

This flag indicates that a folder should be included during account synchronization.

### const quint64 & QMailFolder::Synchronized

The status mask needed for testing the value of the registered status flag named `"Synchronized"` against the result of QMailFolder::status().

This flag indicates that a folder has been synchronized during account synchronization.

### const quint64 & QMailFolder::Trash

The status mask needed for testing the value of the registered status flag named `"Trash"` against the result of QMailFolder::status().

This flag indicates that a folder contains messages that have been marked as trash.