diff options
| author | Kai Uwe Broulik <[email protected]> | 2025-06-05 21:07:57 +0200 |
|---|---|---|
| committer | Kai Uwe Broulik <[email protected]> | 2025-06-05 21:13:55 +0200 |
| commit | b67c5478eaa2808028ec511086f01f34230a9277 (patch) | |
| tree | 0739001bd6cc98180c81268b35f79b86feaa8ad3 | |
| parent | a35af3a0d2022a23c5a1cc30d693141a13673b8f (diff) | |
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.
| -rw-r--r-- | src/search/dolphinquery.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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 <KFileMetaData/TypeInfo> #include <KLocalizedString> +#include <KShell> #include <QRegularExpression> #include <QUrlQuery> @@ -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. |
