* re-enable the scripting support
* pepper with (commented out) debug that was useful in figuring out what wasn't working with all these changes svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=804740
This commit is contained in:
parent
6ea602b848
commit
498a59f479
|
@ -162,7 +162,6 @@ FindMatchesJob::FindMatchesJob( const QString& term, Plasma::AbstractRunner* run
|
||||||
m_context(context),
|
m_context(context),
|
||||||
m_runner(runner)
|
m_runner(runner)
|
||||||
{
|
{
|
||||||
// setObjectName( runner->objectName() );
|
|
||||||
if (runner->speed() == Plasma::AbstractRunner::SlowSpeed) {
|
if (runner->speed() == Plasma::AbstractRunner::SlowSpeed) {
|
||||||
assignQueuePolicy(&RunnerRestrictionPolicy::instance());
|
assignQueuePolicy(&RunnerRestrictionPolicy::instance());
|
||||||
}
|
}
|
||||||
|
@ -227,6 +226,7 @@ public:
|
||||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");
|
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");
|
||||||
QString error;
|
QString error;
|
||||||
foreach (const KService::Ptr &service, offers) {
|
foreach (const KService::Ptr &service, offers) {
|
||||||
|
//kDebug() << "Loading runner: " << service->name() << service->storageId();
|
||||||
KPluginInfo description(service);
|
KPluginInfo description(service);
|
||||||
QString runnerName = description.pluginName();
|
QString runnerName = description.pluginName();
|
||||||
if (blacklist.contains(runnerName)) {
|
if (blacklist.contains(runnerName)) {
|
||||||
|
@ -241,12 +241,12 @@ public:
|
||||||
args << service->storageId();
|
args << service->storageId();
|
||||||
runner = service->createInstance<AbstractRunner>(q, args, &error);
|
runner = service->createInstance<AbstractRunner>(q, args, &error);
|
||||||
} else {
|
} else {
|
||||||
//FIXME: this line should be uncommented, but the constructor is protected
|
//kDebug() << "got a script runner known as" << api;
|
||||||
//runner = new AbstractRunner(q, service->storageId());
|
runner = new AbstractRunner(q, service->storageId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runner) {
|
if (runner) {
|
||||||
// kDebug() << "loading runner: " << service->name();
|
//kDebug() << "loading runner: " << service->name();
|
||||||
QString phase = service->property("X-Plasma-RunnerPhase").toString();
|
QString phase = service->property("X-Plasma-RunnerPhase").toString();
|
||||||
if (phase == "last") {
|
if (phase == "last") {
|
||||||
lastRunners.append(runner);
|
lastRunners.append(runner);
|
||||||
|
@ -263,16 +263,16 @@ public:
|
||||||
firstRunners << normalRunners << lastRunners;
|
firstRunners << normalRunners << lastRunners;
|
||||||
runners.clear();
|
runners.clear();
|
||||||
runners = firstRunners;
|
runners = firstRunners;
|
||||||
kDebug() << "All runners loaded, total:" << runners.count();
|
//kDebug() << "All runners loaded, total:" << runners.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
RunnerManager *q;
|
RunnerManager *q;
|
||||||
RunnerContext context;
|
RunnerContext context;
|
||||||
AbstractRunner::List runners;
|
AbstractRunner::List runners;
|
||||||
QList<ThreadWeaver::Job*> searchJobs;
|
QList<ThreadWeaver::Job*> searchJobs;
|
||||||
QStringList prioritylist;
|
QStringList prioritylist;
|
||||||
QStringList blacklist;
|
QStringList blacklist;
|
||||||
KConfigGroup config;
|
KConfigGroup config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -313,6 +313,7 @@ AbstractRunner* RunnerManager::runner(const QString &name) const
|
||||||
{
|
{
|
||||||
//TODO: using a list of runners, if this gets slow, switch to hash
|
//TODO: using a list of runners, if this gets slow, switch to hash
|
||||||
foreach (Plasma::AbstractRunner* runner, d->runners) {
|
foreach (Plasma::AbstractRunner* runner, d->runners) {
|
||||||
|
//kDebug() << "comparing" << name << "with" << runner->id() << runner->name();
|
||||||
if (name == runner->id()) {
|
if (name == runner->id()) {
|
||||||
return runner;
|
return runner;
|
||||||
}
|
}
|
||||||
|
@ -375,7 +376,7 @@ void RunnerManager::launchQuery (const QString & term, const QString & runnerNam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RunnerManager::execQuery(const QString & term, const QString & runnerName)
|
bool RunnerManager::execQuery(const QString &term, const QString &runnerName)
|
||||||
{
|
{
|
||||||
if (term.isEmpty()) {
|
if (term.isEmpty()) {
|
||||||
reset();
|
reset();
|
||||||
|
@ -384,24 +385,27 @@ bool RunnerManager::execQuery(const QString & term, const QString & runnerName)
|
||||||
|
|
||||||
if (d->context.query() == term) {
|
if (d->context.query() == term) {
|
||||||
// we already are searching for this!
|
// we already are searching for this!
|
||||||
|
emit matchesChanged(d->context.matches());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
// kDebug() << "executing query about " << term << "on" << runnerName;
|
//kDebug() << "executing query about " << term << "on" << runnerName;
|
||||||
d->context.setQuery(term);
|
d->context.setQuery(term);
|
||||||
|
|
||||||
AbstractRunner *r = runner(runnerName);
|
AbstractRunner *r = runner(runnerName);
|
||||||
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
|
//kDebug() << "failed to find the runner";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r->ignoredTypes() & d->context.type()) != 0) {
|
if ((r->ignoredTypes() & d->context.type()) != 0) {
|
||||||
|
//kDebug() << "ignored!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
r->performMatch(d->context);
|
r->performMatch(d->context);
|
||||||
|
//kDebug() << "succeeded with" << d->context.matches().count() << "results";
|
||||||
emit matchesChanged(d->context.matches());
|
emit matchesChanged(d->context.matches());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user