![]() |
Home | ![]() |
The QMailMessageModelBase class provides an interface to a model containing messages. More...
#include <QMailMessageModelBase>
This class is under development and is subject to change.
Inherits QAbstractItemModel.
Inherited by QMailMessageListModel and QMailMessageThreadedModel.
enum | Roles { MessageAddressTextRole, MessageSubjectTextRole, MessageFilterTextRole, MessageTimeStampTextRole, ..., MessageIdRole } |
QMailMessageModelBase ( QObject * parent = 0 ) | |
QMailMessageId | idFromIndex ( const QModelIndex & index ) const |
bool | ignoreMailStoreUpdates () const |
QModelIndex | indexFromId ( const QMailMessageId & id ) const |
bool | isEmpty () const |
QMailMessageKey | key () const |
void | setIgnoreMailStoreUpdates ( bool ignore ) |
void | setKey ( const QMailMessageKey & key ) |
void | setSortKey ( const QMailMessageSortKey & sortKey ) |
QMailMessageSortKey | sortKey () const |
virtual int | columnCount ( const QModelIndex & index = QModelIndex() ) const |
virtual QVariant | data ( const QModelIndex & index, int role = Qt::DisplayRole ) const |
virtual int | rowCount ( const QModelIndex & index = QModelIndex() ) const |
virtual bool | setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ) |
void | modelChanged () |
The QMailMessageModelBase class provides an interface to a model containing messages.
The QMailMessageModelBase presents a model of all the messages 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 messages, sorted in a particular order.
The QMailMessageModelBase is a descendant of QAbstractListModel, so it is suitable for use with the Qt View classes such as QListView and QTreeView to visually present groups of messages.
The model listens for changes reported by the QMailStore, and automatically synchronizes its content with that of the store. This behaviour can be optionally or temporarily disabled by calling the setIgnoreMailStoreUpdates() function.
Messages can be extracted from the view with the idFromIndex() function and the resultant id can be used to load a message from the store.
For filters or sorting not provided by the QMailMessageModelBase it is recommended that QSortFilterProxyModel is used to wrap the model to provide custom sorting and filtering.
See also QMailMessage and QSortFilterProxyModel.
Represents common display roles of a message. These roles are used to display common message elements in a view and its attached delegates.
Constant | Value | Description |
---|---|---|
QMailMessageModelBase::MessageAddressTextRole | Qt::UserRole | The address text of a message. This a can represent a name if the address is tied to a contact in the addressbook and represents either the incoming or outgoing address depending on the message direction. |
QMailMessageModelBase::MessageSubjectTextRole | ? | The subject of a message. For-non email messages this may represent the body text of a message. |
QMailMessageModelBase::MessageFilterTextRole | ? | The MessageAddressTextRole concatenated with the MessageSubjectTextRole. This can be used by filtering classes to filter messages based on the text of these commonly displayed roles. |
QMailMessageModelBase::MessageTimeStampTextRole | ? | The timestamp of a message. "Received" or "Sent" is prepended to the timestamp string depending on the message direction. |
QMailMessageModelBase::MessageSizeTextRole | ? | The size of a message, formatted as text. |
QMailMessageModelBase::MessageTypeIconRole | ? | A string that can be passed to QIcon representing the type of the message. |
QMailMessageModelBase::MessageStatusIconRole | ? | A string that can be passed to QIcon representing the status of the message. e.g Read, Unread, Downloaded |
QMailMessageModelBase::MessageDirectionIconRole | ? | A string that can be passed to QIcon representing the incoming or outgoing direction of a message. |
QMailMessageModelBase::MessagePresenceIconRole | ? | A string that can be passed to QIcon representing the presence status of the contact associated with the MessageAddressTextRole. |
QMailMessageModelBase::MessageBodyTextRole | ? | The body of a message represented as text. |
QMailMessageModelBase::MessageIdRole | ? | The QMailMessageId value identifying the message. |
Constructs a QMailMessageModelBase with the parent parent.
Reimplemented from QAbstractItemModel::columnCount().
Reimplemented from QAbstractItemModel::data().
See also setData().
Returns the QMailMessageId of the message represented by the QModelIndex index. If the index is not valid an invalid QMailMessageId is returned.
Returns true if the model has been set to ignore updates emitted by the mail store; otherwise returns false.
See also setIgnoreMailStoreUpdates().
Returns the QModelIndex that represents the message with QMailMessageId id. If the id is not contained in this model, an invalid QModelIndex is returned.
Returns true if the model contains no messages.
Returns the QMailMessageKey used to populate the contents of this model.
See also setKey().
Signal that is emitted when the content or ordering of the model is reset.
Reimplemented from QAbstractItemModel::rowCount().
Reimplemented from QAbstractItemModel::setData().
See also data().
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().
Sets the QMailMessageKey used to populate the contents of the model to key. If the key is empty, the model is populated with all the messages from the database.
See also key() and modelChanged().
Sets the QMailMessageSortKey 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 messages are displayed in the order in which they were added into the database.
See also sortKey() and modelChanged().
Returns the QMailMessageSortKey used to sort the contents of the model.
See also setSortKey().
Copyright © 2010 QtSoftware | Messaging Framework |