Fix the mutliple inheritence from QObject issue... people having this
problem: rejoice! svn path=/trunk/KDE/kdelibs/; revision=1019153
This commit is contained in:
parent
5b160ac802
commit
a2206eddda
@ -32,6 +32,56 @@
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
ServiceMonitor::ServiceMonitor(DataEngineConsumer *consumer)
|
||||
: m_consumer(consumer)
|
||||
{
|
||||
}
|
||||
|
||||
ServiceMonitor::~ServiceMonitor()
|
||||
{
|
||||
}
|
||||
|
||||
void ServiceMonitor::slotJobFinished(Plasma::ServiceJob *job)
|
||||
{
|
||||
kDebug() << "engine ready!";
|
||||
QString engineName = job->parameters()["EngineName"].toString();
|
||||
QString location = job->destination();
|
||||
QPair<QString, QString> pair(location, engineName);
|
||||
kDebug() << "pair = " << pair;
|
||||
if (!m_consumer->m_remoteEngines.contains(pair)) {
|
||||
kDebug() << "engine doesnt exist yet!";
|
||||
} else {
|
||||
KUrl engineLocation(location);
|
||||
engineLocation.setFileName(job->result().toString());
|
||||
kDebug() << "setting location : "
|
||||
<< engineLocation.prettyUrl();
|
||||
m_consumer->m_remoteEngines[pair]->setLocation(engineLocation);
|
||||
}
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
}
|
||||
|
||||
DataEngineConsumer::~DataEngineConsumer()
|
||||
{
|
||||
foreach (const QString &engine, m_loadedEngines) {
|
||||
@ -69,47 +119,11 @@ DataEngine *DataEngineConsumer::remoteDataEngine(const KUrl &location, const QSt
|
||||
plasmoidService->setDestination(location.prettyUrl());
|
||||
m_engineNameForService[plasmoidService] = name;
|
||||
kDebug() << "name = " << name;
|
||||
connect(plasmoidService, SIGNAL(serviceReady(Plasma::Service*)),
|
||||
this, SLOT(slotServiceReady(Plasma::Service*)));
|
||||
QObject::connect(plasmoidService, SIGNAL(serviceReady(Plasma::Service*)),
|
||||
m_monitor, SLOT(slotServiceReady(Plasma::Service*)));
|
||||
return engine;
|
||||
}
|
||||
|
||||
void DataEngineConsumer::slotJobFinished(Plasma::ServiceJob *job)
|
||||
{
|
||||
kDebug() << "engine ready!";
|
||||
QString engineName = job->parameters()["EngineName"].toString();
|
||||
QString location = job->destination();
|
||||
QPair<QString, QString> pair(location, engineName);
|
||||
kDebug() << "pair = " << pair;
|
||||
if (!m_remoteEngines.contains(pair)) {
|
||||
kDebug() << "engine doesnt exist yet!";
|
||||
} else {
|
||||
KUrl engineLocation(location);
|
||||
engineLocation.setFileName(job->result().toString());
|
||||
kDebug() << "setting location : "
|
||||
<< engineLocation.prettyUrl();
|
||||
m_remoteEngines[pair]->setLocation(engineLocation);
|
||||
}
|
||||
}
|
||||
|
||||
void DataEngineConsumer::slotServiceReady(Plasma::Service *plasmoidService)
|
||||
{
|
||||
kDebug() << "service ready!";
|
||||
if (!m_engineNameForService.contains(plasmoidService)) {
|
||||
kDebug() << "no engine name for service!";
|
||||
kDebug() << "amount of services in map: " << m_engineNameForService.count();
|
||||
} else {
|
||||
kDebug() << "value = " << m_engineNameForService.value(plasmoidService);
|
||||
}
|
||||
|
||||
kDebug() << "requesting dataengine!";
|
||||
KConfigGroup op = plasmoidService->operationDescription("DataEngine");
|
||||
op.writeEntry("EngineName", m_engineNameForService.value(plasmoidService));
|
||||
//m_engineNameForService.remove(service);
|
||||
plasmoidService->startOperationCall(op);
|
||||
connect(plasmoidService, SIGNAL(finished(Plasma::ServiceJob*)),
|
||||
this, SLOT(slotJobFinished(Plasma::ServiceJob*)));
|
||||
}
|
||||
|
||||
} // namespace Plasma
|
||||
|
||||
|
@ -33,23 +33,38 @@
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class DataEngineConsumer : public QObject
|
||||
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:
|
||||
DataEngineConsumer();
|
||||
~DataEngineConsumer();
|
||||
DataEngine *dataEngine(const QString &name);
|
||||
DataEngine *remoteDataEngine(const KUrl &location, const QString &name);
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotJobFinished(Plasma::ServiceJob *job);
|
||||
void slotServiceReady(Plasma::Service *service);
|
||||
|
||||
private:
|
||||
QSet<QString> m_loadedEngines;
|
||||
QMap<QPair<QString, QString>, RemoteDataEngine*> m_remoteEngines;
|
||||
QMap<Service*, QString> m_engineNameForService;
|
||||
ServiceMonitor *m_monitor;
|
||||
|
||||
friend class ServiceMonitor;
|
||||
};
|
||||
|
||||
} // namespace Plasma
|
||||
|
Loading…
Reference in New Issue
Block a user