![]() |
Home · All Classes · All Functions · | ![]() |
The QContactManagerEngine class provides the interface for all implementations of the contact manager backend functionality. More...
#include <QContactManagerEngine>
This class is under development and is subject to change.
Inherits QObject.
Inherited by QContactInvalidEngine and QContactMemoryEngine.
QContactManagerEngine () | |
virtual bool | cancelRequest ( QContactAbstractRequest * req ) |
virtual QContact | contact ( const QContactLocalId & contactId, const QStringList & definitionRestrictions, QContactManager::Error & error ) const |
virtual QList<QContactLocalId> | contactIds ( const QList<QContactSortOrder> & sortOrders, QContactManager::Error & error ) const |
virtual QList<QContactLocalId> | contactIds ( const QContactFilter & filter, const QList<QContactSortOrder> & sortOrders, QContactManager::Error & error ) const |
virtual QList<QContact> | contacts ( const QList<QContactSortOrder> & sortOrders, const QStringList & definitionRestrictions, QContactManager::Error & error ) const |
virtual QList<QContact> | contacts ( const QContactFilter & filter, const QList<QContactSortOrder> & sortOrders, const QStringList & definitionRestrictions, QContactManager::Error & error ) const |
virtual void | deref () = 0 |
virtual QContactDetailDefinition | detailDefinition ( const QString & definitionName, const QString & contactType, QContactManager::Error & error ) const |
virtual QMap<QString, QContactDetailDefinition> | detailDefinitions ( const QString & contactType, QContactManager::Error & error ) const |
virtual bool | hasFeature ( QContactManager::ManagerFeature feature, const QString & contactType ) const |
virtual bool | isFilterSupported ( const QContactFilter & filter ) const |
virtual QString | managerName () const |
virtual QMap<QString, QString> | managerParameters () const |
QString | managerUri () const |
virtual int | managerVersion () const |
virtual QList<QContactRelationship> | relationships ( const QString & relationshipType, const QContactId & participantId, QContactRelationshipFilter::Role role, QContactManager::Error & error ) const |
virtual bool | removeContact ( const QContactLocalId & contactId, QContactManager::Error & error ) |
virtual bool | removeContacts ( QList<QContactLocalId> * contactIds, QMap<int, QContactManager::Error> * errorMap, QContactManager::Error & error ) |
virtual bool | removeDetailDefinition ( const QString & definitionName, const QString & contactType, QContactManager::Error & error ) |
virtual bool | removeRelationship ( const QContactRelationship & relationship, QContactManager::Error & error ) |
virtual QList<QContactManager::Error> | removeRelationships ( const QList<QContactRelationship> & relationships, QContactManager::Error & error ) |
virtual void | requestDestroyed ( QContactAbstractRequest * req ) |
virtual bool | saveContact ( QContact * contact, QContactManager::Error & error ) |
virtual bool | saveContacts ( QList<QContact> * contacts, QMap<int, QContactManager::Error> * errorMap, QContactManager::Error & error ) |
virtual bool | saveDetailDefinition ( const QContactDetailDefinition & def, const QString & contactType, QContactManager::Error & error ) |
virtual bool | saveRelationship ( QContactRelationship * relationship, QContactManager::Error & error ) |
virtual QList<QContactManager::Error> | saveRelationships ( QList<QContactRelationship> * relationships, QContactManager::Error & error ) |
virtual QContactLocalId | selfContactId ( QContactManager::Error & error ) const |
QContact | setContactDisplayLabel ( const QString & displayLabel, const QContact & contact ) const |
virtual bool | setSelfContactId ( const QContactLocalId & contactId, QContactManager::Error & error ) |
virtual bool | startRequest ( QContactAbstractRequest * req ) |
virtual QStringList | supportedContactTypes () const |
virtual QList<QVariant::Type> | supportedDataTypes () const |
virtual QStringList | supportedRelationshipTypes ( const QString & contactType ) const |
virtual QString | synthesizedDisplayLabel ( const QContact & contact, QContactManager::Error & error ) const |
virtual bool | validateContact ( const QContact & contact, QContactManager::Error & error ) const |
virtual bool | validateDefinition ( const QContactDetailDefinition & definition, QContactManager::Error & error ) const |
virtual bool | waitForRequestFinished ( QContactAbstractRequest * req, int msecs ) |
void | contactsAdded ( const QList<QContactLocalId> & contactIds ) |
void | contactsChanged ( const QList<QContactLocalId> & contactIds ) |
void | contactsRemoved ( const QList<QContactLocalId> & contactIds ) |
void | dataChanged () |
void | relationshipsAdded ( const QList<QContactLocalId> & affectedContactIds ) |
void | relationshipsRemoved ( const QList<QContactLocalId> & affectedContactIds ) |
void | selfContactIdChanged ( const QContactLocalId & oldId, const QContactLocalId & newId ) |
void | addSorted ( QList<QContact> * sorted, const QContact & toAdd, const QList<QContactSortOrder> & sortOrders ) |
int | compareContact ( const QContact & a, const QContact & b, const QList<QContactSortOrder> & sortOrders ) |
int | compareVariant ( const QVariant & first, const QVariant & second, Qt::CaseSensitivity sensitivity ) |
QMap<QString, QMap<QString, QContactDetailDefinition> > | schemaDefinitions () |
void | setContactRelationships ( QContact * contact, const QList<QContactRelationship> & relationships ) |
QList<QContactLocalId> | sortContacts ( const QList<QContact> & cs, const QList<QContactSortOrder> & sortOrders ) |
bool | testFilter ( const QContactFilter & filter, const QContact & contact ) |
void | updateContactFetchRequest ( QContactFetchRequest * req, const QList<QContact> & result, QContactManager::Error error ) |
void | updateContactLocalIdFetchRequest ( QContactLocalIdFetchRequest * req, const QList<QContactLocalId> & result, QContactManager::Error error ) |
void | updateContactRemoveRequest ( QContactRemoveRequest * req, QContactManager::Error error, const QMap<int, QContactManager::Error> & errorMap ) |
void | updateContactSaveRequest ( QContactSaveRequest * req, const QList<QContact> & result, QContactManager::Error error, const QMap<int, QContactManager::Error> & errorMap ) |
void | updateDefinitionFetchRequest ( QContactDetailDefinitionFetchRequest * req, const QMap<QString, QContactDetailDefinition> & result, QContactManager::Error error, const QMap<int, QContactManager::Error> & errorMap ) |
void | updateDefinitionRemoveRequest ( QContactDetailDefinitionRemoveRequest * req, QContactManager::Error error, const QMap<int, QContactManager::Error> & errorMap ) |
void | updateDefinitionSaveRequest ( QContactDetailDefinitionSaveRequest * req, const QList<QContactDetailDefinition> & result, QContactManager::Error error, const QMap<int, QContactManager::Error> & errorMap ) |
void | updateRelationshipFetchRequest ( QContactRelationshipFetchRequest * req, const QList<QContactRelationship> & result, QContactManager::Error error ) |
void | updateRelationshipRemoveRequest ( QContactRelationshipRemoveRequest * req, QContactManager::Error error, const QMap<int, QContactManager::Error> & errorMap ) |
void | updateRelationshipSaveRequest ( QContactRelationshipSaveRequest * req, const QList<QContactRelationship> & result, QContactManager::Error error, const QMap<int, QContactManager::Error> & errorMap ) |
void | updateRequestState ( QContactAbstractRequest * req, QContactAbstractRequest::State state ) |
bool | validateActionFilter ( const QContactFilter & filter ) |
void | setDetailAccessConstraints ( QContactDetail * detail, QContactDetail::AccessConstraints constraints ) const |
The QContactManagerEngine class provides the interface for all implementations of the contact manager backend functionality.
Instances of this class are usually provided by a QContactManagerEngineFactory, which is loaded from a plugin.
The default implementation of this interface provides a basic level of functionality for some functions so that specific engines can simply implement the functionality that is supported by the specific contacts engine that is being adapted.
More information on writing a contacts engine plugin is TODO.
See also QContactManager and QContactManagerEngineFactory.
A default, empty constructor.
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, 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).
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().
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.
Compares first against second. If the types are strings (QVariant::String), the sensitivity argument controls case sensitivity when comparing.
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 list of detail definition names definitionRestrictions given is non-empty, the contact returned will contain at least those details which are of a definition whose name is contained in the definitionRestrictions list. Note that the returned contact may also contain other details, but this function guarantees that all details whose definition name is included in the given list of definition names definitionRestrictions will be included in the returned contact.
The default implementation returns the entire contact.
Any errors encountered should be stored to error.
Returns a list of contact ids sorted according to the given list of sortOrders. Depending on the backend, this operation may involve retrieving all the contacts. Any error which occurs will be saved in error.
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 stored in the manager sorted according to the given list of sortOrders. If the given list of detail definition names definitionRestrictions is empty, each contact returned will include all of the details which are stored in it, otherwise only those details which are of a definition whose name is included in the definitionRestrictions list will be included. Any error which occurs will be saved in error.
Returns a list of contacs 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. If the given list of detail definition names definitionRestrictions is empty, each contact returned will include all of the details which are stored in it, otherwise only those details which are of a definition whose name is included in the definitionRestrictions list will be included. Any error which occurs will be saved in error.
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().
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().
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().
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().
Notifies the engine that it is no longer required. If this engine can not be shared between managers, it is safe for the engine to delete itself in this function.
If the engine implementation can be shared, this function can use a reference count and track lifetime that way. The factory that returns an instance of this engine should increment the reference count in this case.
Returns the definition identified by the given definitionName that is valid for contacts whose type is of the given contactType in this store, or a default-constructed QContactDetailDefinition if no such definition exists
Any errors encountered during this operation should be stored to error.
Returns the registered detail definitions which are valid for contacts whose type is of the given contactType in this engine.
Any errors encountered during this operation should be stored to error.
Returns true if the given feature is supported by this engine for contacts of the given contactType
Returns a whether the supplied filter can be implemented natively by this engine. If not, the base class implementation will emulate the functionality.
Returns the manager name for this QContactManagerEngine
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.
Returns the unique URI of this manager, which is built from the manager name and the parameters used to construct it.
Returns the engine backend implementation version number
Returns a list of relationships of the given relationshipType in which the contact identified by the given participantId participates in the given role. If participantId is the default-constructed id, role is ignored and all relationships of the given relationshipType are returned. If relationshipType is empty, relationships of any type are returned. If no relationships of the given relationshipType in which the contact identified by the given participantId is involved in the given role exists, error is set to QContactManager::DoesNotExistError.
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().
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().
Remove the contact identified by contactId from the database, and removes the contact from any relationships in which it was involved. Returns true if the contact was removed successfully, otherwise returns false.
The backend must emit the appropriate signals to inform clients of changes to the database resulting from this operation.
Any errors encountered during this operation should be stored to error.
Remove every contact whose id is contained in the list of contacts ids contactIds. Returns true if all contacts were removed successfully, otherwise false.
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 QContactManager::error() function will only return QContactManager::NoError if all contacts were removed successfully.
For each contact that was removed succesfully, the corresponding id in the contactIds list will be retained but set to zero. The id of contacts that were not successfully removed will be left alone.
Any contact that was removed successfully will have the relationships in which it was involved removed also.
Any errors encountered during this operation should be stored to error.
See also QContactManager::removeContact().
Removes the definition identified by the given definitionName from the database, where it was valid for contacts whose type was the given contactType.
Returns true if the definition was removed successfully, otherwise returns false.
The backend must emit the appropriate signals to inform clients of changes to the database resulting from this operation.
Any errors encountered during this operation should be stored to error.
Removes the given relationship from the manager. If the relationship exists in the manager, the relationship will be removed, the error will be set to QContactManager::NoError and this function will return true. If no such relationship exists in the manager, the error will be set to QContactManager::DoesNotExistError and this function will return false.
The priority of the relationship is ignored when determining existence of the relationship.
Removes the given relationships from the database and returns a list of error codes. Any error which occurs will be saved in error.
Notifies the manager engine that the given request req has been destroyed
Adds the given contact to the database if contact has a default-constructed id, or an id with the manager URI set to the URI of this manager and a local id of zero.
If the manager URI of the id of the contact is neither empty nor equal to the URI of this manager, or local id of the contact is non-zero but does not exist in the manager, the operation will fail and error will be set to QContactManager::DoesNotExistError.
Alternatively, the function will update the existing contact in the database if contact has a non-zero id and currently exists in the database.
If the contact contains one or more details whose definitions have not yet been saved with the manager, the operation will fail and error will be set to QContactManager::UnsupportedError.
If the contact has had its relationships reordered, the manager will check to make sure that every relationship that the contact is currently involved in is included in the reordered list, and that no relationships which either do not involve the contact, or have not been saved in the manager are included in the list. If these conditions are not met, the function will return false and error will be set to QContactManager::InvalidRelationshipError.
The engine must automatically synthesize the display label of the contact when it is saved, by either using the built in synthesizedDisplayLabel() function or overriding it, and then calling setContactDisplayLabel().
Returns false on failure, or true on success. On successful save of a contact with an id of zero, its id will be set to a new, valid id with the manager URI set to the URI of this manager, and the local id set to a new, valid local id.
This function is called by the contacts framework in both the single contact save and batch contact save, if the saveContacts function is not overridden.
The backend must emit the appropriate signals to inform clients of changes to the database resulting from this operation.
Any errors encountered during this operation should be stored to error.
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 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().
Persists the given definition def in the database, which is valid for contacts whose type is the given contactType.
Returns true if the definition was saved successfully, and otherwise returns false.
The backend must emit the appropriate signals to inform clients of changes to the database resulting from this operation.
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 (one of the destination contacts is also the source contact), or if it references a non-existent local contact (either source or destination). If the given relationship is invalid, the function will return false and the error will be set to QContactManager::InvalidRelationshipError. If the given relationship could not be saved in the database (due to backend limitations) the function will return false and error will be set to QContactManager::NotSupportedError.
If any destination contact manager URI is not set in the relationship, these will be automatically set to the URI of this manager, before the relationship is saved.
Saves the given relationships in the database and returns a list of error codes. Any error which occurs will be saved in error.
Returns the base schema definitions
Returns the id of the "self" contact which has previously been set. If no "self" contact has been set, or if the self contact was removed from the manager after being set, or if the backend does not support the concept of a "self" contact, an invalid id will be returned and the error will be set to QContactManager::DoesNotExistError.
See also setSelfContactId().
This signal is emitted at some point after the id of the self-contact is changed from oldId to newId in the manager. If the newId is the invalid, zero id, then the self contact was deleted or no self contact exists. This signal must not be emitted if the dataChanged() signal was previously emitted for this change. 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().
Returns a copy of the given contact contact with its display label set to displayLabel. This function does not touch the database in any way, and is purely a convenience to allow engine implementations to set the display label.
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.
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
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().
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 definition which is valid in this engine.
Returns the list of data types supported by this engine.
Returns the list of relationship types supported by this engine for contacts whose type is the given contactType.
Synthesizes the display label of the given contact in a platform specific manner. Any error that occurs will be stored in error. Returns the synthesized display label.
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 QContactFetchRequest req with the latest results result, and operation error error. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given QContactLocalIdFetchRequest req with the latest results result, and operation error error. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given QContactRemoveRequest req with the operation error error, and map of input index to individual error errorMap. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given QContactSaveRequest req with the latest results result, operation error error, and map of input index to individual error errorMap. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given QContactDetailDefinitionFetchRequest req with the latest results result, operation error error, and map of input index to individual error errorMap. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given QContactDetailDefinitionRemoveRequest req with the operation error error, and map of input index to individual error errorMap. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given QContactDetailDefinitionSaveRequest req with the latest results result, operation error error, and map of input index to individual error errorMap. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given QContactRelationshipFetchRequest req with the latest results result, and operation error error. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given QContactRelationshipRemoveRequest req with the operation error error, and map of input index to individual error errorMap. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given QContactRelationshipSaveRequest req with the latest results result, operation error error, and map of input index to individual error errorMap. It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
Updates the given asynchronous request req by setting the new state of the request. It then causes the stateChanged() signal to be emitted by the request.
Given a QContactFilter filter retrieved from a QContactAction, check that it is valid and cannot cause infinite recursion.
In particular, a filter from a QContactAction cannot contain any instances of a QContactActionFilter.
Returns true if filter seems ok, or false otherwise.
Checks that the given contact contact does not have details which don't conform to a valid definition, violate uniqueness constraints, or contain values for nonexistent fields, and that the values contained are of the correct type for each field, and are allowable values for that field.
Note that this function is unable to ensure 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 is valid according to the definitions for its details, otherwise returns false.
Any errors encountered during this operation should be stored to error.
Checks that the given detail definition definition seems valid, with a correct id, defined fields, and any specified value types are supported by this engine. This function is called before trying to save a definition.
Returns true if the definition seems valid, otherwise returns false.
Any errors encountered during this operation should be stored to error.
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().
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt Mobility Project 1.0.0 |