Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QContactAbstractRequest Class

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

 #include <QContactAbstractRequest>

Inherits: QObject.

Inherited by: QContactFetchByIdRequest, QContactFetchRequest, QContactIdFetchRequest, QContactRelationshipFetchRequest, QContactRelationshipRemoveRequest, QContactRelationshipSaveRequest, QContactRemoveRequest, and QContactSaveRequest.

Public Types

enum RequestType { InvalidRequest, ContactFetchRequest, ContactIdFetchRequest, ContactRemoveRequest, ..., ContactFetchByIdRequest }
enum State { InactiveState, ActiveState, CanceledState, FinishedState }
enum StorageLocation { UserDataStorage, SystemStorage }
flags StorageLocations

Public Functions

~QContactAbstractRequest()
QContactManager::Error error() const
bool isActive() const
bool isCanceled() const
bool isFinished() const
bool isInactive() const
QContactManager * manager() const
void setManager(QContactManager * manager)
State state() const
RequestType type() const
  • 31 public functions inherited from QObject

Public Slots

bool cancel()
bool start()
bool waitForFinished(int msecs = 0)
  • 1 public slot inherited from QObject

Signals

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

Additional Inherited Members

  • 1 property inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QContactAbstractRequest 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 QContactManager. 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.

All such request classes have a similar interface: clients set the parameters of the asynchronous call, including which manager the request will be made of, and then call the start() slot of the request. The manager will then enqueue or begin to process the request, at which point the request's state will transition from InactiveState to ActiveState. After any state transition, the request will emit the stateChanged() signal. The manager may periodically update the request with results, at which point the request will emit the resultsAvailable() signal. These results are not guaranteed to have a stable ordering. Error information is considered a result, so some requests will emit the resultsAvailable() signal even if no results are possible from the request (for example, a contact remove request) when the manager updates the request with information about any errors which may have occurred.

Please see the class documentation of each of the use-case-specific classes derived from this class for information about how to retrieve the results of a request (including error information). In all cases, those functions are synchronous, and will return the cached result set with which the manager has updated the request instance if the resultsAvailable() signal has been emitted.

Clients can choose which signals they wish to handle from a request. If the client is not interested in interim results, they can choose to handle only the stateChanged() signal, and in the slot to which that signal is connected, check whether the state has changed to either FinishedState or CanceledState (both of which signify that the manager has finished handling the request, and that the request will not be updated with any more results). If the client is not interested in any results (including error information), they may choose to delete the request after calling start(), or simply not connect the request's signals to any slots.

If the request is allocated via operator new, the client must delete the request when they are no longer using it in order to avoid leaking memory. That is, the client retains ownership of the request.

The client may delete a heap-allocated request in various ways: by deleting it directly (but 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 (from within a slot connected to a signal emitted by the request, for example stateChanged()).

An active request may be deleted by the client, but the client will not receive any notifications about whether the request succeeded or not, nor any results of the request.

Because clients retain ownership of any request object, and may delete a request object at any time, manager engine implementors must be careful to ensure that they do not assume that a request has not been deleted at some point during processing of a request, particularly if the engine has a multithreaded implementation. It is suggested that engine implementors read the Qt Contacts Manager Engines documentation for more information on this topic.

Member Type Documentation

enum QContactAbstractRequest::RequestType

Enumerates the various possible types of asynchronous requests

ConstantValueDescription
QContactAbstractRequest::InvalidRequest0An invalid request
QContactAbstractRequest::ContactFetchRequest1A request to fetch a list of contacts
QContactAbstractRequest::ContactIdFetchRequest2A request to fetch a list of contact ids
QContactAbstractRequest::ContactRemoveRequest3A request to remove a list of contacts
QContactAbstractRequest::ContactSaveRequest4A request to save a list of contacts
QContactAbstractRequest::RelationshipFetchRequest5A request to fetch relationships between contacts
QContactAbstractRequest::RelationshipRemoveRequest6A request to remove any relationships which match the request criteria
QContactAbstractRequest::RelationshipSaveRequest7A request to save a list of relationships
QContactAbstractRequest::ContactFetchByIdRequest8A request to fetch a list of contacts given a list of ids

enum QContactAbstractRequest::State

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

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

enum QContactAbstractRequest::StorageLocation
flags QContactAbstractRequest::StorageLocations

Enumerates the different storage locations for a request.

ConstantValueDescription
QContactAbstractRequest::UserDataStorage0x1A storage location where user data is stored.
QContactAbstractRequest::SystemStorage0x2A storage location where system files are stored.

Depending on the backend implementation, the access rights for different storage locations might vary.

The StorageLocations type is a typedef for QFlags<StorageLocation>. It stores an OR combination of StorageLocation values.

Member Function Documentation

QContactAbstractRequest::~QContactAbstractRequest()

Cleans up the memory used by this request

bool QContactAbstractRequest::cancel() [slot]

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

QContactManager::Error QContactAbstractRequest::error() const

Returns the overall error of the most recent asynchronous operation

bool QContactAbstractRequest::isActive() const

Returns true if the request is in the QContactAbstractRequest::ActiveState state; otherwise, returns false

See also state().

bool QContactAbstractRequest::isCanceled() const

Returns true if the request is in the QContactAbstractRequest::CanceledState; otherwise, returns false

See also state().

bool QContactAbstractRequest::isFinished() const

Returns true if the request is in the QContactAbstractRequest::FinishedState; otherwise, returns false

See also state().

bool QContactAbstractRequest::isInactive() const

Returns true if the request is in the QContactAbstractRequest::InactiveState state; otherwise, returns false

See also state().

QContactManager * QContactAbstractRequest::manager() const

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

See also setManager().

void QContactAbstractRequest::resultsAvailable() [signal]

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 QContactAbstractRequest::setManager(QContactManager * manager)

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

If the request is currently active, this function will return without updating the manager object.

See also manager().

bool QContactAbstractRequest::start() [slot]

Attempts to start the request. Returns false if the request is not in the QContactAbstractRequest::Inactive, QContactAbstractRequest::Finished or QContactAbstractRequest::Cancelled states, or if the request was unable to be performed by the manager engine; otherwise returns true.

State QContactAbstractRequest::state() const

Returns the current state of the request.

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

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

RequestType QContactAbstractRequest::type() const

Returns the type of this asynchronous request

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

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.

Note that any signals generated while waiting for the request to complete may be queued and delivered some time after this function has returned, when the calling thread's event loop is dispatched. If your code depends on your slots being invoked, you may need to process events after calling this function.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web