DataEngine::query should not create an empty source but do what
DataEngine::connectSource does: ask the engine svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=698833
This commit is contained in:
parent
b764db9438
commit
17e17536b1
@ -80,6 +80,24 @@ class DataEngine::Private
|
||||
return s;
|
||||
}
|
||||
|
||||
DataContainer* requestSource(const QString& sourceName)
|
||||
{
|
||||
DataContainer* s = source(sourceName, false);
|
||||
|
||||
if (!s) {
|
||||
// we didn't find a data source, so give the engine an opportunity to make one
|
||||
if (engine->sourceRequested(sourceName)) {
|
||||
s = source(sourceName, false);
|
||||
if (s) {
|
||||
// now we have a source; since it was created on demand, assume
|
||||
// it should be removed when not used
|
||||
connect(s, SIGNAL(unused(QString)), engine, SLOT(removeSource(QString)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void trimQueue()
|
||||
{
|
||||
while (sourceQueue.count() >= limit) {
|
||||
@ -96,12 +114,6 @@ class DataEngine::Private
|
||||
updateTimer->start(0);
|
||||
}
|
||||
|
||||
bool sourceRequested(const QString& source)
|
||||
{
|
||||
//get around const! =P
|
||||
return engine->sourceRequested(source);
|
||||
}
|
||||
|
||||
QAtomic ref;
|
||||
DataEngine::SourceDict sources;
|
||||
QQueue<DataContainer*> sourceQueue;
|
||||
@ -136,19 +148,7 @@ QStringList DataEngine::sources() const
|
||||
|
||||
void DataEngine::connectSource(const QString& source, QObject* visualization) const
|
||||
{
|
||||
DataContainer* s = d->source(source, false);
|
||||
|
||||
if (!s) {
|
||||
// we didn't find a data source, so give the engine an opportunity to make one
|
||||
if (d->sourceRequested(source)) {
|
||||
s = d->source(source, false);
|
||||
if (s) {
|
||||
// now we have a source; since it was created on demand, assume
|
||||
// it should be removed when not used
|
||||
connect(s, SIGNAL(unused(QString)), this, SLOT(removeSource(QString)));
|
||||
}
|
||||
}
|
||||
}
|
||||
DataContainer* s = d->requestSource(source);
|
||||
|
||||
if (!s) {
|
||||
return;
|
||||
@ -189,9 +189,12 @@ void DataEngine::connectAllSources(QObject* visualization) const
|
||||
|
||||
DataEngine::Data DataEngine::query(const QString& source) const
|
||||
{
|
||||
Q_UNUSED(source)
|
||||
DataContainer* s = d->requestSource(source);
|
||||
|
||||
if (!s) {
|
||||
return DataEngine::Data();
|
||||
}
|
||||
|
||||
DataContainer* s = d->source(source);
|
||||
return s->data();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user