QtMobility Reference Documentation

QContactManager Class Reference

The QContactManager class provides an interface which allows clients with access to contact information stored in a particular backend. More...

 #include <QContactManager>

Inherits: QObject.

This class was introduced in Qt Mobility 1.0.

Public Types

enum Error { NoError, DoesNotExistError, AlreadyExistsError, InvalidDetailError, ..., UnspecifiedError }
enum ManagerFeature { Groups, ActionPreferences, DetailOrdering, Relationships, ..., Anonymous }

Public Functions

QContactManager ( const QString & managerName = QString(), const QMap<QString, QString> & parameters = 0, QObject * parent = 0 )
QContactManager ( const QString & managerName, int implementationVersion, const QMap<QString, QString> & parameters = 0, QObject * parent = 0 )
QContactManager ( QObject * parent )
~QContactManager ()
QContact compatibleContact ( const QContact & original )
QContact contact ( const QContactLocalId & contactId, const QContactFetchHint & fetchHint = QContactFetchHint() ) const
QList<QContactLocalId> contactIds ( const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> () ) const
QList<QContactLocalId> contactIds ( const QContactFilter & filter, const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> () ) const
QList<QContact> contacts ( const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> (), const QContactFetchHint & fetchHint = QContactFetchHint() ) const
QList<QContact> contacts ( const QContactFilter & filter, const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> (), const QContactFetchHint & fetchHint = QContactFetchHint() ) const
QList<QContact> contacts ( const QList<QContactLocalId> & localIds, const QContactFetchHint & fetchHint = QContactFetchHint(), QMap<int, QContactManager::Error> * errorMap = 0 ) const
QContactDetailDefinition detailDefinition ( const QString & definitionName, const QString & contactType = QContactType::TypeContact ) const
QMap<QString, QContactDetailDefinition> detailDefinitions ( const QString & contactType = QContactType::TypeContact ) const
QContactManager::Error error () const
QMap<int, QContactManager::Error> errorMap () const
bool hasFeature ( QContactManager::ManagerFeature feature, const QString & contactType = QContactType::TypeContact ) const
bool isFilterSupported ( const QContactFilter & filter ) const
bool isRelationshipTypeSupported ( const QString & relationshipType, const QString & contactType = QContactType::TypeContact ) const
QString managerName () const
QMap<QString, QString> managerParameters () const
QString managerUri () const
int managerVersion () const
QList<QContactRelationship> relationships ( const QContactId & participantId, QContactRelationship::Role role = QContactRelationship::Either ) const
QList<QContactRelationship> relationships ( const QString & relationshipType = QString(), const QContactId & participantId = QContactId(), QContactRelationship::Role role = QContactRelationship::Either ) const
bool removeContact ( const QContactLocalId & contactId )
bool removeContacts ( const QList<QContactLocalId> & contactIds, QMap<int, QContactManager::Error> * errorMap = 0 )
bool removeDetailDefinition ( const QString & definitionName, const QString & contactType = QContactType::TypeContact )
bool removeRelationship ( const QContactRelationship & relationship )
bool removeRelationships ( const QList<QContactRelationship> & relationships, QMap<int, QContactManager::Error> * errorMap = 0 )
bool saveContact ( QContact * contact )
bool saveContacts ( QList<QContact> * contacts, QMap<int, QContactManager::Error> * errorMap = 0 )
bool saveContacts ( QList<QContact> * contacts, const QStringList & definitionMask, QMap<int, QContactManager::Error> * errorMap = 0 )
bool saveDetailDefinition ( const QContactDetailDefinition & def, const QString & contactType = QContactType::TypeContact )
bool saveRelationship ( QContactRelationship * relationship )
bool saveRelationships ( QList<QContactRelationship> * relationships, QMap<int, QContactManager::Error> * errorMap = 0 )
QContactLocalId selfContactId () const
bool setSelfContactId ( const QContactLocalId & contactId )
QStringList supportedContactTypes () const
QList<QVariant::Type> supportedDataTypes () const
void synthesizeContactDisplayLabel ( QContact * contact ) const
QString synthesizedContactDisplayLabel ( const QContact & contact ) const
  • 29 public functions inherited from QObject

Signals

void contactsAdded ( const QList<QContactLocalId> & contactIds )
void contactsChanged ( const QList<QContactLocalId> & contactIds )
void contactsRemoved ( const QList<QContactLocalId> & contactIds )
void dataChanged ()
void relationshipsAdded ( const QList<QContactLocalId> & affectedContactIds )
void relationshipsRemoved ( const QList<QContactLocalId> & affectedContactIds )
void selfContactIdChanged ( const QContactLocalId & oldId, const QContactLocalId & newId )

Static Public Members

const QLatin1Constant ParameterSignalDefinitions
const QLatin1Constant ParameterSignalSources
const QLatin1Constant ParameterValueOnlyOtherManagers
const QLatin1Constant ParameterValueOnlyOtherProcesses
QStringList availableManagers ()
QString buildUri ( const QString & managerName, const QMap<QString, QString> & params, int implementationVersion = -1 )
QContactManager * fromUri ( const QString & managerUri, QObject * parent = 0 )
bool parseUri ( const QString & uri, QString * pManagerId, QMap<QString, QString> * pParams )
  • 4 static public members inherited from QObject

Additional Inherited Members

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

Detailed Description

The QContactManager class provides an interface which allows clients with access to contact information stored in a particular backend.

This class provides an abstraction of a datastore or aggregation of datastores which contains contact information. It provides methods to retrieve and manipulate contact information, contact relationship information, and supported schema definitions. It also provides metadata and error information reporting.

The functions provided by QContactManager are purely synchronous; to access the same functionality in an asynchronous manner, clients should use the use-case-specific classes derived from QContactAbstractRequest.

Some functionality provided by QContactManager directly is not accessible using the asynchronous API; see the synchronous and asynchronous API information from the contacts module API documentation.

Member Type Documentation

enum QContactManager::Error

This enum specifies an error that occurred during the most recent operation:

ConstantValueDescription
QContactManager::NoError0The most recent operation was successful
QContactManager::DoesNotExistError1The most recent operation failed because the requested contact or detail definition does not exist
QContactManager::AlreadyExistsError2The most recent operation failed because the specified contact or detail definition already exists
QContactManager::InvalidDetailError3The most recent operation failed because the specified contact contains details which do not conform to their definition
QContactManager::InvalidRelationshipError4The most recent operation failed because the specified relationship is circular or references an invalid local contact
QContactManager::InvalidContactTypeError14The most recent operation failed because the contact type specified was not valid for the operation
QContactManager::LockedError5The most recent operation failed because the datastore specified is currently locked
QContactManager::DetailAccessError6The most recent operation failed because a detail was modified or removed and its access method does not allow that
QContactManager::PermissionsError7The most recent operation failed because the caller does not have permission to perform the operation
QContactManager::OutOfMemoryError8The most recent operation failed due to running out of memory
QContactManager::VersionMismatchError12The most recent operation failed because the backend of the manager is not of the required version
QContactManager::LimitReachedError13The most recent operation failed because the limit for that type of object has been reached
QContactManager::NotSupportedError9The most recent operation failed because the requested operation is not supported in the specified store
QContactManager::BadArgumentError10The most recent operation failed because one or more of the parameters to the operation were invalid
QContactManager::TimeoutError15The most recent operation failed because it took longer than expected. It may be possible to try again.
QContactManager::UnspecifiedError11The most recent operation failed for an undocumented reason

enum QContactManager::ManagerFeature

This enum describes the possible features that a particular manager may support

ConstantValueDescription
QContactManager::Groups0The manager supports saving contacts of the QContactType::TypeGroup type
QContactManager::ActionPreferences1The manager supports saving preferred details per action per contact
QContactManager::DetailOrdering5When a contact is retrieved, the manager will return the details in the same order in which they were saved
QContactManager::Relationships3The manager supports at least some types of relationships between contacts
QContactManager::ArbitraryRelationshipTypes4The manager supports relationships of arbitrary types between contacts
QContactManager::MutableDefinitions2The manager supports saving, updating or removing detail definitions. Some built-in definitions may still be immutable
QContactManager::SelfContact6The manager supports the concept of saving a contact which represents the current user
QContactManager::ChangeLogs8The manager supports reporting of timestamps of changes, and filtering and sorting by those timestamps
QContactManager::Anonymous7The manager is isolated from other managers

Member Function Documentation

QContactManager::QContactManager ( const QString & managerName = QString(), const QMap<QString, QString> & parameters = 0, QObject * parent = 0 )

Constructs a QContactManager whose implementation is identified by managerName with the given parameters.

The parent QObject will be used as the parent of this QContactManager.

If an empty managerName is specified, the default implementation for the platform will be used.

This function was introduced in Qt Mobility 1.0.

QContactManager::QContactManager ( const QString & managerName, int implementationVersion, const QMap<QString, QString> & parameters = 0, QObject * parent = 0 )

Constructs a QContactManager whose backend has the name managerName and version implementationVersion, where the manager is constructed with the provided parameters.

The parent QObject will be used as the parent of this QContactManager.

If an empty managerName is specified, the default implementation for the platform will be instantiated. If the specified implementation version is not available, the manager with the name managerName with the default implementation version is instantiated.

This function was introduced in Qt Mobility 1.0.

QContactManager::QContactManager ( QObject * parent )

Constructs a QContactManager whose parent QObject is parent. The default implementation for the platform will be created.

This function was introduced in Qt Mobility 1.0.

QContactManager::~QContactManager ()

Frees the memory used by the QContactManager

QStringList QContactManager::availableManagers () [static]

Returns a list of available manager ids that can be used when constructing a QContactManager. If an empty id is specified to the constructor, the first value in this list will be used instead.

The QTCONTACTS_MANAGER_OVERRIDE environment variable may be set to override the default engine.

This function was introduced in Qt Mobility 1.0.

QString QContactManager::buildUri ( const QString & managerName, const QMap<QString, QString> & params, int implementationVersion = -1 ) [static]

Returns a URI that completely describes a manager implementation, datastore, and the parameters with which to instantiate the manager, from the given managerName, params and an optional implementationVersion. This function is generally useful only if you intend to construct a manager with the fromUri() function, or wish to set the manager URI field in a QContactId manually (for synchronization or other purposes). Most clients will not need to use this function.

This function was introduced in Qt Mobility 1.0.

QContact QContactManager::compatibleContact ( const QContact & original )

Returns a pruned or modified version of the original contact which is valid and can be saved in the manager. The returned contact might have entire details removed or arbitrarily changed. The cache of relationships in the contact are ignored entirely when considering compatibility with the backend, as they are saved and validated separately.

This function was introduced in Qt Mobility 1.0.

QContact QContactManager::contact ( const QContactLocalId & contactId, const QContactFetchHint & fetchHint = QContactFetchHint() ) const

Returns the contact in the database identified by contactId.

If the contact does not exist, an empty, default constructed QContact will be returned, and the error returned by error() will be QContactManager::DoesNotExistError.

The fetchHint parameter describes the optimization hints that a manager may take. If the fetchHint is the default constructed hint, all existing details, relationships and action preferences in the matching contact will be returned. If a client makes changes to an contact which has been retrieved with a fetch hint, they should save it back using a partial save, masked by the same set of detail names in order to avoid information loss.

This function was introduced in Qt Mobility 1.0.

See also QContactFetchHint.

QList<QContactLocalId> QContactManager::contactIds ( const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> () ) const

Return the list of contact ids, sorted according to the given list of sortOrders

This function was introduced in Qt Mobility 1.0.

QList<QContactLocalId> QContactManager::contactIds ( const QContactFilter & filter, const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> () ) const

Returns a list of contact ids that match the given filter, sorted according to the given list of sortOrders. Depending on the backend, this filtering operation may involve retrieving all the contacts.

This function was introduced in Qt Mobility 1.0.

QList<QContact> QContactManager::contacts ( const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> (), const QContactFetchHint & fetchHint = QContactFetchHint() ) const

Returns the list of contacts stored in the manager sorted according to the given list of sortOrders.

The fetchHint parameter describes the optimization hints that a manager may take. If the fetchHint is the default constructed hint, all existing details, relationships and action preferences in the matching contact will be returned. If a client makes changes to an contact which has been retrieved with a fetch hint, they should save it back using a partial save, masked by the same set of detail names in order to avoid information loss.

This function was introduced in Qt Mobility 1.0.

See also QContactFetchHint.

QList<QContact> QContactManager::contacts ( const QContactFilter & filter, const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> (), const QContactFetchHint & fetchHint = QContactFetchHint() ) const

Returns a list of contacts that match the given filter, sorted according to the given list of sortOrders.

Depending on the manager implementation, this filtering operation might be slow and involve retrieving all the contacts and testing them against the supplied filter - see the isFilterSupported() function.

The fetchHint parameter describes the optimization hints that a manager may take. If the fetchHint is the default constructed hint, all existing details, relationships and action preferences in the matching contact will be returned. If a client makes changes to an contact which has been retrieved with a fetch hint, they should save it back using a partial save, masked by the same set of detail names in order to avoid information loss.

This function was introduced in Qt Mobility 1.0.

See also QContactFetchHint.

QList<QContact> QContactManager::contacts ( const QList<QContactLocalId> & localIds, const QContactFetchHint & fetchHint = QContactFetchHint(), QMap<int, QContactManager::Error> * errorMap = 0 ) const

Returns a list of contacts given a list of local ids (localIds).

Returns the list of contacts with the ids given by localIds. There is a one-to-one correspondence between the returned contacts and the supplied localIds.

If there is an invalid id in localIds, then an empty QContact will take its place in the returned list. The deprecated errorMap parameter can be supplied to store per-input errors in. In all cases, calling errorMap() will return the per-input errors for the latest batch function.

The fetchHint parameter describes the optimization hints that a manager may take. If the fetchHint is the default constructed hint, all existing details, relationships and action preferences in the matching contact will be returned. If a client makes changes to an contact which has been retrieved with a fetch hint, they should save it back using a partial save, masked by the same set of detail names in order to avoid information loss.

See also QContactFetchHint.

void QContactManager::contactsAdded ( const QList<QContactLocalId> & contactIds ) [signal]

This signal is emitted at some point once the contacts identified by contactIds have been added to a datastore managed by this manager. This signal must not be emitted if the dataChanged() signal was previously emitted for these changes.

This function was introduced in Qt Mobility 1.0.

void QContactManager::contactsChanged ( const QList<QContactLocalId> & contactIds ) [signal]

This signal is emitted at some point once the contacts identified by contactIds have been modified in a datastore managed by this manager. This signal must not be emitted if the dataChanged() signal was previously emitted for these changes.

This function was introduced in Qt Mobility 1.0.

void QContactManager::contactsRemoved ( const QList<QContactLocalId> & contactIds ) [signal]

This signal is emitted at some point once the contacts identified by contactIds have been removed from a datastore managed by this manager. This signal must not be emitted if the dataChanged() signal was previously emitted for these changes.

This function was introduced in Qt Mobility 1.0.

void QContactManager::dataChanged () [signal]

This signal is emitted by the manager if its internal state changes, and it is unable to determine the changes which occurred, or if the manager considers the changes to be radical enough to require clients to reload all data. If this signal is emitted, no other signals will be emitted for the associated changes.

This function was introduced in Qt Mobility 1.0.

QContactDetailDefinition QContactManager::detailDefinition ( const QString & definitionName, const QString & contactType = QContactType::TypeContact ) const

Returns the definition identified by the given definitionName that is valid for the contacts whose type is the given contactType in this store, or a default-constructed QContactDetailDefinition if no such definition exists

This function was introduced in Qt Mobility 1.0.

QMap<QString, QContactDetailDefinition> QContactManager::detailDefinitions ( const QString & contactType = QContactType::TypeContact ) const

Returns a map of identifier to detail definition for the registered detail definitions which are valid for contacts whose type is the given contactType which are valid for the contacts in this store

This function was introduced in Qt Mobility 1.0.

QContactManager::Error QContactManager::error () const

Return the error code of the most recent operation. For batch operations, if the error code is not equal to QContactManager::NoError, detailed per-input errors may be retrieved by calling errorMap().

This function was introduced in Qt Mobility 1.0.

See also errorMap().

QMap<int, QContactManager::Error> QContactManager::errorMap () const

Returns per-input error codes for the most recent operation. This function only returns meaningful information if the most recent operation was a batch operation. Each key in the map is the index of the element in the input list for which the error (whose error code is stored in the value for that key in the map) occurred during the batch operation.

This function was introduced in Qt Mobility 1.0.

See also error(), contacts(), saveContacts(), removeContacts(), saveRelationships(), and removeRelationships().

QContactManager * QContactManager::fromUri ( const QString & managerUri, QObject * parent = 0 ) [static]

Constructs a QContactManager whose implementation version, manager name and specific parameters are specified in the given managerUri, and whose parent object is parent.

This function was introduced in Qt Mobility 1.0.

bool QContactManager::hasFeature ( QContactManager::ManagerFeature feature, const QString & contactType = QContactType::TypeContact ) const

Returns true if the given feature feature is supported by the manager, for the specified type of contact contactType

This function was introduced in Qt Mobility 1.0.

bool QContactManager::isFilterSupported ( const QContactFilter & filter ) const

Returns true if the given filter is supported natively by the manager, and false if the filter behaviour would be emulated.

Note: In some cases, the behaviour of an unsupported filter cannot be emulated. For example, a filter that requests contacts that have changed since a given time depends on having that information available. In these cases, the filter will fail.

This function was introduced in Qt Mobility 1.0.

bool QContactManager::isRelationshipTypeSupported ( const QString & relationshipType, const QString & contactType = QContactType::TypeContact ) const

Returns true if the manager supports the relationship type specified in relationshipType for contacts whose type is the given contactType.

Note that some managers may support the relationship type for a contact in a limited manner (for example, only as the first contact in the relationship, or only as the second contact in the relationship). In this case, it will still return true. It will only return false if the relationship is entirely unsupported for the given type of contact.

This function was introduced in Qt Mobility 1.0.

QString QContactManager::managerName () const

Returns the manager name for this QContactManager

QMap<QString, QString> QContactManager::managerParameters () const

Return the parameters relevant to the creation of this QContactManager

QString QContactManager::managerUri () const

Return the uri describing this QContactManager, consisting of the manager name and any parameters.

This function was introduced in Qt Mobility 1.0.

int QContactManager::managerVersion () const

Returns the engine backend implementation version number

bool QContactManager::parseUri ( const QString & uri, QString * pManagerId, QMap<QString, QString> * pParams ) [static]

Splits the given uri into the manager, store, and parameters that it describes, and places the information into the memory addressed by pManagerId and pParams respectively. Returns true if uri could be split successfully, otherwise returns false

This function was introduced in Qt Mobility 1.0.

QList<QContactRelationship> QContactManager::relationships ( const QContactId & participantId, QContactRelationship::Role role = QContactRelationship::Either ) const

Returns a list of relationships in which the contact identified by the given participantId participates in the given role. If participantId is the default-constructed id, role is ignored and all relationships are returned.

This function was introduced in Qt Mobility 1.0.

QList<QContactRelationship> QContactManager::relationships ( const QString & relationshipType = QString(), const QContactId & participantId = QContactId(), QContactRelationship::Role role = QContactRelationship::Either ) const

Returns a list of relationships of the given relationshipType in which the contact identified by the given participantId participates in the given role. If participantId is the default-constructed id, role is ignored and all relationships of the given relationshipType are returned. If relationshipType is empty, relationships of any type are returned.

This function was introduced in Qt Mobility 1.0.

void QContactManager::relationshipsAdded ( const QList<QContactLocalId> & affectedContactIds ) [signal]

This signal is emitted at some point after relationships have been added to the manager which involve the contacts identified by affectedContactIds. This signal must not be emitted if the dataChanged() signal was previously emitted for these changes.

This function was introduced in Qt Mobility 1.0.

void QContactManager::relationshipsRemoved ( const QList<QContactLocalId> & affectedContactIds ) [signal]

This signal is emitted at some point after relationships have eben removed from the manager which involve the contacts identified by affectedContactIds. This signal must not be emitted if the dataChanged() signal was previously emitted for these changes.

This function was introduced in Qt Mobility 1.0.

bool QContactManager::removeContact ( const QContactLocalId & contactId )

Remove the contact identified by contactId from the database, and also removes any relationships in which the contact was involved. Returns true if the contact was removed successfully, otherwise returns false.

This function was introduced in Qt Mobility 1.0.

bool QContactManager::removeContacts ( const QList<QContactLocalId> & contactIds, QMap<int, QContactManager::Error> * errorMap = 0 )

Remove every contact whose id is contained in the list of contacts ids contactIds. Returns true if all contacts were removed successfully, otherwise false.

Any contact that was removed successfully will have the relationships in which it was involved removed also.

The deprecated errorMap parameter can be supplied to store per-input errors in. In all cases, calling errorMap() will return the per-input errors for the latest batch function. The QContactManager::error() function will only return QContactManager::NoError if all contacts were removed successfully.

If the given list of contact ids contactIds is empty, the function will return false and calling error() will return QContactManager::BadArgumentError. If the list is non-empty and contains ids which do not identify a valid contact in the manager, the function will remove any contacts which are identified by ids in the contactIds list, insert QContactManager::DoesNotExist entries into the errorMap for the indices of invalid ids in the contactIds list, return false, and set the overall operation error to QContactManager::DoesNotExistError.

This function was introduced in Qt Mobility 1.0.

See also QContactManager::removeContact().

bool QContactManager::removeDetailDefinition ( const QString & definitionName, const QString & contactType = QContactType::TypeContact )

Removes the detail definition identified by definitionName from the database, which is valid for contacts whose type is the given contactType. Returns true if the definition was removed successfully, otherwise returns false

This function was introduced in Qt Mobility 1.0.

bool QContactManager::removeRelationship ( const QContactRelationship & relationship )

Removes the given relationship from the manager. If the relationship exists in the manager, the relationship will be removed, the error will be set to QContactManager::NoError and this function will return true. If no such relationship exists in the manager, the error will be set to QContactManager::DoesNotExistError and this function will return false.

This function was introduced in Qt Mobility 1.0.

bool QContactManager::removeRelationships ( const QList<QContactRelationship> & relationships, QMap<int, QContactManager::Error> * errorMap = 0 )

Removes the given relationships from the database and returns true if the operation was successful. The deprecated errorMap parameter can be supplied to store per-input errors in. In all cases, calling errorMap() will return the per-input errors for the latest batch function.

This function was introduced in Qt Mobility 1.0.

bool QContactManager::saveContact ( QContact * contact )

Adds the given contact to the database if contact has a default-constructed id, or an id with the manager URI set to the URI of this manager and a local id of zero.

Alternatively, the function will update the existing contact in the database if contact has a manager URI set to the URI of this manager and a non-zero local id and currently exists in the database.

If the id of contact does not match any of these two descriptions, the operation will fail and calling error() will return QContactManager::DoesNotExistError.

If the contact contains one or more details whose definitions have not yet been saved with the manager, the operation will fail and calling error() will return QContactManager::UnsupportedError.

Returns false on failure, or true on success. On successful save of a contact with a local id of zero, its id will be set to a new, valid id with the manager URI set to the URI of this manager, and the local id set to a new, valid local id. The manager will automatically synthesize the display label of the contact when it is saved. The manager is not required to fetch updated details of the contact on save, and as such, clients should fetch a contact if they want the most up-to-date information by calling QContactManager::contact().

This function was introduced in Qt Mobility 1.0.

See also managerUri().

bool QContactManager::saveContacts ( QList<QContact> * contacts, QMap<int, QContactManager::Error> * errorMap = 0 )

Adds the list of contacts given by contacts list to the database. Returns true if the contacts were saved successfully, otherwise false.

The deprecated errorMap parameter can be supplied to store per-input errors in. In all cases, calling errorMap() will return the per-input errors for the latest batch function. The QContactManager::error() function will only return QContactManager::NoError if all contacts were saved successfully.

For each newly saved contact that was successful, the id of the contact in the contacts list will be updated with the new value.

This function was introduced in Qt Mobility 1.0.

See also QContactManager::saveContact().

bool QContactManager::saveContacts ( QList<QContact> * contacts, const QStringList & definitionMask, QMap<int, QContactManager::Error> * errorMap = 0 )

Adds the list of contacts given by contacts list to the database. Returns true if the contacts were saved successfully, otherwise false.

This function accepts a definitionMask, which specifies which details of the contacts should be added or updated. Details with definition names not included in the definitionMask will not be updated or added.

The deprecated errorMap parameter can be supplied to store per-input errors in. In all cases, calling errorMap() will return the per-input errors for the latest batch function. The QContactManager::error() function will only return QContactManager::NoError if all contacts were saved successfully.

For each newly saved contact that was successful, the id of the contact in the contacts list will be updated with the new value.

See also QContactManager::saveContact().

bool QContactManager::saveDetailDefinition ( const QContactDetailDefinition & def, const QString & contactType = QContactType::TypeContact )

Persists the given definition def in the database, which is valid for contacts whose type is the given contactType. Returns true if the definition was saved successfully, otherwise returns false

This function was introduced in Qt Mobility 1.0.

bool QContactManager::saveRelationship ( QContactRelationship * relationship )

Saves the given relationship in the database. If the relationship already exists in the database, this function will return false and the error will be set to QContactManager::AlreadyExistsError. If the relationship is saved successfully, this function will return true and error will be set to QContactManager::NoError. Note that relationships cannot be updated directly using this function; in order to update a relationship, you must remove the old relationship, make the required modifications, and then save it.

The given relationship is invalid if it is circular (the first contact is the second contact), or if it references a non-existent local contact (either the first or second contact). If the given relationship is invalid, the function will return false and the error will be set to QContactManager::InvalidRelationshipError. If the given relationship could not be saved in the database (due to backend limitations) the function will return false and error will be set to QContactManager::NotSupportedError.

This function was introduced in Qt Mobility 1.0.

bool QContactManager::saveRelationships ( QList<QContactRelationship> * relationships, QMap<int, QContactManager::Error> * errorMap = 0 )

Saves the given relationships in the database and returns true if the operation was successful. The deprecated errorMap parameter can be supplied to store per-input errors in. In all cases, calling errorMap() will return the per-input errors for the latest batch function.

This function was introduced in Qt Mobility 1.0.

QContactLocalId QContactManager::selfContactId () const

Returns the id of the "self" contact which has previously been set. If no "self" contact has been set, or if the self contact was removed from the manager after being set, or if the backend does not support the concept of a "self" contact, an invalid id will be returned and the error will be set to QContactManager::DoesNotExistError.

This function was introduced in Qt Mobility 1.0.

See also setSelfContactId().

void QContactManager::selfContactIdChanged ( const QContactLocalId & oldId, const QContactLocalId & newId ) [signal]

This signal is emitted at some point after the id of the self-contact is changed from oldId to newId in the manager. If the newId is the invalid, zero id, then the self contact was deleted or no self contact exists. This signal must not be emitted if the dataChanged() signal was previously emitted for this change.

This function was introduced in Qt Mobility 1.0.

bool QContactManager::setSelfContactId ( const QContactLocalId & contactId )

Sets the id of the "self" contact to the given contactId. Returns true if the "self" contact id was set successfully. If the given contactId does not identify a contact stored in this manager, the error will be set to QContactManager::DoesNotExistError and the function will return false; if the backend does not support the concept of a "self" contact then the error will be set to QContactManager::NotSupportedError and the function will return false.

This function was introduced in Qt Mobility 1.0.

See also selfContactId().

QStringList QContactManager::supportedContactTypes () const

Returns the list of contact types which are supported by this manager. This is a convenience function, equivalent to retrieving the allowable values for the QContactType::FieldType field of the QContactType definition which is valid in this manager.

This function was introduced in Qt Mobility 1.0.

QList<QVariant::Type> QContactManager::supportedDataTypes () const

Returns the list of data types supported by the manager

This function was introduced in Qt Mobility 1.0.

void QContactManager::synthesizeContactDisplayLabel ( QContact * contact ) const

Updates the display label of the supplied contact, according to the formatting rules of this manager.

Different managers can format the display label of a contact in different ways - some managers may only consider first or last name, or might put them in different orders. Others might consider an organization, a nickname, or a freeform label.

This function will update the QContactDisplayLabel of this contact, and the string returned by QContact::displayLabel().

If contact is null, nothing will happen.

See the following example for more information:

     /* Retrieve a contact */
     QContact c = manager->contact(myId);
     qDebug() << "Current display label" << c.displayLabel();

     /* Update some fields that might influence the display label */
     QContactName name = c.detail<QContactName>();
     name.setFirstName("Abigail");
     name.setLastName("Arkansas");
     c.saveDetail(&name);

     /* Update the display label */
     manager->synthesizeContactDisplayLabel(&c);
     qDebug() << "Now the label is:" << c.displayLabel();

Note: Depending on the used engine it is possible that the data that is used to synthesize the display label is not up-to-date after a partial save of the contact, i.e after the contact was saved with saveContacts() with a definitionMask parameter. It is recommended to fetch the contact from the engine again and use that new contact as a parameter to this function. Right now this is needed for the tracker engine on the Harmattan platform.

This function was introduced in Qt Mobility 1.0.

See also synthesizedContactDisplayLabel(), QContact::displayLabel(), and saveContacts().

QString QContactManager::synthesizedContactDisplayLabel ( const QContact & contact ) const

Returns a display label for a contact which is synthesized from its details in a manager specific manner.

If you want to update the display label stored in the contact, use the synthesizeContactDisplayLabel() function instead.

Note: Depending on the used engine it is possible that the data that is used to synthesize the display label is not up-to-date after a partial save of the contact, i.e after the contact was saved with saveContacts() with a definitionMask parameter. It is recommended to fetch the contact from the engine again and use that new contact as a parameter to this function. Right now this is needed for the tracker engine on the Harmattan platform.

This function was introduced in Qt Mobility 1.0.

See also synthesizeContactDisplayLabel() and saveContacts().

Member Variable Documentation

const QLatin1Constant QContactManager::ParameterSignalDefinitions

The string constant for the parameter key which holds the names of detail definitions. If a manager supports suppressing change signals depending on the value given for this construction parameter, clients can request that signals be suppressed if the changes which might otherwise cause a signal to be emitted, involve details whose definition name is not contained in the given list.

That is, if a detail in a contact is changed, but that detail's definition name is not listed in the value for this parameter, the manager will not emit a change signal for that change.

If this parameter is not specified at construction time, changes to any detail of a contact will cause a change signal to be emitted.

The value of this parameter should be a comma (,) separated list of definition names. Any commas which might be part of a definition name must be escaped with a single backslash () character prior to concatenation. Any backslash character which might be part of a definition name must also be escaped with a backslash.

If the parameter (or value given for the parameter) is not supported by the manager, the manager may still be constructed, however the parameter will not be reported to the client if the client calls managerParameters() subsequent to manager construction.

const QLatin1Constant QContactManager::ParameterSignalSources

The string constant for the parameter key which holds the value for signal sources. If a manager supports suppressing change signals depending on the value given for this construction parameter, clients can request that signals be suppressed if the changes which might cause a signal to be emitted do not match particular criteria.

If the parameter (or value given for the parameter) is not supported by the manager, the manager may still be constructed, however the parameter will not be reported to the client if the client calls managerParameters() subsequent to manager construction.

The default (assumed) value for this parameter, if this parameter is not given, is that the client wants to be notified of all changes to the data, regardless of the source of the change.

const QLatin1Constant QContactManager::ParameterValueOnlyOtherManagers

This value tells the manager to only emit signals for changes which are made in other manager instances. That is, the client wishes to receive change signals when another client (or background service) changes the data as it is stored in the backend, but does not wish to be notified of changes (or side effects) which it has caused itself.

const QLatin1Constant QContactManager::ParameterValueOnlyOtherProcesses

This value tells the manager to only emit signals for changes which are made in other processes. That is, the client wishes to receive change signals when a client (or background service) in another process changes the data as it is stored in the backend, but does not wish to be notified of changes (or side effects) which were caused in the current client's process, even if those changes were made in a different manager instance to this one.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.