1
0
mirror of https://invent.kde.org/system/dolphin synced 2024-07-04 17:30:55 +00:00

Set viewFocus when DolphinViewContainer state is consistent

Read Felix' comment here: https://invent.kde.org/system/dolphin/-/merge_requests/679#note_835657

In short: 
> The above change moves the `m_view->setFocus()` towards a point in time in 
> which `DolphinViewContainer`'s selection mode state is consistent again.

BUG:478724
This commit is contained in:
Akseli Lahtinen 2023-12-22 08:29:40 +00:00
parent 425fc930a6
commit 7043ae1100

View File

@ -326,12 +326,13 @@ 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);
if (m_selectionModeTopBar->isAncestorOf(QApplication::focusWidget()) || m_selectionModeBottomBar->isAncestorOf(QApplication::focusWidget())) {
m_view->setFocus();
}
return;
}