more careful with the client name

This commit is contained in:
Aaron Seigo 2011-04-28 15:18:45 +02:00 committed by Marco Martin
parent 055f35cba1
commit 0fff74cec0

View File

@ -240,16 +240,21 @@ void StorageJob::start()
Plasma::ServiceJob* Storage::createJob(const QString &operation, QMap<QString, QVariant> &parameters) Plasma::ServiceJob* Storage::createJob(const QString &operation, QMap<QString, QVariant> &parameters)
{ {
if (m_clientName.isEmpty()) {
return 0;
}
return new StorageJob(m_clientName, operation, parameters, this); return new StorageJob(m_clientName, operation, parameters, this);
} }
//Storage implementation //Storage implementation
Storage::Storage(QObject* parent) : Plasma::Service(parent) Storage::Storage(QObject* parent)
: Plasma::Service(parent),
m_clientName("data")
{ {
//search among parents for an applet or dataengine: if found call the table as its plugin name //search among parents for an applet or dataengine: if found call the table as its plugin name
QObject *parentObject = this; QObject *parentObject = this;
QString clientName("data");
while ((parentObject = parentObject->parent())) { while ((parentObject = parentObject->parent())) {
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(parentObject); Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(parentObject);
if (applet) { if (applet) {