don't emit addSource for a source being added in a sourceRequest event until the event is over

This commit is contained in:
Aaron Seigo 2011-09-01 19:07:22 +02:00
parent d09397673e
commit 423ce0c356
2 changed files with 6 additions and 2 deletions

View File

@ -197,7 +197,7 @@ void DataEngine::setData(const QString &source, const QString &key, const QVaria
s->setData(key, value); s->setData(key, value);
if (isNew) { if (isNew && source != d->waitingSourceRequest) {
emit sourceAdded(source); emit sourceAdded(source);
} }
@ -219,7 +219,7 @@ void DataEngine::setData(const QString &source, const Data &data)
++it; ++it;
} }
if (isNew) { if (isNew && source != d->waitingSourceRequest) {
emit sourceAdded(source); emit sourceAdded(source);
} }
@ -701,6 +701,7 @@ DataContainer *DataEnginePrivate::requestSource(const QString &sourceName, bool
/*kDebug() << "DataEngine " << q->objectName() /*kDebug() << "DataEngine " << q->objectName()
<< ": could not find DataContainer " << sourceName << ": could not find DataContainer " << sourceName
<< " will create on request" << endl;*/ << " will create on request" << endl;*/
waitingSourceRequest = sourceName;
if (q->sourceRequestEvent(sourceName)) { if (q->sourceRequestEvent(sourceName)) {
s = source(sourceName, false); s = source(sourceName, false);
if (s) { if (s) {
@ -710,8 +711,10 @@ DataContainer *DataEnginePrivate::requestSource(const QString &sourceName, bool
*newSource = true; *newSource = true;
} }
QObject::connect(s, SIGNAL(becameUnused(QString)), q, SLOT(removeSource(QString))); QObject::connect(s, SIGNAL(becameUnused(QString)), q, SLOT(removeSource(QString)));
emit q->sourceAdded(sourceName);
} }
} }
waitingSourceRequest.clear();
} }
return s; return s;

View File

@ -118,6 +118,7 @@ class DataEnginePrivate
QString serviceName; QString serviceName;
Package *package; Package *package;
Service *publishedService; Service *publishedService;
QString waitingSourceRequest;
}; };
} // Plasma namespace } // Plasma namespace