change when we call setName when loaded as a plugin

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=870187
This commit is contained in:
Aaron J. Seigo 2008-10-12 00:05:39 +00:00
parent f0b3371d1a
commit fbd8bc850e

View File

@ -47,14 +47,7 @@ Service::Service(QObject *parent, const QVariantList &args)
: QObject(parent), : QObject(parent),
d(new ServicePrivate(this)) d(new ServicePrivate(this))
{ {
// remove those first item since those are managed by Service and subclasses shouldn't Q_UNUSED(args)
// need to worry about it. yes, it violates the constness of this var, but it lets us add
// or remove items later while applets can just pretend that their args always start at 0
QVariantList &mutableArgs = const_cast<QVariantList &>(args);
if (!mutableArgs.isEmpty()) {
setName(mutableArgs[0].toString());
mutableArgs.removeFirst();
}
} }
Service::~Service() Service::~Service()
@ -80,7 +73,7 @@ Service *Service::load(const QString &name, QObject *parent)
KService::Ptr offer = offers.first(); KService::Ptr offer = offers.first();
QString error; QString error;
QVariantList args; QVariantList args;
args << name; //args << name;
Service *service = 0; Service *service = 0;
if (Plasma::isPluginVersionCompatible(KPluginLoader(*offer).pluginVersion())) { if (Plasma::isPluginVersionCompatible(KPluginLoader(*offer).pluginVersion())) {
@ -92,6 +85,10 @@ Service *Service::load(const QString &name, QObject *parent)
return new NullService(name, parent); return new NullService(name, parent);
} }
if (service->name().isEmpty()) {
service->setName(name);
}
return service; return service;
} }