* add a way to query if a visualization is already connected to a source

* don't do an immediate call using invokeMethod if the visualization is already connected and we're just adjusting it

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=800383
This commit is contained in:
Aaron J. Seigo 2008-04-24 05:58:59 +00:00
parent f24d1efa28
commit 7d1d889a47
3 changed files with 16 additions and 0 deletions

View File

@ -104,6 +104,11 @@ void DataContainer::setNeedsUpdate(bool update)
d->cached = update;
}
bool DataContainer::visualizationIsConnected(QObject *visualization) const
{
return d->relayObjects.find(visualization) != d->relayObjects.constEnd();
}
void DataContainer::checkUsage()
{
if (d->relays.count() < 1 &&

View File

@ -101,6 +101,11 @@ class PLASMA_EXPORT DataContainer : public QObject
**/
void setNeedsUpdate(bool update = true);
/**
* @return true if the visualization is currently connected
*/
bool visualizationIsConnected(QObject *visualization) const;
public Q_SLOTS:
/**
* Check if the DataContainer is still in use.

View File

@ -138,6 +138,12 @@ class DataEngine::Private
pollingInterval = pollingInterval - (pollingInterval % 50);
}
if (immediateCall) {
// we don't want to do an immediate call if we are simply
// reconnecting
immediateCall = !s->visualizationIsConnected(visualization);
}
s->connectVisualization(visualization, pollingInterval, align);
if (immediateCall) {