Related: tdf#147667 don't toggle radiobutton on mnemonic if it's not unique
which we already do with checkbuttons, and is what gtk also does when
this arises
Change-Id: I1b5a4c98bd5062f3a340a53a5d6d977a4af3e384
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130691
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index e9db1ee..328fcd3 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -520,9 +520,11 @@ void Window::ImplControlFocus( GetFocusFlags nFlags )
if (mpWindowImpl->maMnemonicActivateHdl.Call(*this))
return;
const bool bUniqueMnemonic(nFlags & GetFocusFlags::UniqueMnemonic);
if ( GetType() == WindowType::RADIOBUTTON )
{
if ( !static_cast<RadioButton*>(this)->IsChecked() )
if (bUniqueMnemonic && !static_cast<RadioButton*>(this)->IsChecked())
static_cast<RadioButton*>(this)->ImplCallClick( true, nFlags );
else
ImplGrabFocus( nFlags );
@@ -530,7 +532,7 @@ void Window::ImplControlFocus( GetFocusFlags nFlags )
else
{
ImplGrabFocus( nFlags );
if ( nFlags & GetFocusFlags::UniqueMnemonic )
if (bUniqueMnemonic)
{
if ( GetType() == WindowType::CHECKBOX )
static_cast<CheckBox*>(this)->ImplCheck();