From 35b309aa3efac59b12e0c6bfc127516649f8cfa2 Mon Sep 17 00:00:00 2001 From: Pan Zhang Date: Mon, 16 Mar 2026 16:23:55 +0800 Subject: dolphinviewcontainer: Avoid adding an extra history entry when leaving search results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When navigating away from a search result, hiding the search bar unintentionally emitted urlChangeRequested(searchPath). This inserted an extra navigation step into the history, causing the “Back” button to require multiple presses to return to the search results. Introduce Search::Bar::HideBehavior to allow callers to hide the search bar without triggering a URL change, and use it when the bar is automatically hidden due to non-search navigation. BUG: 515236 --- src/search/bar.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/search/bar.cpp') diff --git a/src/search/bar.cpp b/src/search/bar.cpp index 851eef942..7e31cb0f2 100644 --- a/src/search/bar.cpp +++ b/src/search/bar.cpp @@ -187,11 +187,13 @@ void Bar::selectAll() m_searchTermEditor->selectAll(); } -void Bar::setVisible(bool visible, Animated animated) +void Bar::setVisible(bool visible, Animated animated, HideBehavior hideBehavior) { if (!visible) { m_startSearchTimer->stop(); - Q_EMIT urlChangeRequested(m_searchConfiguration->searchPath()); + if (hideBehavior == HideBehavior::RestoreUrl) { + Q_EMIT urlChangeRequested(m_searchConfiguration->searchPath()); + } if (isAncestorOf(QApplication::focusWidget())) { Q_EMIT focusViewRequest(); } -- cgit v1.3