From b67c5478eaa2808028ec511086f01f34230a9277 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 5 Jun 2025 21:07:57 +0200 Subject: [PATCH] DolphinQuery: Use prettier URL particularly for local paths Use toLocalFile() to avoid the 'file://' prefix and use KShell::tildeCollapse that collapses the home path into ~ as is done in many other places. Also strip trailing slash for the other URLs. --- src/search/dolphinquery.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/search/dolphinquery.cpp b/src/search/dolphinquery.cpp index e23f1f08e..100bac4d0 100644 --- a/src/search/dolphinquery.cpp +++ b/src/search/dolphinquery.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -366,7 +367,11 @@ QString DolphinQuery::title() const prettySearchLocation = m_searchPath.fileName(); } if (prettySearchLocation.isEmpty()) { - prettySearchLocation = m_searchPath.toString(QUrl::RemoveAuthority); + if (m_searchPath.isLocalFile()) { + prettySearchLocation = KShell::tildeCollapse(m_searchPath.adjusted(QUrl::StripTrailingSlash).toLocalFile()); + } else { + prettySearchLocation = m_searchPath.toString(QUrl::RemoveAuthority | QUrl::StripTrailingSlash); + } } // A great title clearly identifies a search results page among many tabs, windows, or links in the Places panel. -- 2.47.3