1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
/****************************************************************************
**
** 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 contacts.html
\title Contacts
\brief An API enabling clients to request contact data from local or
remote backends.
\ingroup mobility
The Contacts API enables a client to request contact data from local or
remote backends. This is part of the QtMobility Project.
\tableofcontents
\section1 Namespace
The QtMobility APIs are placed into the \i{QtMobility} namespace. This is done
to facilitate the future migration of QtMobility APIs into Qt. See the
\l {Quickstart guide} for an example on how the
namespace impacts on application development.
\section1 Introduction
The Contacts API provides clients with the ability to access contact data
in a platform-independent and datastore-agnostic manner. This is achieved
by defining generic personal information data abstractions which can
sufficiently describe contact data stored on any platform. Due to the
cross-platform nature of the API, and the ability for developers to write
platform-independent implementations of a QContactManager which may unify
one or more platform-specific contact backends, it is intended that the
semantics and quirks of the underlying datastores on any platform may be
entirely opaque from the perspective of Qt-based, cross-platform client
applications.
\section1 Overview
The QtMobility APIs are placed into the \i{QtMobility} namespace. This is done
to facilitate the future migration of QtMobility APIs into Qt. See the
\l {Quickstart guide} for an example on how the
namespace impacts on application development.
Contact information is stored in datastores whose functionality is exposed
via a \l{QContactManager}{manager}. The Contacts API models a
\l{QContact}{contact} as a collection of distinct details. Each
\l{QContactDetail}{detail} conforms to a particular
\l{QContactDetailDefinition}{definition} (or template), which may be
extensible or otherwise modifiable by clients. Individual contacts may be
related to one other, and these \l{QContactRelationship}{relationships} are
stored separately from contacts themselves and may be manipulated directly by
clients.
\l{QContact}{Contact}, \l{QContactDetailDefinition}{detail definition}, and
\l{QContactRelationship}{relationship} information may all be
retrieved, modified or deleted by clients using either
\l{Contacts Asynchronous API}{synchronous} or
\l{Contacts Asynchronous API}{asynchronous} API.
\section1 Client-Facing API
The client-facing API allows retrieval, modification and deletion of contacts,
detail definitions and relationships, and access to manager meta data and
capability reporting.
\section2 Container Classes
Contact information is stored in container (value) classes. These classes
are not derived from QObject, and hence can be used in lists, do not have
parents, do not emit signals, and so on. They represent data which may be
manipulated and retrieved from a \l{Manager}{manager}.
\section3 Contact
A \l{QContact}{contact} is the digital representation of a person, group or
entity, which is stored in a platform-specific manner. Information pertaining
to a single contact may be located across several different datastores, and
each datum (or detail) may or may not pertain to a particular context in which
that information is valid. A contact may include semantically identical
pieces of information that are relevant in different contexts. For
example, a contact may have a phone number that is relevant to their "home"
context, and another phone number that is relevant to their "work" context.
It can be seen that the context of information defines its validity to the
user, depending on the context of usage; and as such, the sum of
information in a given context can be considered equivalent to a "contextual
identity". This allows great flexibility when consolidating data from
various sources into a single, cohesive contact.
Each contact stored in a manager is identified by an \l{QContactId}{id} which
consists of a manager identifier (URI) and the
\l{QContactLocalId}{manager-local id} which is used to identify the contact
in that manager. Note that a contact stored in one manager may have the same
local id as a different contact stored in another manager; please see the
QContactId documentation for more information.
\section3 Detail
A \l{QContactDetail}{detail} is a single, cohesive unit of information that is
stored in a contact. As explained previously, it is valid for a particular
context or set of contexts, and conforms to a particular definition. A detail
may have specific metadata associated with it, such as its sub-type, context,
and arbitrary, user-defined metadata, as well as access constraints which may
apply to the the detail (such as read-only, irremovable, etc).
There are a number of common details defined in the API which are intended
for use by clients, as listed \l{"Contact Details" Leaf Classes}{here}.
\section3 Detail Definition
Each detail stored in a contact has defined semantics of usage and storage.
The Qt Contacts API allows per-datastore contact
\l{QContactDetailDefinition}{detail definitions}, allowing a manager to
provide clients with this information on demand, and allowing third-party
developers to register detail definitions for use by clients. A detail
definition includes the fields (and value-types of those fields) which make up
the detail, and per-contact uniqueness constraints on details of the
definition.
Most clients can safely ignore this class entirely, since they will most
likely want to use the predefined details listed
\l{"Contact Details" Leaf Classes}{here}. In some cases, however, a manager
will not support all of the fields of a particular predefined detail leaf
class; in that case, it may be necessary for the client to inspect the
supported detail definition for that leaf class and modify its behavior
accordingly (for example, if the \c CustomLabel field of the QContactName
leaf detail is not supported in a particular manager).
\section3 Relationships
Contacts may participate in \l{QContactRelationship}{relationships} with other
contacts. The details of any such relationship is stored by the manager which
contains the contact. There are several standard relationship types supported
by the default schema, and arbitrary relationship types are also allowed if
the manager supports that feature. One important relationship is that of
group membership; membership of a contact in a group can be modeled as that
group contact participating in a \c HasMember relationship with the contact.
\section2 Manager
Access to contacts is provided by implementations of the Qt Contacts
\l{QContactManager}{manager} API. A manager provides access to zero or more
platform-specific datastores. Each datastore may support different
capabilities (for example, the ability to store certain datatypes, the ability
to natively filter on different details or details of different definitions,
the provision of locking mechanisms, the provision of changelog information,
etc) which are reported by the manager on request. The manager therefore
provides access to detail definitions, contacts, and relationships stored in
different datastores, in a platform and datastore independent manner.
\section3 Meta Data API
The API offered by the QContactManager exposes functionality which is
implemented by plugins. These plugins may be platform specific, and may be
provided by Nokia or by third party developers. As described above, each
plugin will have different capabilities and implement the functionality
exposed by the Contacts API to a different degree.
The QContactManager class provides a static function
QContactManager::availableManagers() which allows clients of the API to
determine (at run time) which plugins (managers) are available for use.
Clients of the API also need to be able to determine (at run time) what the
capabilities of a given plugin (contact manager) are. The QContactManager
class provides API to query the capabilities of a given manager with the
following synchronous functions:
\list
\o hasFeature(QContactManager::ManagerFeature feature, const QString& contactType = QContactType::TypeContact) const
\o isFilterSupported(const QContactFilter& filter) const
\o isRelationshipTypeSupported(const QString& relationshipType, const QString& contactType = QContactType::TypeContact) const
\o supportedDataTypes() const
\o supportedContactTypes() const
\endlist
A given manager is identified by its URI. The URI consists of the manager's
name, any relevant parameters which were used during instantiation of the
manager, and the version of the manager. While the name of the manager
identifies the plugin which provides the functionality, you cannot guarantee
that the data available through one manager will be available through another
with the same name (for example, if one parameter tells the plugin to store
and retrieve contact information from a particular online service or local
file).
The synchronous API offered to allow run-time querying of a manager's metadata
includes:
\list
\o managerName() const
\o managerParameters() const
\o managerUri() const
\o managerVersion() const;
\o (static) parseUri(const QString& uri, QString* managerName, QMap<QString, QString>* params)
\o (static) buildUri(const QString& managerName, const QMap<QString, QString>& params, int implementationVersion = -1)
\endlist
The functionality that the above functions provide is only available through
synchronous API.
\section3 Asynchronous API
The asynchronous API provides a way to access or modify the
contact information managed by a particular backend via non-blocking,
asynchronous requests. It is recommended for most
applications that the asynchronous API be used where possible.
The asynchronous API is offered through various classes derived from the
QContactAbstractRequest class, including QContactLocalIdFetchRequest,
QContactFetchRequest, QContactSaveRequest, QContactRemoveRequest,
QContactDetailDefinitionFetchRequest, QContactDetailDefinitionSaveRequest,
QContactDetailDefinitionRemoveRequest, QContactRelationshipFetchRequest,
QContactRelationshipSaveRequest, and QContactRelationshipRemoveRequest.
The asynchronous API allows manipulation of \l{QContact}{contacts},
\l{QContactRelationship}{contact relationships}, and
\l{QContactDetailDefinition}{schema definitions}, but does not provide manager
capability or meta data information reporting.
For more detailed documentation on the asynchronous API, see the \l{Contacts Asynchronous API}.
\section3 Synchronous API
The synchronous API provides the simplest way to access or modify the
contact information managed by a particular backend. It has the
disadvantage that calls block the current thread of execution until completion
and is therefore most suitable only for applications which interact with
local, high-speed datastores, or for applications which do not require a
responsive user interface.
The synchronous API is offered through the QContactManager class, and includes
manipulation of \l{QContact}{contacts},
\l{QContactRelationship}{contact relationships}, and
\l{QContactDetailDefinition}{schema definitions}. As previously described,
the meta data reporting and manipulation functions are also provided via
synchronous API only.
For more detailed documentation on the synchronous API, see the \l{Contacts Synchronous API}.
\section2 Actions
Clients can perform \l{QContactAction}{actions} on contacts which support
them. Actions are things like "Send Email" or "Dial", and can be provided
from various sources including Qt Plugins or the QtMobility Service
Framework. Every action implementation is uniquely identified by a
combination of its name, the name of the service which provided the
implementation, and the version of the implementation. These pieces of data
may be encapsulated in a \l{QContactActionDescriptor} which can be used to
retrieve an instance of the implementation from a \l{QContactActionFactory}.
Different actions will allow (or require) different parameters to invocation.
For example, an action which allows clients to send emails to a contact may
be able to accept attachments as a parameter to invocation. Each action must
be invoked on an \l{QContactActionTarget}{action target} or list of targets,
where a target may be a contact or a specific detail of a particular contact.
See the \l{Qt Contacts Action API} documentation for more information on this topic.
\section1 Non-Client-Facing API
The non-client-facing API allows third party developers to implement a manager
engine plugin from which clients may request data.
\section2 Manager Engine
The functionality exposed by the QContactManager class may be implemented by
\l{QContactManagerEngine}{engine} plugins which interface directly to a
platform-specific backend or provide their own data storage backend. As such,
the terms "manager", "plugin" and "backend" are used interchangeably in this
documentation to refer to any engine plugin which implements the functionality
exposed by the QContactManager interface. The plugin architecture allows
dynamic loading of different manager engines at runtime.
A manager backend may be implemented by subclassing
\l{QContactManagerEngine}, and providing a \l{QContactManagerEngineFactory}
which can instantiate it when required.
See \l{Qt Contacts Manager Engines} for more information on available engines
and how to write your own engine.
\section1 Using the API
Some examples of common usage of the API may be found
\l{Contacts API Usage}{here}.
\section1 Building and compiling
To build the library, see the QtMobility installation instructions.
\section1 Reference documentation
\section2 Main classes
\annotatedlist contacts-main
\section2 "Contact Details" Leaf Classes
Several subclasses of \l{QContactDetail} are provided as part of the
QtMobility Project Contacts API. They are general in design but are intended
to fulfill specific use-cases. Please note that certain backends may
choose not to support one or more of these subclasses as they appear here;
they may offer their own which provide similar functionality.
\annotatedlist contacts-details
Each of these subclasses provide access to information stored in fields which
may have certain constraints, as listed in the \l{Qt Contacts Schema}{schema}.
\section2 Asynchronous Requests
Clients may use either the \l{Contacts Synchronous API}{synchronous}
or \l{Contacts Asynchronous API}{asynchronous} API to access
functionality provided by a manager backend. The
\l{Contacts Asynchronous API}{asynchronous} API is
offered through subclasses of the \l{QContactAbstractRequest} class:
\annotatedlist contacts-requests
\section2 Contact Selection
Clients may select a contact by specifying a unique contact id, or by
supplying a \l{QContactFilter} which matches the contact or contacts they
wish to select. The various derivatives of \l{QContactFilter} allow for
fine-grained and flexible selection of contacts according to various
criteria:
\annotatedlist contacts-filters
A client can also request that the results of such a selection be sorted,
by passing a \l{QContactSortOrder} (or list of sort orders) to the manager.
\section2 Actions
Actions are described by descriptors and are instantiated by factories.
\annotatedlist contacts-actions
\section2 Implementing Backends
A backend implementor must implement the following interfaces:
\annotatedlist contacts-backends
For more information on this topic, see please see the documentation on
\l{Qt Contacts Manager Engines}{implementing manager engines}.
\section2 Synchronization and Serialization
The contacts API is used by another QtMobility module: the \l {Versit} {Versit}* module. It allows
serialization of a QContact into a vCard document, and vice versa.
[*] Versit \reg is a trademark of the Internet Mail Consortium.
\section2 Examples
The following sample applications show examples of API usage:
\list
\o \l{samplephonebook}{Sample Phonebook}
\endlist
See also: \l{Contacts API Usage}
\section1 QML Elements
For details on the QML support provided for the Contacts API see the documentation for the \l {Contacts QML Plugin}.
*/
|