convenience setData method for when one gets a DataEngine::Data to set. useful for chaining engines together

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=689132
This commit is contained in:
Aaron J. Seigo 2007-07-17 18:08:57 +00:00
parent acbfadae12
commit 8f056a022a
2 changed files with 21 additions and 0 deletions

View File

@ -225,6 +225,18 @@ void DataEngine::setData(const QString& source, const QString& key, const QVaria
d->queueUpdate();
}
void DataEngine::setData(const QString &source, const Data &data)
{
DataSource *s = d->source(source);
Data::const_iterator it = data.constBegin();
while (it != data.constEnd()) {
s->setData(it.key(), it.value());
++it;
}
d->queueUpdate();
}
void DataEngine::clearData(const QString& source)
{
DataSource* s = d->source(source, false);

View File

@ -210,6 +210,15 @@ class PLASMA_EXPORT DataEngine : public QObject
**/
void setData(const QString& source, const QString& key, const QVariant& value);
/**
* Adds a set of data to a data source. If the source
* doesn't exist then it is created.
*
* @param source the name of the data source
* @param data the data to add to the source
**/
void setData(const QString &source, const Data &data);
/**
* Clears all the data associated with a data source.
*