Member Function Documentation
QOrganizerManagerEngine::QOrganizerManagerEngine ()
A default, empty constructor.
Performs insertion sort of the item toAdd into the sorted list, according to the provided sortOrders list. The first QOrganizerItemSortOrder in the list has the highest priority; if the item toAdd is deemed equal to another in the sorted list, the second QOrganizerItemSortOrder in the list is used (and so on until either the item is inserted or there are no more sort order objects in the list).
bool QOrganizerManagerEngine::cancelRequest ( QOrganizerAbstractRequest * 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 QOrganizerAbstractRequest::cancel().
Given an input filter, returns the canonical version of the filter.
Some of the following transformations may be applied:
Returns the collection identified by the given collectionId in the manager. Any errors encountered during this operation should be stored to error. If the given collectionId does not specify a valid collection, error will be set to QOrganizerManager::DoesNotExistError.
Returns the list of all of the collections managed by this manager. Any errors encountered during this operation should be stored to error.
void QOrganizerManagerEngine::collectionsAdded ( const QList<QOrganizerCollectionId> & collectionIds ) [signal]
This signal should be emitted at some point once the collections identified by collectionIds have been added to a datastore managed by this engine. This signal must not be emitted if the dataChanged() signal was previously emitted for these changes.
void QOrganizerManagerEngine::collectionsChanged ( const QList<QOrganizerCollectionId> & collectionIds ) [signal]
This signal should be emitted at some point once the metadata for the collections identified by collectionIds have been modified in a datastore managed by this engine. This signal is not emitted if one of the items in this collection has changed - itemsChanged() will be emitted instead. This signal must not be emitted if the dataChanged() signal was previously emitted for these changes.
void QOrganizerManagerEngine::collectionsRemoved ( const QList<QOrganizerCollectionId> & collectionIds ) [signal]
This signal should be emitted at some point once the collections identified by collectionIds have been removed from a datastore managed by this engine. This signal must not be emitted if the dataChanged() signal was previously emitted for these changes.
Compares two organizer items (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 QOrganizerManagerEngine::compareVariant ( const QVariant & first, const QVariant & second, Qt::CaseSensitivity sensitivity ) [static]
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 a pruned or modified version of the original collection which is valid and can be saved in the manager. The returned item might have meta data removed or arbitrarily changed. Any error which occurs will be saved to error. By default, modifiable collections are not supported, and so this function always returns false. Any engine which supports mutable collections should reimplement this function.
Returns a pruned or modified version of the original item which is valid and can be saved in the manager. The returned item might have details removed or arbitrarily changed. Any error which occurs will be saved to error.
void QOrganizerManagerEngine::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 itemsAdded(), itemsChanged(), and itemsRemoved().
Returns the default collection of the manager. Any errors encountered during this operation should be stored to error.
Returns the definition identified by the given definitionName that is valid for organizer items whose type is of the given organizeritemType in this store, or a default-constructed QOrganizerItemDetailDefinition 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 organizer items whose type is of the given organizeritemType in this engine.
Any errors encountered during this operation should be stored to error.
Returns the engine id from the given id. The caller does not take ownership of the pointer, and should not delete returned id or undefined behavior may occur.
Returns the engine id from the given id. The caller does not take ownership of the pointer, and should not delete returned id or undefined behavior may occur.
bool QOrganizerManagerEngine::hasFeature ( QOrganizerManager::ManagerFeature feature, const QString & organizeritemType ) const [virtual]
Returns true if the given feature is supported by this engine for organizer items of the given organizeritemType
bool QOrganizerManagerEngine::isFilterSupported ( const QOrganizerItemFilter & 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 QOrganizerManagerEngine::isItemBetweenDates ( const QOrganizerItem & item, const QDateTime & startPeriod, const QDateTime & endPeriod ) [static]
Returns true if the given item (or an occurrence of the item) occurs within the range specified by the startPeriod and the endPeriod, inclusive. A default-constructed startPeriod signifies that the lower bound of the range is infinitely small (i.e., will match anything up to the endPeriod) and a default-constructed endPeriod signifies that the upper bound of the range is infinitely large (i.e., will match anything which occurs after the startPeriod).
Returns the organizer item in the database identified by organizeritemId.
If the item does not exist, an empty, default constructed QOrganizerItem will be returned, and the error will be set to QOrganizerManager::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 in the matching organizer items will be returned.
See also QOrganizerItemFetchHint.
Returns a list of organizer item ids that match the given filter, sorted according to the given list of sortOrders, for any item which occurs (or has an occurrence which occurs) in the range specified by the given startDate and endDate. A default-constructed (invalid) startDate specifies an open start date (matches anything which occurs up until the endDate), and a default-constructed (invalid) endDate specifies an open end date (matches anything which occurs after the startDate). If both the startDate and endDate are invalid, this function will return the ids of all items which match the filter criteria.
Depending on the backend, this filtering operation may involve retrieving all the organizer items. Any error which occurs will be saved in error.
Return the list of a maximum of maxCount organizer item instances which are occurrences of the given parentItem recurring item, which occur between the given periodStart date and the given periodEnd date.
If periodStart is after periodEnd, the operation will fail, and error will be set to QOrganizerManager::BadArgumentError. If maxCount is negative, it is backend specific as to how many occurrences will be returned. Some backends may return no instances, others may return some limited number of occurrences.
If the parentItem is an item of type QOrganizerItemType::TypeEvent, a list of items of type QOrganizerItemType::TypeEventOccurrence will be returned, representing the expansion of the parent item according to its QOrganizerItemRecurrence detail. Similarly, a parentItem of type QOrganizerItemType::TypeTodo will result in a list of QOrganizerItemType::TypeTodoOccurrence items. If the parentItem is of any other type, it is returned by itself from the backend.
The occurrence-typed items returned should have a QOrganizerItemParent detail that refers to the parent item and the original instance that the event would have occurred on (if it is an exception). No returned item should contain a QOrganizerItemRecurrence detail.
If the parentItem does not exist in the backend, or if there are no instances matching the criteria, an empty list should be returned.
The fetchHint parameter is a hint to the manager about which details the client is interested in. It allows the manager to optimize retrieval of occurrences. The manager may ignore the fetchHint, but if it does so each item occurrence it returns must include all of the details associated with it in the database.
Returns the list of organizer items which match the given filter stored in the manager sorted according to the given list of sortOrders, for any item or item occurrence which occurs in the range specified by the given startDate and endDate. A default-constructed (invalid) startDate specifies an open start date (matches anything which occurs up until the endDate), and a default-constructed (invalid) endDate specifies an open end date (matches anything which occurs after the startDate). If both the startDate and endDate are invalid, this function will return all items which match the filter criteria.
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 in the matching organizer items will be returned.
See also QOrganizerItemFetchHint.
void QOrganizerManagerEngine::itemsAdded ( const QList<QOrganizerItemId> & organizeritemIds ) [signal]
This signal is emitted some time after a set of organizer items 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 organizer items, the timing cannot be determined.
The list of ids of organizer items added is given by organizeritemIds. There may be one or more ids in the list.
See also dataChanged().
void QOrganizerManagerEngine::itemsChanged ( const QList<QOrganizerItemId> & organizeritemIds ) [signal]
This signal is emitted some time after a set of organizer items 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 organizer items, the timing cannot be determined.
The list of ids of changed organizer items is given by organizeritemIds. There may be one or more ids in the list.
See also dataChanged().
Returns the list of organizer items which match the given filter stored in the manager sorted according to the given list of sortOrders, for any persisted item which occurs (or has an occurrence which occurs) in the range specified by the given startDate and endDate. A default-constructed (invalid) startDate specifies an open start date (matches anything which occurs up until the endDate), and a default-constructed (invalid) endDate specifies an open end date (matches anything which occurs after the startDate). If both the startDate and endDate are invalid, this function will return all items which match the filter criteria.
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 in the matching organizer items will be returned.
Items of type EventOccurrence and TodoOccurrence should only be returned when they represent an exceptional occurrence; ie. if the client has specifically saved the item occurrence in the manager. Occurrence-typed items that are generated purely from a recurrence specification of another detail should not be returned in this list.
All items returned should have a non-zero ID.
See also QOrganizerItemFetchHint.
void QOrganizerManagerEngine::itemsRemoved ( const QList<QOrganizerItemId> & organizeritemIds ) [signal]
This signal is emitted some time after a set of organizer items 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 organizer items, the timing cannot be determined.
The list of ids of removed organizer items is given by organizeritemIds. There may be one or more ids in the list.
See also dataChanged().
QString QOrganizerManagerEngine::managerName () const [pure virtual]
Returns the manager name for this QOrganizerManagerEngine
QMap<QString, QString> QOrganizerManagerEngine::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 QOrganizerManagerEngine::managerUri () const
Returns the unique URI of this manager, which is built from the manager name and the parameters used to construct it.
int QOrganizerManagerEngine::managerVersion () const [pure virtual]
Returns the engine backend implementation version number
Returns true if the removing of the collectionId was successfull otherwise false. Any errors encountered during this operation should be stored to error.
bool QOrganizerManagerEngine::removeDetailDefinition ( const QString & definitionName, const QString & organizeritemType, QOrganizerManager::Error * error ) [virtual]
Removes the definition identified by the given definitionName from the database, where it was valid for organizer items whose type was the given organizeritemType.
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.
bool QOrganizerManagerEngine::removeItem ( const QOrganizerItemId & organizeritemId, QOrganizerManager::Error * error ) [virtual]
Remove the item identified by organizeritemId from the database. Returns true if the item 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 removeItems.
Remove every item whose id is contained in the list of organizer items ids organizeritemIds. Returns true if all organizer items were removed successfully, otherwise false.
The manager might populate errorMap (the map of indices of the organizeritemIds list to the error which occurred when saving the item at that index) for every index for which the item could not be removed, if it is able. The QOrganizerManager::error() function will only return QOrganizerManager::NoError if all organizer items were removed successfully.
If the list contains ids which do not identify a valid item in the manager, the function will remove any organizer items which are identified by ids in the organizeritemIds list, insert QOrganizerManager::DoesNotExist entries into the errorMap for the indices of invalid ids in the organizeritemIds list, return false, and set the overall operation error to QOrganizerManager::DoesNotExistError.
Any errors encountered during this operation should be stored to error.
See also QOrganizerManager::removeItem().
void QOrganizerManagerEngine::requestDestroyed ( QOrganizerAbstractRequest * req ) [virtual]
Notifies the manager engine that the given request req has been destroyed.
This notifies the engine that:
- the client doesn't care about the request any more. The engine can still complete it, but completion is not required.
- it can't reliably access any properties of the request pointer any more. The pointer will be invalid once this function returns.
This means that if there is a worker thread, the engine needs to let that thread know that the request object is not valid and block until that thread acknowledges it. One way to do this is to have a QSet<QOrganizerAbstractRequest*> (or QMap<QOrganizerAbstractRequest, MyCustomRequestState>) that tracks active requests, and insert into that set in startRequest, and remove in requestDestroyed (or when it finishes or is cancelled). Protect that set/map with a mutex, and make sure you take the mutex in the worker thread before calling any of the QOrganizerAbstractRequest::updateXXXXXXRequest functions. And be careful of lock ordering problems :D
Returns true if the saving of the collection was successfull otherwise false. Any errors encountered during this operation should be stored to error.
Persists the given definition def in the database, which is valid for organizer items whose type is the given organizeritemType.
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.
bool QOrganizerManagerEngine::saveItem ( QOrganizerItem * organizeritem, QOrganizerManager::Error * error ) [virtual]
Adds the given organizeritem to the database if organizeritem has a default-constructed id, or an id with the manager URI set to the URI of this manager and a id of zero, otherwise updates the organizer item in the database which has the same id to be the given organizeritem. If the id is non-zero but does not identify any item stored in the manager, the function will return false and error will be set to QOrganizerManager::DoesNotExistError.
The organizeritem will be added to the collection identified by the collectionId specified in the item (accessible via item->organizerId()) if it exists, and the item conforms to the schema supported for that collection. If the collection exists but the item does not conform to the schema supported for that collection, the function will return false, and the error will be set to QOrganizerManager::InvalidDetailError.
If the collectionId is not the default (zero) id, but does not identify a valid collection, the function will return false, and error will be set to QOrganizerManager::InvalidCollectionError. If the collectionId is the default (zero) id, the item should be saved in the collection in which it is already saved (if it is already saved in this manager), or in the default collection (if it is a new item in this manager).
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 saveItems.
See also managerUri().
Adds the list of organizer items given by organizeritems list to the database. Returns true if the organizer items were saved successfully, otherwise false.
The engine might populate errorMap (the map of indices of the organizeritems list to the error which occurred when saving the item at that index) for every index for which the item could not be saved, if it is able. The QOrganizerManager::error() function will only return QOrganizerManager::NoError if all organizer items were saved successfully.
For each newly saved item that was successful, the id of the item in the organizeritems list will be updated with the new value. If a failure occurs when saving a new item, the id will be cleared.
Each item in the given list organizeritems will be added to the collection identified in the item (accessible via item->collectionId()) if it exists, and if the item conform to the schema supported for that collection. If the collection exists but the item does not conform to the schema supported for that collection, the function will return false, and the error in the errorMap for the item at that index will be set to QOrganizerManager::InvalidDetailError.
If the collectionId is not the default (zero) id, but does not identify a valid collection, the function will return false, and error will be set to QOrganizerManager::InvalidCollectionError. If the collectionId is the default (zero) id, the item should be saved in the collection in which it is already saved (if they are already saved in this manager), or in the default collection (if they are new items in this manager).
Any errors encountered during this operation should be stored to error.
See also QOrganizerManager::saveItem().
Returns the default schema definitions for the given version of the schema. Version 1 of the schema corresponds to version 1.1 of the Qt Mobility APIs.
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 QOrganizerManagerEngine::startRequest ( QOrganizerAbstractRequest * 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.
Generally, the engine queues the request and processes it at some later time (probably in another thread).
Once a request is started, the engine should call the updateRequestState and/or the specific updateXXXXXRequest functions to mark it in the active state.
If the engine is particularly fast, or the operation involves only in memory data, the request can be processed and completed without queueing it.
Note that when the client is threaded, and the request might live on a different thread, the engine needs to be careful with locking. In particular, the request might be deleted while the engine is still working on it. In this case, the requestDestroyed function will be called while the request is still valid, and that function should block until the worker thread (etc.) has been notified not to touch that request any more.
See also QOrganizerAbstractRequest::start().
QStringList QOrganizerManagerEngine::supportedItemTypes () const [virtual]
Returns the list of item types which are supported by this engine. This is a convenience function, equivalent to retrieving the allowable values for the QOrganizerItemType::FieldType field of the QOrganizerItemType definition which is valid in this engine.
bool QOrganizerManagerEngine::testFilter ( const QOrganizerItemFilter & filter, const QOrganizerItem & organizeritem ) [static]
Returns true if the supplied item organizeritem matches the supplied filter filter.
This function will test each condition in the filter, possibly recursing.
Updates the given QOrganizerCollectionFetchRequest 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 QOrganizerCollectionRemoveRequest 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 QOrganizerCollectionSaveRequest 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 QOrganizerItemDetailDefinitionFetchRequest 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 QOrganizerItemDetailDefinitionRemoveRequest 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 QOrganizerItemDetailDefinitionSaveRequest 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 QOrganizerItemFetchForExportRequest 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 QOrganizerItemFetchRequest 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 QOrganizerItemIdFetchRequest 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 QOrganizerItemOccurrenceFetchRequest 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 QOrganizerItemRemoveRequest 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 QOrganizerItemSaveRequest 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 QOrganizerManagerEngine::validateCollection ( const QOrganizerCollection & collection, QOrganizerManager::Error * error ) const [virtual]
Returns true if the collection is valid and can be saved in the engine. By default, modifiable collections are not supported, so this function returns false, and error is set to QOrganizerManager::NotSupportedError. Engines which do implement mutable collections should reimplement this function.
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.
bool QOrganizerManagerEngine::validateItem ( const QOrganizerItem & organizeritem, QOrganizerManager::Error * error ) const [virtual]
Checks that the given item organizeritem 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 organizeritem is valid according to the definitions for its details, otherwise returns false.
Any errors encountered during this operation should be stored to error.
bool QOrganizerManagerEngine::waitForRequestFinished ( QOrganizerAbstractRequest * 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 QOrganizerAbstractRequest::Active state or no progress could be reported.
It is important that this function is implemented by the engine, at least merely as a delay, since clients may call it in a loop.
See also startRequest().