/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page contactsasync.html \title Contacts Asynchronous API \tableofcontents \section1 Introduction The Contacts Asynchronous API enables a client to asynchronously fetch, update, or remove contact, relationship or schema data from a contact manager. Use of the asynchronous API offers the programmer greater flexibility when requesting information from remote or slow local datastores. \section1 Using the API The asynchronous API offered by the Contacts module is available through classes derived from the QContactAbstractRequest class. It consists of three major sections: \list \o Contact Manipulation \o Relationship Manipulation \o Schema Manipulation \endlist The functionality offered by the synchronous API in these three categories is also available through the asynchronous API. There is one category of functionality which is not provided by the asynchronous API which is provided by the synchronous API: some information and reporting functionality is only provided through the synchronous API. For detailed information about the information and reporting functionality provided, please refer to the documentation for the \l{Contacts Synchronous API}. The functions to set and retrieve the id of the self-contact are also only provided by the synchronous API. \section2 Contact Manipulation The most common type of operation that clients will perform involves retrieval or modification of contacts. For in-depth information about contact manipulation, please refer to the \l{Contacts Synchronous API}. There are four different types of operation which are supported by the asynchronous API: \list \o Fetch contact ids \o Fetch contacts \o Save contacts (create or update) \o Remove contacts \endlist These operations are supported via the QContactLocalIdFetchRequest, QContactFetchRequest, QContactSaveRequest and QContactRemoveRequest classes, respectively. The synchronous API offered by the QContactManager class to allow manipulation of contacts consists of the following functions: \list \o contactIds(const QList& sortOrders = QList()) const \o contactIds(const QContactFilter& filter, const QList& sortOrders = QList()) const \o contacts(const QList& sortOrders = QList(), const QContactFetchHint& fetchHint = QContactFetchHint()) const \o contacts(const QContactFilter& filter, const QList& sortOrders = QList(), const QContactFetchHint& fetchHint = QContactFetchHint()) const \o saveContacts(QList* contacts, QMap* errorMap) \o removeContacts(QList* contactIds, QMap* errorMap) \endlist \section3 Relationship Manipulation Contacts may be related in various ways. The contacts API allows clients to define relationships between contacts. For in-depth information about relationship manipulation, please refer to the \l{Contacts Synchronous API}. There are three different types of operation which are supported by the asynchronous API: \list \o Fetch relationships \o Save relationships (create or update, if supported by the backend) \o Remove relationships (if supported by the backend) \endlist These operations are supported via the QContactRelationshipFetchRequest, QContactRelationshipSaveRequest and QContactRelationshipRemoveRequest classes respectively. The synchronous API offered by the QContactManager class to allow manipulation of relationships consists of the following functions: \list \o relationships(const QContactId& participantId, QContactRelationshipFilter::Role role = QContactRelationshipFilter::Either) const; \o relationships(const QString& relationshipType = QString(), const QContactId& participantId = QContactId(), QContactRelationshipFilter::Role role = QContactRelationshipFilter::Either) const; \o saveRelationship(QContactRelationship* relationship); \o saveRelationships(QList* relationships); \o removeRelationship(const QContactRelationship& relationship); \o removeRelationships(const QList& relationships); \endlist \section2 Schema Manipulation The schema supported by a plugin is the list of detail definitions which are supported by the plugin. For in-depth information about the schema, please refer to the \l{Contacts Synchronous API}. There are three different types of operation which are supported by the asynchronous API: \list \o Fetch detail definitions \o Save detail definitions (create or update, if supported by the backend) \o Remove detail definitions (if supported by the backend) \endlist These operations are supported via the the QContactDetailDefinitionFetchRequest, QContactDetailDefinitionSaveRequest and QContactDetailDefinitionRemoveRequest classes, respectively. The synchronous API offered by the QContactManager class to allow manipulation of the schema consists of the following functions: \list \o detailDefinitions(const QString& contactType = QContactType::TypeContact) const \o detailDefinition(const QString& definitionName, const QString& contactType = QContactType::TypeContact) const \o saveDetailDefinition(const QContactDetailDefinition& def, const QString& contactType = QContactType::TypeContact) \o removeDetailDefinition(const QString& definitionName, const QString& contactType = QContactType::TypeContact) \endlist \section1 Examples Of Usage \section2 Fetching Contacts The client sets up a request for contacts matching a specific criteria from a particular manager. Results from the request will be displayed to the user as they are received. \snippet snippets/qtcontactsdocsample/qtcontactsdocsample.cpp Asynchronous contact request \section2 Other Asynchronous Operations All other asynchronous operations are performed in a similar manner to the previous example. A request of the desired type (which is derived from QContactAbstractRequest) is created, certain criteria are set which determine the intent of the request, and the signals of the request are connected to slots which deals with the results. The request can then be started. */