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

Plasma

service.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2008 Aaron Seigo <aseigo@kde.org>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU Library General Public License as
00006  *   published by the Free Software Foundation; either version 2, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 
00020 #ifndef PLASMA_SERVICE_H
00021 #define PLASMA_SERVICE_H
00022 
00023 #include <QtCore/QMap>
00024 #include <QtCore/QObject>
00025 #include <QtCore/QVariant>
00026 
00027 #include <kconfiggroup.h>
00028 
00029 #include <plasma/plasma_export.h>
00030 #include <plasma/plasma.h>
00031 #include "packagemetadata.h"
00032 
00033 class QGraphicsWidget;
00034 class QIODevice;
00035 class QWidget;
00036 
00037 namespace Plasma
00038 {
00039 
00040 class ServiceJob;
00041 class ServicePrivate;
00042 
00077 class PLASMA_EXPORT Service : public QObject
00078 {
00079     Q_OBJECT
00080     Q_DECLARE_PRIVATE(Service)
00081 public:
00085     ~Service();
00086 
00095     static Service *load(const QString &name, QObject *parent = 0);
00096 
00101     static Service *access(const KUrl &url, QObject *parent = 0);
00102 
00109     Q_INVOKABLE void setDestination(const QString &destination);
00110 
00114     Q_INVOKABLE QString destination() const;
00115 
00119     Q_INVOKABLE QStringList operationNames() const;
00120 
00127     Q_INVOKABLE KConfigGroup operationDescription(const QString &operationName);
00128 
00136     Q_INVOKABLE ServiceJob *startOperationCall(const KConfigGroup &description, QObject *parent = 0);
00137 
00144     Q_INVOKABLE bool isOperationEnabled(const QString &operation) const;
00145 
00149     Q_INVOKABLE QString name() const;
00150 
00161     Q_INVOKABLE void associateWidget(QWidget *widget, const QString &operation);
00162 
00171     Q_INVOKABLE void disassociateWidget(QWidget *widget);
00172 
00183     Q_INVOKABLE void associateWidget(QGraphicsWidget *widget, const QString &operation);
00184 
00193     Q_INVOKABLE void disassociateWidget(QGraphicsWidget *widget);
00194 
00200     Q_INVOKABLE QMap<QString, QVariant> parametersFromDescription(const KConfigGroup &description);
00201 
00202 Q_SIGNALS:
00206     void finished(Plasma::ServiceJob *job);
00207 
00213     void operationsChanged();
00214 
00218     void serviceReady(Plasma::Service *service);
00219 
00220 protected:
00226     explicit Service(QObject *parent = 0);
00227 
00231     Service(QObject *parent, const QVariantList &args);
00232 
00240     virtual ServiceJob *createJob(const QString &operation,
00241                                   QMap<QString, QVariant> &parameters) = 0;
00242 
00249     virtual void registerOperationsScheme();
00250 
00255     void setOperationsScheme(QIODevice *xml);
00256 
00263     void setName(const QString &name);
00264 
00271     void setOperationEnabled(const QString &operation, bool enable);
00272 
00273 private:
00274     Q_PRIVATE_SLOT(d, void jobFinished(KJob *))
00275     Q_PRIVATE_SLOT(d, void associatedWidgetDestroyed(QObject *))
00276     Q_PRIVATE_SLOT(d, void associatedGraphicsWidgetDestroyed(QObject *))
00277 
00278     ServicePrivate * const d;
00279 
00280     friend class Applet;
00281     friend class DataEnginePrivate;
00282     friend class GetSource;
00283     friend class PackagePrivate;
00284     friend class ServiceProvider;
00285     friend class RemoveService;
00286 };
00287 
00288 } // namespace Plasma
00289 
00293 #define K_EXPORT_PLASMA_SERVICE(libname, classname) \
00294 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00295 K_EXPORT_PLUGIN(factory("plasma_service_" #libname)) \
00296 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
00297 
00298 #endif // multiple inclusion guard
00299 

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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  •     Sodep
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.9-20090814
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