[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    [PATCH] Plasma::Service fixes
From:       Alex Merry <huntedhacker () tiscali ! co ! uk>
Date:       2008-07-14 0:20:03
Message-ID: 200807140120.03987.huntedhacker () tiscali ! co ! uk
[Download RAW message or body]

I've been trying to implement service support in the nowplaying engine.  I 
still haven't succeeded (having trouble with moc), but this patch addresses 
various problems with Plasma::Service, including the classes not being 
exported and registerOperationScheme() never being called.

I also gave services created from a plugin the same name as the plugin by 
default.

Alex


-- 
KDE: http://www.kde.org
Ubuntu/Kubuntu: http://www.ubuntu.org http://www.kubuntu.org


["plasma-service.diff" (text/x-patch)]

Index: service.cpp
===================================================================
--- service.cpp	(revision 831395)
+++ service.cpp	(working copy)
@@ -38,13 +38,17 @@ Service::Service(QObject *parent)
     : QObject(parent),
       d(new ServicePrivate(this))
 {
+    registerOperationsScheme();
 }
 
 Service::Service(QObject *parent, const QVariantList &args)
     : QObject(parent),
       d(new ServicePrivate(this))
 {
-    Q_UNUSED(args);
+    if (!args.isEmpty()) {
+        setName(args[0].toString());
+    }
+    registerOperationsScheme();
 }
 
 Service::~Service()
@@ -70,6 +74,7 @@ Service* Service::load(const QString &na
     KService::Ptr offer = offers.first();
     QString error;
     QVariantList args;
+    args << name;
     Service* service = offer->createInstance<Plasma::Service>(parent, args, &error);
 
     if (!service) {
Index: service.h
===================================================================
--- service.h	(revision 832033)
+++ service.h	(working copy)
@@ -26,6 +26,8 @@
 
 #include <KDE/KConfigGroup>
 
+#include <plasma/plasma_export.h>
+
 class QIODevice;
 
 namespace Plasma
@@ -66,7 +68,7 @@ class ServicePrivate;
  * connect(job, SIGNAL(finished(KJob*)), this, SLOT(jobCompeted()));
  * @endcode
  */
-class Service : public QObject
+class PLASMA_EXPORT Service : public QObject
 {
     Q_OBJECT
 public:
@@ -183,6 +185,9 @@ private:
 
 } // namespace Plasma
 
+/**
+ * Register a service when it is contained in a loadable module
+ */
 #define K_EXPORT_PLASMA_SERVICE(libname, classname) \
 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
 K_EXPORT_PLUGIN(factory("plasma_service_" #libname))
Index: servicejob.h
===================================================================
--- servicejob.h	(revision 831395)
+++ servicejob.h	(working copy)
@@ -25,6 +25,8 @@
 #include <KDE/KJob>
 #include <KDE/KService>
 
+#include <plasma/plasma_export.h>
+
 namespace Plasma
 {
 
@@ -33,7 +35,7 @@ class ServiceJobPrivate;
 /**
  * @brief This class provides jobs for use with Plasma::Service
  */
-class ServiceJob : public KJob
+class PLASMA_EXPORT ServiceJob : public KJob
 {
     Q_OBJECT
 


_______________________________________________
Panel-devel mailing list
Panel-devel@kde.org
https://mail.kde.org/mailman/listinfo/panel-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic