add clearData() methods
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=685602
This commit is contained in:
parent
44bf51c596
commit
606b1862a7
@ -225,6 +225,15 @@ void DataEngine::setData(const QString& source, const QString& key, const QVaria
|
||||
d->queueUpdate();
|
||||
}
|
||||
|
||||
void DataEngine::clearData(const QString& source)
|
||||
{
|
||||
DataSource* s = d->source(source, false);
|
||||
if (s) {
|
||||
s->clearData();
|
||||
d->queueUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void DataEngine::removeData(const QString& source, const QString& key)
|
||||
{
|
||||
DataSource* s = d->source(source, false);
|
||||
|
@ -210,6 +210,13 @@ class PLASMA_EXPORT DataEngine : public QObject
|
||||
**/
|
||||
void setData(const QString& source, const QString& key, const QVariant& value);
|
||||
|
||||
/**
|
||||
* Clears all the data associated with a data source.
|
||||
*
|
||||
* @param source the name of the data source
|
||||
**/
|
||||
void clearData(const QString& source);
|
||||
|
||||
/**
|
||||
* Removes a data entry from a source
|
||||
*
|
||||
|
@ -69,6 +69,17 @@ void DataSource::setData(const QString& key, const QVariant& value)
|
||||
d->dirty = true;
|
||||
}
|
||||
|
||||
void DataSource::clearData()
|
||||
{
|
||||
if (d->data.count() < 1) {
|
||||
// avoid an update if we don't have any data anyways
|
||||
return;
|
||||
}
|
||||
|
||||
d->data.clear();
|
||||
d->dirty = true;
|
||||
}
|
||||
|
||||
void DataSource::checkForUpdate()
|
||||
{
|
||||
if (d->dirty) {
|
||||
|
@ -69,6 +69,11 @@ class PLASMA_EXPORT DataSource : public QObject
|
||||
**/
|
||||
void setData(const QString& key, const QVariant& value);
|
||||
|
||||
/**
|
||||
* Clears all data currently associated with this source
|
||||
**/
|
||||
void clearData();
|
||||
|
||||
/**
|
||||
* Checks for whether the data has changed and therefore an update
|
||||
* signal needs to be emitted.
|
||||
|
Loading…
x
Reference in New Issue
Block a user