]> cloud.milkyroute.net Git - dolphin.git/commitdiff
DolphinViewContainer: Keep search box open when URL is changed
authorAmol Godbole <amolagodbole@gmail.com>
Wed, 4 Oct 2023 02:38:47 +0000 (21:38 -0500)
committerFelix Ernst <felixernst@kde.org>
Thu, 5 Oct 2023 09:43:23 +0000 (09:43 +0000)
The search box was being automatically closed whenever the URL is changed.
Keep the search box open if no search text had been entered when the URL
was changed.

BUG: 474951

src/dolphinviewcontainer.cpp

index 66a9a116ac3cf487fe65aa74e3ab21f7d782b564..5b2a318d679f2e299b9a5c20166941aad7f61c68 100644 (file)
@@ -818,11 +818,13 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl &url)
     }
 
     if (KProtocolManager::supportsListing(url)) {
-        setSearchModeEnabled(isSearchUrl(url));
+        const bool searchBoxInitialized = isSearchModeEnabled() && m_searchBox->text().isEmpty();
+        setSearchModeEnabled(isSearchUrl(url) || searchBoxInitialized);
+
         m_view->setUrl(url);
         tryRestoreViewState();
 
-        if (m_autoGrabFocus && isActive() && !isSearchUrl(url)) {
+        if (m_autoGrabFocus && isActive() && !isSearchModeEnabled()) {
             // 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.