329 /*! |
330 /*! |
330 Return the list of contact ids, sorted according to the given list of \a sortOrders |
331 Return the list of contact ids, sorted according to the given list of \a sortOrders |
331 */ |
332 */ |
332 QList<QContactLocalId> QContactManager::contactIds(const QList<QContactSortOrder>& sortOrders) const |
333 QList<QContactLocalId> QContactManager::contactIds(const QList<QContactSortOrder>& sortOrders) const |
333 { |
334 { |
334 return d->m_engine->contactIds(sortOrders, d->m_error); |
335 return d->m_engine->contactIds(QContactFilter(), sortOrders, &d->m_error); |
335 } |
336 } |
336 |
337 |
337 /*! |
338 /*! |
338 Returns a list of contact ids that match the given \a filter, sorted according to the given list of \a sortOrders. |
339 Returns a list of contact ids that match the given \a filter, sorted according to the given list of \a sortOrders. |
339 Depending on the backend, this filtering operation may involve retrieving all the contacts. |
340 Depending on the backend, this filtering operation may involve retrieving all the contacts. |
340 */ |
341 */ |
341 QList<QContactLocalId> QContactManager::contactIds(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders) const |
342 QList<QContactLocalId> QContactManager::contactIds(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders) const |
342 { |
343 { |
343 return d->m_engine->contactIds(filter, sortOrders, d->m_error); |
344 return d->m_engine->contactIds(filter, sortOrders, &d->m_error); |
344 } |
345 } |
345 |
346 |
346 /*! |
347 /*! |
347 Returns the list of contacts stored in the manager sorted according to the given list of \a sortOrders. |
348 Returns the list of contacts stored in the manager sorted according to the given list of \a sortOrders. |
348 |
349 |
349 The \a definitionRestrictions parameter describes the details that are of |
350 The \a fetchHint parameter describes the optimization hints that a manager may take. |
350 interest, as a performance hint. If the list is empty, all existing details for the matching |
351 If the \a fetchHint is the default constructed hint, all existing details, relationships and action preferences |
351 contacts will be returned. Otherwise, the returned contacts may only contain details of the |
352 in the matching contacts will be returned. A client should not make changes to a contact which has |
352 supplied definition names, although the manager is free to return extra details. |
353 been retrieved using a fetch hint other than the default fetch hint. Doing so will result in information |
353 */ |
354 loss when saving the contact back to the manager (as the "new" restricted contact will |
354 QList<QContact> QContactManager::contacts(const QList<QContactSortOrder>& sortOrders, const QStringList& definitionRestrictions) const |
355 replace the previously saved contact in the backend). |
355 { |
356 |
356 return d->m_engine->contacts(sortOrders, definitionRestrictions, d->m_error); |
357 \sa QContactFetchHint |
|
358 */ |
|
359 QList<QContact> QContactManager::contacts(const QList<QContactSortOrder>& sortOrders, const QContactFetchHint& fetchHint) const |
|
360 { |
|
361 return d->m_engine->contacts(QContactFilter(), sortOrders, fetchHint, &d->m_error); |
357 } |
362 } |
358 |
363 |
359 /*! |
364 /*! |
360 Returns a list of contacts that match the given \a filter, sorted according to the given list of \a sortOrders. |
365 Returns a list of contacts that match the given \a filter, sorted according to the given list of \a sortOrders. |
361 |
366 |
362 Depending on the manager implementation, this filtering operation might be slow and involve retrieving all the |
367 Depending on the manager implementation, this filtering operation might be slow and involve retrieving all the |
363 contacts and testing them against the supplied filter - see the \l isFilterSupported() function. |
368 contacts and testing them against the supplied filter - see the \l isFilterSupported() function. |
364 |
369 |
365 The \a definitionRestrictions parameter describes the details that are of |
370 The \a fetchHint parameter describes the optimization hints that a manager may take. |
366 interest, as a performance hint. If the list is empty, all existing details for the matching |
371 If the \a fetchHint is the default constructed hint, all existing details, relationships and action preferences |
367 contacts will be returned. Otherwise, the returned contacts may only contain details of the |
372 in the matching contacts will be returned. A client should not make changes to a contact which has |
368 supplied definition names, although the manager is free to return extra details. |
373 been retrieved using a fetch hint other than the default fetch hint. Doing so will result in information |
369 */ |
374 loss when saving the contact back to the manager (as the "new" restricted contact will |
370 QList<QContact> QContactManager::contacts(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders, const QStringList& definitionRestrictions) const |
375 replace the previously saved contact in the backend). |
371 { |
376 |
372 return d->m_engine->contacts(filter, sortOrders, definitionRestrictions, d->m_error); |
377 \sa QContactFetchHint |
|
378 */ |
|
379 QList<QContact> QContactManager::contacts(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders, const QContactFetchHint& fetchHint) const |
|
380 { |
|
381 return d->m_engine->contacts(filter, sortOrders, fetchHint, &d->m_error); |
373 } |
382 } |
374 |
383 |
375 /*! |
384 /*! |
376 Returns the contact in the database identified by \a contactId. |
385 Returns the contact in the database identified by \a contactId. |
377 |
386 |
378 If the contact does not exist, an empty, default constructed QContact will be returned, |
387 If the contact does not exist, an empty, default constructed QContact will be returned, |
379 and the error returned by \l error() will be \c QContactManager::DoesNotExistError. |
388 and the error returned by \l error() will be \c QContactManager::DoesNotExistError. |
380 |
389 |
381 The \a definitionRestrictions parameter describes the details that are of |
390 The \a fetchHint parameter describes the optimization hints that a manager may take. |
382 interest, as a performance hint. If the list is empty, all existing details for the requested |
391 If the \a fetchHint is the default constructed hint, all existing details, relationships and action preferences |
383 contact will be returned. Otherwise, the returned contact may only contain details of the |
392 in the matching contact will be returned. A client should not make changes to a contact which has |
384 supplied definition names, although the manager is free to return extra details. |
393 been retrieved using a fetch hint other than the default fetch hint. Doing so will result in information |
385 */ |
394 loss when saving the contact back to the manager (as the "new" restricted contact will |
386 QContact QContactManager::contact(const QContactLocalId& contactId, const QStringList& definitionRestrictions) const |
395 replace the previously saved contact in the backend). |
387 { |
396 |
388 return d->m_engine->contact(contactId, definitionRestrictions, d->m_error); |
397 \sa QContactFetchHint |
|
398 */ |
|
399 QContact QContactManager::contact(const QContactLocalId& contactId, const QContactFetchHint& fetchHint) const |
|
400 { |
|
401 return d->m_engine->contact(contactId, fetchHint, &d->m_error); |
389 } |
402 } |
390 |
403 |
391 /*! |
404 /*! |
392 Adds the given \a contact to the database if \a contact has a |
405 Adds the given \a contact to the database if \a contact has a |
393 default-constructed id, or an id with the manager URI set to the URI of |
406 default-constructed id, or an id with the manager URI set to the URI of |
424 |
437 |
425 \sa managerUri() |
438 \sa managerUri() |
426 */ |
439 */ |
427 bool QContactManager::saveContact(QContact* contact) |
440 bool QContactManager::saveContact(QContact* contact) |
428 { |
441 { |
429 return d->m_engine->saveContact(contact, d->m_error); |
442 if (contact) { |
|
443 return d->m_engine->saveContact(contact, &d->m_error); |
|
444 } else { |
|
445 d->m_error = QContactManager::BadArgumentError; |
|
446 return false; |
|
447 } |
430 } |
448 } |
431 |
449 |
432 /*! |
450 /*! |
433 Remove the contact identified by \a contactId from the database, |
451 Remove the contact identified by \a contactId from the database, |
434 and also removes any relationships in which the contact was involved. |
452 and also removes any relationships in which the contact was involved. |
435 Returns true if the contact was removed successfully, otherwise |
453 Returns true if the contact was removed successfully, otherwise |
436 returns false. |
454 returns false. |
437 */ |
455 */ |
438 bool QContactManager::removeContact(const QContactLocalId& contactId) |
456 bool QContactManager::removeContact(const QContactLocalId& contactId) |
439 { |
457 { |
440 return d->m_engine->removeContact(contactId, d->m_error); |
458 return d->m_engine->removeContact(contactId, &d->m_error); |
441 } |
|
442 |
|
443 /*! |
|
444 \internal |
|
445 Adds the list of contacts given by \a contactList to the database. |
|
446 Returns a list of the error codes corresponding to the contacts in |
|
447 the \a contactList. The \l QContactManager::error() function will |
|
448 only return \c QContactManager::NoError if all contacts were saved |
|
449 successfully. |
|
450 |
|
451 For each newly saved contact that was successful, the uid of the contact |
|
452 in the list will be updated with the new value. If a failure occurs |
|
453 when saving a new contact, the id will be cleared. If a failure occurs |
|
454 when updating a contact that already exists, then TODO. |
|
455 |
|
456 This function was deprecated in week 1 and will be removed after the transition period has elapsed. |
|
457 |
|
458 \sa QContactManager::saveContact() |
|
459 */ |
|
460 QList<QContactManager::Error> QContactManager::saveContacts(QList<QContact>* contactList) |
|
461 { |
|
462 if (contactList) { |
|
463 QMap<int, QContactManager::Error> errorMap; |
|
464 QList<QContactManager::Error> errorList; |
|
465 int size = contactList->size(); |
|
466 d->m_engine->saveContacts(contactList, &errorMap, d->m_error); |
|
467 |
|
468 for (int j=0; j < size; j++) { |
|
469 if (errorMap.contains(j)) |
|
470 errorList << errorMap.value(j); |
|
471 else |
|
472 errorList << QContactManager::NoError; |
|
473 } |
|
474 return errorList; |
|
475 } else { |
|
476 d->m_error = QContactManager::BadArgumentError; |
|
477 return QList<QContactManager::Error>(); |
|
478 } |
|
479 } |
459 } |
480 |
460 |
481 /*! |
461 /*! |
482 Adds the list of contacts given by \a contacts list to the database. |
462 Adds the list of contacts given by \a contacts list to the database. |
483 Returns true if the contacts were saved successfully, otherwise false. |
463 Returns true if the contacts were saved successfully, otherwise false. |
494 |
474 |
495 \sa QContactManager::saveContact() |
475 \sa QContactManager::saveContact() |
496 */ |
476 */ |
497 bool QContactManager::saveContacts(QList<QContact>* contacts, QMap<int, QContactManager::Error>* errorMap) |
477 bool QContactManager::saveContacts(QList<QContact>* contacts, QMap<int, QContactManager::Error>* errorMap) |
498 { |
478 { |
499 return d->m_engine->saveContacts(contacts, errorMap, d->m_error); |
479 if (errorMap) |
|
480 errorMap->clear(); |
|
481 if (!contacts) { |
|
482 d->m_error =QContactManager::BadArgumentError; |
|
483 return false; |
|
484 } |
|
485 return d->m_engine->saveContacts(contacts, errorMap, &d->m_error); |
500 } |
486 } |
501 |
487 |
502 /*! |
488 /*! |
503 Remove every contact whose id is contained in the list of contacts ids |
489 Remove every contact whose id is contained in the list of contacts ids |
504 \a contactIds. Returns true if all contacts were removed successfully, |
490 \a contactIds. Returns true if all contacts were removed successfully, |
505 otherwise false. |
491 otherwise false. |
|
492 |
|
493 Any contact that was removed successfully will have the relationships |
|
494 in which it was involved removed also. |
506 |
495 |
507 The manager might populate \a errorMap (the map of indices of the \a contactIds list to |
496 The manager might populate \a errorMap (the map of indices of the \a contactIds list to |
508 the error which occurred when saving the contact at that index) for every |
497 the error which occurred when saving the contact at that index) for every |
509 index for which the contact could not be removed, if it is able. |
498 index for which the contact could not be removed, if it is able. |
510 The \l QContactManager::error() function will |
499 The \l QContactManager::error() function will |
511 only return \c QContactManager::NoError if all contacts were removed |
500 only return \c QContactManager::NoError if all contacts were removed |
512 successfully. |
501 successfully. |
513 |
502 |
514 For each contact that was removed succesfully, the corresponding |
503 If the given list of contact ids \a contactIds is empty, the function will return false |
515 id in the \a contactIds list will be retained but set to zero. The id of contacts |
504 and calling error() will return \c QContactManager::BadArgumentError. If the list is non-empty |
516 that were not successfully removed will be left alone. |
505 and contains ids which do not identify a valid contact in the manager, the function will |
517 |
506 remove any contacts which are identified by ids in the \a contactIds list, insert |
518 Any contact that was removed successfully will have the relationships |
507 \c QContactManager::DoesNotExist entries into the \a errorMap for the indices of invalid ids |
519 in which it was involved removed also. |
508 in the \a contactIds list, return false, and set the overall operation error to |
|
509 \c QContactManager::DoesNotExistError. |
520 |
510 |
521 \sa QContactManager::removeContact() |
511 \sa QContactManager::removeContact() |
522 */ |
512 */ |
523 bool QContactManager::removeContacts(QList<QContactLocalId>* contactIds, QMap<int, QContactManager::Error>* errorMap) |
513 bool QContactManager::removeContacts(const QList<QContactLocalId>& contactIds, QMap<int, QContactManager::Error>* errorMap) |
524 { |
514 { |
525 return d->m_engine->removeContacts(contactIds, errorMap, d->m_error); |
515 if (contactIds.isEmpty()) { |
526 } |
|
527 |
|
528 /*! |
|
529 \internal |
|
530 Remove the list of contacts identified in \a idList. |
|
531 Returns a list of the error codes corresponding to the contact ids in |
|
532 the \a idList. The \l QContactManager::error() function will |
|
533 only return \c QContactManager::NoError if all contacts were removed |
|
534 successfully. |
|
535 |
|
536 For each contact that was removed succesfully, the corresponding |
|
537 id in the list will be retained but set to zero. The id of contacts |
|
538 that were not successfully removed will be left alone. |
|
539 |
|
540 Any contact that was removed successfully will have the relationships |
|
541 in which it was involved removed also. |
|
542 |
|
543 This function was deprecated in week 1 and will be removed after the transition period has elapsed. |
|
544 |
|
545 \sa QContactManager::removeContact() |
|
546 */ |
|
547 QList<QContactManager::Error> QContactManager::removeContacts(QList<QContactLocalId>* idList) |
|
548 { |
|
549 if (idList) { |
|
550 QMap<int, QContactManager::Error> errorMap; |
|
551 QList<QContactManager::Error> errorList; |
|
552 int size = idList->size(); |
|
553 d->m_engine->removeContacts(idList, &errorMap, d->m_error); |
|
554 |
|
555 for (int j=0; j < size; j++) { |
|
556 if (errorMap.contains(j)) |
|
557 errorList << errorMap.value(j); |
|
558 else |
|
559 errorList << QContactManager::NoError; |
|
560 } |
|
561 return errorList; |
|
562 } else { |
|
563 d->m_error = QContactManager::BadArgumentError; |
516 d->m_error = QContactManager::BadArgumentError; |
564 return QList<QContactManager::Error>(); |
517 return false; |
565 } |
518 } |
|
519 |
|
520 if (errorMap) |
|
521 errorMap->clear(); |
|
522 return d->m_engine->removeContacts(contactIds, errorMap, &d->m_error); |
|
523 } |
|
524 |
|
525 /*! |
|
526 \preliminary |
|
527 Returns a pruned or modified version of the \a original contact which is valid and can be saved in the manager. |
|
528 The returned contact might have entire details removed or arbitrarily changed. The cache of relationships |
|
529 in the contact are ignored entirely when considering compatibility with the backend, as they are |
|
530 saved and validated separately. |
|
531 |
|
532 This function is preliminary and the behaviour is subject to change! |
|
533 */ |
|
534 QContact QContactManager::compatibleContact(const QContact& original) |
|
535 { |
|
536 return d->m_engine->compatibleContact(original, &d->m_error); |
566 } |
537 } |
567 |
538 |
568 /*! |
539 /*! |
569 Returns a display label for a \a contact which is synthesized from its details in a platform-specific manner |
540 Returns a display label for a \a contact which is synthesized from its details in a platform-specific manner |
570 */ |
541 */ |
571 QString QContactManager::synthesizedDisplayLabel(const QContact& contact) const |
542 QString QContactManager::synthesizedDisplayLabel(const QContact& contact) const |
572 { |
543 { |
573 return d->m_engine->synthesizedDisplayLabel(contact, d->m_error); |
544 return d->m_engine->synthesizedDisplayLabel(contact, &d->m_error); |
574 } |
545 } |
575 |
546 |
576 /*! |
547 /*! |
577 Sets the id of the "self" contact to the given \a contactId. |
548 Sets the id of the "self" contact to the given \a contactId. |
578 Returns true if the "self" contact id was set successfully. |
549 Returns true if the "self" contact id was set successfully. |
596 the concept of a "self" contact, an invalid id will be returned |
567 the concept of a "self" contact, an invalid id will be returned |
597 and the error will be set to \c QContactManager::DoesNotExistError. |
568 and the error will be set to \c QContactManager::DoesNotExistError. |
598 */ |
569 */ |
599 QContactLocalId QContactManager::selfContactId() const |
570 QContactLocalId QContactManager::selfContactId() const |
600 { |
571 { |
601 return d->m_engine->selfContactId(d->m_error); |
572 return d->m_engine->selfContactId(&d->m_error); |
602 } |
573 } |
|
574 |
603 |
575 |
604 /*! |
576 /*! |
605 Returns a list of relationships in which the contact identified by the given \a participantId participates in the given \a role. |
577 Returns a list of relationships in which the contact identified by the given \a participantId participates in the given \a role. |
606 If \a participantId is the default-constructed id, \a role is ignored and all relationships are returned. |
578 If \a participantId is the default-constructed id, \a role is ignored and all relationships are returned. |
607 */ |
579 */ |
608 QList<QContactRelationship> QContactManager::relationships(const QContactId& participantId, QContactRelationshipFilter::Role role) const |
580 QList<QContactRelationship> QContactManager::relationships(const QContactId& participantId, QContactRelationship::Role role) const |
609 { |
581 { |
610 return d->m_engine->relationships(QString(), participantId, role, d->m_error); |
582 return d->m_engine->relationships(QString(), participantId, role, &d->m_error); |
611 } |
583 } |
612 |
584 |
613 /*! |
585 /*! |
614 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. |
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. |
615 If \a participantId is the default-constructed id, \a role is ignored and all relationships of the given \a relationshipType are returned. |
587 If \a participantId is the default-constructed id, \a role is ignored and all relationships of the given \a relationshipType are returned. |
616 If \a relationshipType is empty, relationships of any type are returned. |
588 If \a relationshipType is empty, relationships of any type are returned. |
617 */ |
589 */ |
618 QList<QContactRelationship> QContactManager::relationships(const QString& relationshipType, const QContactId& participantId, QContactRelationshipFilter::Role role) const |
590 QList<QContactRelationship> QContactManager::relationships(const QString& relationshipType, const QContactId& participantId, QContactRelationship::Role role) const |
619 { |
591 { |
620 return d->m_engine->relationships(relationshipType, participantId, role, d->m_error); |
592 return d->m_engine->relationships(relationshipType, participantId, role, &d->m_error); |
621 } |
593 } |
622 |
594 |
623 /*! |
595 /*! |
624 Saves the given \a relationship in the database. If the relationship already exists in the database, this function will |
596 Saves the given \a relationship in the database. If the relationship already exists in the database, this function will |
625 return \c false and the error will be set to \c QContactManager::AlreadyExistsError. |
597 return \c false and the error will be set to \c QContactManager::AlreadyExistsError. |
626 If the relationship is saved successfully, this function will return \c true and error will be set |
598 If the relationship is saved successfully, this function will return \c true and error will be set |
627 to \c QContactManager::NoError. Note that relationships cannot be updated directly using this function; in order |
599 to \c QContactManager::NoError. Note that relationships cannot be updated directly using this function; in order |
628 to update a relationship, you must remove the old relationship, make the required modifications, and then save it. |
600 to update a relationship, you must remove the old relationship, make the required modifications, and then save it. |
629 |
601 |
630 The given relationship is invalid if it is circular (one of the destination contacts is also the source contact), or |
602 The given relationship is invalid if it is circular (the first contact is the second contact), or |
631 if it references a non-existent local contact (either source or destination). If the given \a relationship is invalid, |
603 if it references a non-existent local contact (either the first or second contact). If the given \a relationship is invalid, |
632 the function will return \c false and the error will be set to \c QContactManager::InvalidRelationshipError. |
604 the function will return \c false and the error will be set to \c QContactManager::InvalidRelationshipError. |
633 If the given \a relationship could not be saved in the database (due to backend limitations) |
605 If the given \a relationship could not be saved in the database (due to backend limitations) |
634 the function will return \c false and error will be set to \c QContactManager::NotSupportedError. |
606 the function will return \c false and error will be set to \c QContactManager::NotSupportedError. |
635 |
|
636 If any destination contact manager URI is not set in the \a relationship, these will be |
|
637 automatically set to the URI of this manager, before the relationship is saved. |
|
638 */ |
607 */ |
639 bool QContactManager::saveRelationship(QContactRelationship* relationship) |
608 bool QContactManager::saveRelationship(QContactRelationship* relationship) |
640 { |
609 { |
641 return d->m_engine->saveRelationship(relationship, d->m_error); |
610 if (relationship) { |
642 } |
611 return d->m_engine->saveRelationship(relationship, &d->m_error); |
643 |
612 } else { |
644 /*! |
613 d->m_error =QContactManager::BadArgumentError; |
645 Saves the given \a relationships in the database and returns a list of error codes. |
614 return false; |
646 */ |
615 } |
647 QList<QContactManager::Error> QContactManager::saveRelationships(QList<QContactRelationship>* relationships) |
616 } |
648 { |
617 |
649 return d->m_engine->saveRelationships(relationships, d->m_error); |
618 /*! |
|
619 Saves the given \a relationships in the database and returns true if the operation was successful. |
|
620 For any relationship which was unable to be saved, an entry into the \a errorMap will be created, |
|
621 with the key being the index into the input relationships list, and the value being the error which |
|
622 occurred for that index. |
|
623 */ |
|
624 bool QContactManager::saveRelationships(QList<QContactRelationship>* relationships, QMap<int, QContactManager::Error>* errorMap) |
|
625 { |
|
626 // check arguments |
|
627 if (errorMap) |
|
628 errorMap->clear(); |
|
629 if (!relationships) { |
|
630 d->m_error =QContactManager::BadArgumentError; |
|
631 return false; |
|
632 } |
|
633 return d->m_engine->saveRelationships(relationships, errorMap, &d->m_error); |
650 } |
634 } |
651 |
635 |
652 /*! |
636 /*! |
653 Removes the given \a relationship from the manager. If the relationship exists in the manager, the relationship |
637 Removes the given \a relationship from the manager. If the relationship exists in the manager, the relationship |
654 will be removed, the error will be set to \c QContactManager::NoError and this function will return true. If no such |
638 will be removed, the error will be set to \c QContactManager::NoError and this function will return true. If no such |
655 relationship exists in the manager, the error will be set to \c QContactManager::DoesNotExistError and this function |
639 relationship exists in the manager, the error will be set to \c QContactManager::DoesNotExistError and this function |
656 will return false. |
640 will return false. |
657 |
|
658 The priority of the relationship is ignored when determining existence of the relationship. |
|
659 */ |
641 */ |
660 bool QContactManager::removeRelationship(const QContactRelationship& relationship) |
642 bool QContactManager::removeRelationship(const QContactRelationship& relationship) |
661 { |
643 { |
662 return d->m_engine->removeRelationship(relationship, d->m_error); |
644 return d->m_engine->removeRelationship(relationship, &d->m_error); |
663 } |
645 } |
664 |
646 |
665 /*! |
647 /*! |
666 Removes the given \a relationships from the database and returns a list of error codes. |
648 Removes the given \a relationships from the database and returns true if the operation was successful. |
667 */ |
649 For any relationship which was unable to be removed, an entry into the \a errorMap will be created, |
668 QList<QContactManager::Error> QContactManager::removeRelationships(const QList<QContactRelationship>& relationships) |
650 with the key being the index into the input relationships list, and the value being the error which |
669 { |
651 occurred for that index. |
670 return d->m_engine->removeRelationships(relationships, d->m_error); |
652 */ |
|
653 bool QContactManager::removeRelationships(const QList<QContactRelationship>& relationships, QMap<int, QContactManager::Error>* errorMap) |
|
654 { |
|
655 if (errorMap) |
|
656 errorMap->clear(); |
|
657 return d->m_engine->removeRelationships(relationships, errorMap, &d->m_error); |
671 } |
658 } |
672 |
659 |
673 /*! |
660 /*! |
674 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 |
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 |
675 which are valid for the contacts in this store |
662 which are valid for the contacts in this store |
676 */ |
663 */ |
677 QMap<QString, QContactDetailDefinition> QContactManager::detailDefinitions(const QString& contactType) const |
664 QMap<QString, QContactDetailDefinition> QContactManager::detailDefinitions(const QString& contactType) const |
678 { |
665 { |
679 if (!supportedContactTypes().contains(contactType)) { |
666 if (!supportedContactTypes().contains(contactType)) { |
680 d->m_error = QContactManager::InvalidContactTypeError; |
667 d->m_error =QContactManager::InvalidContactTypeError; |
681 return QMap<QString, QContactDetailDefinition>(); |
668 return QMap<QString, QContactDetailDefinition>(); |
682 } |
669 } |
683 |
670 |
684 return d->m_engine->detailDefinitions(contactType, d->m_error); |
671 return d->m_engine->detailDefinitions(contactType, &d->m_error); |
685 } |
672 } |
686 |
673 |
687 /*! 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 */ |
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 */ |
688 QContactDetailDefinition QContactManager::detailDefinition(const QString& definitionName, const QString& contactType) const |
675 QContactDetailDefinition QContactManager::detailDefinition(const QString& definitionName, const QString& contactType) const |
689 { |
676 { |
690 if (!supportedContactTypes().contains(contactType)) { |
677 if (!supportedContactTypes().contains(contactType)) { |
691 d->m_error = QContactManager::InvalidContactTypeError; |
678 d->m_error =QContactManager::InvalidContactTypeError; |
692 return QContactDetailDefinition(); |
679 return QContactDetailDefinition(); |
693 } |
680 } |
694 |
681 |
695 return d->m_engine->detailDefinition(definitionName, contactType, d->m_error); |
682 return d->m_engine->detailDefinition(definitionName, contactType, &d->m_error); |
696 } |
683 } |
697 |
684 |
698 /*! 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 */ |
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 */ |
699 bool QContactManager::saveDetailDefinition(const QContactDetailDefinition& def, const QString& contactType) |
686 bool QContactManager::saveDetailDefinition(const QContactDetailDefinition& def, const QString& contactType) |
700 { |
687 { |
701 if (!supportedContactTypes().contains(contactType)) { |
688 if (!supportedContactTypes().contains(contactType)) { |
702 d->m_error = QContactManager::InvalidContactTypeError; |
689 d->m_error =QContactManager::InvalidContactTypeError; |
703 return false; |
690 return false; |
704 } |
691 } |
705 |
692 |
706 return d->m_engine->saveDetailDefinition(def, contactType, d->m_error); |
693 return d->m_engine->saveDetailDefinition(def, contactType, &d->m_error); |
707 } |
694 } |
708 |
695 |
709 /*! 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 */ |
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 */ |
710 bool QContactManager::removeDetailDefinition(const QString& definitionName, const QString& contactType) |
697 bool QContactManager::removeDetailDefinition(const QString& definitionName, const QString& contactType) |
711 { |
698 { |
712 if (!supportedContactTypes().contains(contactType)) { |
699 if (!supportedContactTypes().contains(contactType)) { |
713 d->m_error = QContactManager::InvalidContactTypeError; |
700 d->m_error =QContactManager::InvalidContactTypeError; |
714 return false; |
701 return false; |
715 } |
702 } |
716 |
703 |
717 return d->m_engine->removeDetailDefinition(definitionName, contactType, d->m_error); |
704 return d->m_engine->removeDetailDefinition(definitionName, contactType, &d->m_error); |
718 } |
705 } |
719 |
706 |
720 /*! |
707 /*! |
721 \enum QContactManager::ManagerFeature |
708 \enum QContactManager::ManagerFeature |
722 This enum describes the possible features that a particular manager may support |
709 This enum describes the possible features that a particular manager may support |
723 \value Groups The manager supports all QContactGroup related operations, and emits the appropriate signals |
710 \value Groups The manager supports all QContactGroup related operations, and emits the appropriate signals |
724 \value ActionPreferences The manager supports saving preferred details per action per contact |
711 \value ActionPreferences The manager supports saving preferred details per action per contact |
725 \value DetailOrdering When a contact is retrieved, the manager will return the details in the same order in which they were saved |
712 \value DetailOrdering When a contact is retrieved, the manager will return the details in the same order in which they were saved |
726 \value Relationships The manager supports at least some types of relationships between contacts |
713 \value Relationships The manager supports at least some types of relationships between contacts |
727 \value ArbitraryRelationshipTypes The manager supports relationships of arbitrary types between contacts |
714 \value ArbitraryRelationshipTypes The manager supports relationships of arbitrary types between contacts |
728 \value RelationshipOrdering The manager supports relationships (re)ordering |
|
729 \value MutableDefinitions The manager supports saving, updating or removing detail definitions. Some built-in definitions may still be immutable |
715 \value MutableDefinitions The manager supports saving, updating or removing detail definitions. Some built-in definitions may still be immutable |
730 \value SelfContact The manager supports the concept of saving a contact which represents the current user |
716 \value SelfContact The manager supports the concept of saving a contact which represents the current user |
731 \value ChangeLogs The manager supports reporting of timestamps of changes, and filtering and sorting by those timestamps |
717 \value ChangeLogs The manager supports reporting of timestamps of changes, and filtering and sorting by those timestamps |
732 \value Anonymous The manager is isolated from other managers |
718 \value Anonymous The manager is isolated from other managers |
733 */ |
719 */ |