QOrganizerAbstractRequest Class

The QOrganizerAbstractRequest class provides a mechanism for asynchronous requests to be made of a manager if it supports them. More...

Public Types

enum RequestType { InvalidRequest, ItemOccurrenceFetchRequest, ItemFetchRequest, ItemFetchForExportRequest, ..., CollectionSaveRequest }
enum State { InactiveState, ActiveState, CanceledState, FinishedState }

Public Functions

~QOrganizerAbstractRequest()
QOrganizerManager::Error error() const
bool isActive() const
bool isCanceled() const
bool isFinished() const
bool isInactive() const
QOrganizerManager * manager() const
void setManager(QOrganizerManager * manager)
State state() const
RequestType type() const

Public Slots

bool cancel()
bool start()
bool waitForFinished(int msecs = 0)

Signals

void resultsAvailable()
void stateChanged(QOrganizerAbstractRequest::State newState)

Detailed Description

The QOrganizerAbstractRequest class provides a mechanism for asynchronous requests to be made of a manager if it supports them.

It allows a client to asynchronously request some functionality of a particular QOrganizerManager. Instances of the class will emit signals when the state of the request changes, or when more results become available.

Clients should not attempt to create instances of this class directly, but should instead use the use-case-specific classes derived from this class.

After creating any sort of request, the client retains ownership and must delete the request to avoid leaking memory. The client may either do this directly (if not within a slot connected to a signal emitted by the request) or by using the deleteLater() slot to schedule the request for deletion when control returns to the event loop.

Member Type Documentation

enum QOrganizerAbstractRequest::RequestType

Enumerates the various possible types of asynchronous requests.

ConstantValueDescription
QOrganizerAbstractRequest::InvalidRequest0An invalid request.
QOrganizerAbstractRequest::ItemOccurrenceFetchRequest1A request to fetch a list of occurrences of an organizer item.
QOrganizerAbstractRequest::ItemFetchRequest2A request to fetch a list of organizer items.
QOrganizerAbstractRequest::ItemFetchForExportRequest3A request to fetch a list of persisted organizer items and exceptions.
QOrganizerAbstractRequest::ItemIdFetchRequest4A request to fetch a list of organizer item IDs.
QOrganizerAbstractRequest::ItemFetchByIdRequest5A request to fetch a list of organizer items by the given IDs.
QOrganizerAbstractRequest::ItemRemoveRequest6A request to remove a list of organizer items.
QOrganizerAbstractRequest::ItemRemoveByIdRequest7A request to remove a list of organizer items by the given IDs.
QOrganizerAbstractRequest::ItemSaveRequest8A request to save a list of organizer items.
QOrganizerAbstractRequest::CollectionFetchRequest9A request to fetch a collection.
QOrganizerAbstractRequest::CollectionRemoveRequest10A request to remove a collection.
QOrganizerAbstractRequest::CollectionSaveRequest11A request to save a collection.
QOrganizerAbstractRequest::ItemFetchByIdRequest5A request to fetch an organizer item by ID.
QOrganizerAbstractRequest::ItemRemoveByIdRequest7A request to remove an organizer item by ID.

enum QOrganizerAbstractRequest::State

Enumerates the various states that a request may be in at any given time.

ConstantValueDescription
QOrganizerAbstractRequest::InactiveState0Operation not yet started.
QOrganizerAbstractRequest::ActiveState1Operation started, not yet finished.
QOrganizerAbstractRequest::CanceledState2Operation is finished due to cancellation.
QOrganizerAbstractRequest::FinishedState3Operation successfully completed.

Member Function Documentation

QOrganizerAbstractRequest::~QOrganizerAbstractRequest()

Cleans up the memory used by this request.

[slot] bool QOrganizerAbstractRequest::cancel()

Attempts to cancel the request. Returns false if the request is not in the QOrganizerAbstractRequest::Active state, or if the request is unable to be cancelled by the manager engine; otherwise returns true.

QOrganizerManager::Error QOrganizerAbstractRequest::error() const

Returns the overall error of the most recent asynchronous operation.

bool QOrganizerAbstractRequest::isActive() const

Returns true if the request is in the QOrganizerAbstractRequest::ActiveState state; returns false otherwise.

See also state(), isInactive(), isCanceled(), and isFinished().

bool QOrganizerAbstractRequest::isCanceled() const

Returns true if the request is in the QOrganizerAbstractRequest::CanceledState; returns false otherwise.

See also state(), isActive(), isInactive(), and isFinished().

bool QOrganizerAbstractRequest::isFinished() const

Returns true if the request is in the QOrganizerAbstractRequest::FinishedState; returns false otherwise.

See also state(), isActive(), isInactive(), and isCanceled().

bool QOrganizerAbstractRequest::isInactive() const

Returns true if the request is in the QOrganizerAbstractRequest::InactiveState state; returns false otherwise.

See also state(), isActive(), isCanceled(), and isFinished().

QOrganizerManager * QOrganizerAbstractRequest::manager() const

Returns a pointer to the manager of which this request instance requests operations.

See also setManager().

[signal] void QOrganizerAbstractRequest::resultsAvailable()

This signal is emitted when new results are available. Results can include the operation error which may be accessed via error(), or derived-class-specific results which are accessible through the derived class API.

See also error().

void QOrganizerAbstractRequest::setManager(QOrganizerManager * manager)

Sets the manager of which this request instance requests operations to manager.

Note that if the current request is in active state, the manager can not be changed.

See also manager().

[slot] bool QOrganizerAbstractRequest::start()

Attempts to start the request. Returns false if the request is in the QOrganizerAbstractRequest::Active state, or if the request was unable to be performed by the manager engine; otherwise returns true.

State QOrganizerAbstractRequest::state() const

Returns the current state of the request.

[signal] void QOrganizerAbstractRequest::stateChanged(QOrganizerAbstractRequest::State newState)

This signal is emitted when the state of the request is changed. The new state of the request will be contained in newState.

RequestType QOrganizerAbstractRequest::type() const

Returns the type of this asynchronous request.

[slot] bool QOrganizerAbstractRequest::waitForFinished(int msecs = 0)

Blocks until the request has been completed by the manager engine, or until msecs milliseconds has elapsed.

If msecs is zero or negative, this function will block until the request is complete, regardless of how long it takes.

Returns true if the request was cancelled or completed successfully within the given period, otherwise false. Some backends are unable to support this operation safely, and will return false immediately.