dataengine api review: engineName() -> name() + add protected setName()

I also added a default value for the name

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=800336
This commit is contained in:
Chani Armitage 2008-04-23 22:40:03 +00:00
parent d28a4c277a
commit 563d3ab294
2 changed files with 16 additions and 2 deletions

View File

@ -59,6 +59,9 @@ class DataEngine::Private
}
engineName = service->property("X-Plasma-EngineName").toString();
if (engineName.isEmpty()) {
engineName = i18n("Anonymous Engine");
}
e->setObjectName(engineName);
icon = service->icon();
@ -576,11 +579,17 @@ void DataEngine::checkForUpdates()
}
}
QString DataEngine::engineName() const
QString DataEngine::name() const
{
return d->engineName;
}
void DataEngine::setName(const QString& name)
{
d->engineName = name;
setObjectName(name);
}
}
#include "dataengine.moc"

View File

@ -96,7 +96,7 @@ class PLASMA_EXPORT DataEngine : public QObject
/**
* Returns the engine name for the DataEngine
*/
QString engineName() const;
QString name() const;
/**
* Connects a source to an object for data updates. The object must
@ -382,6 +382,11 @@ class PLASMA_EXPORT DataEngine : public QObject
**/
void timerEvent(QTimerEvent *event);
/**
* Sets the engine name for the DataEngine
*/
void setName(const QString &name);
protected Q_SLOTS:
/**
* Call this method when you call setData directly on a DataContainer instead