slightly smarter handling of single runners

This commit is contained in:
Aaron Seigo 2013-02-13 13:50:45 +01:00
parent 78a5f5e2c5
commit 2203be8e13

View File

@ -716,10 +716,14 @@ void RunnerManager::launchQuery(const QString &untrimmedTerm, const QString &run
QString term = untrimmedTerm.trimmed(); QString term = untrimmedTerm.trimmed();
setSingleModeRunnerId(runnerName); setSingleModeRunnerId(runnerName);
setSingleMode(!runnerName.isEmpty()); setSingleMode(d->currentSingleRunner);
if (!runnerName.isEmpty() && !d->currentSingleRunner) {
reset();
return;
}
if (term.isEmpty()) { if (term.isEmpty()) {
if (d->singleMode && d->currentSingleRunner && d->currentSingleRunner->defaultSyntax()) { if (d->singleMode && d->currentSingleRunner->defaultSyntax()) {
term = d->currentSingleRunner->defaultSyntax()->exampleQueries().first().remove(QRegExp(":q:")); term = d->currentSingleRunner->defaultSyntax()->exampleQueries().first().remove(QRegExp(":q:"));
} else { } else {
reset(); reset();
@ -732,12 +736,7 @@ void RunnerManager::launchQuery(const QString &untrimmedTerm, const QString &run
return; return;
} }
if (d->singleMode && !d->currentSingleRunner) { if (!d->singleMode && d->runners.isEmpty()) {
reset();
return;
}
if (d->runners.isEmpty()) {
d->loadRunners(); d->loadRunners();
} }
@ -748,7 +747,7 @@ void RunnerManager::launchQuery(const QString &untrimmedTerm, const QString &run
QHash<QString, AbstractRunner*> runable; QHash<QString, AbstractRunner*> runable;
//if the name is not empty we will launch only the specified runner //if the name is not empty we will launch only the specified runner
if (d->singleMode && d->currentSingleRunner) { if (d->singleMode) {
runable.insert(QString(), d->currentSingleRunner); runable.insert(QString(), d->currentSingleRunner);
d->context.setSingleRunnerQueryMode(true); d->context.setSingleRunnerQueryMode(true);
} else { } else {