mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
plasma: sync copies of Plasma::DataEngineConsumer class
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
b4da0cdf60
commit
5c0a65dd61
4 changed files with 0 additions and 121 deletions
|
@ -28,42 +28,7 @@
|
|||
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"
|
||||
|
||||
|
||||
|
|
|
@ -27,28 +27,10 @@
|
|||
#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
|
||||
|
|
|
@ -26,47 +26,11 @@
|
|||
#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)
|
||||
|
|
|
@ -27,28 +27,10 @@
|
|||
#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
|
||||
|
|
Loading…
Add table
Reference in a new issue