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

libplasma

Plasma::Service

Plasma::Service Class Reference

#include <service.h>

Inheritance diagram for Plasma::Service:

Inheritance graph
[legend]

List of all members.


Detailed Description

This class provides a generic API for write access to settings or services.

Plasma::Service allows interaction with a "destination", the definition of which depends on the Service itself. For a network settings Service this might be a profile name ("Home", "Office", "Road Warrior") while a web based Service this might be a username ("aseigo", "stranger65").

A Service provides one or more operations, each of which provides some sort of interaction with the destination. Operations are described using config XML which is used to create a KConfig object with one group per operation. The group names are used as the operation names, and the defined items in the group are the parameters available to be set when using that operation.

A service is started with a KConfigGroup (representing a ready to be serviced operation) and automatically deletes itself after completion and signaling success or failure. See KJob for more information on this part of the process.

Services may either be loaded "stand alone" from plugins, or from a DataEngine by passing in a source name to be used as the destination.

Sample use might look like:

Plasma::DataEngine *twitter = dataEngine("twitter"); Plasma::Service *service = twitter.serviceForSource("aseigo"); KConfigGroup op = service->operationParameters("update"); op.writeEntry("tweet", "Hacking on plasma!"); Plasma::ServiceJob *job = service->startOperation(op); connect(job, SIGNAL(finished(KJob*)), this, SLOT(jobCompeted()));

Definition at line 67 of file service.h.


Signals

void finished (ServiceJob *job)

Public Member Functions

QString destination () const
QString name () const
KConfigGroup operationDescription (const QString &operationName)
QStringList operationNames () const
void setDestination (const QString &destination)
ServiceJob * startOperationCall (const KConfigGroup &description)
 ~Service ()

Static Public Member Functions

static Service * load (const QString &name, QObject *parent=0)

Protected Member Functions

virtual ServiceJob * createJob (const QString &operation, QMap< QString, QVariant > &parameters)=0
virtual void registerOperationsScheme ()
 Service (QObject *parent, const QVariantList &args)
 Service (QObject *parent=0)
void setName (const QString &name)
void setOperationsScheme (QIODevice *xml)

Constructor & Destructor Documentation

Plasma::Service::~Service (  ) 

Destructor.

Definition at line 62 of file service.cpp.

Plasma::Service::Service ( QObject *  parent = 0  )  [explicit, protected]

Default constructor.

  • parent the parent object for this service

Definition at line 39 of file service.cpp.

Plasma::Service::Service ( QObject *  parent,
const QVariantList &  args 
) [protected]

Constructor for plugin loading.

Definition at line 46 of file service.cpp.


Member Function Documentation

virtual ServiceJob* Plasma::Service::createJob ( const QString &  operation,
QMap< QString, QVariant > &  parameters 
) [protected, pure virtual]

Called when a job should be created by the Service.

Parameters:
operation which operation to work on
parameters the parameters set by the user for the operation
Returns:
a ServiceJob that can be started and monitored by the consumer

QString Plasma::Service::destination (  )  const

Returns:
the target destination, if any, that this service is associated with

Definition at line 105 of file service.cpp.

void Plasma::Service::finished ( ServiceJob *  job  )  [signal]

Service * Plasma::Service::load ( const QString &  name,
QObject *  parent = 0 
) [static]

Used to load a given service from a plugin.

Parameters:
name the plugin name of the service to load
parent the parent object, if any, for the service
Returns:
a Service object, guaranteed to be not null.

Definition at line 67 of file service.cpp.

QString Plasma::Service::name (  )  const

The name of this service.

Definition at line 152 of file service.cpp.

KConfigGroup Plasma::Service::operationDescription ( const QString &  operationName  ) 

Retrieves the parameters for a given operation.

Parameters:
operation the operation to retrieve parameters for
Returns:
KConfigGroup containing the parameters

Definition at line 119 of file service.cpp.

QStringList Plasma::Service::operationNames (  )  const

Returns:
the possible operations for this profile

Definition at line 110 of file service.cpp.

void Plasma::Service::registerOperationsScheme (  )  [protected, virtual]

By default this is based on the file in plasma/services/name.operations, but can be reimplented to use a different mechanism.

It should result in a call to setOperationsScheme(QIODevice *);

Definition at line 182 of file service.cpp.

void Plasma::Service::setDestination ( const QString &  destination  ) 

Sets the destination for this Service to operate on.

  • destination specific to each Service, this sets which target or address for ServiceJobs to operate on

Definition at line 100 of file service.cpp.

void Plasma::Service::setName ( const QString &  name  )  [protected]

Sets the name of the Service; useful for Services not loaded from plugins, which use the plugin name for this.

  • name the name to use for this service

Definition at line 157 of file service.cpp.

void Plasma::Service::setOperationsScheme ( QIODevice *  xml  )  [protected]

Sets the XML used to define the operation schema for this Service.

Definition at line 171 of file service.cpp.

ServiceJob * Plasma::Service::startOperationCall ( const KConfigGroup &  description  ) 

Called to create a ServiceJob which is associated with a given operation and parameter set.

Returns:
a started ServiceJob; the consumer may connect to relevant signals before returning to the event loop

Definition at line 129 of file service.cpp.


The documentation for this class was generated from the following files:
  • service.h
  • service.cpp

libplasma

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

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
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