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  · 

Messaging

The Qt Messaging API enables access to messaging services to search and sort messages, send messages, retrieve message data, and launch the preferred messaging client on the system to either display an existing message, compose a new message, or respond to an existing message.

Overview

The messaging library provides a set of APIs for accessing messaging data. Interfaces are provided to retrieve and query messages, folders and accounts, also interfaces to create, modify, and store messages are provided. A unified interface for manipulation and storage of SMS, MMS, Email and XMPP messages is provided. Handling of internet media (MIME) messages that have only been partially retrieved is supported.

An API to access messaging services to send messages and retrieve message data is provided, as well as messaging services to compose, reply to, forward and show messages using a native application.

Notifications of addition, removal and updating of stored messages can be enabled.

The library provides unified access to the messaging data on a device including concurrent access to messaging data by multiple applications, and independence from the mechanism used to store the messaging data on the device.

On Microsoft Windows, MAPI header files are required to be installed, we recommend installing Visual Studio Express for this purpose.

On Linux QMF is required to be installed and the QMF_INCLUDEDIR and QMF_LIBDIR environment variables set to the messagingframework/src/libraries/qtopiamail and build/messagingframework/image/lib directories respectively.

Reference documentation

Main classes

QMessageConvenient interface for working with messages
QMessageAccountRepresents a messaging account in the messaging store
QMessageAccountFilterDefines the parameters used for querying a subset of all available accounts from the messaging store
QMessageAccountIdUnique identifier for a QMessageAccount messaging account, within the scope of the messaging store
QMessageAccountOrderingDefines the parameters used for sorting a subset of queried accounts from the messaging store
QMessageAddressInterface for a message address
QMessageContentContainerInterface for internet media (MIME) and Transport Neutral Encapsulation Format (TNEF) content that is possibly only partially retrieved
QMessageContentContainerIdUnique identifier for QMessageContentContainer internet media (MIME) type entities, within the scope of the containing message
QMessageDataComparatorContains types used in specifying the comparison of MessageStore objects with user-defined values
QMessageFilterDefines the parameters used for querying a subset of all available messages from the messaging store
QMessageFolderInterface for folders containing messages in the messaging store
QMessageFolderFilterDefines the parameters used for querying a subset of all available folders from the messaging store
QMessageFolderIdUnique identifier for a QMessageFolder message folder, within the scope of the messaging store
QMessageFolderOrderingDefines the parameters used for sorting a subset of queried folders from the messaging store
QMessageIdUnique identifier for a QMessage message within the scope of the messaging store
QMessageOrderingDefines the parameters used for sorting a subset of queried messages from the messaging store
QMessageServiceActionThe interface for requesting messaging services
QMessageStoreRepresents the main interface for storage and retrieval of messages, folders and accounts in the messaging store

Composition and Manipulation of Messages

The library provides a number of classes to assist with the composition and manipulation of message data. Messages of all supported types are represented uniformly. Messages can be composed of multiple parts.

Classes to assist with composition and manipulation of messages:

ClassDescription
QMessageIdRepresents the messaging store identifiers for messages.
QMessageConvenient interface for working with messages.
QMessageContentContainerInterface for an internet media (MIME) entity.
QMessageAddressInterface for manipulating message address strings.

Message Accounts

The library provides classes for accessing information about messaging accounts both outgoing and incoming.

Classes relating to messaging accounts:

ClassDescription
QMessageAccountIdRepresents the messaging store identifiers for accounts.
QMessageAccountStores attributes for a messaging account.
QMessageFolderIdRepresents the messaging store identifiers for folders.
QMessageFolderRepresents a folder of messages on the messaging store.

Sorting and Filtering Functionality

The library provides a number of sort and filter functions to aid in selecting a useful view of data. This reduces the burden on the client of the library for managing the messaging data, as well as allowing better use of the underlying storage mechanism.

Sorting is accomplished by providing a ordering object, specifying the sort order, and the message property upon which to order.

Filtering is accomplished by providing a filtering condition, specifying a value, the property to match, and the desired relation between the value and the property.

Filters can be combined using boolean operators to produce filters of arbitrary complexity.

Classes to assist with sorting and filtering messages:

ClassDescription
QMessageStoreRepresents the main interface for storage and retrieval of messages, folders and accounts from the messaging store.
QMessageFilterDefines the parameters used for querying a subset of all available messages from the messaging store.
QMessageOrderingDefines the parameters used for ordering messages queried from the messaging store.
QMessageFolderFilterDefines the parameters used for querying a subset of all available message folders from the messaging store.
QMessageFolderOrderingDefines the parameters used for ordering message folders queried from the messaging store.
QMessageAccountFilterDefines the parameters used for querying a subset of all available accounts from the messaging store.
QMessageAccountOrderingDefines the parameters used for ordering accounts queried from the messaging store.

Using the Ordering Functions

An example of the use of Ordering functions can be found in the Send Message example.

    QMessageIdList ids = QMessageStore::instance()->queryMessages(QMessageFilter(),
        QMessageOrdering::byReceptionTimeStamp(Qt::DescendingOrder), 100, 0);

Using the Filter Functions

The following code is taken from the Keep In Touch example, it demonstrates the use of filters to achieve desired effects. You can also see how the filters once constructed can be operated on by typical boolean operators, in the same way you would manipulate bit settings in C. In this way we can build more complex conditions.

    QMessageFilter includeFilter(QMessageFilter::byTimeStamp(minimumDate,
            QMessageDataComparator::GreaterThanEqual));
    QMessageFilter excludeFilter(QMessageFilter::byTimeStamp(maximumDate,
            QMessageDataComparator::GreaterThanEqual));
    QMessageFilter outgoingFilter(QMessageFilter::byStatus(QMessage::Incoming,
            QMessageDataComparator::Excludes));

    // Search for messages containing addresses to exclude
    service.queryMessages(outgoingFilter & excludeFilter);

    // Create the filter needed to locate messages to search for addresses
    inclusionFilter = (outgoingFilter & includeFilter & ~excludeFilter);

Messaging Services

The library provides the QMessageServiceAction class, which provides an interface to communicate with the system's native messaging services, including sending messages, retrieving message data, and composing or showing a message using a native application.

Service actions communciate their operational status by emitting signals.

Functions outside the QMessageServiceAction class should not invoke network activity. That is only QMessageServiceAction functions should be responsible for initiating network activity.

Concurrent Access to Messaging Data

The library provides a level of concurrent access to messaging data by multiple clients.

The concurrent access does guarantee that data won't be corrupted by concurrent access, however it does not give any guarantees as to performance of messaging data access if accessed concurrently by multiple clients.

Abstraction of Messaging Data Storage Mechanism

The library abstracts the storage method used to store messaging data.

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 80
  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. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Le Qt Developer Network au hasard

Logo

Combiner licence, à propos et fermer d'une dernière manière

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. 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