runners and engines need packages with mainscripts
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=796412
This commit is contained in:
parent
637515f2a9
commit
3e7d6cc024
@ -17,9 +17,10 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "runnerscript.h"
|
||||
#include "plasma/scripting/runnerscript.h"
|
||||
|
||||
#include "abstractrunner.h"
|
||||
#include "plasma/abstractrunner.h"
|
||||
#include "plasma/package.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
@ -62,6 +63,20 @@ void RunnerScript::exec(const Plasma::SearchContext *search, const Plasma::Searc
|
||||
Q_UNUSED(action)
|
||||
}
|
||||
|
||||
const Package* RunnerScript::package() const
|
||||
{
|
||||
return d->runner ? d->runner->package() : 0;
|
||||
}
|
||||
|
||||
QString RunnerScript::mainScript() const
|
||||
{
|
||||
if (!package()) {
|
||||
return QString();
|
||||
} else {
|
||||
return package()->filePath("mainscript");
|
||||
}
|
||||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
#include "runnerscript.moc"
|
||||
|
@ -70,6 +70,19 @@ public:
|
||||
*/
|
||||
virtual void exec(const Plasma::SearchContext *search, const Plasma::SearchMatch *action);
|
||||
|
||||
protected Q_SLOTS:
|
||||
/**
|
||||
* @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;
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private * const d;
|
||||
|
@ -51,6 +51,16 @@ bool ScriptEngine::init()
|
||||
return true;
|
||||
}
|
||||
|
||||
const Package* ScriptEngine::package() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString ScriptEngine::mainScript() const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
QStringList knownLanguages(ComponentTypes types)
|
||||
{
|
||||
QString constraintTemplate = "'%1' in [X-Plasma-ComponentTypes]";
|
||||
@ -210,6 +220,15 @@ PackageStructure::Ptr defaultPackageStructure(ComponentType type)
|
||||
case AppletComponent:
|
||||
return PackageStructure::Ptr(new PlasmoidPackage());
|
||||
break;
|
||||
case RunnerComponent:
|
||||
case DataEngineComponent:
|
||||
{
|
||||
PackageStructure::Ptr structure(new PackageStructure());
|
||||
structure->addFileDefinition("mainscript", "code/main", i18n("Main Script File"));
|
||||
structure->setRequired("mainscript", true);
|
||||
return structure;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// TODO: we don't have any special structures for other components yet
|
||||
break;
|
||||
|
@ -70,8 +70,21 @@ public:
|
||||
*/
|
||||
virtual bool init();
|
||||
|
||||
protected Q_SLOTS:
|
||||
/**
|
||||
* @return absolute path to the main script file for this plasmoid
|
||||
*/
|
||||
virtual QString mainScript() const;
|
||||
|
||||
/**
|
||||
* @return the Package associated with this plasmoid which can
|
||||
* be used to request resources, such as images and
|
||||
* interface files.
|
||||
*/
|
||||
virtual const Package* package() const;
|
||||
|
||||
private:
|
||||
class Private;
|
||||
class Private;
|
||||
Private * const d;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user