* update the source (if appropriate) when query is called
* use the source name for the destination of NullService; handy in debugging svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=856772
This commit is contained in:
parent
6774525044
commit
456e81518e
@ -69,7 +69,7 @@ QStringList DataEngine::sources() const
|
|||||||
|
|
||||||
Service* DataEngine::serviceForSource(const QString &source)
|
Service* DataEngine::serviceForSource(const QString &source)
|
||||||
{
|
{
|
||||||
return new NullService(this);
|
return new NullService(source, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataEngine::connectSource(const QString& source, QObject* visualization,
|
void DataEngine::connectSource(const QString& source, QObject* visualization,
|
||||||
@ -112,10 +112,16 @@ DataContainer* DataEngine::containerForSource(const QString &source)
|
|||||||
|
|
||||||
DataEngine::Data DataEngine::query(const QString& source) const
|
DataEngine::Data DataEngine::query(const QString& source) const
|
||||||
{
|
{
|
||||||
DataContainer* s = d->requestSource(source);
|
bool newSource;
|
||||||
|
DataContainer* s = d->requestSource(source, &newSource);
|
||||||
|
|
||||||
if (!s) {
|
if (!s) {
|
||||||
return DataEngine::Data();
|
return DataEngine::Data();
|
||||||
|
} else if (!newSource && d->minPollingInterval >= 0 &&
|
||||||
|
s->timeSinceLastUpdate() >= uint(d->minPollingInterval)) {
|
||||||
|
if (const_cast<DataEngine*>(this)->updateSourceEvent(source)) {
|
||||||
|
d->queueUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DataEngine::Data data = s->data();
|
DataEngine::Data data = s->data();
|
||||||
@ -251,6 +257,10 @@ uint DataEngine::maxSourceCount() const
|
|||||||
|
|
||||||
void DataEngine::setMinimumPollingInterval(int minimumMs)
|
void DataEngine::setMinimumPollingInterval(int minimumMs)
|
||||||
{
|
{
|
||||||
|
if (minimumMs < 0) {
|
||||||
|
minimumMs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
d->minPollingInterval = minimumMs;
|
d->minPollingInterval = minimumMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user