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

QMailAccountListModel Class Reference
[QtMessagingModule, QtPimModule]

The QMailAccountListModel class provides access to a list of stored accounts. More...

    #include <QMailAccountListModel>

This class is under development and is subject to change.

Inherits QAbstractListModel.

Public Types

Public Functions

Additional Inherited Members


Detailed Description

The QMailAccountListModel class provides access to a list of stored accounts.

The QMailAccountListModel presents a list of all the accounts currently stored in the message store. By using the setKey() and sortKey() functions it is possible to have the model represent specific user filtered subsets of accounts sorted in a particular order.

The QMailAccountListModel is a descendant of QAbstractListModel, so it is suitable for use with the Qt View classes such as QListView to visually represent lists of accounts.

The model listens for changes to the underlying storage system and sychronizes its contents based on the setSynchronizeEnabled() setting.

Accounts can be extracted from the view with the idFromIndex() function and the resultant id can be used to load an account from the store.

For filters or sorting not provided by the QMailAccountListModel it is recommended that QSortFilterProxyModel is used to wrap the model to provide custom sorting and filtering.

See also QMailAccount and QSortFilterProxyModel.


Member Type Documentation

enum QMailAccountListModel::Roles

Represents common display roles of an account. These roles are used to display common account elements in a view and its attached delegates.

ConstantValueDescription
QMailAccountListModel::NameTextRoleQt::UserRoleThe name of the account
QMailAccountListModel::MessageTypeRole?The type of the account
QMailAccountListModel::MessageSourcesRole?The list of message sources for the account
QMailAccountListModel::MessageSinksRole?The list of message sinks for the account


Member Function Documentation

QMailAccountListModel::QMailAccountListModel ( QObject * parent = 0 )

Constructs a QMailAccountListModel with a parent parent. By default, the model will match all accounts in the database, and display them in the order they were submitted. Synchronization defaults to true.

QMailAccountListModel::~QMailAccountListModel ()   [virtual]

Deletes the QMailMessageListModel object.

QMailAccountId QMailAccountListModel::idFromIndex ( const QModelIndex & index ) const

Returns the QMailAccountId of the account represented by the QModelIndex index. If the index is not valid an invalid QMailAccountId is returned.

QModelIndex QMailAccountListModel::indexFromId ( const QMailAccountId & id ) const

Returns the QModelIndex that represents the account with QMailAccountId id. If the id is not conatained in this model, an invalid QModelIndex is returned.

QMailAccountKey QMailAccountListModel::key () const

Returns the QMailAccountKey used to populate the contents of this model.

See also setKey().

void QMailAccountListModel::setKey ( const QMailAccountKey & key )

Sets the QMailAccountKey used to populate the contents of the model to key. If the key is empty, the model is populated with all the accounts from the database.

See also key().

void QMailAccountListModel::setSortKey ( const QMailAccountSortKey & sortKey )

Sets the QMailAccountSortKey used to sort the contents of the model to sortKey. If the sort key is invalid, no sorting is applied to the model contents and accounts are displayed in the order in which they were added into the database.

See also sortKey().

void QMailAccountListModel::setSynchronizeEnabled ( bool val )

Sets wheather the model synchronizes its contents based on account changes in the database to val.

See also synchronizeEnabled().

QMailAccountSortKey QMailAccountListModel::sortKey () const

Returns the QMailAccountSortKey used to sort the contents of the model.

See also setSortKey().

bool QMailAccountListModel::synchronizeEnabled () const

Returns true if the model sychronizes its contents based on account changes in the database, otherwise returns false.

See also setSynchronizeEnabled().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3