]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Move focus from hiding selection mode bars to view
authorFelix Ernst <felixernst@zohomail.eu>
Fri, 23 Jun 2023 17:07:10 +0000 (19:07 +0200)
committerFelix Ernst <felixernst@kde.org>
Wed, 28 Jun 2023 16:35:56 +0000 (16:35 +0000)
When a user exits selection mode for example by clicking the "Exit
Selection Mode" button, the bar is closed but the focus doesn't return
to the view which would be expected. This commit actively moves the
focus to the view in such a scenario.

BUG: 469621

src/dolphinviewcontainer.cpp

index 8627891c053d92f40e1eda0765532efa38a17c22..5a4540786a39ad9d5ad6802ead7852fe211d38e3 100644 (file)
@@ -37,6 +37,7 @@
 #include <KProtocolManager>
 #include <KShell>
 
+#include <QApplication>
 #include <QDesktopServices>
 #include <QDropEvent>
 #include <QGridLayout>
@@ -343,6 +344,9 @@ void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollecti
         }
         Q_CHECK_PTR(m_selectionModeTopBar); // there is no point in disabling selectionMode when it wasn't even enabled once.
         Q_CHECK_PTR(m_selectionModeBottomBar);
+        if (m_selectionModeTopBar->isAncestorOf(QApplication::focusWidget()) || m_selectionModeBottomBar->isAncestorOf(QApplication::focusWidget())) {
+            m_view->setFocus();
+        }
         m_selectionModeTopBar->setVisible(false, WithAnimation);
         m_selectionModeBottomBar->setVisible(false, WithAnimation);
         Q_EMIT selectionModeChanged(false);