• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Plasma

Plasma::ServiceJob

Plasma::ServiceJob Class Reference

This class provides jobs for use with Plasma::Service. More...

#include <Plasma/ServiceJob>

Inheritance diagram for Plasma::ServiceJob:
KJob

List of all members.

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 > &parameters, 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 (  ) 

Destructor.

Definition at line 58 of file servicejob.cpp.


Member Function Documentation

QString Plasma::ServiceJob::destination (  )  const
Returns:
the subject that the job is acting on

Definition at line 63 of file servicejob.cpp.

QString Plasma::ServiceJob::operationName (  )  const
Returns:
the operation the job is performing on the destination

Definition at line 68 of file servicejob.cpp.

QMap< QString, QVariant > Plasma::ServiceJob::parameters (  )  const
Returns:
the parameters for the operation

Definition at line 73 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]

Sets the result for an operation.

Definition at line 83 of file servicejob.cpp.

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:
  • servicejob.h
  • servicejob.cpp

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal