]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.cpp
Update searchbox on URL changes (Fix D24369)
[dolphin.git] / src / dolphinviewcontainer.cpp
index 585610550573c4c1962edf0276fc76ffdcae57b3..c6d9d89ad9fffb50218c105155dfb78a5ee816e8 100644 (file)
@@ -385,6 +385,11 @@ bool DolphinViewContainer::isFilterBarVisible() const
 
 void DolphinViewContainer::setSearchModeEnabled(bool enabled)
 {
+    if (enabled) {
+        const QUrl& locationUrl = m_urlNavigator->locationUrl();
+        m_searchBox->fromSearchUrl(locationUrl);
+    }
+
     if (enabled == isSearchModeEnabled()) {
         if (enabled && !m_searchBox->hasFocus()) {
             m_searchBox->setFocus();
@@ -396,10 +401,7 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled)
     m_searchBox->setVisible(enabled);
     m_navigatorWidget->setVisible(!enabled);
 
-    if (enabled) {
-        const QUrl& locationUrl = m_urlNavigator->locationUrl();
-        m_searchBox->fromSearchUrl(locationUrl);
-    } else {
+    if (!enabled) {
         m_view->setViewPropertiesContext(QString());
 
         // Restore the URL for the URL navigator. If Dolphin has been
@@ -426,7 +428,7 @@ QString DolphinViewContainer::placesText() const
     if (isSearchModeEnabled()) {
         text = i18n("Search for %1 in %2", m_searchBox->text(), m_searchBox->searchPath().fileName());
     } else {
-        text = url().fileName();
+        text = url().adjusted(QUrl::StripTrailingSlash).fileName();
         if (text.isEmpty()) {
             text = url().host();
         }