+checkForUpdate()->protected

+int timeSinceLastUpdate()->protected+return uint 


svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=801145
This commit is contained in:
Alexis Ménard 2008-04-25 19:45:09 +00:00
parent c5e0d52ac3
commit 9316dbd0d5
2 changed files with 33 additions and 31 deletions

View File

@ -69,26 +69,6 @@ void DataContainer::removeAllData()
d->updateTs.start(); d->updateTs.start();
} }
void DataContainer::checkForUpdate()
{
if (d->dirty) {
emit dataUpdated(objectName(), d->data);
foreach (SignalRelay* relay, d->relays) {
relay->checkQueueing();
}
d->dirty = false;
}
}
int DataContainer::timeSinceLastUpdate() const
{
//FIXME: we still assume it's been <24h
//and ignore possible daylight savings changes
return d->updateTs.elapsed();
}
bool DataContainer::hasUpdates() const bool DataContainer::hasUpdates() const
{ {
if (d->cached) { if (d->cached) {
@ -193,6 +173,26 @@ void DataContainer::disconnectVisualization(QObject* visualization)
checkUsage(); checkUsage();
} }
void DataContainer::checkForUpdate()
{
if (d->dirty) {
emit dataUpdated(objectName(), d->data);
foreach (SignalRelay* relay, d->relays) {
relay->checkQueueing();
}
d->dirty = false;
}
}
uint DataContainer::timeSinceLastUpdate() const
{
//FIXME: we still assume it's been <24h
//and ignore possible daylight savings changes
return d->updateTs.elapsed();
}
} // Plasma namespace } // Plasma namespace
#include "datacontainer.moc" #include "datacontainer.moc"

View File

@ -41,6 +41,7 @@ namespace Plasma
**/ **/
class PLASMA_EXPORT DataContainer : public QObject class PLASMA_EXPORT DataContainer : public QObject
{ {
friend class DataEngine;
Q_OBJECT Q_OBJECT
public: public:
@ -75,17 +76,6 @@ class PLASMA_EXPORT DataContainer : public QObject
**/ **/
void removeAllData(); void removeAllData();
/**
* Checks for whether the data has changed and therefore an update
* signal needs to be emitted.
**/
void checkForUpdate();
/**
* Returns how long ago, in msecs, that the data in this container was last updated
**/
int timeSinceLastUpdate() const;
/** /**
* @internal * @internal
**/ **/
@ -145,6 +135,18 @@ class PLASMA_EXPORT DataContainer : public QObject
* requests to be updated. * requests to be updated.
**/ **/
void updateRequested(DataContainer *source); void updateRequested(DataContainer *source);
protected:
/**
* Checks for whether the data has changed and therefore an update
* signal needs to be emitted.
**/
void checkForUpdate();
/**
* Returns how long ago, in msecs, that the data in this container was last updated
**/
uint timeSinceLastUpdate() const;
private: private:
friend class SignalRelay; friend class SignalRelay;