]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/search/dolphinquery.cpp
DolphinQuery: Use prettier URL particularly for local paths
[dolphin.git] / src / search / dolphinquery.cpp
index e23f1f08e9cbe7c1a6ffda9dae479925a1b63979..100bac4d078004131a859a7d69cb94c9c2738de5 100644 (file)
@@ -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.