remove DataEngine::query()

This commit is contained in:
Marco Martin 2013-04-04 16:16:31 +02:00
parent d207025d8f
commit 12b5b7639d
4 changed files with 4 additions and 53 deletions

View File

@ -136,26 +136,6 @@ DataContainer *DataEngine::containerForSource(const QString &source)
return d->source(source, false);
}
DataEngine::Data DataEngine::query(const QString &source) const
{
bool newSource;
DataContainer *s = d->requestSource(source, &newSource);
if (!s) {
return DataEngine::Data();
} else if (!newSource && d->minPollingInterval >= 0 &&
s->timeSinceLastUpdate() >= uint(d->minPollingInterval)) {
DataEngine *unconstThis = const_cast<DataEngine*>(this);
if (unconstThis->updateSourceEvent(source)) {
unconstThis->scheduleSourcesUpdated();
}
}
DataEngine::Data data = s->data();
s->d->checkUsage();
return data;
}
void DataEngine::init()
{
if (d->script) {
@ -385,15 +365,6 @@ void DataEngine::forceImmediateUpdateOfAllVisualizations()
}
}
QString DataEngine::pluginName() const
{
if (!d->dataEngineDescription.isValid()) {
return QString();
}
return d->dataEngineDescription.pluginName();
}
void DataEngine::setDefaultService(const QString &serviceName)
{
d->serviceName = serviceName;

View File

@ -184,18 +184,6 @@ NoAlignment) const;
**/
Q_INVOKABLE DataContainer *containerForSource(const QString &source);
/**
* Gets the Data associated with a data source.
*
* The data is a QHash of QVariants keyed by QString names, allowing
* one data source to provide sets of related data.
*
* @param source the data source to retrieve the data for
* @return the Data associated with the source; if the source doesn't
* exist an empty data set is returned
**/
Q_INVOKABLE DataEngine::Data query(const QString &source) const;
/**
* Returns true if this engine is valid, otherwise returns false
*
@ -224,11 +212,6 @@ NoAlignment) const;
**/
Package package() const;
/**
* @return the plugin name for the applet
*/
QString pluginName() const;
/**
* Initializes and returns a new service from the name that was set
* with setDefaultService. (service name is set internally). Remember to dispose

View File

@ -135,7 +135,7 @@ Storage::Storage(QObject* parent)
Plasma::DataEngine *engine = qobject_cast<Plasma::DataEngine *>(parentObject);
if (engine) {
m_clientName = engine->pluginName();
m_clientName = engine->pluginInfo().pluginName();
break;
}

View File

@ -26,6 +26,8 @@
#include <KComponentData>
#include <k4aboutdata.h>
#include <solid/device.h>
#include <Plasma/Containment>
#include <Plasma/Corona>
#include <Plasma/DataEngine>
@ -159,12 +161,7 @@ void AppInterface::sleep(int ms)
bool AppInterface::hasBattery() const
{
Plasma::DataEngineConsumer *consumer = new Plasma::DataEngineConsumer();
Plasma::DataEngine *power = consumer->dataEngine("powermanagement");
const QStringList batteries = power->query("Battery")["Sources"].toStringList();
delete consumer;
return !batteries.isEmpty();
return !Solid::Device::listFromType(Solid::DeviceInterface::Battery).isEmpty();
}
QStringList AppInterface::knownWidgetTypes() const