[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
wilder-5.14
Kai Uwe Broulik 8 years ago
parent 5a951e9a7e
commit f896fb554e
  1. 7
      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<PlacesRunner *>(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();

Loading…
Cancel
Save