add icons to data engines. a bit superfluous, but can be nice when showing engines to the user as we do in the engine explorer

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=667592
This commit is contained in:
Aaron J. Seigo 2007-05-23 07:13:00 +00:00
parent 479a977830
commit 22015aa3c9
2 changed files with 25 additions and 4 deletions

View File

@ -67,6 +67,7 @@ class DataEngine::Private
DataSource::Dict sources;
DataEngine* engine;
QTimer* updateTimer;
QString icon;
};
@ -75,7 +76,7 @@ DataEngine::DataEngine(QObject* parent)
d(new Private(this))
{
connect(d->updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdates()));
//FIXME: should we try and delay this call?
//FIXME: we should delay this call; to when is the question.
init();
}
@ -184,6 +185,16 @@ bool DataEngine::isUsed()
return d->ref != 0;
}
void DataEngine::setIcon(const QString& icon)
{
d->icon = icon;
}
QString DataEngine::icon()
{
return d->icon;
}
void DataEngine::checkForUpdates()
{
QHashIterator<QString, Plasma::DataSource*> it(d->sources);

View File

@ -41,9 +41,9 @@ class DataSource;
* element to show all sorts of data: as long as there is a DataEngine, the
* data is retrievable.
*
* DataEngines are loaded as plugins on demand and provide one more data
* sources which are identified by name. For instance, a network DataEngine
* might provide a data source for each network interface.
* DataEngines are loaded as plugins on demand and provide zero, one or more
* data sources which are identified by name. For instance, a network
* DataEngine might provide a data source for each network interface.
**/
class PLASMA_EXPORT DataEngine : public QObject
{
@ -113,6 +113,16 @@ class PLASMA_EXPORT DataEngine : public QObject
**/
bool isUsed();
/**
* Sets the icon for this data engine
**/
void setIcon(const QString& icon);
/**
* @return the name of the icon for this data engine; and empty string
* is returned if there is no associated icon.
**/
QString icon();
Q_SIGNALS:
/**
* Emitted when a new data source is created