2008-11-04 00:08:39 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2006-2007 Aaron Seigo <aseigo@kde.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "abstractrunner.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
#include <QHash>
|
2009-07-25 06:42:52 +02:00
|
|
|
#include <QMenu>
|
2010-02-21 18:06:10 +01:00
|
|
|
#include <QMimeData>
|
2008-11-04 00:08:39 +01:00
|
|
|
#include <QMutex>
|
|
|
|
#include <QMutexLocker>
|
|
|
|
#include <QTimer>
|
|
|
|
|
2008-11-04 03:04:34 +01:00
|
|
|
#include <kdebug.h>
|
|
|
|
#include <kplugininfo.h>
|
|
|
|
#include <kservicetypetrader.h>
|
|
|
|
#include <kstandarddirs.h>
|
2012-11-18 20:26:13 +01:00
|
|
|
#include <klocalizedstring.h>
|
2012-04-28 16:34:56 +02:00
|
|
|
#include <kiconloader.h>
|
2012-06-12 12:59:34 +02:00
|
|
|
#include <qstandardpaths.h>
|
2008-11-04 03:04:34 +01:00
|
|
|
|
2011-07-19 22:04:22 +02:00
|
|
|
#include "package.h"
|
|
|
|
#include "pluginloader.h"
|
2009-11-11 01:25:27 +01:00
|
|
|
#include "private/abstractrunner_p.h"
|
2011-07-19 22:04:22 +02:00
|
|
|
#include "querymatch.h"
|
2008-11-04 00:08:39 +01:00
|
|
|
#include "runnercontext.h"
|
2009-11-11 01:25:27 +01:00
|
|
|
#include "scripting/runnerscript.h"
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2010-03-23 23:43:34 +01:00
|
|
|
AbstractRunner::AbstractRunner(QObject *parent, const QString &path)
|
2008-11-04 00:08:39 +01:00
|
|
|
: QObject(parent),
|
2010-03-23 23:43:34 +01:00
|
|
|
d(new AbstractRunnerPrivate(this))
|
2008-11-04 00:08:39 +01:00
|
|
|
{
|
2010-03-23 23:43:34 +01:00
|
|
|
d->init(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
AbstractRunner::AbstractRunner(const KService::Ptr service, QObject *parent)
|
|
|
|
: QObject(parent),
|
|
|
|
d(new AbstractRunnerPrivate(this))
|
|
|
|
{
|
|
|
|
d->init(service);
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AbstractRunner::AbstractRunner(QObject *parent, const QVariantList &args)
|
|
|
|
: QObject(parent),
|
2010-03-23 23:43:34 +01:00
|
|
|
d(new AbstractRunnerPrivate(this))
|
2008-11-04 00:08:39 +01:00
|
|
|
{
|
2010-03-23 23:43:34 +01:00
|
|
|
if (args.count() > 0) {
|
|
|
|
KService::Ptr service = KService::serviceByStorageId(args[0].toString());
|
|
|
|
if (service) {
|
|
|
|
d->init(service);
|
|
|
|
}
|
|
|
|
}
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AbstractRunner::~AbstractRunner()
|
|
|
|
{
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
|
|
|
|
KConfigGroup AbstractRunner::config() const
|
|
|
|
{
|
2011-04-30 09:32:48 +02:00
|
|
|
QString group = id();
|
2008-11-04 00:08:39 +01:00
|
|
|
if (group.isEmpty()) {
|
|
|
|
group = "UnnamedRunner";
|
|
|
|
}
|
|
|
|
|
2012-03-24 19:33:54 +01:00
|
|
|
KConfigGroup runners(KSharedConfig::openConfig(), "Runners");
|
2008-11-04 00:08:39 +01:00
|
|
|
return KConfigGroup(&runners, group);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::reloadConfiguration()
|
|
|
|
{
|
2009-11-06 07:33:24 +01:00
|
|
|
if (d->script) {
|
|
|
|
emit d->script->reloadConfiguration();
|
|
|
|
}
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2009-03-25 02:08:08 +01:00
|
|
|
void AbstractRunner::addSyntax(const RunnerSyntax &syntax)
|
|
|
|
{
|
|
|
|
d->syntaxes.append(syntax);
|
|
|
|
}
|
|
|
|
|
2009-11-25 10:37:47 +01:00
|
|
|
void AbstractRunner::setDefaultSyntax(const RunnerSyntax &syntax)
|
|
|
|
{
|
|
|
|
d->syntaxes.append(syntax);
|
|
|
|
d->defaultSyntax = &(d->syntaxes.last());
|
|
|
|
}
|
|
|
|
|
2009-03-25 19:33:41 +01:00
|
|
|
void AbstractRunner::setSyntaxes(const QList<RunnerSyntax> &syntaxes)
|
2009-03-25 02:08:08 +01:00
|
|
|
{
|
2009-03-25 18:41:15 +01:00
|
|
|
d->syntaxes = syntaxes;
|
2009-03-25 02:08:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QList<RunnerSyntax> AbstractRunner::syntaxes() const
|
|
|
|
{
|
|
|
|
return d->syntaxes;
|
|
|
|
}
|
|
|
|
|
2009-11-25 10:37:47 +01:00
|
|
|
RunnerSyntax *AbstractRunner::defaultSyntax() const
|
|
|
|
{
|
|
|
|
return d->defaultSyntax;
|
|
|
|
}
|
|
|
|
|
2009-03-12 18:25:13 +01:00
|
|
|
void AbstractRunner::performMatch(Plasma::RunnerContext &localContext)
|
2008-11-04 00:08:39 +01:00
|
|
|
{
|
|
|
|
static const int reasonableRunTime = 1500;
|
|
|
|
static const int fastEnoughTime = 250;
|
|
|
|
|
2010-09-03 00:18:03 +02:00
|
|
|
if (d->suspendMatching) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-10-09 01:23:52 +02:00
|
|
|
QTime time;
|
|
|
|
time.restart();
|
2009-03-04 22:03:33 +01:00
|
|
|
|
|
|
|
//The local copy is already obtained in the job
|
2008-11-04 00:08:39 +01:00
|
|
|
match(localContext);
|
2009-03-12 18:25:13 +01:00
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
// automatically rate limit runners that become slooow
|
2009-10-09 01:23:52 +02:00
|
|
|
const int runtime = time.elapsed();
|
2008-11-04 00:08:39 +01:00
|
|
|
bool slowed = speed() == SlowSpeed;
|
|
|
|
|
|
|
|
if (!slowed && runtime > reasonableRunTime) {
|
|
|
|
// we punish runners that return too slowly, even if they don't bring
|
|
|
|
// back matches
|
2011-07-29 15:46:52 +02:00
|
|
|
#ifndef NDEBUG
|
2008-11-04 00:08:39 +01:00
|
|
|
kDebug() << id() << "runner is too slow, putting it on the back burner.";
|
2011-07-29 15:46:52 +02:00
|
|
|
#endif
|
2008-11-04 00:08:39 +01:00
|
|
|
d->fastRuns = 0;
|
|
|
|
setSpeed(SlowSpeed);
|
|
|
|
}
|
|
|
|
|
2009-03-03 18:37:22 +01:00
|
|
|
if (slowed && runtime < fastEnoughTime && localContext.query().size() > 2) {
|
2008-11-04 00:08:39 +01:00
|
|
|
++d->fastRuns;
|
|
|
|
|
|
|
|
if (d->fastRuns > 2) {
|
|
|
|
// we reward slowed runners who bring back matches fast enough
|
|
|
|
// 3 times in a row
|
2011-07-29 15:46:52 +02:00
|
|
|
#ifndef NDEBUG
|
2008-11-04 00:08:39 +01:00
|
|
|
kDebug() << id() << "runner is faster than we thought, kicking it up a notch";
|
2011-07-29 15:46:52 +02:00
|
|
|
#endif
|
2008-11-04 00:08:39 +01:00
|
|
|
setSpeed(NormalSpeed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<QAction*> AbstractRunner::actionsForMatch(const Plasma::QueryMatch &match)
|
|
|
|
{
|
|
|
|
Q_UNUSED(match)
|
|
|
|
QList<QAction*> ret;
|
2009-11-16 08:24:39 +01:00
|
|
|
if (d->script) {
|
|
|
|
emit d->script->actionsForMatch(match, &ret);
|
|
|
|
}
|
2008-11-04 00:08:39 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
QAction* AbstractRunner::addAction(const QString &id, const QIcon &icon, const QString &text)
|
|
|
|
{
|
|
|
|
QAction *a = new QAction(icon, text, this);
|
|
|
|
d->actions.insert(id, a);
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::addAction(const QString &id, QAction *action)
|
|
|
|
{
|
|
|
|
d->actions.insert(id, action);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::removeAction(const QString &id)
|
|
|
|
{
|
|
|
|
QAction *a = d->actions.take(id);
|
|
|
|
delete a;
|
|
|
|
}
|
|
|
|
|
|
|
|
QAction* AbstractRunner::action(const QString &id) const
|
|
|
|
{
|
|
|
|
return d->actions.value(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
QHash<QString, QAction*> AbstractRunner::actions() const
|
|
|
|
{
|
|
|
|
return d->actions;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::clearActions()
|
|
|
|
{
|
|
|
|
qDeleteAll(d->actions);
|
|
|
|
d->actions.clear();
|
|
|
|
}
|
|
|
|
|
2011-05-20 09:01:12 +02:00
|
|
|
QMimeData *AbstractRunner::mimeDataForMatch(const QueryMatch &match)
|
2010-02-21 18:06:10 +01:00
|
|
|
{
|
2010-03-23 23:43:34 +01:00
|
|
|
Q_UNUSED(match)
|
2010-02-21 18:06:10 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
bool AbstractRunner::hasRunOptions()
|
|
|
|
{
|
|
|
|
return d->hasRunOptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::setHasRunOptions(bool hasRunOptions)
|
|
|
|
{
|
|
|
|
d->hasRunOptions = hasRunOptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::createRunOptions(QWidget *parent)
|
|
|
|
{
|
2009-11-06 07:33:24 +01:00
|
|
|
if (d->script) {
|
|
|
|
emit d->script->createRunOptions(parent);
|
|
|
|
}
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AbstractRunner::Speed AbstractRunner::speed() const
|
|
|
|
{
|
2009-10-09 01:32:25 +02:00
|
|
|
// the only time the read lock will fail is if we were slow are going to speed up
|
|
|
|
// or if we were fast and are going to slow down; so don't wait in this case, just
|
|
|
|
// say we're slow. we either will be soon or were just a moment ago and it doesn't
|
|
|
|
// hurt to do one more run the slow way
|
2009-10-17 15:55:18 +02:00
|
|
|
if (!d->speedLock.tryLockForRead()) {
|
|
|
|
return SlowSpeed;
|
|
|
|
}
|
|
|
|
Speed s = d->speed;
|
|
|
|
d->speedLock.unlock();
|
|
|
|
return s;
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::setSpeed(Speed speed)
|
|
|
|
{
|
2009-10-09 01:32:25 +02:00
|
|
|
d->speedLock.lockForWrite();
|
2008-11-04 00:08:39 +01:00
|
|
|
d->speed = speed;
|
2009-10-09 01:32:25 +02:00
|
|
|
d->speedLock.unlock();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AbstractRunner::Priority AbstractRunner::priority() const
|
|
|
|
{
|
|
|
|
return d->priority;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::setPriority(Priority priority)
|
|
|
|
{
|
|
|
|
d->priority = priority;
|
|
|
|
}
|
|
|
|
|
|
|
|
RunnerContext::Types AbstractRunner::ignoredTypes() const
|
|
|
|
{
|
|
|
|
return d->blackListed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::setIgnoredTypes(RunnerContext::Types types)
|
|
|
|
{
|
|
|
|
d->blackListed = types;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::run(const Plasma::RunnerContext &search, const Plasma::QueryMatch &action)
|
|
|
|
{
|
|
|
|
if (d->script) {
|
|
|
|
return d->script->run(search, action);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::match(Plasma::RunnerContext &search)
|
|
|
|
{
|
|
|
|
if (d->script) {
|
|
|
|
return d->script->match(search);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AbstractRunner::name() const
|
|
|
|
{
|
2010-03-23 23:43:34 +01:00
|
|
|
if (d->runnerDescription.isValid()) {
|
|
|
|
return d->runnerDescription.name();
|
|
|
|
}
|
|
|
|
|
|
|
|
return objectName();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2009-03-25 02:08:08 +01:00
|
|
|
QIcon AbstractRunner::icon() const
|
|
|
|
{
|
2010-03-23 23:43:34 +01:00
|
|
|
if (d->runnerDescription.isValid()) {
|
2012-04-28 13:03:35 +02:00
|
|
|
return KDE::icon(d->runnerDescription.icon());
|
2010-03-23 23:43:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return QIcon();
|
2009-03-25 02:08:08 +01:00
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
QString AbstractRunner::id() const
|
|
|
|
{
|
2010-03-23 23:43:34 +01:00
|
|
|
if (d->runnerDescription.isValid()) {
|
|
|
|
return d->runnerDescription.pluginName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return objectName();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString AbstractRunner::description() const
|
|
|
|
{
|
2010-03-23 23:54:01 +01:00
|
|
|
if (d->runnerDescription.isValid()) {
|
2010-03-23 23:43:34 +01:00
|
|
|
return d->runnerDescription.property("Comment").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
return objectName();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2011-07-15 12:58:33 +02:00
|
|
|
Package AbstractRunner::package() const
|
2008-11-04 00:08:39 +01:00
|
|
|
{
|
2011-07-15 12:58:33 +02:00
|
|
|
return d->package ? *d->package : Package();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2009-11-25 10:37:47 +01:00
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
void AbstractRunner::init()
|
|
|
|
{
|
|
|
|
if (d->script) {
|
2009-11-12 07:38:16 +01:00
|
|
|
d->setupScriptSupport();
|
2008-11-04 00:08:39 +01:00
|
|
|
d->script->init();
|
|
|
|
}
|
2010-08-24 22:38:35 +02:00
|
|
|
|
|
|
|
reloadConfiguration();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2009-11-19 01:19:11 +01:00
|
|
|
DataEngine *AbstractRunner::dataEngine(const QString &name) const
|
|
|
|
{
|
|
|
|
return d->dataEngine(name);
|
|
|
|
}
|
|
|
|
|
2010-09-03 00:18:03 +02:00
|
|
|
bool AbstractRunner::isMatchingSuspended() const
|
|
|
|
{
|
|
|
|
return d->suspendMatching;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunner::suspendMatching(bool suspend)
|
|
|
|
{
|
|
|
|
if (d->suspendMatching == suspend) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
d->suspendMatching = suspend;
|
|
|
|
emit matchingSuspended(suspend);
|
|
|
|
}
|
|
|
|
|
2010-03-23 23:43:34 +01:00
|
|
|
AbstractRunnerPrivate::AbstractRunnerPrivate(AbstractRunner *r)
|
2009-11-11 01:25:27 +01:00
|
|
|
: priority(AbstractRunner::NormalPriority),
|
|
|
|
speed(AbstractRunner::NormalSpeed),
|
|
|
|
blackListed(0),
|
|
|
|
script(0),
|
|
|
|
runner(r),
|
|
|
|
fastRuns(0),
|
|
|
|
package(0),
|
2010-09-03 00:18:03 +02:00
|
|
|
defaultSyntax(0),
|
2009-11-25 10:37:47 +01:00
|
|
|
hasRunOptions(false),
|
2010-09-03 00:18:03 +02:00
|
|
|
suspendMatching(false)
|
2009-11-11 01:25:27 +01:00
|
|
|
{
|
2010-03-23 23:43:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AbstractRunnerPrivate::~AbstractRunnerPrivate()
|
|
|
|
{
|
|
|
|
delete script;
|
|
|
|
script = 0;
|
|
|
|
delete package;
|
|
|
|
package = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractRunnerPrivate::init(const KService::Ptr service)
|
|
|
|
{
|
|
|
|
runnerDescription = KPluginInfo(service);
|
2009-11-11 01:25:27 +01:00
|
|
|
if (runnerDescription.isValid()) {
|
|
|
|
const QString api = runnerDescription.property("X-Plasma-API").toString();
|
|
|
|
if (!api.isEmpty()) {
|
2012-05-30 20:25:25 +02:00
|
|
|
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "plasma/runners/" + runnerDescription.pluginName() + '/');
|
2010-03-23 23:43:34 +01:00
|
|
|
prepScripting(path, api);
|
2009-11-11 01:25:27 +01:00
|
|
|
if (!script) {
|
2011-07-29 15:46:52 +02:00
|
|
|
#ifndef NDEBUG
|
2010-03-23 23:43:34 +01:00
|
|
|
kDebug() << "Could not create a(n)" << api << "ScriptEngine for the" << runnerDescription.name() << "Runner.";
|
2011-07-29 15:46:52 +02:00
|
|
|
#endif
|
2009-11-11 01:25:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-23 23:43:34 +01:00
|
|
|
void AbstractRunnerPrivate::init(const QString &path)
|
2009-11-11 01:25:27 +01:00
|
|
|
{
|
2011-05-31 00:03:39 +02:00
|
|
|
runnerDescription = KPluginInfo(path + "/metadata.desktop");
|
|
|
|
const QString api = runnerDescription.property("X-Plasma-API").toString();
|
|
|
|
prepScripting(path, api);
|
2010-03-23 23:43:34 +01:00
|
|
|
}
|
|
|
|
|
2011-05-31 00:03:39 +02:00
|
|
|
void AbstractRunnerPrivate::prepScripting(const QString &path, const QString &api)
|
2010-03-23 23:43:34 +01:00
|
|
|
{
|
|
|
|
if (script) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-08-25 16:48:41 +02:00
|
|
|
delete package;
|
2011-05-31 00:03:39 +02:00
|
|
|
package = 0;
|
|
|
|
|
|
|
|
if (api.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
2010-03-23 23:43:34 +01:00
|
|
|
|
2011-07-19 22:04:22 +02:00
|
|
|
package = new Package(PluginLoader::self()->loadPackage("Plasma/Runner", api));
|
2011-07-15 12:58:33 +02:00
|
|
|
package->setPath(path);
|
2010-03-23 23:43:34 +01:00
|
|
|
|
|
|
|
if (!package->isValid()) {
|
2011-07-29 15:46:52 +02:00
|
|
|
#ifndef NDEBUG
|
2010-03-23 23:43:34 +01:00
|
|
|
kDebug() << "Invalid Runner package at" << path;
|
2011-07-29 15:46:52 +02:00
|
|
|
#endif
|
2010-03-23 23:43:34 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
script = Plasma::loadScriptEngine(api, runner);
|
|
|
|
if (!script) {
|
|
|
|
delete package;
|
|
|
|
package = 0;
|
|
|
|
}
|
2009-11-11 01:25:27 +01:00
|
|
|
}
|
|
|
|
|
2009-11-12 07:38:16 +01:00
|
|
|
// put all setup routines for script here. at this point we can assume that
|
|
|
|
// package exists and that we have a script engine
|
|
|
|
void AbstractRunnerPrivate::setupScriptSupport()
|
|
|
|
{
|
|
|
|
if (!package) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-07-29 15:46:52 +02:00
|
|
|
#ifndef NDEBUG
|
2009-11-12 07:38:16 +01:00
|
|
|
kDebug() << "setting up script support, package is in" << package->path()
|
|
|
|
<< ", main script is" << package->filePath("mainscript");
|
2011-07-29 15:46:52 +02:00
|
|
|
#endif
|
2009-11-12 07:38:16 +01:00
|
|
|
|
2011-05-31 00:12:57 +02:00
|
|
|
const QString translationsPath = package->filePath("translations");
|
2009-11-12 07:38:16 +01:00
|
|
|
if (!translationsPath.isEmpty()) {
|
|
|
|
KGlobal::dirs()->addResourceDir("locale", translationsPath);
|
2012-11-18 20:26:13 +01:00
|
|
|
KLocalizedString::insertCatalog(runnerDescription.pluginName());
|
2009-11-12 07:38:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
} // Plasma namespace
|
|
|
|
|
2012-02-08 23:33:03 +01:00
|
|
|
|
|
|
|
#include "moc_abstractrunner.cpp"
|