|  | Home |

# QMailMessageSetModel Class Reference

The QMailMessageSetModel class provides a model for a tree of QMailMessageSets. More...

        #include <QMailMessageSetModel>

This class is under development and is subject to change.

Inherits QAbstractItemModel and QMailMessageSetContainer.

- List of all members, including inherited members

## Public Types

enum | Roles { DisplayNameRole, MessageKeyRole, SubclassUserRole }

## Public Functions

| QMailMessageSetModel ( QObject * parent = 0 )
QMailAccountId | accountIdFromIndex ( const QModelIndex & index ) const
virtual QVariant | data ( QMailMessageSet * item, int role, int column ) const
QMailFolderId | folderIdFromIndex ( const QModelIndex & index ) const
bool | ignoreMailStoreUpdates () const
QModelIndex | indexFromAccountId ( const QMailAccountId & id ) const
QModelIndex | indexFromFolderId ( const QMailFolderId & id ) const
QModelIndex | indexFromItem ( QMailMessageSet * item ) const
bool | isEmpty () const
QMailMessageSet * | itemFromIndex ( const QModelIndex & index ) const
void | setIgnoreMailStoreUpdates ( bool ignore )

## Reimplemented Public Functions

virtual QVariant | data ( const QModelIndex & index, int role ) const
virtual QModelIndex | index ( int row, int column, const QModelIndex & parentIndex ) const
virtual QModelIndex | parent ( const QModelIndex & index ) const

- 34 public functions inherited from QAbstractItemModel
- 10 public functions inherited from QMailMessageSetContainer
- 29 public functions inherited from QObject

## Signals

void | accountContentsModified ( const QMailAccountIdList & ids )
void | accountsAdded ( const QMailAccountIdList & ids )
void | accountsRemoved ( const QMailAccountIdList & ids )
void | accountsUpdated ( const QMailAccountIdList & ids )
void | folderContentsModified ( const QMailFolderIdList & ids )
void | foldersAdded ( const QMailFolderIdList & ids )
void | foldersRemoved ( const QMailFolderIdList & ids )
void | foldersUpdated ( const QMailFolderIdList & ids )
void | messagesAdded ( const QMailMessageIdList & ids )
void | messagesRemoved ( const QMailMessageIdList & ids )
void | messagesUpdated ( const QMailMessageIdList & ids )

- 14 signals inherited from QAbstractItemModel
- 1 signal inherited from QObject

## Protected Functions

virtual void | appended ( QMailMessageSet * item )
virtual void | removed ( QMailMessageSet * item )
virtual void | updated ( QMailMessageSet * item )

- 14 protected functions inherited from QAbstractItemModel
- 1 protected function inherited from QMailMessageSetContainer
- 7 protected functions inherited from QObject

### Additional Inherited Members

- 1 property inherited from QObject
- 2 public slots inherited from QAbstractItemModel
- 1 public slot inherited from QObject
- 1 public type inherited from QObject
- 4 static public members inherited from QObject
- 2 protected variables inherited from QObject

## Detailed Description

The QMailMessageSetModel class provides a model for a tree of QMailMessageSets.

QMailMessageSetModel provides a model containing sets of messages, arranged in a tree structure. Each node in the tree is a named entity that represents a set of messages, specified by a QMailMessageKey filter. QMailMessageSetModel can be used to construct a hierarchical tree of message folders, or other, more flexible ways of partitioning the set of messages into hierarchical groups.

QMailMessageSetModel inherits from QAbstractItemModel, so it is suitable for use with the Qt View classes such as QTreeView, to visually represent the hierarchical structure.

The model listens for change events emitted from the QMailStore, and automatically propagates these changes to attached views, unless the setIgnoreMailStoreUpdates() function is used to disable this feature.

To customize the display of QMailMessageSets, create a delegate that paints the object as desired, using data elements accessed via the data() function. The data() function should be overridden by subclasses to support additional roles, or to customize the data displayed for existing roles.

To define the content of a QMailMessageSetModel, derive classes from QMailMessageSet which select your desired message sets, and add them to the model in the init() member function. The model is informed of the addition, removal and update events for message sets anywhere within the model, via the notification functions appended(), removed() and updated(). Override these functions to perform any content management tasks specific to your model.

## Member Type Documentation

### enum QMailMessageSetModel::Roles

This enum type is used to define data elements used in common display roles when presenting message set objects.

Constant | Value | Description
--- | --- | ---
`QMailMessageSetModel::DisplayNameRole` | `Qt::UserRole` | The name of the message set for display purposes.
`QMailMessageSetModel::MessageKeyRole` | ? | The message selection key associated with a message set.
`QMailMessageSetModel::SubclassUserRole` | ? | The first value that should be used by subclasses when defining new message set roles.

## Member Function Documentation

### QMailMessageSetModel::QMailMessageSetModel ( QObject * parent = 0 )

Constructs a QMailMessageSetModel object with the supplied parent.

By default, mail store updates are not ignored.

See also setIgnoreMailStoreUpdates().

### void QMailMessageSetModel::accountContentsModified ( const QMailAccountIdList & ids ) `[signal]`

Signal that is emitted when changes to messages and folders in the mail store affect the content of the accounts in the list ids.

See also messagesAdded(), messagesUpdated(), messagesRemoved(), foldersAdded(), foldersUpdated(), and foldersRemoved().

### QMailAccountId QMailMessageSetModel::accountIdFromIndex ( const QModelIndex & index ) const

Return the identifier of the account associated with the item at index, if that item's type conforms to QMailAccountMessageSet.

### void QMailMessageSetModel::accountsAdded ( const QMailAccountIdList & ids ) `[signal]`

Signal that is emitted when the accounts in the list ids are added to the mail store.

See also accountsRemoved() and accountsUpdated().

### void QMailMessageSetModel::accountsRemoved ( const QMailAccountIdList & ids ) `[signal]`

Signal that is emitted when the accounts in the list ids are removed from the mail store.

See also accountsAdded() and accountsUpdated().

### void QMailMessageSetModel::accountsUpdated ( const QMailAccountIdList & ids ) `[signal]`

Signal that is emitted when the accounts in the list ids are updated within the mail store.

See also accountsAdded() and accountsRemoved().

### void QMailMessageSetModel::appended ( QMailMessageSet * item ) `[virtual protected]`

Updates the model's indexing information when item is appended to a container within the model.

Override this function to perform any management tasks specific to a subclass of QMailMessageSetContainer.

### QVariant QMailMessageSetModel::data ( const QModelIndex & index, int role ) const `[virtual]`

Reimplemented from QAbstractItemModel::data().

Returns the data element for the item at index, specified by role.

Note: this function is implemented by invoking the alternative overloaded method.

### QVariant QMailMessageSetModel::data ( QMailMessageSet * item, int role, int column ) const `[virtual]`

Returns the data element for item, specified by role and column.

### void QMailMessageSetModel::folderContentsModified ( const QMailFolderIdList & ids ) `[signal]`

Signal that is emitted when changes to messages in the mail store affect the content of the folders in the list ids.

See also messagesAdded(), messagesUpdated(), and messagesRemoved().

### QMailFolderId QMailMessageSetModel::folderIdFromIndex ( const QModelIndex & index ) const

Return the identifier of the folder associated with the item at index, if that item's type conforms to QMailFolderMessageSet.

### void QMailMessageSetModel::foldersAdded ( const QMailFolderIdList & ids ) `[signal]`

Signal that is emitted when the folders in the list ids are added to the mail store.

See also foldersRemoved() and foldersUpdated().

### void QMailMessageSetModel::foldersRemoved ( const QMailFolderIdList & ids ) `[signal]`

Signal that is emitted when the folders in the list ids are removed from the mail store.

See also foldersAdded() and foldersUpdated().

### void QMailMessageSetModel::foldersUpdated ( const QMailFolderIdList & ids ) `[signal]`

Signal that is emitted when the folders in the list ids are updated within the mail store.

See also foldersAdded() and foldersRemoved().

### bool QMailMessageSetModel::ignoreMailStoreUpdates () const

Returns true if the model has been set to ignore updates emitted by the mail store; otherwise returns false.

See also setIgnoreMailStoreUpdates().

### QModelIndex QMailMessageSetModel::index ( int row, int column, const QModelIndex & parentIndex ) const `[virtual]`

Reimplemented from QAbstractItemModel::index().

Returns an index object representing the object at row within the container located by parentIndex, having the column column.

### QModelIndex QMailMessageSetModel::indexFromAccountId ( const QMailAccountId & id ) const

Return the index of the message set associated with the account identified by id, if one exists.

See also accountIdFromIndex().

### QModelIndex QMailMessageSetModel::indexFromFolderId ( const QMailFolderId & id ) const

Return the index of the message set associated with the folder identified by id, if one exists.

See also folderIdFromIndex().

### QModelIndex QMailMessageSetModel::indexFromItem ( QMailMessageSet * item ) const

Returns the index within the model of item.

### bool QMailMessageSetModel::isEmpty () const

Returns true if the model contains no child message set objects; otherwise returns false.

### QMailMessageSet * QMailMessageSetModel::itemFromIndex ( const QModelIndex & index ) const

Returns the item located at index.

### void QMailMessageSetModel::messagesAdded ( const QMailMessageIdList & ids ) `[signal]`

Signal that is emitted when the messages in the list ids are added to the mail store.

See also messagesRemoved() and messagesUpdated().

### void QMailMessageSetModel::messagesRemoved ( const QMailMessageIdList & ids ) `[signal]`

Signal that is emitted when the messages in the list ids are removed from the mail store.

See also messagesAdded() and messagesUpdated().

### void QMailMessageSetModel::messagesUpdated ( const QMailMessageIdList & ids ) `[signal]`

Signal that is emitted when the messages in the list ids are updated within the mail store.

See also messagesAdded() and messagesRemoved().

### QModelIndex QMailMessageSetModel::parent ( const QModelIndex & index ) const `[virtual]`

Reimplemented from QAbstractItemModel::parent().

Returns an index object representing the parent container of the message set at index.

### void QMailMessageSetModel::removed ( QMailMessageSet * item ) `[virtual protected]`

Updates the model's indexing information when item is removed from a container within the model.

Override this function to perform any management tasks specific to a subclass of QMailMessageSetContainer.

### void QMailMessageSetModel::setIgnoreMailStoreUpdates ( bool ignore )

Sets whether or not mail store updates are ignored to ignore.

If ignoring updates is set to true, the model will ignore updates reported by the mail store. If set to false, the model will automatically synchronize its content in reaction to updates reported by the mail store.

If updates are ignored, signals such as rowInserted and dataChanged will not be emitted; instead, the modelReset signal will be emitted when the model is later changed to stop ignoring mail store updates, and detailed change information will not be accessible.

See also ignoreMailStoreUpdates().

### void QMailMessageSetModel::updated ( QMailMessageSet * item ) `[virtual protected]`

Updates the model's indexing information when item is updated.

Override this function to perform any management tasks specific to a subclass of QMailMessageSetContainer.