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

Plasma

  • sources
  • kde-4.12
  • kdelibs
  • plasma
service.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Aaron Seigo <aseigo@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef PLASMA_SERVICE_H
21 #define PLASMA_SERVICE_H
22 
23 #include <QtCore/QMap>
24 #include <QtCore/QObject>
25 #include <QtCore/QVariant>
26 
27 #include <kconfiggroup.h>
28 
29 #include <plasma/plasma_export.h>
30 #include <plasma/plasma.h>
31 #include "packagemetadata.h"
32 
33 class QGraphicsObject;
34 class QIODevice;
35 class QWidget;
36 
37 namespace Plasma
38 {
39 
40 class ServiceJob;
41 class ServicePrivate;
42 
91 class PLASMA_EXPORT Service : public QObject
92 {
93  Q_OBJECT
94  Q_DECLARE_PRIVATE(Service)
95  Q_PROPERTY(QString destination READ destination WRITE setDestination)
96  Q_PROPERTY(QStringList operationNames READ operationNames)
97  Q_PROPERTY(QString name READ name)
98 
99 public:
103  ~Service();
104 
115  static Service *load(const QString &name, const QVariantList &args, QObject *parent = 0);
116 
125  static Service *load(const QString &name, QObject *parent = 0);
126 
131  static Service *access(const KUrl &url, QObject *parent = 0);
132 
139  Q_INVOKABLE void setDestination(const QString &destination);
140 
144  Q_INVOKABLE QString destination() const;
145 
149  Q_INVOKABLE QStringList operationNames() const;
150 
157  Q_INVOKABLE KConfigGroup operationDescription(const QString &operationName);
158 
166  Q_INVOKABLE ServiceJob *startOperationCall(const KConfigGroup &description, QObject *parent = 0);
167 
174  Q_INVOKABLE bool isOperationEnabled(const QString &operation) const;
175 
179  Q_INVOKABLE QString name() const;
180 
191  Q_INVOKABLE void associateWidget(QWidget *widget, const QString &operation);
192 
201  Q_INVOKABLE void disassociateWidget(QWidget *widget);
202 
208  Q_INVOKABLE void associateWidget(QGraphicsWidget *widget, const QString &operation);
209 
215  Q_INVOKABLE void disassociateWidget(QGraphicsWidget *widget);
216 
227  Q_INVOKABLE void associateItem(QGraphicsObject *item, const QString &operation);
228 
237  Q_INVOKABLE void disassociateItem(QGraphicsObject *widget);
238 
244  Q_INVOKABLE QMap<QString, QVariant> parametersFromDescription(const KConfigGroup &description);
245 
246 Q_SIGNALS:
250  void finished(Plasma::ServiceJob *job);
251 
257  void operationsChanged();
258 
262  void serviceReady(Plasma::Service *service);
263 
264 protected:
270  explicit Service(QObject *parent = 0);
271 
275  Service(QObject *parent, const QVariantList &args);
276 
284  virtual ServiceJob *createJob(const QString &operation,
285  QMap<QString, QVariant> &parameters) = 0;
286 
293  virtual void registerOperationsScheme();
294 
299  void setOperationsScheme(QIODevice *xml);
300 
307  void setName(const QString &name);
308 
315  void setOperationEnabled(const QString &operation, bool enable);
316 
317 private:
318  Q_PRIVATE_SLOT(d, void jobFinished(KJob *))
319  Q_PRIVATE_SLOT(d, void associatedWidgetDestroyed(QObject *))
320  Q_PRIVATE_SLOT(d, void associatedGraphicsWidgetDestroyed(QObject *))
321 
322  ServicePrivate * const d;
323 
324  friend class Applet;
325  friend class DataEnginePrivate;
326  friend class GetSource;
327  friend class PackagePrivate;
328  friend class ServiceProvider;
329  friend class RemoveService;
330  friend class PluginLoader;
331 };
332 
333 } // namespace Plasma
334 
335 Q_DECLARE_METATYPE(Plasma::Service *)
336 
340 #define K_EXPORT_PLASMA_SERVICE(libname, classname) \
341 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
342 K_EXPORT_PLUGIN(factory("plasma_service_" #libname)) \
343 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
344 
345 #endif // multiple inclusion guard
346 
packagemetadata.h
Plasma::ServiceJob
This class provides jobs for use with Plasma::Service.
Definition: servicejob.h:54
QWidget
QObject
Plasma::Service
This class provides a generic API for write access to settings or services.
Definition: service.h:91
Plasma::Applet
The base Applet class.
Definition: applet.h:77
Plasma::PluginLoader
This is an abstract base class which defines an interface to which Plasma's Applet Loading logic can ...
Definition: pluginloader.h:51
plasma.h
KJob
plasma_export.h
QGraphicsWidget
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:34 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal