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  · 

QMessageStore Class Reference

The QMessageStore class represents the main interface for storage and retrieval of messages, folders and accounts in the messaging store. More...

    #include <QMessageStore>

This class is under development and is subject to change.

Inherits QObject.


Public Types

enum ErrorCode { NoError, InvalidId, ConstraintFailure, ContentInaccessible, ..., Busy }
typedef NotificationFilterId
typedef NotificationFilterIdSet
enum RemovalOption { RemoveLocalCopyOnly, RemoveOnOriginatingServer }

Public Functions

QMessageAccount account ( const QMessageAccountId & id ) const
bool addMessage ( QMessage * m )
int countAccounts ( const QMessageAccountFilter & filter = QMessageAccountFilter() ) const
int countFolders ( const QMessageFolderFilter & filter = QMessageFolderFilter() ) const
int countMessages ( const QMessageFilter & filter = QMessageFilter() ) const
QMessageFolder folder ( const QMessageFolderId & id ) const
QMessageStore::ErrorCode lastError () const
QMessage message ( const QMessageId & id ) const
QMessageAccountIdList queryAccounts ( const QMessageAccountFilter & filter = QMessageAccountFilter(), const QMessageAccountOrdering & ordering = QMessageAccountOrdering(), uint limit = 0, uint offset = 0 ) const
QMessageFolderIdList queryFolders ( const QMessageFolderFilter & filter = QMessageFolderFilter(), const QMessageFolderOrdering & ordering = QMessageFolderOrdering(), uint limit = 0, uint offset = 0 ) const
QMessageIdList queryMessages ( const QMessageFilter & filter = QMessageFilter(), const QMessageOrdering & ordering = QMessageOrdering(), uint limit = 0, uint offset = 0 ) const
QMessageIdList queryMessages ( const QMessageFilter & filter, const QString & body, QMessageDataComparator::Options options = 0, const QMessageOrdering & ordering = QMessageOrdering(), uint limit = 0, uint offset = 0 ) const
NotificationFilterId registerNotificationFilter ( const QMessageFilter & filter )
bool removeMessage ( const QMessageId & id, RemovalOption option = RemoveOnOriginatingServer )
bool removeMessages ( const QMessageFilter & filter, RemovalOption option = RemoveOnOriginatingServer )
void unregisterNotificationFilter ( NotificationFilterId notificationFilterId )
bool updateMessage ( QMessage * m )
  • 29 public functions inherited from QObject

Signals

void messageAdded ( const QMessageId & id, const QMessageStore::NotificationFilterIdSet & matchingFilterIds )
void messageRemoved ( const QMessageId & id, const QMessageStore::NotificationFilterIdSet & matchingFilterIds )
void messageUpdated ( const QMessageId & id, const QMessageStore::NotificationFilterIdSet & matchingFilterIds )

Static Public Members

QMessageStore * instance ()
  • 4 static public members inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public type inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QMessageStore class represents the main interface for storage and retrieval of messages, folders and accounts in the messaging store.

The QMessageStore class is accessed through a singleton interface and provides functions for adding, updating and deleting messages in the messaging store.

QMessageStore provides the countFolders() and queryFolders() functions for counting and listing the folders contained by the messaging store, and the countAccounts() and queryAccounts() functions for counting and listing the accounts contained by the store. These functions use the QMessageFolderFilter and QMessageFolderOrdering classes, and the QMessageAccountFilter and QMessageAccountOrdering classes to constrain their searches.

QMessageStore also implements functionality allowing the messages contained by the store to be counted or listed, using various filtering and ordering constraints. Clients can access this functionality via the countMessages and queryMessages functions of the QMessageServiceAction class.

With the exception of Windows mobile and desktop platforms, QMessageStore functions should not initiate network activity. Instead functions are restricted to operating on data already on the device. See QMessageServiceAction for functions related to initiating network activity.

If a QMessageStore operation fails, the lastError() function will return an error code value indicating the failure mode encountered. A successful operation will set the lastError() result to QMessageStore::NoError.

Messages in the messaging store are identified by QMessageId objects. The data associated with a message is retrieved in the form of a QMessage object using message(). Likewise a folder is retrieved in the form of a QMessageFolder object using folder(), and an account is retrieved in the form of a QMessageAccount object using account().

Messages can be inserted into the store using the addMessage() function, messages in the store can be manipulated via the updateMessage() function ,and removed by the removeMessage() functions.

Messaging store manipulations involving messages are reported via the messagesAdded(), messagesUpdated() and messagesRemoved() signals.

See also QMessage, QMessageId, QMessageContentContainerId, and QMessageServiceAction.


Member Type Documentation

enum QMessageStore::ErrorCode

Defines the result of attempting to perform a messaging store operation.

ConstantValueDescription
QMessageStore::NoError0The operation was successfully performed.
QMessageStore::InvalidId1The operation failed due to the specification of an invalid identifier.
QMessageStore::ConstraintFailure2The operation failed due to a constraint violation.
QMessageStore::ContentInaccessible3The operation failed because the content data cannot be accessed by the messaging store.
QMessageStore::NotYetImplemented4The operation failed because the messaging store does not yet implement the operation.
QMessageStore::FrameworkFault5The operation failed because the messaging store encountered an error in performing the operation.
QMessageStore::WorkingMemoryOverflow6The operation failed because the messaging store exhausted all memory available for evaluating queries.
QMessageStore::Busy7The operation failed because the messaging store is being used by another thread.

typedef QMessageStore::NotificationFilterId

This type contains a value identifying a registered message filter.

typedef QMessageStore::NotificationFilterIdSet

This type contains a set of values identifying registered message filters.

enum QMessageStore::RemovalOption

Defines whether or not a message will be removed from the originating server.

ConstantValueDescription
QMessageStore::RemoveLocalCopyOnly1Do not remove the message from the originating server.
QMessageStore::RemoveOnOriginatingServer2Remove the message both from the local store and from the originating server if any.


Member Function Documentation

QMessageAccount QMessageStore::account ( const QMessageAccountId & id ) const

Returns the QMessageAccount identified by id from the store.

bool QMessageStore::addMessage ( QMessage * m )

Updates the existing QMessage m on the messaging store. Returns true if the operation successfully updates the store; otherwise returns false.

To ensure the change is propagated to any affected external server QMessageServiceAction::exportUpdates() should be subsequently called.

See also message(), updateMessage(), removeMessage(), and QMessageServiceAction::exportUpdates().

int QMessageStore::countAccounts ( const QMessageAccountFilter & filter = QMessageAccountFilter() ) const

Returns the number of messages which match the filtering criteria defined in QMessageAccountFilter filter. If filter is empty a count of all messages is returned.

See also lastError() and queryAccounts().

int QMessageStore::countFolders ( const QMessageFolderFilter & filter = QMessageFolderFilter() ) const

Returns the number of messages which match the filtering criteria defined in QMessageFolderFilter filter. If filter is empty a count of all messages is returned.

See also lastError() and queryFolders().

int QMessageStore::countMessages ( const QMessageFilter & filter = QMessageFilter() ) const

Returns the number of messages which match the filtering criteria defined in QMessageFilter filter. If filter is empty a count of all messages is returned.

See also lastError() and queryMessages().

QMessageFolder QMessageStore::folder ( const QMessageFolderId & id ) const

Returns the QMessageFolder identified by id from the store.

QMessageStore * QMessageStore::instance ()   [static]

Returns the single instance of the QMessageStore class.

If necessary, the store will be instantiated and initialized.

QMessageStore::ErrorCode QMessageStore::lastError () const

Returns the code of the last error condition reported by the messaging store.

QMessage QMessageStore::message ( const QMessageId & id ) const

Returns the QMessage identified by id from the store.

void QMessageStore::messageAdded ( const QMessageId & id, const QMessageStore::NotificationFilterIdSet & matchingFilterIds )   [signal]

Signal that is emitted when the message identified by id is added to the message store. matchingFilterIds contains a set of values identifiying registered notification filters that matched the message.

See also messageRemoved(), messageUpdated(), and registerNotificationFilter().

void QMessageStore::messageRemoved ( const QMessageId & id, const QMessageStore::NotificationFilterIdSet & matchingFilterIds )   [signal]

Signal that is emitted when the message identified by id is removed from the message store. matchingFilterIds contains a set of values identifiying registered notification filters that matched the message.

Since the filters apply to the state of the data after the message removal, the only data item that may be subject to filtration is the identifier of the removed message.

See also messageAdded(), messageUpdated(), and registerNotificationFilter().

void QMessageStore::messageUpdated ( const QMessageId & id, const QMessageStore::NotificationFilterIdSet & matchingFilterIds )   [signal]

Signal that is emitted when the message identified by id is updated in the message store. matchingFilterIds contains a set of values identifiying registered notification filters that matched the message.

Since the filters apply to the state of the data after the message modification, updates to messages which matched a given filter prior to modification but not afterwards will not result in the emission of the messageUpdated signal.

See also messageAdded(), messageRemoved(), and registerNotificationFilter().

QMessageAccountIdList QMessageStore::queryAccounts ( const QMessageAccountFilter & filter = QMessageAccountFilter(), const QMessageAccountOrdering & ordering = QMessageAccountOrdering(), uint limit = 0, uint offset = 0 ) const

Returns the QMessageAccountIds of accounts in the messaging store. If filter is not empty only accounts matching the parameters set by filter will be returned, otherwise identifiers for all accounts will be returned. If ordering is not empty, then the identifiers will be sorted by the parameters set by ordering. If limit is not zero, then limit places an upper bound on the number of ids in the list returned. offset specifies how many ids to skip at the beginning of the list returned.

See also lastError() and countAccounts().

QMessageFolderIdList QMessageStore::queryFolders ( const QMessageFolderFilter & filter = QMessageFolderFilter(), const QMessageFolderOrdering & ordering = QMessageFolderOrdering(), uint limit = 0, uint offset = 0 ) const

Returns the QMessageFolderIds of folders in the messaging store. If filter is not empty only folders matching the parameters set by filter will be returned, otherwise identifiers for all folders will be returned. If ordering is not empty, then the identifiers will be sorted by the parameters set by ordering. If limit is not zero, then limit places an upper bound on the number of ids in the list returned. offset specifies how many ids to skip at the beginning of the list returned.

See also lastError() and countFolders().

QMessageIdList QMessageStore::queryMessages ( const QMessageFilter & filter = QMessageFilter(), const QMessageOrdering & ordering = QMessageOrdering(), uint limit = 0, uint offset = 0 ) const

Returns the QMessageIds of messages in the messaging store. If filter is not empty only messages matching the parameters set by filter will be returned, otherwise identifiers for all messages will be returned. If ordering is not empty, then the identifiers will be sorted by the parameters set by ordering. If limit is not zero, then limit places an upper bound on the number of ids in the list returned. offset specifies how many ids to skip at the beginning of the list returned.

See also lastError() and countMessages().

QMessageIdList QMessageStore::queryMessages ( const QMessageFilter & filter, const QString & body, QMessageDataComparator::Options options = 0, const QMessageOrdering & ordering = QMessageOrdering(), uint limit = 0, uint offset = 0 ) const

Returns the QMessageIds of messages in the messaging store. If filter is not empty only messages matching the parameters set by filter and with a body containing the string body will be returned, otherwise identifiers for all messages with a body containing body will be returned. If ordering is not empty, then the identifiers will be sorted by the parameters set by ordering. If limit is not zero, then limit places an upper bound on the number of ids in the list returned. offset specifies how many ids to skip at the beginning of the list returned. options specifies the search optons to use.

See also lastError() and countMessages().

NotificationFilterId QMessageStore::registerNotificationFilter ( const QMessageFilter & filter )

Registers a message filter that will be used to generate messageAdded(), messageRemoved() and messageUpdated() signals. Returns an identifier value that can be used to identify the reason that a signal was emitted, and to unregister the filter at a later time.

The filter is applied to the state of the data after the occurrence of the event for which a notification may be emitted.

See also unregisterNotificationFilter(), messageAdded(), messageRemoved(), and messageUpdated().

bool QMessageStore::removeMessage ( const QMessageId & id, RemovalOption option = RemoveOnOriginatingServer )

Removes the message with QMessageId id from the messaging store. If option is QMessageStore::RemoveOnOriginatingServer then when synchronization is performed the message should be removed from both the local message store and the originating server if any.

Returns true if the operation successfully updates the store; otherwise returns false.

To ensure the change is propagated to any affected external server QMessageServiceAction::exportUpdates() should be subsequently called.

option is ignored on Windows mobile and desktop platforms.

See also removeMessages(), addMessage(), updateMessage(), and QMessageServiceAction::exportUpdates().

bool QMessageStore::removeMessages ( const QMessageFilter & filter, RemovalOption option = RemoveOnOriginatingServer )

Removes all messages identified by the filter filter from the messaging store. If option is QMessageStore::RemoveOnOriginatingServer then when synchronization is performed the messages should be removed from both the local message store and the originating server if any.

Returns true if the operation successfully updates the store; otherwise returns false.

To ensure the change is propagated to any affected external server QMessageServiceAction::exportUpdates() should be subsequently called.

option is ignored on Windows mobile and desktop platforms.

For example:

To implement a function to remove a list messages identified by QMessageIds from the messaging store.

    bool removeMessages(const QMessageIdList& ids)
    {
        QMessageFilter idsFilter(ids);
        return QMessageStore::instance()->removeMessages(idsFilter);
    }

See also removeMessage(), addMessage(), updateMessage(), and QMessageServiceAction::exportUpdates().

void QMessageStore::unregisterNotificationFilter ( NotificationFilterId notificationFilterId )

Removes the message filter associated with notificationFilterId from the set used to generate message event signals.

See also registerNotificationFilter(), messageAdded(), messageRemoved(), and messageUpdated().

bool QMessageStore::updateMessage ( QMessage * m )

Updates the existing QMessage m on the messaging store. Returns true if the operation successfully updates the store; otherwise returns false.

To ensure the change is propagated to any affected external server QMessageServiceAction::exportUpdates() should be subsequently called.

See also addMessage(), removeMessage(), and QMessageServiceAction::exportUpdates().

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 94
  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. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 43
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 9
Page suivante

Le Qt Labs au hasard

Logo

Génération de contenu dans des threads

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. 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 qtmobility-1.0-tp
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