Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QMailMessageSetModel Class Reference
[QtMessagingModule]

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.

Public Types

Public Functions

Signals

Protected Functions

Additional Inherited Members


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.

QMailMessageListModel inherits from QAbstractListModel, so it is suitable for use with the Qt View classes such as QTreeView, to visually represent the hierachical 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 QMailMessageSetModel data() method. The data() function should be overridden to support additional roles, or to customize the display of 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.

ConstantValueDescription
QMailMessageSetModel::DisplayNameRoleQt::UserRoleThe 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]

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

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

Reimplemented from QAbstractItemModel.

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

This is an overloaded member function, provided for convenience.

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]

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

Reimplemented from QAbstractItemModel.

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 is the model contains no child message set objects.

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]

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

Reimplemented from QAbstractItemModel.

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.


Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3