]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.cpp
Update searchbox on URL changes (Fix D24369)
[dolphin.git] / src / dolphinviewcontainer.cpp
index 98b812497986f472efb9360815633af928fa21a0..13b88f601f3d311afa55649004b96410c3aae864 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();
@@ -673,15 +678,11 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url)
     slotReturnPressed();
 
     if (KProtocolManager::supportsListing(url)) {
-        const bool searchUrl = isSearchUrl(url);
-        if (searchUrl) {
-            m_searchBox->fromSearchUrl(url);
-        }
-        setSearchModeEnabled(searchUrl);
+        setSearchModeEnabled(isSearchUrl(url));
         m_view->setUrl(url);
         tryRestoreViewState();
 
-        if (m_autoGrabFocus && isActive() && !searchUrl) {
+        if (m_autoGrabFocus && isActive() && !isSearchUrl(url)) {
             // When an URL has been entered, the view should get the focus.
             // The focus must be requested asynchronously, as changing the URL might create
             // a new view widget.