From a5a71167bae2fdb1d5d2c4dbdb2ca4c3c12f65bd Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Mon, 3 Jan 2022 14:19:13 +0100 Subject: [PATCH] Export KRunner QueryMatch::isMultiLine in Kicker model This way we can enable styled text for the multiline results. This is utilized by the helprunner. --- applets/kicker/plugin/abstractmodel.cpp | 1 + applets/kicker/plugin/actionlist.h | 1 + applets/kicker/plugin/runnermatchesmodel.cpp | 2 ++ 3 files changed, 4 insertions(+) diff --git a/applets/kicker/plugin/abstractmodel.cpp b/applets/kicker/plugin/abstractmodel.cpp index 63119a968..44f81e3f8 100644 --- a/applets/kicker/plugin/abstractmodel.cpp +++ b/applets/kicker/plugin/abstractmodel.cpp @@ -33,6 +33,7 @@ QHash AbstractModel::roleNames() const roles.insert(Kicker::ActionListRole, "actionList"); roles.insert(Kicker::UrlRole, "url"); roles.insert(Kicker::DisabledRole, "disabled"); + roles.insert(Kicker::IsMultilineTextRole, "isMultilineText"); return roles; } diff --git a/applets/kicker/plugin/actionlist.h b/applets/kicker/plugin/actionlist.h index 6cb203f42..32aabdc89 100644 --- a/applets/kicker/plugin/actionlist.h +++ b/applets/kicker/plugin/actionlist.h @@ -27,6 +27,7 @@ enum { ActionListRole, UrlRole, DisabledRole, + IsMultilineTextRole, }; QVariantMap createActionItem(const QString &label, const QString &icon, const QString &actionId, const QVariant &argument = QVariant()); diff --git a/applets/kicker/plugin/runnermatchesmodel.cpp b/applets/kicker/plugin/runnermatchesmodel.cpp index 63ca9d849..4804d2e12 100644 --- a/applets/kicker/plugin/runnermatchesmodel.cpp +++ b/applets/kicker/plugin/runnermatchesmodel.cpp @@ -66,6 +66,8 @@ QVariant RunnerMatchesModel::data(const QModelIndex &index, int role) const } } else if (role == Kicker::HasActionListRole) { return match.runner()->id() == QLatin1String("services") || !match.runner()->findChildren().isEmpty(); + } else if (role == Kicker::IsMultilineTextRole) { + return match.isMultiLine(); } else if (role == Kicker::ActionListRole) { QVariantList actionList; const QList actions = m_runnerManager->actionsForMatch(match);