Commit f9a679a7 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Allow the RunnerManager to decide which plugins to load

If no runners are explicitly specified the RunnerManager will read the enabled plugins from the krunnerrc file. This way enabled plugins are configurable and consistent with KRunner.
parent e13ef603
...@@ -247,9 +247,32 @@ void RunnerModel::matchesChanged(const QList<Plasma::QueryMatch> &matches) ...@@ -247,9 +247,32 @@ void RunnerModel::matchesChanged(const QList<Plasma::QueryMatch> &matches)
} }
QList<Plasma::QueryMatch> matches; QList<Plasma::QueryMatch> matches;
// To preserve the old behavior when allowing all runners we use static sorting
foreach (const QString &runnerId, m_runners) { const static QStringList runnerIds = {QStringLiteral("desktopsessions"),
matches.append(matchesForRunner.take(runnerId)); QStringLiteral("services"),
QStringLiteral("places"),
QStringLiteral("PowerDevil"),
QStringLiteral("calculator"),
QStringLiteral("unitconverter"),
QStringLiteral("shell"),
QStringLiteral("bookmarks"),
QStringLiteral("recentdocuments"),
QStringLiteral("locations")};
if (m_runners.isEmpty()) {
const auto baloo = matchesForRunner.take(QStringLiteral("baloosearch"));
const auto appstream = matchesForRunner.take(QStringLiteral("krunner_appstream"));
for (const QString &runnerId : runnerIds) {
matches.append(matchesForRunner.take(runnerId));
}
for (const auto &match : matchesForRunner) {
matches.append(match);
}
matches.append(baloo);
matches.append(appstream);
} else {
for (const QString &runnerId : qAsConst(m_runners)) {
matches.append(matchesForRunner.take(runnerId));
}
} }
matchesModel->setMatches(matches); matchesModel->setMatches(matches);
...@@ -309,8 +332,12 @@ void RunnerModel::matchesChanged(const QList<Plasma::QueryMatch> &matches) ...@@ -309,8 +332,12 @@ void RunnerModel::matchesChanged(const QList<Plasma::QueryMatch> &matches)
void RunnerModel::createManager() void RunnerModel::createManager()
{ {
if (!m_runnerManager) { if (!m_runnerManager) {
m_runnerManager = new Plasma::RunnerManager(this); // FIXME: Which KConfigGroup is this using now? m_runnerManager = new Plasma::RunnerManager(QStringLiteral("krunnerrc"), this);
m_runnerManager->setAllowedRunners(m_runners); if (m_runners.isEmpty()) {
m_runnerManager->enableKNotifyPluginWatcher();
} else {
m_runnerManager->setAllowedRunners(m_runners);
}
connect(m_runnerManager, &Plasma::RunnerManager::matchesChanged, connect(m_runnerManager, &Plasma::RunnerManager::matchesChanged,
this, &RunnerModel::matchesChanged); this, &RunnerModel::matchesChanged);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment