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

Plasma

  • 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
33class QGraphicsObject;
34class QIODevice;
35class QWidget;
36
37namespace Plasma
38{
39
40class ServiceJob;
41class ServicePrivate;
42
91class 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
99public:
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
246Q_SIGNALS:
250 void finished(Plasma::ServiceJob *job);
251
257 void operationsChanged();
258
262 void serviceReady(Plasma::Service *service);
263
264protected:
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
317private:
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
335Q_DECLARE_METATYPE(Plasma::Service *)
336
337
340#define K_EXPORT_PLASMA_SERVICE(libname, classname) \
341K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
342K_EXPORT_PLUGIN(factory("plasma_service_" #libname)) \
343K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
344
345#endif // multiple inclusion guard
346
KJob
Plasma::Applet
The base Applet class.
Definition: applet.h:78
Plasma::PluginLoader
This is an abstract base class which defines an interface to which Plasma's Applet Loading logic can ...
Definition: pluginloader.h:52
Plasma::ServiceJob
This class provides jobs for use with Plasma::Service.
Definition: servicejob.h:55
Plasma::Service
This class provides a generic API for write access to settings or services.
Definition: service.h:92
Plasma::Service::operationsChanged
void operationsChanged()
Emitted when the Service's operations change.
Plasma::Service::serviceReady
void serviceReady(Plasma::Service *service)
Emitted when this service is ready for use.
Plasma::Service::createJob
virtual ServiceJob * createJob(const QString &operation, QMap< QString, QVariant > &parameters)=0
Called when a job should be created by the Service.
Plasma::Service::finished
void finished(Plasma::ServiceJob *job)
Emitted when a job associated with this Service completes its task.
QGraphicsWidget
QObject
QWidget
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
packagemetadata.h
plasma.h
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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