Member Function Documentation
QContactManagerEngine::QContactManagerEngine()
A default, empty constructor.
void QContactManagerEngine::addSorted(QList<QContact> * sorted, const QContact & toAdd, const QList<QContactSortOrder> & sortOrders) [static]
Performs insertion sort of the contact toAdd into the sorted list, according to the provided sortOrders list. The first QContactSortOrder in the list has the highest priority: if the contact toAdd is deemed equal to another in the sorted list according to the first QContactSortOrder, the second QContactSortOrder in the list is used (and so on until either the contact is inserted or there are no more sort order objects in the list).
If a contact is equal to another contact according to all sort orders, it is inserted after the previously-added contact.
bool QContactManagerEngine::cancelRequest(QContactAbstractRequest * req) [virtual]
Asks the manager engine to cancel the given request req which was previously started and is currently in a cancellable state. Returns true if cancellation of the request was started successfully, otherwise returns false.
See also startRequest() and QContactAbstractRequest::cancel().
QContactFilter QContactManagerEngine::canonicalizedFilter(const QContactFilter & filter) [static]
Given an input filter, returns the canonical version of the filter.
Some of the following transformations may be applied:
int QContactManagerEngine::compareContact(const QContact & a, const QContact & b, const QList<QContactSortOrder> & sortOrders) [static]
Compares two contacts (a and b) using the given list of sortOrders. Returns a negative number if a should appear before b according to the sort order, a positive number if a should appear after b according to the sort order, and zero if the two are unable to be sorted.
int QContactManagerEngine::compareVariant(const QVariant & first, const QVariant & second, Qt::CaseSensitivity sensitivity) [static]
Compares first against second. If the types are strings (QVariant::String(obsolete)), the sensitivity argument controls case sensitivity when comparing. Also, when comparing strings, a locale aware comparison is used, and if the sensitivity is CaseSensitive, strings that are identical under a case insensitive sort are then sorted case sensitively within that context.
For example:
aaron Bob Aaron aAron Carol
would sort as:
aaron aAron Aaron Bob Carol
Returns: <0 if first is less than second 0 if first is equal to second >0 if first is greater than second.
The results are undefined if the variants are different types, or cannot be compared.
Returns the contact in the database identified by contactId.
If the contact does not exist, an empty, default constructed QContact will be returned, and the error will be set to QContactManager::DoesNotExistError.
Any operation error which occurs will be saved in error.
The fetchHint parameter describes the optimization hints that a manager may take. If the fetchHint is the default constructed hint, all existing details, relationships and action preferences in the matching contact will be returned. If a client makes changes to an contact which has been retrieved with a fetch hint, they should save it back using a partial save, masked by the same set of detail names in order to avoid information loss.
See also QContactFetchHint.
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. Any error which occurs will be saved in error.
Returns the list of contacts which match the given filter stored in the manager sorted according to the given list of sortOrders.
Any operation error which occurs will be saved in error.
The fetchHint parameter describes the optimization hints that a manager may take. If the fetchHint is the default constructed hint, all existing details, relationships and action preferences in the matching contacts will be returned.
If a non-default fetch hint is supplied, and the client wishes to make changes to the contacts, they should ensure that only a detail type hint is supplied and that when saving it back, a type mask should be used which corresponds to the detail type hint. This is to ensure that no data is lost by overwriting an existing contact with a restricted version of it.
See also QContactFetchHint.
Returns the list of contacts with the ids given by contactIds. There is a one-to-one correspondence between the returned contacts and the supplied contactIds.
If there is an invalid id in contactIds, then an empty QContact will take its place in the returned list and an entry will be inserted into errorMap.
The overall operation error will be saved in error.
The fetchHint parameter describes the optimization hints that a manager may take. If the fetchHint is the default constructed hint, all existing details, relationships and action preferences in the matching contacts will be returned.
If a non-default fetch hint is supplied, and the client wishes to make changes to the contacts, they should ensure that only a detail type hint is supplied and that when saving it back, a type mask should be used which corresponds to the detail type hint. This is to ensure that no data is lost by overwriting an existing contact with a restricted version of it.
See also QContactFetchHint.
void QContactManagerEngine::contactsAdded(const QList<QContactId> & contactIds) [signal]
This signal is emitted some time after a set of contacts has been added to this engine where the dataChanged() signal was not emitted for those changes. As it is possible that other processes (or other devices) may have added the contacts, the timing cannot be determined.
The list of ids of contacts added is given by contactIds. There may be one or more ids in the list.
See also dataChanged().
void QContactManagerEngine::contactsChanged(const QList<QContactId> & contactIds) [signal]
This signal is emitted some time after a set of contacts has been modified in this engine where the dataChanged() signal was not emitted for those changes. As it is possible that other processes (or other devices) may have modified the contacts, the timing cannot be determined.
The list of ids of changed contacts is given by contactIds. There may be one or more ids in the list.
See also dataChanged().
void QContactManagerEngine::contactsRemoved(const QList<QContactId> & contactIds) [signal]
This signal is emitted some time after a set of contacts has been removed from this engine where the dataChanged() signal was not emitted for those changes. As it is possible that other processes (or other devices) may have removed the contacts, the timing cannot be determined.
The list of ids of removed contacts is given by contactIds. There may be one or more ids in the list.
See also dataChanged().
void QContactManagerEngine::dataChanged() [signal]
This signal is emitted some time after changes occur to the data managed by this engine, and the engine is unable to determine which changes occurred, or if the engine considers the changes to be radical enough to require clients to reload all data.
If this signal is emitted, no other signals may be emitted for the associated changes.
As it is possible that other processes (or other devices) may have caused the changes, the timing can not be determined.
See also contactsAdded(), contactsChanged(), and contactsRemoved().
const QContactEngineId * QContactManagerEngine::engineId(const QContactId & contactId) [static]
Returns the engine ID from the given contactId.
The caller does not take ownership of the pointer, and should not delete returned id or undefined behavior may occur.
bool QContactManagerEngine::isFilterSupported(const QContactFilter & filter) const [virtual]
Returns a whether the supplied filter can be implemented natively by this engine. If not, the base class implementation will emulate the functionality.
bool QContactManagerEngine::isRelationshipTypeSupported(const QString & relationshipType, QContactType::TypeValues contactType) const [virtual]
Returns true if the manager supports the relationship type specified in relationshipType for contacts whose type is the given contactType.
Note that some managers may support the relationship type for a contact in a limited manner (for example, only as the first contact in the relationship, or only as the second contact in the relationship). In this case, it will still return true. It will only return false if the relationship is entirely unsupported for the given type of contact.
QString QContactManagerEngine::managerName() const [pure virtual]
Returns the manager name for this QContactManagerEngine
QMap<QString, QString> QContactManagerEngine::managerParameters() const [virtual]
Returns the parameters with which this engine was constructed. Note that the engine may have discarded unused or invalid parameters at the time of construction, and these will not be returned.
QString QContactManagerEngine::managerUri() const
Returns the unique URI of this manager, which is built from the manager name and the parameters used to construct it.
int QContactManagerEngine::managerVersion() const [pure virtual]
Returns the engine backend implementation version number
Returns a list of relationships of the given relationshipType in which the contact identified by the given participant participates in the given role. If participant is empty, role is ignored and all relationships of the given relationshipType are returned. If relationshipType is empty, relationships of any type are returned. If no relationships of the given relationshipType in which the contact identified by the given participant is involved in the given role exists, error is set to QContactManager::DoesNotExistError.
void QContactManagerEngine::relationshipsAdded(const QList<QContactId> & affectedContactIds) [signal]
This signal is emitted some time after a set of contacts has been added to this engine where the dataChanged() signal was not emitted for those changes. As it is possible that other processes (or other devices) may have added the contacts, the timing cannot be determined.
The list of ids of affected contacts is given by affectedContactIds. There may be one or more ids in the list.
See also dataChanged().
void QContactManagerEngine::relationshipsRemoved(const QList<QContactId> & affectedContactIds) [signal]
This signal is emitted some time after a set of relationships has been removed from this engine where the dataChanged() signal was not emitted for those changes. As it is possible that other processes (or other devices) may have removed the relationships, the timing cannot be determined.
The list of ids of affected contacts is given by affectedContactIds. There may be one or more ids in the list.
See also dataChanged().
bool QContactManagerEngine::removeContact(const QContactId & contactId, QContactManager::Error * error) [virtual]
Remove the contact identified by contactId from the database, and also removes any relationships in which the contact was involved. After the contact has been removed it can not be updated or re-created with the same contact id anymore. Returns true if the contact was removed successfully, otherwise returns false.
Any error which occurs will be saved in error.
The default implementation will convert this into a call to removeContacts.
Remove every contact whose id is contained in the list of contacts ids contactIds. Returns true if all contacts were removed successfully, otherwise false.
Any contact that was removed successfully will have the relationships in which it was involved removed also.
The manager might populate errorMap (the map of indices of the contactIds list to the error which occurred when saving the contact at that index) for every index for which the contact could not be removed, if it is able.
The supplied errorMap parameter may be null, if the client does not desire detailed error information. If supplied, it will be empty upon entry to this function.
The QContactManager::error() function will only return QContactManager::NoError if all contacts were removed successfully.
If the list contains ids which do not identify a valid contact in the manager, the function will remove any contacts which are identified by ids in the contactIds list, insert QContactManager::DoesNotExist entries into the errorMap for the indices of invalid ids in the contactIds list, return false, and set the overall operation error to QContactManager::DoesNotExistError.
Any errors encountered during this operation should be stored to error.
See also QContactManager::removeContact().
bool QContactManagerEngine::removeRelationship(const QContactRelationship & relationship, QContactManager::Error * error) [virtual]
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 default implementation of this function converts the argument into a call to removeRelationships
Removes the given relationships from the database and returns true if the operation was successful. For any relationship which was unable to be removed, an entry into the errorMap will be created, with the key being the index into the input relationships list, and the value being the error which occurred for that index.
The supplied errorMap parameter may be null, if the client does not desire detailed error information. If supplied, it will be empty upon entry to this function.
The overall operation error will be saved in error.
void QContactManagerEngine::requestDestroyed(QContactAbstractRequest * req) [virtual]
Notifies the manager engine that the given request req is in the process of being destroyed.
The request pointer req is still valid during this function call, but before returning from this call the engine should ensure that it no longer holds any references to the req pointer (for example, in a queue in another thread) because directly following this call the request will be deleted and this pointer will become invalid. In a multithreaded engine, this may mean blocking the calling thread while other threads clean up.
If a request is still in progress at this point, it is undefined what will happen to the operation requested, but in general it should either be fully completed or fully aborted. In any case, the client has signalled that they do not care about the outcome (by deleting the request).
bool QContactManagerEngine::saveContact(QContact * contact, QContactManager::Error * error) [virtual]
Adds the given contact to the database if contact has a null id, otherwise updates the contact in the database which has the same id to be the given contact. If the id is not null but does not identify any contact stored in the manager, the function will return false and error will be set to QContactManager::DoesNotExistError.
Returns true if the save operation completed successfully, otherwise returns false. Any error which occurs will be saved in error.
The default implementation will convert this into a call to saveContacts.
See also managerUri().
Adds the list of contacts given by contacts list to the database. Returns true if the contacts were saved successfully, otherwise false.
The manager might populate errorMap (the map of indices of the contacts list to the error which occurred when saving the contact at that index) for every index for which the contact could not be saved, if it is able.
The supplied errorMap parameter may be null, if the client does not desire detailed error information. If supplied, it will be empty upon entry to this function.
The QContactManager::error() function will only return QContactManager::NoError if all contacts were saved successfully.
For each newly saved contact that was successful, the id of the contact in the contacts list will be updated with the new value. If a failure occurs when saving a new contact, the id will be cleared.
Any errors encountered during this operation should be stored to error.
See also QContactManager::saveContact().
For each contact in contacts, either add it to the database or update an existing one.
This function accepts a typeMask, which specifies which details of the contacts should be updated. Details with types not included in the typeMask will not be updated or added.
The manager should populate errorMap (the map of indices of the contacts list to the error which occurred when saving the contact at that index) for every index for which the contact could not be saved, if it is able.
The supplied errorMap parameter may be null, if the client does not desire detailed error information. If supplied, it will be empty upon entry to this function.
The QContactManager::error() function will only return QContactManager::NoError if all contacts were saved successfully.
For each newly saved contact that was successful, the id of the contact in the contacts list will be updated with the new value. If a failure occurs when saving a new contact, the id will be cleared.
Any errors encountered during this operation should be stored to error.
Saves the given relationship in the database. If the relationship already exists in the database, this function will return false and the error will be set to QContactManager::AlreadyExistsError. If the relationship is saved successfully, this function will return true and error will be set to QContactManager::NoError. Note that relationships cannot be updated directly using this function; in order to update a relationship, you must remove the old relationship, make the required modifications, and then save it.
The given relationship is invalid if it is circular (the first contact is the second contact), or if it references a non-existent local contact (either the first or second contact). If the given relationship is invalid, the function will return false and the error will be set to QContactManager::InvalidRelationshipError.
The default implementation of this function converts the argument into a call to saveRelationships.
Saves the given relationships in the database and returns true if the operation was successful. For any relationship which was unable to be saved, an entry into the errorMap will be created, with the key being the index into the input relationships list, and the value being the error which occurred for that index.
The supplied errorMap parameter may be null, if the client does not desire detailed error information. If supplied, it will be empty upon entry to this function.
The overall operation error will be saved in error.
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, the null id will be returned and the error will be set to QContactManager::DoesNotExistError.
See also setSelfContactId().
void QContactManagerEngine::selfContactIdChanged(const QContactId & oldId, const QContactId & 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, null 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. As it is possible that other processes (or other devices) may have removed or changed the self contact, the timing cannot be determined.
See also dataChanged().
void QContactManagerEngine::setContactRelationships(QContact * contact, const QList<QContactRelationship> & relationships) [static]
Sets the cached relationships in the given contact to relationships
Sets the access constraints of detail to the supplied constraints.
This function is provided to allow engine implementations to report the access constraints of retrieved details, without generally allowing the access constraints to be modified after retrieval.
Application code should not call this function, since validation of the detail will happen in the engine in any case.
bool QContactManagerEngine::setSelfContactId(const QContactId & contactId, QContactManager::Error * error) [virtual]
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, the error will be set to QContactManager::NotSupportedError and the function will return false.
See also selfContactId().
Sorts the given list of contacts cs according to the provided sortOrders
bool QContactManagerEngine::startRequest(QContactAbstractRequest * req) [virtual]
Asks the manager engine to begin the given request req which is currently in a (re)startable state. Returns true if the request was started successfully, else returns false.
See also QContactAbstractRequest::start().
QList<QContactDetail::DetailType> QContactManagerEngine::supportedContactDetailTypes() const [virtual]
Returns the list of contact detail types which are supported by this engine.
QList<QContactType::TypeValues> QContactManagerEngine::supportedContactTypes() const [virtual]
Returns the list of contact types which are supported by this engine. This is a convenience function, equivalent to retrieving the allowable values for the QContactType::FieldType field of the QContactType detail which is valid in this engine.
QList<QVariant::Type> QContactManagerEngine::supportedDataTypes() const [virtual]
Returns the list of data types supported by this engine.
bool QContactManagerEngine::testFilter(const QContactFilter & filter, const QContact & contact) [static]
Returns true if the supplied contact contact matches the supplied filter filter.
This function will test each condition in the filter, possibly recursing.
Updates the given QContactFetchByIdRequest req with the latest results result, and operation error error, and map of input index to individual error errorMap. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QContactFetchRequest req with the latest results result, and operation error error. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QContactIdFetchRequest req with the latest results result, and operation error error. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QContactRemoveRequest req with the operation error error, and map of input index to individual error errorMap. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QContactSaveRequest req with the latest results result, operation error error, and map of input index to individual error errorMap. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QContactRelationshipFetchRequest req with the latest results result, and operation error error. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QContactRelationshipRemoveRequest req with the operation error error, and map of input index to individual error errorMap. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QContactRelationshipSaveRequest req with the latest results result, operation error error, and map of input index to individual error errorMap. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given asynchronous request req by setting the new state of the request. If the new state is different, the stateChanged() signal will be emitted by the request.
bool QContactManagerEngine::validateContact(const QContact & contact, QContactManager::Error * error) const [virtual]
Checks that the given contact contact does not have a type which is not supported. It also checks if the details of the given contact are valid or not. Note that this function is unable to ensure that all the details of contact are supported by a certain back-end. It also cannot check that the access constraints (such as CreateOnly and ReadOnly) are observed; backend specific code must be written if you wish to enforce these constraints.
Returns true if the contact has a valid type, otherwise returns false.
Any errors encountered during this operation should be stored to error.
bool QContactManagerEngine::waitForRequestFinished(QContactAbstractRequest * req, int msecs) [virtual]
Blocks until the manager engine has completed the given request req which was previously started, or until msecs milliseconds have passed. Returns true if the request was completed, and false if the request was not in the QContactAbstractRequest::Active state or no progress could be reported.
See also startRequest().