]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Have "Replace Location" toggle focus of the view
authorFelix Ernst <felixernst@zohomail.eu>
Mon, 28 Oct 2024 02:22:05 +0000 (03:22 +0100)
committerMéven Car <meven@kde.org>
Thu, 31 Oct 2024 16:28:02 +0000 (16:28 +0000)
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.

src/dolphinmainwindow.cpp

index a8ef550d68cdf527ff4e5c7080532e5518a509e8..7df17886ba806d4b44fa3fd7216ee62087843c90 100644 (file)
@@ -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();