MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QGalleryAbstractResponse Class Reference

The QGalleryAbstractResponse class provides a base class for responses to gallery requests. More...

 #include <QGalleryAbstractResponse>

Inherits: QObject.

Inherited by: QGalleryResultSet.

This class was introduced in Qt Mobility 1.1.

Public Functions

QGalleryAbstractResponse ( int error, const QString & errorString = QString(), QObject * parent = 0 )
~QGalleryAbstractResponse ()
virtual void cancel ()
int error () const
QString errorString () const
bool isActive () const
bool isIdle () const
virtual bool waitForFinished ( int msecs )
  • 29 public functions inherited from QObject

Signals

void canceled ()
void finished ()
void progressChanged ( int current, int maximum )
void resumed ()

Protected Functions

QGalleryAbstractResponse ( QObject * parent = 0 )
void error ( int error, const QString & errorString = QString() )
void finish ( bool idle = false )
void resume ()
  • 7 protected functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QGalleryAbstractResponse class provides a base class for responses to gallery requests.

QGalleryAbstractResponse is the interface through which a QAbstractGallery returns a response to a QGalleryAbstractRequest. The interface provides functions to communicate the state of a response to a request, additional classes derived from QGalleryAbstractRequest such as QGalleryResultSet are used to communicate actual results.

New responses start in an active state indicating they have not yet finished. When a response has finished; implementers should call the finish function which will put the response into an inactive state and emit the finished signal. If the idle argument of finish is true then isIdle() will be true on return indicating that the response may return to an active state in order to refresh its results in the future. The resume function will return the response to an active state and emit the resumed signal.

If a response cannot finish successfully then implementers should call the error() function and supply an error code and description. This will finish the request and set values for error() and errorString().

If a request is cancelled it will call cancel() on its response. The base implementation wsets isActive() and isIdle() to false and emits the canceled signal, so implementers will need to override the default implementation to actually cancel any ongoing task or suspend updates before calling the base implementation. If the response can't be canceled synchronously then calling the base implementation should be deferred until the cancelation has completed. Canceling a response should not discard any intermediate results already made available by the response.

Unless a response finishes synchronously and calls finish() or error() from its constructor it must implement the waitForFinished() function to allow clients to block while waiting for the response to finish.

Member Function Documentation

QGalleryAbstractResponse::QGalleryAbstractResponse ( int error, const QString & errorString = QString(), QObject * parent = 0 )

Constructs a new gallery response, for a request that has finished with an error. The optional errorString will describe the error in greater detail.

The parent is passed to QObject.

QGalleryAbstractResponse::QGalleryAbstractResponse ( QObject * parent = 0 ) [protected]

Constructs a new gallery response.

The parent is passed to QObject.

QGalleryAbstractResponse::~QGalleryAbstractResponse ()

Destroys a gallery response.

void QGalleryAbstractResponse::cancel () [virtual]

Cancels an active or idle gallery response.

The default implementation finishes the an active response with the QGalleryAbstractRequest::Canceled result. If the reponse is idle the finished() signal will be re-emitted with idle

This function was introduced in Qt Mobility 1.1.

void QGalleryAbstractResponse::canceled () [signal]

Signals that a response was canceled.

This function was introduced in Qt Mobility 1.1.

int QGalleryAbstractResponse::error () const

Returns an identifier describing an error condition encountered by a response.

In the case of no error this will return QGalleryAbstractRequest::NoError.

This function was introduced in Qt Mobility 1.1.

See also QGalleryAbstractRequest::Error and QDocumentGallery::Error.

void QGalleryAbstractResponse::error ( int error, const QString & errorString = QString() ) [protected]

Finalizes a response in response to an error condition.

The error, and errorString are communicated to issuing request.

This function was introduced in Qt Mobility 1.1.

QString QGalleryAbstractResponse::errorString () const

Returns a string describing the cause of an error() in more detail.

This function was introduced in Qt Mobility 1.1.

void QGalleryAbstractResponse::finish ( bool idle = false ) [protected]

Finalizes a gallery response.

If idle is true the items returned by a response will be monitored for changes and updated as appropriate.

This function was introduced in Qt Mobility 1.1.

void QGalleryAbstractResponse::finished () [signal]

Signals that a response has finished.

This function was introduced in Qt Mobility 1.1.

bool QGalleryAbstractResponse::isActive () const

Identifies if a response is in an active state.

Returns true if a response is active, and false otherwise.

This function was introduced in Qt Mobility 1.1.

bool QGalleryAbstractResponse::isIdle () const

Identifies if the items returned by a response are being monitored for changes.

Returns true if a response is in an idle state, and false otherwise.

This function was introduced in Qt Mobility 1.1.

void QGalleryAbstractResponse::progressChanged ( int current, int maximum ) [signal]

Signals that the current or maximum progress of a request has changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryAbstractResponse::resume () [protected]

Returns a response to an active state.

An idle response can call this to indicate it has begun refreshing its contents.

This function was introduced in Qt Mobility 1.1.

void QGalleryAbstractResponse::resumed () [signal]

Signals that an idle response has resumed communications.

This function was introduced in Qt Mobility 1.1.

bool QGalleryAbstractResponse::waitForFinished ( int msecs ) [virtual]

Waits for msecs for the a response to finish.

Returns true if the response has finished on return, and returns false if the wait time expires or the request is inactive or idle.

This function was introduced in Qt Mobility 1.1.