On Plasmate's previewer
Aaron J. Seigo
aseigo at kde.org
Tue Mar 23 18:08:55 CET 2010
On March 20, 2010, Yuen Hoe Lim wrote:
> Hmmm, so I've been looking at the runner-related classes in Plasma::. Is it
> possible at the moment to load (say make an AbstractRunner out of) a
> scripted runner without installing it, a'la Applet::loadPlasmoid for
> applets? I can't seem to find a way to do this in the API docs, nor can I
> find an existing example of something like that....
this should work for installed runners:
QStringList runners;
runners << targetRunner;
Plasma::RunnerManager *manager = new Plasma::RunnerManager(parent);
manager->setAllowedRunners(runners);
but for non-installed runners, there is indeed no recourse using
RunnerManager.
to make matters more complex, AbstractRunner's ctor is protected (since one is
supposed to use RunnerManager rather than messing about with runners
directly).
i think we will have to extend RunnerManager's API in some way. perhaps
something like:
Plasma::RunnerManager *manager = new Plasma::RunnerManager(parent);
manager->setAllowedRunners(QStringList()); // deny all runners!
manager->addRunner(pathToDesktopFileInPackage);
in this model, Plasma::RunnerManager::addRunner would have two versions: one
that takes a KService and expects it to be installed and one that takes a path
to a package and behaves like Applet::loadPlasmoid.
this will require a small adjustment in AbstractRunner as well: it currently
creates that ScriptEngine in the AbstractRunnerPrivate constructor which
assumes it to be an installed plugin.
so AbstractRunner needs a new constructor which takes a path (just like the
Applet ctor used from loadPlasmoid) and adjust AbstractRunnerPrivate to work
in both cases.
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Qt Development Frameworks
More information about the Plasma-devel
mailing list