]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.cpp
Provide a default name when adding a search query to the places panel
[dolphin.git] / src / dolphinviewcontainer.cpp
index 7c7d7d309173055888e527ed54d0af983e394b3b..4d3f1983bc1dcdf6068ad35df6f1c18db769cddb 100644 (file)
@@ -316,6 +316,22 @@ bool DolphinViewContainer::isSearchModeEnabled() const
     return m_searchBox->isVisible();
 }
 
+QString DolphinViewContainer::placesText() const
+{
+    QString text;
+
+    if (isSearchModeEnabled()) {
+        text = m_searchBox->searchPath().fileName() + QLatin1String(": ") + m_searchBox->text();
+    } else {
+        text = url().fileName();
+        if (text.isEmpty()) {
+            text = url().host();
+        }
+    }
+
+    return text;
+}
+
 void DolphinViewContainer::setUrl(const KUrl& newUrl)
 {
     if (newUrl != m_urlNavigator->locationUrl()) {