Development/Tutorials/Plasma4/JavaScript/API-DataEnginesServices

From KDE TechBase

DataEngines and Services provide access to various types of data and the ability to interact with them via asynchronous services with a convenient and consistent API. See the JavaScript Plasmoid DataEngine tutorials for examples on how to use DataEngines and Services in your Plasmoids.

Global Functions to Access DataEngines and Services

  • dataEngine(string name): returns a DataEngine object
  • service(string dataEngineName, string sourceName): returns a ServiceObject, see also DataEngine::serviceForSource

DataEngine

Read-only properties:

  • Array[String] sources
  • boolean valid
  • String icon
  • String name

Signals:

  • sourceAdded(String sourceName)
  • sourceRemoved(String sourceName)

Functions:

  • serviceForSource(String sourceName)
  • connectSource(String sourceName, Object connectTo[, number interval[, IntervalAlignment alignment] ]): if the object passed in as the object to connect to is the plasmoid object, then the plasmoid.dataUpdated(String source, Map[String, Any] data) callback will be called if it exists
  • connectAllSources(Object connectTo[, number interval[, IntervalAlignment alignment] ]): if the object passed in as the object to connect to is the plasmoid object, then the plasmoid.dataUpdated(String source, Map[String, Any] data) callback will be called if it exists
  • disconnectSource(String sourceName, Object connectedTo): if the object passed in as the object to connect to is the plasmoid object, then the plasmoid.dataUpdated(String source, Map[String, Any] data) callback will be called if it exists
  • Data query(String sourceName)

The following functions are only of interest to DataEngine reimplementations (e.g. JavaScript DataEngines):

  • scheduleSourcesUpdated()
  • removeSource(String)
  • updateAllSources()
  • forceImmediateUpdateOfAllVisualizations()
  • DataContainer containerForSource(String)

Service

  • function finished(Plasma::ServiceJob*)
  • function operationsChanged()
  • function serviceReady(Plasma::Service*)
  • function setDestination(QString)
  • function destination()
  • function operationNames()
  • function operationDescription(QString)
  • function startOperationCall(KConfigGroup,QObject*)
  • function startOperationCall(KConfigGroup)
  • function isOperationEnabled(QString)
  • function name()
  • function associateWidget(QWidget*,QString)
  • function disassociateWidget(QWidget*)
  • function associateWidget(QGraphicsWidget*,QString)
  • function disassociateWidget(QGraphicsWidget*)
  • function parametersFromDescription(KConfigGroup)