Plasma
Plasma::ServiceJob Class Reference
This class provides jobs for use with Plasma::Service. More...
#include <Plasma/ServiceJob>

Public Member Functions | |
QString | destination () const |
QString | operationName () const |
QMap< QString, QVariant > | parameters () const |
QVariant | result () const |
ServiceJob (const QString &destination, const QString &operation, const QMap< QString, QVariant > ¶meters, QObject *parent=0) | |
virtual void | start () |
~ServiceJob () | |
Protected Member Functions | |
void | setResult (const QVariant &result) |
Detailed Description
This class provides jobs for use with Plasma::Service.Unlike KJob, you can do the work in start(), since Plasma::Service already delays the call to start() until the event loop is reached.
If the job is quick enough that it is not worth reporting the progress, you just need to implement start() to do the task, then call emitResult() at the end of it. If the task does not complete successfully, you should set a non-zero error code with setError(int) and an error message with setErrorText(QString).
If the job is longer (involving network access, for instance), you should report the progress at regular intervals. See the KJob documentation for information on how to do this.
Definition at line 53 of file servicejob.h.
Constructor & Destructor Documentation
Plasma::ServiceJob::ServiceJob | ( | const QString & | destination, | |
const QString & | operation, | |||
const QMap< QString, QVariant > & | parameters, | |||
QObject * | parent = 0 | |||
) |
Default constructor.
- destination the subject that the job is acting on
- operation the action that the job is performing on the
destination
- parameters the parameters of the
action
- parent the parent object for this service
Definition at line 51 of file servicejob.cpp.
Plasma::ServiceJob::~ServiceJob | ( | ) |
Member Function Documentation
QString Plasma::ServiceJob::destination | ( | ) | const |
QString Plasma::ServiceJob::operationName | ( | ) | const |
- Returns:
- the operation the job is performing on the destination
Definition at line 68 of file servicejob.cpp.
QVariant Plasma::ServiceJob::result | ( | ) | const |
Returns the result of the operation.
The result will be invalid if the job has not completed yet, or if the job does not have a meaningful result.
Note that this should not be used to find out whether the operation was successful. Instead, you should check the value of error().
- Returns:
- the result of the operation
Definition at line 78 of file servicejob.cpp.
void Plasma::ServiceJob::setResult | ( | const QVariant & | result | ) | [protected] |
void Plasma::ServiceJob::start | ( | ) | [virtual] |
Default implementation of start, which simply sets the results to false.
This makes it easy to create a "failure" job.
Definition at line 89 of file servicejob.cpp.
The documentation for this class was generated from the following files: