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  · 

QContactManager Class Reference

    #include <QContactManager>

Inherits QObject.


Public Types

enum Error { NoError, DoesNotExistError, AlreadyExistsError, InvalidDetailError, ..., UnspecifiedError }
enum ManagerFeature { Groups, ActionPreferences, Relationships, ArbitraryRelationshipTypes, ..., 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 ()
QContact contact ( const QContactLocalId & contactId ) const
QList<QContactLocalId> contacts ( const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> () ) const
QList<QContactLocalId> contacts ( const QContactFilter & filter, const QList<QContactSortOrder> & sortOrders = QList<QContactSortOrder> () ) 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
bool filterSupported ( const QContactFilter & filter ) const
bool hasFeature ( QContactManager::ManagerFeature feature, const QString & contactType = QContactType::TypeContact ) const
int implementationVersion () const
QString managerName () const
QMap<QString, QString> managerParameters () const
QString managerUri () const
QList<QContactRelationship> relationships ( const QContactId & participantId, QContactRelationshipFilter::Role role = QContactRelationshipFilter::Either ) const
QList<QContactRelationship> relationships ( const QString & relationshipType = QString(), const QContactId & participantId = QContactId(), QContactRelationshipFilter::Role role = QContactRelationshipFilter::Either ) const
bool removeContact ( const QContactLocalId & contactId )
QList<QContactManager::Error> removeContacts ( QList<QContactLocalId> * idList )
bool removeDetailDefinition ( const QString & definitionName, const QString & contactType = QContactType::TypeContact )
bool removeRelationship ( const QContactRelationship & relationship )
QList<QContactManager::Error> removeRelationships ( const QList<QContactRelationship> & relationships )
bool saveContact ( QContact * contact )
QList<QContactManager::Error> saveContacts ( QList<QContact> * contactList )
bool saveDetailDefinition ( const QContactDetailDefinition & def, const QString & contactType = QContactType::TypeContact )
bool saveRelationship ( QContactRelationship * relationship )
QList<QContactManager::Error> saveRelationships ( QList<QContactRelationship> * relationships )
QContactLocalId selfContactId () const
bool setSelfContactId ( const QContactLocalId & contactId )
QStringList supportedContactTypes () const
QList<QVariant::Type> supportedDataTypes () const
QStringList supportedRelationshipTypes ( const QString & contactType = QContactType::TypeContact ) const
QString synthesizeDisplayLabel ( 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

QStringList availableManagers ()
QString buildUri ( const QString & managerName, const QMap<QString, QString> & params, int implementationVersion = -1 )
QContactManager * fromUri ( const QString & storeUri, QObject * parent = 0 )
bool splitUri ( const QString & uri, QString * pManagerId, QMap<QString, QString> * pParams )
int version ()
  • 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

This class provides adding, updating and removal of contacts. It also provides definitions for fields that can be found in contacts.


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::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 all QContactGroup related operations, and emits the appropriate signals
QContactManager::ActionPreferences1The manager supports saving preferred details per action per contact
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::SelfContact5The manager supports the concept of saving a contact which represents the current user
QContactManager::ChangeLogs7The manager supports reporting of timestamps of changes, and filtering and sorting by those timestamps
QContactManager::Anonymous6The 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.

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.

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.

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

QContact QContactManager::contact ( const QContactLocalId & contactId ) const

Returns the contact in the database identified by contactId

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

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

QList<QContactLocalId> QContactManager::contacts ( 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.

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.

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.

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.

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.

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

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

QContactManager::Error QContactManager::error () const

Return the error code of the most recent operation

bool QContactManager::filterSupported ( 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.

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

Constructs a QContactManager whose implementation, store and parameters are specified in the given storeUri, and whose parent object is parent.

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

int QContactManager::implementationVersion () const

Returns the engine backend implementation version number

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.

QList<QContactRelationship> QContactManager::relationships ( const QContactId & participantId, QContactRelationshipFilter::Role role = QContactRelationshipFilter::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.

QList<QContactRelationship> QContactManager::relationships ( const QString & relationshipType = QString(), const QContactId & participantId = QContactId(), QContactRelationshipFilter::Role role = QContactRelationshipFilter::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.

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.

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.

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.

QList<QContactManager::Error> QContactManager::removeContacts ( QList<QContactLocalId> * idList )

Remove the list of contacts identified in idList. Returns a list of the error codes corresponding to the contact ids in the idList. The QContactManager::error() function will only return QContactManager::NoError if all contacts were removed successfully.

For each contact that was removed succesfully, the corresponding id in the list will be retained but set to zero. The id of contacts that were not successfully removed will be left alone.

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

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

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.

The priority of the relationship is ignored when determining existence of the relationship.

QList<QContactManager::Error> QContactManager::removeRelationships ( const QList<QContactRelationship> & relationships )

Removes the given relationships from the database and returns a list of error codes.

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.

If the manager URI of the id of the contact is neither empty nor equal to the URI of this manager, or local id of the contact is non-zero but does not exist in the manager, the operation will fail and calling error() will return QContactManager::DoesNotExistError.

Alternatively, the function will update the existing contact in the database if contact has a non-zero id and currently exists in the database.

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.

If the contact has had its relationships reordered, the manager will check to make sure that every relationship that the contact is currently involved in is included in the reordered list, and that no relationships which either do not involve the contact, or have not been saved in the manager are included in the list. If these conditions are not met, the function will return false and calling error() will return QContactManager::InvalidRelationshipError.

The manager will automatically synthesize the display label of the contact when it is saved.

Returns false on failure, or true on success. On successful save of a contact with an 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.

See also managerUri().

QList<QContactManager::Error> QContactManager::saveContacts ( QList<QContact> * contactList )

Adds the list of contacts given by contactList to the database. Returns a list of the error codes corresponding to the contacts in the contactList. The QContactManager::error() function will only return QContactManager::NoError if all contacts were saved successfully.

For each newly saved contact that was successful, the uid of the contact in the list will be updated with the new value. If a failure occurs when saving a new contact, the id will be cleared. If a failure occurs when updating a contact that already exists, then TODO.

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

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 (one of the destination contacts is also the source contact), or if it references a non-existent local contact (either source or destination). 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.

If any destination contact manager URI is not set in the relationship, these will be automatically set to the URI of this manager, before the relationship is saved.

QList<QContactManager::Error> QContactManager::saveRelationships ( QList<QContactRelationship> * relationships )

Saves the given relationships in the database and returns a list of error codes.

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.

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.

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.

See also selfContactId().

bool QContactManager::splitUri ( 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

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.

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

Returns the list of data types supported by the manager

QStringList QContactManager::supportedRelationshipTypes ( const QString & contactType = QContactType::TypeContact ) const

Returns the list of relationship types which are supported by this manager for contacts of the given contactType. If the backend does not support the QContactManager::Relationships feature, this list should be empty. If the backend supports the QContactManager::Relationships feature and also supports the QContactManager::ArbitraryRelationshipTypes feature, the list will contain the natively supported (well-known) relationship types contained in the list, but clients are able to add relationships of any custom type also.

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

Returns a display label for a contact which is synthesized from its details in a platform-specific manner

int QContactManager::version ()   [static]

Returns the version number of the Qt Mobility Contacts API

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