┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2025-06-05 21:07:57 +0200
committerKai Uwe Broulik <[email protected]>2025-06-05 21:13:55 +0200
commitb67c5478eaa2808028ec511086f01f34230a9277 (patch)
tree0739001bd6cc98180c81268b35f79b86feaa8ad3 /src
parenta35af3a0d2022a23c5a1cc30d693141a13673b8f (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.
Diffstat (limited to 'src')
-rw-r--r--src/search/dolphinquery.cpp7
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.