From f896fb554e8e52ca47216496f6828acc2b38e36a Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 2 Jul 2018 14:46:51 +0200 Subject: [PATCH] [Places Runner] Add place category as subtext This allows to tell between "Pictures" location and "Search for Pictures". Differential Revision: https://phabricator.kde.org/D13844 --- runners/places/placesrunner.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/runners/places/placesrunner.cpp b/runners/places/placesrunner.cpp index 18ab20141..7102ebdfc 100644 --- a/runners/places/placesrunner.cpp +++ b/runners/places/placesrunner.cpp @@ -119,6 +119,13 @@ void PlacesRunnerHelper::match(Plasma::RunnerContext *c) match.setIcon(m_places.icon(current_index)); match.setText(text); + // 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(parent())->categories().contains(groupName)) { + match.setSubtext(groupName); + } + //if we have to mount it set the device udi instead of the URL, as we can't open it directly if (m_places.isDevice(current_index) && m_places.setupNeeded(current_index)) { const QString udi = m_places.deviceForIndex(current_index).udi();