Commit 2969719c authored by Alexander Lohnau's avatar Alexander Lohnau 💬

Port away from deprecated KRunner methods

parent 694ab684
......@@ -34,7 +34,7 @@ ActivityRunner::ActivityRunner(QObject *parent, const QVariantList &args)
setObjectName(QStringLiteral("Activities"));
setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File |
Plasma::RunnerContext::NetworkLocation | Plasma::RunnerContext::Help);
setDefaultSyntax(Plasma::RunnerSyntax(m_keywordi18n, i18n("Lists all activities currently available to be run.")));
addSyntax(Plasma::RunnerSyntax(m_keywordi18n, i18n("Lists all activities currently available to be run.")));
addSyntax(Plasma::RunnerSyntax(i18nc("KRunner keyword", "activity :q:"), i18n("Switches to activity :q:.")));
qRegisterMetaType<KActivities::Consumer::ServiceStatus>();
......
......@@ -44,7 +44,7 @@ BookmarksRunner::BookmarksRunner( QObject* parent, const QVariantList &args )
{
setObjectName(QStringLiteral("Bookmarks"));
addSyntax(Plasma::RunnerSyntax(QStringLiteral(":q:"), i18n("Finds web browser bookmarks matching :q:.")));
setDefaultSyntax(Plasma::RunnerSyntax(i18nc("list of all web browser bookmarks", "bookmarks"),
addSyntax(Plasma::RunnerSyntax(i18nc("list of all web browser bookmarks", "bookmarks"),
i18n("List all web browser bookmarks")));
connect(this, &Plasma::AbstractRunner::prepare, this, &BookmarksRunner::prep);
......
......@@ -38,7 +38,6 @@ PlacesRunner::PlacesRunner(QObject* parent, const QVariantList &args)
{
setObjectName(QStringLiteral("Places"));
Plasma::RunnerSyntax defaultSyntax(i18n("places"), i18n("Lists all file manager locations"));
setDefaultSyntax(defaultSyntax);
addSyntax(defaultSyntax);
addSyntax(Plasma::RunnerSyntax(QStringLiteral(":q:"), i18n("Finds file manager locations that match :q:")));
......@@ -120,7 +119,7 @@ void PlacesRunnerHelper::match(Plasma::RunnerContext *c)
// Add category as subtext so one can tell "Pictures" folder from "Search for Pictures"
// Don't add it if it would match the category ("Places") of the runner to avoid "Places: Pictures (Places)"
const QString groupName = m_places.data(current_index, KFilePlacesModel::GroupRole).toString();
if (!groupName.isEmpty() && !static_cast<PlacesRunner *>(parent())->categories().contains(groupName)) {
if (!groupName.isEmpty() && static_cast<PlacesRunner *>(parent())->name() != groupName) {
match.setSubtext(groupName);
}
......
......@@ -421,23 +421,6 @@ ServiceRunner::ServiceRunner(QObject *parent, const QVariantList &args)
ServiceRunner::~ServiceRunner() = default;
QStringList ServiceRunner::categories() const
{
return {i18n("Applications"), i18n("System Settings")};
}
QIcon ServiceRunner::categoryIcon(const QString& category) const
{
if (category == i18n("Applications")) {
return QIcon::fromTheme(QStringLiteral("applications-other"));
} else if (category == i18n("System Settings")) {
return QIcon::fromTheme(QStringLiteral("preferences-system"));
}
return Plasma::AbstractRunner::categoryIcon(category);
}
void ServiceRunner::match(Plasma::RunnerContext &context)
{
// This helper class aids in keeping state across numerous
......
......@@ -42,8 +42,6 @@ class ServiceRunner : public Plasma::AbstractRunner
void match(Plasma::RunnerContext &context) override;
void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) override;
QStringList categories() const override;
QIcon categoryIcon(const QString& category) const override;
protected Q_SLOTS:
QMimeData * mimeDataForMatch(const Plasma::QueryMatch &match) override;
......
......@@ -65,7 +65,7 @@ SessionRunner::SessionRunner(QObject *parent, const QVariantList &args)
addSyntax(fastUserSwitchSyntax);
//"SESSIONS" should not be translated; it's used programmaticaly
setDefaultSyntax(Plasma::RunnerSyntax(QStringLiteral("SESSIONS"), i18n("Lists all sessions")));
addSyntax(Plasma::RunnerSyntax(QStringLiteral("SESSIONS"), i18n("Lists all sessions")));
}
......
......@@ -40,7 +40,7 @@ WindowedWidgetsRunner::WindowedWidgetsRunner(QObject *parent, const QVariantList
setPriority(AbstractRunner::HighestPriority);
addSyntax(Plasma::RunnerSyntax(QStringLiteral(":q:"), i18n("Finds Plasma widgets whose name or description match :q:")));
setDefaultSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "mobile applications"), i18n("list all Plasma widgets that can run as standalone applications")));
addSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "mobile applications"), i18n("list all Plasma widgets that can run as standalone applications")));
}
WindowedWidgetsRunner::~WindowedWidgetsRunner()
......
......@@ -48,7 +48,7 @@ WindowsRunner::WindowsRunner(QObject* parent, const QVariantList& args)
"It is possible to interact with the windows by using one of the following keywords: "
"activate, close, min(imize), max(imize), fullscreen, shade, keep above and keep below.")));
addSyntax(Plasma::RunnerSyntax(QStringLiteral(":q:"), i18n("Switch to desktop named :q:")));
setDefaultSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "window"),
addSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "window"),
i18n("Lists all windows and allows to activate them. "
"With name=, class=, role= and desktop= the list can be reduced to "
"windows matching these restrictions. "
......
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