Plasma
#include <Plasma/ServiceJob>
Public Member Functions | |
ServiceJob (const QString &destination, const QString &operation, const QMap< QString, QVariant > ¶meters, QObject *parent=0) | |
~ServiceJob () | |
QString | destination () const |
Credentials | identity () const |
QString | operationName () const |
QMap< QString, QVariant > | parameters () const |
QVariant | result () const |
virtual Q_INVOKABLE void | start () |
Protected Member Functions | |
void | setResult (const QVariant &result) |
Properties | |
QString | destination |
QString | operationName |
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 54 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.
- Parameters
-
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 | ( | ) |
Destructor.
Definition at line 59 of file servicejob.cpp.
Member Function Documentation
QString Plasma::ServiceJob::destination | ( | ) | const |
- Returns
- the subject that the job is acting on
Credentials Plasma::ServiceJob::identity | ( | ) | const |
- Returns
- the identity of the caller of this operation
Definition at line 79 of file servicejob.cpp.
QString Plasma::ServiceJob::operationName | ( | ) | const |
- Returns
- the operation the job is performing on the destination
QMap< QString, QVariant > Plasma::ServiceJob::parameters | ( | ) | const |
- Returns
- the parameters for the operation
Definition at line 74 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
|
protected |
Sets the result for an operation.
Definition at line 89 of file servicejob.cpp.
|
virtual |
Default implementation of start, which simply sets the results to false.
This makes it easy to create a "failure" job.
Definition at line 95 of file servicejob.cpp.
Property Documentation
|
read |
Definition at line 57 of file servicejob.h.
|
read |
Definition at line 58 of file servicejob.h.
|
read |
Definition at line 59 of file servicejob.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:35 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.