Telepathy::Client::PendingOperation Class Reference

#include <TelepathyQt4/Client/pending-operation.h>

Inheritance diagram for Telepathy::Client::PendingOperation:

Inheritance graph
[legend]
Collaboration diagram for Telepathy::Client::PendingOperation:

Collaboration graph
[legend]

List of all members.

Signals

void finished (Telepathy::Client::PendingOperation *operation)

Public Member Functions

virtual ~PendingOperation ()
bool isFinished () const
bool isValid () const
bool isError () const
QString errorName () const
QString errorMessage () const

Protected Member Functions

 PendingOperation (QObject *parent)
void setFinished ()
void setFinishedWithError (const QString &name, const QString &message)
void setFinishedWithError (const QDBusError &error)


Detailed Description

Abstract base class for pending asynchronous operations.

This class represents an incomplete asynchronous operation, such as a D-Bus method call. When the operation has finished, it emits finished. The slot or slots connected to the finished() signal may obtain additional information from the PendingOperation.

In simple cases, like a D-Bus method with no 'out' arguments or for which all 'out' arguments are to be ignored (so the possible results are success with no extra information, or failure with an error code), the trivial subclass PendingVoidMethodCall can be used.

For pending operations that produce a result, another subclass of PendingOperation can be used, with additional methods that provide that result to the library user.

After finished() is emitted, the PendingOperation is automatically deleted using deleteLater(), so library users must not explicitly delete this object.

The design is loosely based on KDE's KJob.


Constructor & Destructor Documentation

Telepathy::Client::PendingOperation::~PendingOperation (  )  [virtual]

References Telepathy::warning().

Telepathy::Client::PendingOperation::PendingOperation ( QObject *  parent  )  [protected]

Protected constructor. Only subclasses of this class may be constructed

Parameters:
parent The object on which this pending operation takes place


Member Function Documentation

QString Telepathy::Client::PendingOperation::errorMessage (  )  const

If isError() would return true, returns a debugging message associated with the error, which may be an empty string. Otherwise, return an empty string.

Returns:
a debugging message or an empty string

Referenced by setFinished(), and setFinishedWithError().

QString Telepathy::Client::PendingOperation::errorName (  )  const

If isError() would return true, returns the D-Bus error with which the operation failed. If the operation succeeded or has not yet finished, returns an empty string.

Returns:
a D-Bus error name or an empty string

Referenced by setFinished(), and setFinishedWithError().

void Telepathy::Client::PendingOperation::finished ( Telepathy::Client::PendingOperation operation  )  [signal]

Emitted when the pending operation finishes, i.e. when isFinished() changes from false to true.

Parameters:
operation This operation object, from which further information may be obtained

Referenced by Telepathy::Client::Connection::Connection::PendingConnect::PendingConnect(), and Telepathy::Client::PendingVoidMethodCall::PendingVoidMethodCall().

bool Telepathy::Client::PendingOperation::isError (  )  const

Returns whether or not the request resulted in an error. If the request has not yet finished processing (isFinished() returns false), this cannot yet be known, and false will be returned.

Equivalent to (isFinished() && !isValid()).

Returns:
true iff the request has finished processing AND has resulted in an error.

Referenced by Telepathy::Client::PendingContactAttributes::attributes(), Telepathy::Client::PendingContacts::contacts(), Telepathy::Client::PendingContacts::invalidHandles(), Telepathy::Client::PendingContactAttributes::invalidHandles(), setFinishedWithError(), and Telepathy::Client::PendingContactAttributes::validHandles().

bool Telepathy::Client::PendingOperation::isFinished (  )  const

bool Telepathy::Client::PendingOperation::isValid (  )  const

Returns whether or not the request completed successfully. If the request has not yet finished processing (isFinished() returns false), this cannot yet be known, and false will be returned.

Equivalent to (isFinished() && !isError()).

Returns:
true iff the request has finished processing AND has completed successfully.

Referenced by Telepathy::Client::PendingAccount::account(), Telepathy::Client::PendingChannel::channel(), Telepathy::Client::PendingConnection::connection(), setFinished(), and Telepathy::Client::PendingChannel::yours().

void Telepathy::Client::PendingOperation::setFinished (  )  [protected]

Record that this pending operation has finished successfully, and emit the finished() signal next time the event loop runs.

References errorMessage(), errorName(), isValid(), and Telepathy::warning().

Referenced by Telepathy::Client::TextChannel::becomeReady(), Telepathy::Client::Channel::becomeReady(), and Telepathy::Client::PendingSuccess::PendingSuccess().

void Telepathy::Client::PendingOperation::setFinishedWithError ( const QDBusError &  error  )  [protected]

Record that this pending operation has finished with an error, and emit the finished() signal next time the event loop runs.

Parameters:
error A QtDBus error

References setFinishedWithError().

void Telepathy::Client::PendingOperation::setFinishedWithError ( const QString &  name,
const QString &  message 
) [protected]

Record that this pending operation has finished with an error, and emit the finished() signal next time the event loop runs.

Parameters:
name A D-Bus error name, which must be non-empty
message A debugging message

References errorMessage(), errorName(), isError(), and Telepathy::warning().

Referenced by Telepathy::Client::TextChannel::becomeReady(), Telepathy::Client::ReadinessHelper::becomeReady(), Telepathy::Client::Channel::becomeReady(), Telepathy::Client::PendingFailure::PendingFailure(), and setFinishedWithError().


Generated on Thu Mar 5 18:52:10 2009 for TelepathyQt4-0.1.1 by  doxygen 1.5.8