• Skip to content
  • Skip to link menu
KDE 4.3 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 
00031 class QGraphicsWidget;
00032 class QIODevice;
00033 class QWidget;
00034 
00035 namespace Plasma
00036 {
00037 
00038 class ServiceJob;
00039 class ServicePrivate;
00040 
00075 class PLASMA_EXPORT Service : public QObject
00076 {
00077     Q_OBJECT
00078 public:
00082     ~Service();
00083 
00092     static Service *load(const QString &name, QObject *parent = 0);
00093 
00100     Q_INVOKABLE void setDestination(const QString &destination);
00101 
00105     Q_INVOKABLE QString destination() const;
00106 
00110     Q_INVOKABLE QStringList operationNames() const;
00111 
00118     Q_INVOKABLE KConfigGroup operationDescription(const QString &operationName);
00119 
00127     Q_INVOKABLE ServiceJob *startOperationCall(const KConfigGroup &description, QObject *parent = 0);
00128 
00135     Q_INVOKABLE bool isOperationEnabled(const QString &operation) const;
00136 
00140     Q_INVOKABLE QString name() const;
00141 
00152     Q_INVOKABLE void associateWidget(QWidget *widget, const QString &operation);
00153 
00162     Q_INVOKABLE void disassociateWidget(QWidget *widget);
00163 
00174     Q_INVOKABLE void associateWidget(QGraphicsWidget *widget, const QString &operation);
00175 
00184     Q_INVOKABLE void disassociateWidget(QGraphicsWidget *widget);
00185 
00186 Q_SIGNALS:
00190     void finished(Plasma::ServiceJob *job);
00191 
00197     void operationsChanged();
00198 
00199 protected:
00205     explicit Service(QObject *parent = 0);
00206 
00210     Service(QObject *parent, const QVariantList &args);
00211 
00219     virtual ServiceJob *createJob(const QString &operation,
00220                                   QMap<QString, QVariant> &parameters) = 0;
00221 
00228     virtual void registerOperationsScheme();
00229 
00234     void setOperationsScheme(QIODevice *xml);
00235 
00242     void setName(const QString &name);
00243 
00250     void setOperationEnabled(const QString &operation, bool enable);
00251 
00252 private:
00253     Q_PRIVATE_SLOT(d, void jobFinished(KJob *))
00254     Q_PRIVATE_SLOT(d, void associatedWidgetDestroyed(QObject *))
00255     Q_PRIVATE_SLOT(d, void associatedGraphicsWidgetDestroyed(QObject *))
00256 
00257     ServicePrivate * const d;
00258 
00259     friend class ServicePrivate;
00260 };
00261 
00262 } // namespace Plasma
00263 
00267 #define K_EXPORT_PLASMA_SERVICE(libname, classname) \
00268 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00269 K_EXPORT_PLUGIN(factory("plasma_service_" #libname)) \
00270 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
00271 
00272 #endif // multiple inclusion guard
00273 

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