OSDN Git Service

plasma: sync copies of Plasma::DataEngineConsumer class
authorIvailo Monev <xakepa10@gmail.com>
Mon, 22 May 2023 00:06:16 +0000 (03:06 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 22 May 2023 00:06:16 +0000 (03:06 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
plasma/dataengines/weather/ions/dataengineconsumer.cpp
plasma/dataengines/weather/ions/dataengineconsumer_p.h
plasma/declarativeimports/core/dataengineconsumer.cpp
plasma/declarativeimports/core/dataengineconsumer_p.h

index d252116..f08f99c 100644 (file)
 namespace Plasma
 {
 
-ServiceMonitor::ServiceMonitor(DataEngineConsumer *consumer)
-    : m_consumer(consumer)
-{
-}
-
-ServiceMonitor::~ServiceMonitor()
-{
-}
-
-void ServiceMonitor::slotJobFinished(Plasma::ServiceJob *job)
-{
-    const QString engineName = job->parameters()["EngineName"].toString();
-    const QString location = job->destination();
-    kDebug() << "engine ready!" << engineName << location;
-}
-
-void ServiceMonitor::slotServiceReady(Plasma::Service *plasmoidService)
-{
-    kDebug() << "service ready!";
-    if (!m_consumer->m_engineNameForService.contains(plasmoidService)) {
-        kDebug() << "no engine name for service!";
-        kDebug() << "amount of services in map: " << m_consumer->m_engineNameForService.count();
-    } else {
-        kDebug() << "value = " << m_consumer->m_engineNameForService.value(plasmoidService);
-    }
-
-    kDebug() << "requesting dataengine!";
-    KConfigGroup op = plasmoidService->operationDescription("DataEngine");
-    op.writeEntry("EngineName", m_consumer->m_engineNameForService.value(plasmoidService));
-    plasmoidService->startOperationCall(op);
-    connect(plasmoidService, SIGNAL(finished(Plasma::ServiceJob*)),
-            this, SLOT(slotJobFinished(Plasma::ServiceJob*)));
-}
-
 DataEngineConsumer::DataEngineConsumer()
-    : m_monitor(new ServiceMonitor(this))
 {
 }
 
@@ -72,8 +37,6 @@ DataEngineConsumer::~DataEngineConsumer()
     foreach (const QString &engine, m_loadedEngines) {
         DataEngineManager::self()->unloadEngine(engine);
     }
-
-    delete m_monitor;
 }
 
 DataEngine *DataEngineConsumer::dataEngine(const QString &name)
@@ -98,5 +61,3 @@ DataEngine *DataEngineConsumer::dataEngine(const QString &name)
 } // namespace Plasma
 
 #include "moc_dataengineconsumer_p.cpp"
-
-
index a4e84d4..3d9bb23 100644 (file)
 #include <kdebug.h>
 
 #include "plasma/dataenginemanager.h"
-#include <plasma/servicejob.h>
 
 namespace Plasma
 {
 
-class DataEngineConsumer;
-
-class ServiceMonitor : public QObject
-{
-    Q_OBJECT
-public:
-    ServiceMonitor(DataEngineConsumer *consumer);
-    ~ServiceMonitor();
-
-public Q_SLOTS:
-    void slotJobFinished(Plasma::ServiceJob *job);
-    void slotServiceReady(Plasma::Service *service);
-
-private:
-    DataEngineConsumer *m_consumer;
-};
-
 class DataEngineConsumer
 {
 public:
@@ -58,10 +40,6 @@ public:
 
 private:
     QSet<QString> m_loadedEngines;
-    QMap<Service*, QString> m_engineNameForService;
-    ServiceMonitor *m_monitor;
-
-    friend class ServiceMonitor;
 };
 
 } // namespace Plasma
index e01e5d4..a94d470 100644 (file)
 #include <kdebug.h>
 
 #include <plasma/dataenginemanager.h>
-#include <plasma/servicejob.h>
 
 namespace Plasma
 {
 
-ServiceMonitor::ServiceMonitor(DataEngineConsumer *consumer)
-    : m_consumer(consumer)
-{
-}
-
-ServiceMonitor::~ServiceMonitor()
-{
-}
-
-void ServiceMonitor::slotJobFinished(Plasma::ServiceJob *job)
-{
-    const QString engineName = job->parameters()["EngineName"].toString();
-    const QString location = job->destination();
-    kDebug() << "engine ready!" << engineName << location;
-}
-
-void ServiceMonitor::slotServiceReady(Plasma::Service *plasmoidService)
-{
-    kDebug() << "service ready!";
-    if (!m_consumer->m_engineNameForService.contains(plasmoidService)) {
-        kDebug() << "no engine name for service!";
-        kDebug() << "amount of services in map: " << m_consumer->m_engineNameForService.count();
-    } else {
-        //kDebug() << "value = " << m_consumer->m_engineNameForService.value(plasmoidService);
-    }
-
-    //kDebug() << "requesting dataengine!";
-    KConfigGroup op = plasmoidService->operationDescription("DataEngine");
-    op.writeEntry("EngineName", m_consumer->m_engineNameForService.value(plasmoidService));
-    plasmoidService->startOperationCall(op);
-    connect(plasmoidService, SIGNAL(finished(Plasma::ServiceJob*)),
-            this, SLOT(slotJobFinished(Plasma::ServiceJob*)));
-}
-
 DataEngineConsumer::DataEngineConsumer()
-    : m_monitor(new ServiceMonitor(this))
 {
 }
 
@@ -75,8 +39,6 @@ DataEngineConsumer::~DataEngineConsumer()
     foreach (const QString &engine, m_loadedEngines) {
         DataEngineManager::self()->unloadEngine(engine);
     }
-
-    delete m_monitor;
 }
 
 void DataEngineConsumer::finishedWithEngine(const QString &name)
index 5668b59..3bb3fc5 100644 (file)
 #include <kdebug.h>
 
 #include "plasma/dataenginemanager.h"
-#include <plasma/servicejob.h>
 
 namespace Plasma
 {
 
-class DataEngineConsumer;
-
-class ServiceMonitor : public QObject
-{
-    Q_OBJECT
-public:
-    ServiceMonitor(DataEngineConsumer *consumer);
-    ~ServiceMonitor();
-
-public Q_SLOTS:
-    void slotJobFinished(Plasma::ServiceJob *job);
-    void slotServiceReady(Plasma::Service *service);
-
-private:
-    DataEngineConsumer *m_consumer;
-};
-
 class DataEngineConsumer
 {
 public:
@@ -59,10 +41,6 @@ public:
 
 private:
     QSet<QString> m_loadedEngines;
-    QMap<Service*, QString> m_engineNameForService;
-    ServiceMonitor *m_monitor;
-
-    friend class ServiceMonitor;
 };
 
 } // namespace Plasma