Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QMailMessageListModel Class Reference
[QtMessagingModule, QtPimModule]

The QMailMessageListModel class provides access to a list of stored messages. More...

    #include <QMailMessageListModel>

This class is under development and is subject to change.

Inherits QAbstractListModel.

Public Types

  • enum Roles { MessageAddressTextRole, MessageSubjectTextRole, MessageFilterTextRole, MessageTimeStampTextRole, ..., MessageIdRole }

Public Functions

Signals

Additional Inherited Members


Detailed Description

The QMailMessageListModel class provides access to a list of stored messages.

The QQMailMessageListModel presents a list 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 QMailMessageListModel is a descendant of QAbstractListModel, so it is suitable for use with the Qt View classes such as QListView to visually represent lists 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 QMailMessageListModel it is recommended that QSortFilterProxyModel is used to wrap the model to provide custom sorting and filtering.

See also QMailMessage and QSortFilterProxyModel.


Member Type Documentation

enum QMailMessageListModel::Roles

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

ConstantValueDescription
QMailMessageListModel::MessageAddressTextRoleQt::UserRoleThe 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.
QMailMessageListModel::MessageSubjectTextRole?The subject of a message. For-non email messages this may represent the body text of a message.
QMailMessageListModel::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.
QMailMessageListModel::MessageTimeStampTextRole?The timestamp of a message. "Recieved" or "Sent" is prepended to the timestamp string depending on the message direction.
QMailMessageListModel::MessageTypeIconRole?An Icon representing the type of the message.
QMailMessageListModel::MessageStatusIconRole?An Icon representing the status of the message. e.g Read, Unread, Downloaded
QMailMessageListModel::MessageDirectionIconRole?An Icon representing the incoming or outgoing direction of a message.
QMailMessageListModel::MessagePresenceIconRole?An Icon representing the presence status of the contact associated with the MessageAddressTextRole.
QMailMessageListModel::MessageBodyTextRole?The body of a message represented as text.
QMailMessageListModel::MessageIdRole?The QMailMessageId value identifying the message.


Member Function Documentation

QMailMessageListModel::QMailMessageListModel ( QObject * parent = 0 )

Constructs a QMailMessageListModel with a parent parent.

By default, the model will match all messages in the database, and display them in the order they were submitted, and mail store updates are not ignored.

See also setKey(), setSortKey(), and setIgnoreMailStoreUpdates().

QMailMessageListModel::~QMailMessageListModel ()   [virtual]

Deletes the QMailMessageListModel object.

QMailMessageId QMailMessageListModel::idFromIndex ( const QModelIndex & index ) const

Returns the QMailMessageId of the message represented by the QModelIndex index. If the index is not valid an invalid QMailMessageId is returned.

bool QMailMessageListModel::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 QMailMessageListModel::indexFromId ( const QMailMessageId & id ) const

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

bool QMailMessageListModel::isEmpty () const

Returns true if the model contains no messages.

QMailMessageKey QMailMessageListModel::key () const

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

See also setKey().

void QMailMessageListModel::modelChanged ()   [signal]

Signal emitted when the data set represented by the model is changed. Unlike modelReset(), the modelChanged() signal can not be emitted as a result of changes occurring in the current data set.

void QMailMessageListModel::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 QMailMessageListModel::setKey ( const QMailMessageKey & key )

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().

void QMailMessageListModel::setSortKey ( const QMailMessageSortKey & sortKey )

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().

QMailMessageSortKey QMailMessageListModel::sortKey () const

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

See also setSortKey().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web