* Add package() and mainScript() methods to the scripting dataengine class

* Fix expected load path for a scripting dataengine and change from
  'plasma/engines' to 'plasma/dataengines' to be in line with the 
  'dataengine' type option of the plasmapkg tool

CCMAIL: kde-bindings@kde.org


svn path=/trunk/KDE/kdelibs/; revision=880550
This commit is contained in:
Richard Dale 2008-11-05 20:32:51 +00:00
parent 3eec0b49ad
commit ecad3fb271
3 changed files with 26 additions and 1 deletions

View File

@ -459,7 +459,7 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, KService::Ptr service)
if (!api.isEmpty()) {
const QString path =
KStandardDirs::locate("data",
"plasma/engines/" + dataEngineDescription.pluginName() + '/');
"plasma/dataengines/" + dataEngineDescription.pluginName() + '/');
PackageStructure::Ptr structure =
Plasma::packageStructure(api, Plasma::DataEngineComponent);
structure->setPath(path);

View File

@ -20,6 +20,7 @@
#include "dataenginescript.h"
#include "dataengine.h"
#include "package.h"
namespace Plasma
{
@ -73,6 +74,18 @@ Service *DataEngineScript::serviceForSource(const QString &source)
return d->dataEngine->serviceForSource(source);
}
QString DataEngineScript::mainScript() const
{
Q_ASSERT(d->dataEngine);
return d->dataEngine->package()->filePath("mainscript");
}
const Package *DataEngineScript::package() const
{
Q_ASSERT(d->dataEngine);
return d->dataEngine->package();
}
void DataEngineScript::setData(const QString &source, const QString &key,
const QVariant &value)
{

View File

@ -98,6 +98,18 @@ public:
virtual Service *serviceForSource(const QString &source);
protected:
/**
* @return absolute path to the main script file for this plasmoid
*/
QString mainScript() const;
/**
* @return the Package associated with this plasmoid which can
* be used to request resources, such as images and
* interface files.
*/
const Package *package() const;
void setData(const QString &source, const QString &key,
const QVariant &value);
void setData(const QString &source, const QVariant &value);