qtmobility/src/contacts/qcontactmanager.cpp
changeset 5 453da2cfceef
parent 4 90517678cc4f
child 8 71781823f776
equal deleted inserted replaced
4:90517678cc4f 5:453da2cfceef
    55 /*!
    55 /*!
    56   \class QContactManager
    56   \class QContactManager
    57   \brief The QContactManager class provides an interface which allows clients with access to contact information stored in a particular backend.
    57   \brief The QContactManager class provides an interface which allows clients with access to contact information stored in a particular backend.
    58   \ingroup contacts-main
    58   \ingroup contacts-main
    59  
    59  
    60   This class provides adding, updating and removal of contacts.
    60   This class provides an abstraction of a datastore or aggregation of datastores which contains contact information.
    61   It also provides definitions for details and fields that can be found in contacts.
    61   It provides methods to retrieve and manipulate contact information, contact relationship information, and
       
    62   supported schema definitions.  It also provides metadata and error information reporting.
       
    63 
       
    64   The functions provided by QContactManager are purely synchronous; to access the same functionality in an
       
    65   asynchronous manner, clients should use the use-case-specific classes derived from QContactAbstractRequest.
       
    66 
       
    67   Some functionality provided by QContactManager directly is not accessible using the asynchronous API; see
       
    68   the \l{Contacts Synchronous API}{synchronous} and \l{Contacts Asynchronous API}{asynchronous} API
       
    69   information from the \l{Contacts}{contacts module} API documentation.
    62  */
    70  */
    63 
    71 
    64 /*!
    72 /*!
    65   \fn QContactManager::dataChanged()
    73   \fn QContactManager::dataChanged()
    66   This signal is emitted by the manager if its internal state changes, and it is unable to determine the changes
    74   This signal is emitted by the manager if its internal state changes, and it is unable to determine the changes
   330 /*!
   338 /*!
   331   Return the list of contact ids, sorted according to the given list of \a sortOrders
   339   Return the list of contact ids, sorted according to the given list of \a sortOrders
   332  */
   340  */
   333 QList<QContactLocalId> QContactManager::contactIds(const QList<QContactSortOrder>& sortOrders) const
   341 QList<QContactLocalId> QContactManager::contactIds(const QList<QContactSortOrder>& sortOrders) const
   334 {
   342 {
       
   343     d->m_error = QContactManager::NoError;
   335     return d->m_engine->contactIds(QContactFilter(), sortOrders, &d->m_error);
   344     return d->m_engine->contactIds(QContactFilter(), sortOrders, &d->m_error);
   336 }
   345 }
   337 
   346 
   338 /*!
   347 /*!
   339   Returns a list of contact ids that match the given \a filter, sorted according to the given list of \a sortOrders.
   348   Returns a list of contact ids that match the given \a filter, sorted according to the given list of \a sortOrders.
   340   Depending on the backend, this filtering operation may involve retrieving all the contacts.
   349   Depending on the backend, this filtering operation may involve retrieving all the contacts.
   341  */
   350  */
   342 QList<QContactLocalId> QContactManager::contactIds(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders) const
   351 QList<QContactLocalId> QContactManager::contactIds(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders) const
   343 {
   352 {
       
   353     d->m_error = QContactManager::NoError;
   344     return d->m_engine->contactIds(filter, sortOrders, &d->m_error);
   354     return d->m_engine->contactIds(filter, sortOrders, &d->m_error);
   345 }
   355 }
   346 
   356 
   347 /*!
   357 /*!
   348   Returns the list of contacts stored in the manager sorted according to the given list of \a sortOrders.
   358   Returns the list of contacts stored in the manager sorted according to the given list of \a sortOrders.
   349 
   359 
   350   The \a fetchHint parameter describes the optimization hints that a manager may take.
   360   The \a fetchHint parameter describes the optimization hints that a manager may take.
   351   If the \a fetchHint is the default constructed hint, all existing details, relationships and action preferences
   361   If the \a fetchHint is the default constructed hint, all existing details and relationships
   352   in the matching contacts will be returned.  A client should not make changes to a contact which has
   362   in the matching contacts will be returned.  A client should not make changes to a contact which has
   353   been retrieved using a fetch hint other than the default fetch hint.  Doing so will result in information
   363   been retrieved using a fetch hint other than the default fetch hint.  Doing so will result in information
   354   loss when saving the contact back to the manager (as the "new" restricted contact will
   364   loss when saving the contact back to the manager (as the "new" restricted contact will
   355   replace the previously saved contact in the backend).
   365   replace the previously saved contact in the backend).
   356 
   366 
   357   \sa QContactFetchHint
   367   \sa QContactFetchHint
   358  */
   368  */
   359 QList<QContact> QContactManager::contacts(const QList<QContactSortOrder>& sortOrders, const QContactFetchHint& fetchHint) const
   369 QList<QContact> QContactManager::contacts(const QList<QContactSortOrder>& sortOrders, const QContactFetchHint& fetchHint) const
   360 {
   370 {
       
   371     d->m_error = QContactManager::NoError;
   361     return d->m_engine->contacts(QContactFilter(), sortOrders, fetchHint, &d->m_error);
   372     return d->m_engine->contacts(QContactFilter(), sortOrders, fetchHint, &d->m_error);
   362 }
   373 }
   363 
   374 
   364 /*!
   375 /*!
   365   Returns a list of contacts that match the given \a filter, sorted according to the given list of \a sortOrders.
   376   Returns a list of contacts that match the given \a filter, sorted according to the given list of \a sortOrders.
   366 
   377 
   367   Depending on the manager implementation, this filtering operation might be slow and involve retrieving all the
   378   Depending on the manager implementation, this filtering operation might be slow and involve retrieving all the
   368   contacts and testing them against the supplied filter - see the \l isFilterSupported() function.
   379   contacts and testing them against the supplied filter - see the \l isFilterSupported() function.
   369 
   380 
   370   The \a fetchHint parameter describes the optimization hints that a manager may take.
   381   The \a fetchHint parameter describes the optimization hints that a manager may take.
   371   If the \a fetchHint is the default constructed hint, all existing details, relationships and action preferences
   382   If the \a fetchHint is the default constructed hint, all existing details and relationships
   372   in the matching contacts will be returned.  A client should not make changes to a contact which has
   383   in the matching contacts will be returned.  A client should not make changes to a contact which has
   373   been retrieved using a fetch hint other than the default fetch hint.  Doing so will result in information
   384   been retrieved using a fetch hint other than the default fetch hint.  Doing so will result in information
   374   loss when saving the contact back to the manager (as the "new" restricted contact will
   385   loss when saving the contact back to the manager (as the "new" restricted contact will
   375   replace the previously saved contact in the backend).
   386   replace the previously saved contact in the backend).
   376 
   387 
   377   \sa QContactFetchHint
   388   \sa QContactFetchHint
   378  */
   389  */
   379 QList<QContact> QContactManager::contacts(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders, const QContactFetchHint& fetchHint) const
   390 QList<QContact> QContactManager::contacts(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders, const QContactFetchHint& fetchHint) const
   380 {
   391 {
       
   392     d->m_error = QContactManager::NoError;
   381     return d->m_engine->contacts(filter, sortOrders, fetchHint, &d->m_error);
   393     return d->m_engine->contacts(filter, sortOrders, fetchHint, &d->m_error);
   382 }
   394 }
   383 
   395 
   384 /*!
   396 /*!
   385   Returns the contact in the database identified by \a contactId.
   397   Returns the contact in the database identified by \a contactId.
   386 
   398 
   387   If the contact does not exist, an empty, default constructed QContact will be returned,
   399   If the contact does not exist, an empty, default constructed QContact will be returned,
   388   and the error returned by \l error() will be \c QContactManager::DoesNotExistError.
   400   and the error returned by \l error() will be \c QContactManager::DoesNotExistError.
   389 
   401 
   390   The \a fetchHint parameter describes the optimization hints that a manager may take.
   402   The \a fetchHint parameter describes the optimization hints that a manager may take.
   391   If the \a fetchHint is the default constructed hint, all existing details, relationships and action preferences
   403   If the \a fetchHint is the default constructed hint, all existing details and relationships
   392   in the matching contact will be returned.  A client should not make changes to a contact which has
   404   in the matching contact will be returned.  A client should not make changes to a contact which has
   393   been retrieved using a fetch hint other than the default fetch hint.  Doing so will result in information
   405   been retrieved using a fetch hint other than the default fetch hint.  Doing so will result in information
   394   loss when saving the contact back to the manager (as the "new" restricted contact will
   406   loss when saving the contact back to the manager (as the "new" restricted contact will
   395   replace the previously saved contact in the backend).
   407   replace the previously saved contact in the backend).
   396 
   408 
   397   \sa QContactFetchHint
   409   \sa QContactFetchHint
   398  */
   410  */
   399 QContact QContactManager::contact(const QContactLocalId& contactId, const QContactFetchHint& fetchHint) const
   411 QContact QContactManager::contact(const QContactLocalId& contactId, const QContactFetchHint& fetchHint) const
   400 {
   412 {
       
   413     d->m_error = QContactManager::NoError;
   401     return d->m_engine->contact(contactId, fetchHint, &d->m_error);
   414     return d->m_engine->contact(contactId, fetchHint, &d->m_error);
   402 }
   415 }
   403 
   416 
   404 /*!
   417 /*!
   405   Adds the given \a contact to the database if \a contact has a
   418   Adds the given \a contact to the database if \a contact has a
   438   \sa managerUri()
   451   \sa managerUri()
   439  */
   452  */
   440 bool QContactManager::saveContact(QContact* contact)
   453 bool QContactManager::saveContact(QContact* contact)
   441 {
   454 {
   442     if (contact) {
   455     if (contact) {
       
   456         d->m_error = QContactManager::NoError;
   443         return d->m_engine->saveContact(contact, &d->m_error);
   457         return d->m_engine->saveContact(contact, &d->m_error);
   444     } else {
   458     } else {
   445         d->m_error = QContactManager::BadArgumentError;
   459         d->m_error = QContactManager::BadArgumentError;
   446         return false;
   460         return false;
   447     }
   461     }
   453   Returns true if the contact was removed successfully, otherwise
   467   Returns true if the contact was removed successfully, otherwise
   454   returns false.
   468   returns false.
   455  */
   469  */
   456 bool QContactManager::removeContact(const QContactLocalId& contactId)
   470 bool QContactManager::removeContact(const QContactLocalId& contactId)
   457 {
   471 {
       
   472     d->m_error = QContactManager::NoError;
   458     return d->m_engine->removeContact(contactId, &d->m_error);
   473     return d->m_engine->removeContact(contactId, &d->m_error);
   459 }
   474 }
   460 
   475 
   461 /*!
   476 /*!
   462   Adds the list of contacts given by \a contacts list to the database.
   477   Adds the list of contacts given by \a contacts list to the database.
   480         errorMap->clear();
   495         errorMap->clear();
   481     if (!contacts) {
   496     if (!contacts) {
   482         d->m_error =QContactManager::BadArgumentError;
   497         d->m_error =QContactManager::BadArgumentError;
   483         return false;
   498         return false;
   484     }
   499     }
       
   500 
       
   501     d->m_error = QContactManager::NoError;
   485     return d->m_engine->saveContacts(contacts, errorMap, &d->m_error);
   502     return d->m_engine->saveContacts(contacts, errorMap, &d->m_error);
   486 }
   503 }
   487 
   504 
   488 /*!
   505 /*!
   489   Remove every contact whose id is contained in the list of contacts ids
   506   Remove every contact whose id is contained in the list of contacts ids
   510 
   527 
   511   \sa QContactManager::removeContact()
   528   \sa QContactManager::removeContact()
   512  */
   529  */
   513 bool QContactManager::removeContacts(const QList<QContactLocalId>& contactIds, QMap<int, QContactManager::Error>* errorMap)
   530 bool QContactManager::removeContacts(const QList<QContactLocalId>& contactIds, QMap<int, QContactManager::Error>* errorMap)
   514 {
   531 {
       
   532     if (errorMap)
       
   533         errorMap->clear();
   515     if (contactIds.isEmpty()) {
   534     if (contactIds.isEmpty()) {
   516         d->m_error = QContactManager::BadArgumentError;
   535         d->m_error = QContactManager::BadArgumentError;
   517         return false;
   536         return false;
   518     }
   537     }
   519 
   538 
   520     if (errorMap)
   539     d->m_error = QContactManager::NoError;
   521         errorMap->clear();
       
   522     return d->m_engine->removeContacts(contactIds, errorMap, &d->m_error);
   540     return d->m_engine->removeContacts(contactIds, errorMap, &d->m_error);
   523 }
   541 }
   524 
   542 
   525 /*!
   543 /*!
   526   \preliminary
   544   \preliminary
   531 
   549 
   532   This function is preliminary and the behaviour is subject to change!
   550   This function is preliminary and the behaviour is subject to change!
   533  */
   551  */
   534 QContact QContactManager::compatibleContact(const QContact& original)
   552 QContact QContactManager::compatibleContact(const QContact& original)
   535 {
   553 {
       
   554     d->m_error = QContactManager::NoError;
   536     return d->m_engine->compatibleContact(original, &d->m_error);
   555     return d->m_engine->compatibleContact(original, &d->m_error);
   537 }
   556 }
   538 
   557 
   539 /*!
   558 /*!
   540   Returns a display label for a \a contact which is synthesized from its details in a platform-specific manner
   559   Returns a display label for a \a contact which is synthesized from its details in a manager specific
   541  */
   560   manner.
   542 QString QContactManager::synthesizedDisplayLabel(const QContact& contact) const
   561 
   543 {
   562   If you want to update the display label stored in the contact, use the synthesizeContactDisplayLabel()
       
   563   function instead.
       
   564 
       
   565   \sa synthesizeContactDisplayLabel()
       
   566  */
       
   567 QString QContactManager::synthesizedContactDisplayLabel(const QContact& contact) const
       
   568 {
       
   569     d->m_error = QContactManager::NoError;
   544     return d->m_engine->synthesizedDisplayLabel(contact, &d->m_error);
   570     return d->m_engine->synthesizedDisplayLabel(contact, &d->m_error);
       
   571 }
       
   572 
       
   573 /*!
       
   574  * Updates the display label of the supplied \a contact, according to the formatting rules
       
   575  * of this manager.
       
   576  *
       
   577  * Different managers can format the display label of a contact in different ways -
       
   578  * some managers may only consider first or last name, or might put them in different
       
   579  * orders.  Others might consider an organization, a nickname, or a freeform label.
       
   580  *
       
   581  * This function will update the QContactDisplayLabel of this contact, and the string
       
   582  * returned by QContact::displayLabel().
       
   583  *
       
   584  * If \a contact is null, nothing will happen.
       
   585  *
       
   586  * See the following example for more information:
       
   587  * \snippet doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp Updating the display label of a contact
       
   588  *
       
   589  * \sa synthesizedContactDisplayLabel(), QContact::displayLabel()
       
   590  */
       
   591 void QContactManager::synthesizeContactDisplayLabel(QContact *contact) const
       
   592 {
       
   593     if (contact) {
       
   594         d->m_error = QContactManager::NoError;
       
   595         QContactManagerEngine::setContactDisplayLabel(contact, d->m_engine->synthesizedDisplayLabel(*contact, &d->m_error));
       
   596     } else {
       
   597         d->m_error = QContactManager::BadArgumentError;
       
   598     }
   545 }
   599 }
   546 
   600 
   547 /*!
   601 /*!
   548   Sets the id of the "self" contact to the given \a contactId.
   602   Sets the id of the "self" contact to the given \a contactId.
   549   Returns true if the "self" contact id was set successfully.
   603   Returns true if the "self" contact id was set successfully.
   555   \c QContactManager::NotSupportedError and the function will
   609   \c QContactManager::NotSupportedError and the function will
   556   return false.
   610   return false.
   557  */
   611  */
   558 bool QContactManager::setSelfContactId(const QContactLocalId& contactId)
   612 bool QContactManager::setSelfContactId(const QContactLocalId& contactId)
   559 {
   613 {
       
   614     d->m_error = QContactManager::NoError;
   560     return d->m_engine->setSelfContactId(contactId, &d->m_error);
   615     return d->m_engine->setSelfContactId(contactId, &d->m_error);
   561 }
   616 }
   562 
   617 
   563 /*!
   618 /*!
   564   Returns the id of the "self" contact which has previously been set.
   619   Returns the id of the "self" contact which has previously been set.
   567   the concept of a "self" contact, an invalid id will be returned
   622   the concept of a "self" contact, an invalid id will be returned
   568   and the error will be set to \c QContactManager::DoesNotExistError.
   623   and the error will be set to \c QContactManager::DoesNotExistError.
   569  */
   624  */
   570 QContactLocalId QContactManager::selfContactId() const
   625 QContactLocalId QContactManager::selfContactId() const
   571 {
   626 {
       
   627     d->m_error = QContactManager::NoError;
   572     return d->m_engine->selfContactId(&d->m_error);
   628     return d->m_engine->selfContactId(&d->m_error);
   573 }
   629 }
   574 
   630 
   575 
   631 
   576 /*!
   632 /*!
   577   Returns a list of relationships in which the contact identified by the given \a participantId participates in the given \a role.
   633   Returns a list of relationships in which the contact identified by the given \a participantId participates in the given \a role.
   578   If \a participantId is the default-constructed id, \a role is ignored and all relationships are returned.
   634   If \a participantId is the default-constructed id, \a role is ignored and all relationships are returned.
   579  */
   635  */
   580 QList<QContactRelationship> QContactManager::relationships(const QContactId& participantId, QContactRelationship::Role role) const
   636 QList<QContactRelationship> QContactManager::relationships(const QContactId& participantId, QContactRelationship::Role role) const
   581 {
   637 {
       
   638     d->m_error = QContactManager::NoError;
   582     return d->m_engine->relationships(QString(), participantId, role, &d->m_error);
   639     return d->m_engine->relationships(QString(), participantId, role, &d->m_error);
   583 }
   640 }
   584 
   641 
   585 /*!
   642 /*!
   586   Returns a list of relationships of the given \a relationshipType in which the contact identified by the given \a participantId participates in the given \a role.
   643   Returns a list of relationships of the given \a relationshipType in which the contact identified by the given \a participantId participates in the given \a role.
   587   If \a participantId is the default-constructed id, \a role is ignored and all relationships of the given \a relationshipType are returned.
   644   If \a participantId is the default-constructed id, \a role is ignored and all relationships of the given \a relationshipType are returned.
   588   If \a relationshipType is empty, relationships of any type are returned.
   645   If \a relationshipType is empty, relationships of any type are returned.
   589  */
   646  */
   590 QList<QContactRelationship> QContactManager::relationships(const QString& relationshipType, const QContactId& participantId, QContactRelationship::Role role) const
   647 QList<QContactRelationship> QContactManager::relationships(const QString& relationshipType, const QContactId& participantId, QContactRelationship::Role role) const
   591 {
   648 {
       
   649     d->m_error = QContactManager::NoError;
   592     return d->m_engine->relationships(relationshipType, participantId, role, &d->m_error);
   650     return d->m_engine->relationships(relationshipType, participantId, role, &d->m_error);
   593 }
   651 }
   594 
   652 
   595 /*!
   653 /*!
   596   Saves the given \a relationship in the database.  If the relationship already exists in the database, this function will
   654   Saves the given \a relationship in the database.  If the relationship already exists in the database, this function will
   606   the function will return \c false and error will be set to \c QContactManager::NotSupportedError.
   664   the function will return \c false and error will be set to \c QContactManager::NotSupportedError.
   607  */
   665  */
   608 bool QContactManager::saveRelationship(QContactRelationship* relationship)
   666 bool QContactManager::saveRelationship(QContactRelationship* relationship)
   609 {
   667 {
   610     if (relationship) {
   668     if (relationship) {
       
   669         d->m_error = QContactManager::NoError;
   611         return d->m_engine->saveRelationship(relationship, &d->m_error);
   670         return d->m_engine->saveRelationship(relationship, &d->m_error);
   612     } else {
   671     } else {
   613         d->m_error =QContactManager::BadArgumentError;
   672         d->m_error =QContactManager::BadArgumentError;
   614         return false;
   673         return false;
   615     }
   674     }
   621   with the key being the index into the input relationships list, and the value being the error which
   680   with the key being the index into the input relationships list, and the value being the error which
   622   occurred for that index.
   681   occurred for that index.
   623  */
   682  */
   624 bool QContactManager::saveRelationships(QList<QContactRelationship>* relationships, QMap<int, QContactManager::Error>* errorMap)
   683 bool QContactManager::saveRelationships(QList<QContactRelationship>* relationships, QMap<int, QContactManager::Error>* errorMap)
   625 {
   684 {
   626     // check arguments
       
   627     if (errorMap)
   685     if (errorMap)
   628         errorMap->clear();
   686         errorMap->clear();
   629     if (!relationships) {
   687     if (!relationships) {
   630         d->m_error =QContactManager::BadArgumentError;
   688         d->m_error =QContactManager::BadArgumentError;
   631         return false;
   689         return false;
   632     }
   690     }
       
   691 
       
   692     d->m_error = QContactManager::NoError;
   633     return d->m_engine->saveRelationships(relationships, errorMap, &d->m_error);
   693     return d->m_engine->saveRelationships(relationships, errorMap, &d->m_error);
   634 }
   694 }
   635 
   695 
   636 /*!
   696 /*!
   637   Removes the given \a relationship from the manager.  If the relationship exists in the manager, the relationship
   697   Removes the given \a relationship from the manager.  If the relationship exists in the manager, the relationship
   639   relationship exists in the manager, the error will be set to \c QContactManager::DoesNotExistError and this function
   699   relationship exists in the manager, the error will be set to \c QContactManager::DoesNotExistError and this function
   640   will return false.
   700   will return false.
   641  */
   701  */
   642 bool QContactManager::removeRelationship(const QContactRelationship& relationship)
   702 bool QContactManager::removeRelationship(const QContactRelationship& relationship)
   643 {
   703 {
       
   704     d->m_error = QContactManager::NoError;
   644     return d->m_engine->removeRelationship(relationship, &d->m_error);
   705     return d->m_engine->removeRelationship(relationship, &d->m_error);
   645 }
   706 }
   646 
   707 
   647 /*!
   708 /*!
   648   Removes the given \a relationships from the database and returns true if the operation was successful.
   709   Removes the given \a relationships from the database and returns true if the operation was successful.
   652  */
   713  */
   653 bool QContactManager::removeRelationships(const QList<QContactRelationship>& relationships, QMap<int, QContactManager::Error>* errorMap)
   714 bool QContactManager::removeRelationships(const QList<QContactRelationship>& relationships, QMap<int, QContactManager::Error>* errorMap)
   654 {
   715 {
   655     if (errorMap)
   716     if (errorMap)
   656         errorMap->clear();
   717         errorMap->clear();
       
   718     d->m_error = QContactManager::NoError;
   657     return d->m_engine->removeRelationships(relationships, errorMap, &d->m_error);
   719     return d->m_engine->removeRelationships(relationships, errorMap, &d->m_error);
   658 }
   720 }
   659 
   721 
   660 /*!
   722 /*!
   661   Returns a map of identifier to detail definition for the registered detail definitions which are valid for contacts whose type is the given \a contactType
   723   Returns a map of identifier to detail definition for the registered detail definitions which are valid for contacts whose type is the given \a contactType
   666     if (!supportedContactTypes().contains(contactType)) {
   728     if (!supportedContactTypes().contains(contactType)) {
   667         d->m_error =QContactManager::InvalidContactTypeError;
   729         d->m_error =QContactManager::InvalidContactTypeError;
   668         return QMap<QString, QContactDetailDefinition>();
   730         return QMap<QString, QContactDetailDefinition>();
   669     }
   731     }
   670 
   732 
       
   733     d->m_error = QContactManager::NoError;
   671     return d->m_engine->detailDefinitions(contactType, &d->m_error);
   734     return d->m_engine->detailDefinitions(contactType, &d->m_error);
   672 }
   735 }
   673 
   736 
   674 /*! Returns the definition identified by the given \a definitionName that is valid for the contacts whose type is the given \a contactType in this store, or a default-constructed QContactDetailDefinition if no such definition exists */
   737 /*! Returns the definition identified by the given \a definitionName that is valid for the contacts whose type is the given \a contactType in this store, or a default-constructed QContactDetailDefinition if no such definition exists */
   675 QContactDetailDefinition QContactManager::detailDefinition(const QString& definitionName, const QString& contactType) const
   738 QContactDetailDefinition QContactManager::detailDefinition(const QString& definitionName, const QString& contactType) const
   677     if (!supportedContactTypes().contains(contactType)) {
   740     if (!supportedContactTypes().contains(contactType)) {
   678         d->m_error =QContactManager::InvalidContactTypeError;
   741         d->m_error =QContactManager::InvalidContactTypeError;
   679         return QContactDetailDefinition();
   742         return QContactDetailDefinition();
   680     }
   743     }
   681 
   744 
       
   745     d->m_error = QContactManager::NoError;
   682     return d->m_engine->detailDefinition(definitionName, contactType, &d->m_error);
   746     return d->m_engine->detailDefinition(definitionName, contactType, &d->m_error);
   683 }
   747 }
   684 
   748 
   685 /*! Persists the given definition \a def in the database, which is valid for contacts whose type is the given \a contactType.  Returns true if the definition was saved successfully, otherwise returns false */
   749 /*! Persists the given definition \a def in the database, which is valid for contacts whose type is the given \a contactType.  Returns true if the definition was saved successfully, otherwise returns false */
   686 bool QContactManager::saveDetailDefinition(const QContactDetailDefinition& def, const QString& contactType)
   750 bool QContactManager::saveDetailDefinition(const QContactDetailDefinition& def, const QString& contactType)
   688     if (!supportedContactTypes().contains(contactType)) {
   752     if (!supportedContactTypes().contains(contactType)) {
   689         d->m_error =QContactManager::InvalidContactTypeError;
   753         d->m_error =QContactManager::InvalidContactTypeError;
   690         return false;
   754         return false;
   691     }
   755     }
   692 
   756 
       
   757     d->m_error = QContactManager::NoError;
   693     return d->m_engine->saveDetailDefinition(def, contactType, &d->m_error);
   758     return d->m_engine->saveDetailDefinition(def, contactType, &d->m_error);
   694 }
   759 }
   695 
   760 
   696 /*! Removes the detail definition identified by \a definitionName from the database, which is valid for contacts whose type is the given \a contactType.  Returns true if the definition was removed successfully, otherwise returns false */
   761 /*! Removes the detail definition identified by \a definitionName from the database, which is valid for contacts whose type is the given \a contactType.  Returns true if the definition was removed successfully, otherwise returns false */
   697 bool QContactManager::removeDetailDefinition(const QString& definitionName, const QString& contactType)
   762 bool QContactManager::removeDetailDefinition(const QString& definitionName, const QString& contactType)
   699     if (!supportedContactTypes().contains(contactType)) {
   764     if (!supportedContactTypes().contains(contactType)) {
   700         d->m_error =QContactManager::InvalidContactTypeError;
   765         d->m_error =QContactManager::InvalidContactTypeError;
   701         return false;
   766         return false;
   702     }
   767     }
   703 
   768 
       
   769     d->m_error = QContactManager::NoError;
   704     return d->m_engine->removeDetailDefinition(definitionName, contactType, &d->m_error);
   770     return d->m_engine->removeDetailDefinition(definitionName, contactType, &d->m_error);
   705 }
   771 }
   706 
   772 
   707 /*!
   773 /*!
   708   \enum QContactManager::ManagerFeature
   774   \enum QContactManager::ManagerFeature
   709   This enum describes the possible features that a particular manager may support
   775   This enum describes the possible features that a particular manager may support
   710   \value Groups The manager supports all QContactGroup related operations, and emits the appropriate signals
   776   \value Groups The manager supports saving contacts of the \c QContactType::TypeGroup type
   711   \value ActionPreferences The manager supports saving preferred details per action per contact
   777   \omitvalue ActionPreferences The manager supports saving preferred details per action per contact
   712   \value DetailOrdering When a contact is retrieved, the manager will return the details in the same order in which they were saved
   778   \value DetailOrdering When a contact is retrieved, the manager will return the details in the same order in which they were saved
   713   \value Relationships The manager supports at least some types of relationships between contacts
   779   \value Relationships The manager supports at least some types of relationships between contacts
   714   \value ArbitraryRelationshipTypes The manager supports relationships of arbitrary types between contacts
   780   \value ArbitraryRelationshipTypes The manager supports relationships of arbitrary types between contacts
   715   \value MutableDefinitions The manager supports saving, updating or removing detail definitions.  Some built-in definitions may still be immutable
   781   \value MutableDefinitions The manager supports saving, updating or removing detail definitions.  Some built-in definitions may still be immutable
   716   \value SelfContact The manager supports the concept of saving a contact which represents the current user
   782   \value SelfContact The manager supports the concept of saving a contact which represents the current user