improve error reporting when a plugin fails to load

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=705985
This commit is contained in:
Aaron J. Seigo 2007-08-29 03:06:48 +00:00
parent e600dbe4c3
commit bf30d19c41
4 changed files with 18 additions and 9 deletions

View File

@ -113,15 +113,16 @@ void AbstractRunner::runExactMatch()
AbstractRunner::List AbstractRunner::loadRunners( QWidget* parent )
{
List runners;
KService::List offers = KServiceTypeTrader::self()->query( "KRunner/Runner" );
foreach ( KService::Ptr service, offers ) {
AbstractRunner* runner = KService::createInstance<AbstractRunner>( service, parent );
KService::List offers = KServiceTypeTrader::self()->query("KRunner/Runner");
QString error;
foreach (KService::Ptr service, offers) {
AbstractRunner* runner = KService::createInstance<AbstractRunner>(service, parent, QVariantList(), &error);
if ( runner ) {
kDebug() << "loaded runner : " << service->name();
runners.append( runner );
}
else {
kDebug() << "failed to load runner : " << service->name();
kDebug() << "failed to load runner : " << service->name() << ". error reported: " << error;
}
}

View File

@ -118,15 +118,16 @@ Plasma::DataEngine* DataEngineManager::loadDataEngine(const QString& name)
QString constraint = QString("[X-EngineName] == '%1'").arg(name);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine",
constraint);
QString error;
if (offers.isEmpty()) {
kDebug() << "offers are empty for " << name << " with constraint " << constraint;
} else {
engine = KService::createInstance<Plasma::DataEngine>(offers.first(), 0);
engine = KService::createInstance<Plasma::DataEngine>(offers.first(), 0, QVariantList(), &error);
}
if (!engine) {
kDebug() << "Couldn't load engine \"" << name << "\"!";
kDebug() << "Couldn't load engine \"" << name << "\". Error given: " << error;
return d->nullEngine();
}

View File

@ -463,7 +463,11 @@ void Phase::init()
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Animator", constraint);
if (!offers.isEmpty()) {
d->animator = KService::createInstance<Plasma::Animator>(offers.first(), 0, QStringList());
QString error;
d->animator = KService::createInstance<Plasma::Animator>(offers.first(), 0, QVariantList(), &error);
if (!d->animator) {
kDebug() << "Could not load requested animator " << offers.first() << ". Error given: " << error;
}
}
}

View File

@ -120,16 +120,19 @@ ScriptEngine* ScriptEngine::load(const QString &language, Applet *applet)
}
QVariantList args;
QString error;
ScriptEngine* engine = 0;
foreach (KService::Ptr service, offers) {
engine = KService::createInstance<Plasma::ScriptEngine>(service, applet, args);
engine = KService::createInstance<Plasma::ScriptEngine>(service, applet, args, &error);
if (engine) {
break;
}
kDebug() << "Couldn't load script engine for language " << language << "! error reported: " << error;
}
if (!engine) {
kDebug() << "Couldn't load script engine for language " << language << "!";
return 0;
}