adapt to Package merge: return a Package by reference rather than a pointer

This commit is contained in:
Aaron Seigo 2011-07-15 12:58:33 +02:00
parent 8d5cd041c0
commit 776fe21b83
2 changed files with 6 additions and 10 deletions

View File

@ -322,9 +322,9 @@ QString AbstractRunner::description() const
return objectName();
}
const Package* AbstractRunner::package() const
Package AbstractRunner::package() const
{
return d->package;
return d->package ? *d->package : Package();
}
@ -415,14 +415,11 @@ void AbstractRunnerPrivate::prepScripting(const QString &path, const QString &ap
return;
}
PackageStructure::Ptr structure = Plasma::packageStructure(api, Plasma::RunnerComponent);
structure->setPath(path);
package = new Package(path, structure);
package = new Package(Plasma::Package::load("Plasma/Runner", api));
package->setPath(path);
if (!package->isValid()) {
kDebug() << "Invalid Runner package at" << path;
delete package;
package = 0;
return;
}
@ -442,7 +439,6 @@ void AbstractRunnerPrivate::setupScriptSupport()
}
kDebug() << "setting up script support, package is in" << package->path()
<< "which is a" << package->structure()->type() << "package"
<< ", main script is" << package->filePath("mainscript");
const QString translationsPath = package->filePath("translations");

View File

@ -222,9 +222,9 @@ class PLASMA_EXPORT AbstractRunner : public QObject
* Note that the returned pointer is only valid for the lifetime of
* the runner.
*
* @return the Package object, or 0 if none
* @return the Package object, which may be invalid
**/
const Package *package() const;
Package package() const;
/**
* Signal runner to reload its configuration.