don't crash when serviceForSource is called "too early" on a remote data engine

svn path=/trunk/KDE/kdelibs/; revision=1037790
This commit is contained in:
Aaron J. Seigo 2009-10-20 01:28:02 +00:00
parent 631f1052b1
commit 9500388d8d
2 changed files with 16 additions and 1 deletions

View File

@ -69,10 +69,17 @@ Plasma::Service* RemoteDataEngine::serviceForSource(const QString& source)
} else {
RemoteService *service = new RemoteService(this);
m_serviceForSource[source] = service;
initRemoteService(source, service);
return service;
}
}
void RemoteDataEngine::initRemoteService(const QString &source, RemoteService *service)
{
if (m_service) {
KConfigGroup op = m_service->operationDescription("ServiceForSource");
op.writeEntry("SourceName", source);
m_service->startOperationCall(op);
return service;
}
}
@ -83,6 +90,13 @@ void RemoteDataEngine::init()
void RemoteDataEngine::serviceReady(Plasma::Service *service)
{
m_service = service;
QMapIterator<QString, RemoteService *> it(m_serviceForSource);
while (it.hasNext()) {
it.next();
initRemoteService(it.key(), it.value());
}
KConfigGroup op = m_service->operationDescription("GetSourceNames");
m_service->startOperationCall(op);
connect(m_service, SIGNAL(finished(Plasma::ServiceJob*)),

View File

@ -49,6 +49,7 @@ private Q_SLOTS:
void serviceReady(Plasma::Service *service);
void remoteCallFinished(Plasma::ServiceJob *job);
void updateSources();
void initRemoteService(const QString &source, RemoteService *service);
private:
Service *m_service;