scripting fixes
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=796423
This commit is contained in:
parent
3e7d6cc024
commit
f2fe39b435
@ -28,8 +28,10 @@
|
||||
#include <KDebug>
|
||||
#include <KPluginInfo>
|
||||
#include <KService>
|
||||
#include <KStandardDirs>
|
||||
|
||||
#include "datacontainer.h"
|
||||
#include "package.h"
|
||||
#include "scripting/dataenginescript.h"
|
||||
|
||||
namespace Plasma
|
||||
@ -45,7 +47,8 @@ class DataEngine::Private
|
||||
minUpdateInterval(-1),
|
||||
limit(0),
|
||||
valid(true),
|
||||
script(0)
|
||||
script(0),
|
||||
package(0)
|
||||
{
|
||||
updateTimer = new QTimer(engine);
|
||||
updateTimer->setSingleShot(true);
|
||||
@ -64,10 +67,18 @@ class DataEngine::Private
|
||||
QString language = dataEngineDescription.property("X-Plasma-Language").toString();
|
||||
|
||||
if (!language.isEmpty()) {
|
||||
const QString path = KStandardDirs::locate("data",
|
||||
"plasma/engines/" + dataEngineDescription.pluginName() + "/");
|
||||
PackageStructure::Ptr structure = Plasma::packageStructure(language, Plasma::RunnerComponent);
|
||||
structure->setPath(path);
|
||||
package = new Package(path, structure);
|
||||
|
||||
script = Plasma::loadScriptEngine(language, engine);
|
||||
if (!script) {
|
||||
kDebug() << "Could not create a" << language << "ScriptEngine for the"
|
||||
<< dataEngineDescription.name() << "DataEngine.";
|
||||
delete package;
|
||||
package = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -193,6 +204,7 @@ class DataEngine::Private
|
||||
bool valid;
|
||||
DataEngineScript* script;
|
||||
QString engineName;
|
||||
Package *package;
|
||||
};
|
||||
|
||||
|
||||
@ -550,6 +562,11 @@ QString DataEngine::icon() const
|
||||
return d->icon;
|
||||
}
|
||||
|
||||
const Package *DataEngine::package() const
|
||||
{
|
||||
return d->package;
|
||||
}
|
||||
|
||||
void DataEngine::checkForUpdates()
|
||||
{
|
||||
QHashIterator<QString, Plasma::DataContainer*> it(d->sources);
|
||||
|
@ -35,6 +35,7 @@ namespace Plasma
|
||||
|
||||
class DataContainer;
|
||||
class DataEngineScript;
|
||||
class Package;
|
||||
|
||||
/**
|
||||
* @class DataEngine
|
||||
@ -221,6 +222,13 @@ class PLASMA_EXPORT DataEngine : public QObject
|
||||
**/
|
||||
QString icon() const;
|
||||
|
||||
/**
|
||||
* Accessor for the associated Package object if any.
|
||||
*
|
||||
* @return the Package object, or 0 if none
|
||||
**/
|
||||
const Package* package() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emitted when a new data source is created
|
||||
|
Loading…
x
Reference in New Issue
Block a user