From: Felix Ernst Date: Mon, 28 Oct 2024 02:22:05 +0000 (+0100) Subject: Have "Replace Location" toggle focus of the view X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/f6d90c92b9c3f53c57313931fd8b92e9fcd44d1c Have "Replace Location" toggle focus of the view The "Replace Location" action moves focus to the location bar and selects the full path there so it can easily be replaced with a different path. When the full path is already selected, triggering "Replace Location" will toggle the editable state of the location bar. This commit makes it, that this also moves the focus to the view. This way, pressing Ctrl+L multiple times will switch back and forth between focusing and selecting the location bar path and focusing the view. This seems more sensible than only partially resetting the state when the "Replace Location" keyboard shortcut is pressed twice. --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index a8ef550d6..7df17886b 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1129,8 +1129,10 @@ void DolphinMainWindow::replaceLocation() // If the text field currently has focus and everything is selected, // pressing the keyboard shortcut returns the whole thing to breadcrumb mode + // and goes back to the view, just like how it was before this action was triggered the first time. if (navigator->isUrlEditable() && lineEdit->hasFocus() && lineEdit->selectedText() == lineEdit->text()) { navigator->setUrlEditable(false); + m_activeViewContainer->view()->setFocus(); } else { navigator->setUrlEditable(true); navigator->setFocus();