From 3f8e50f9b2fb35db190ce0204981f3f02d1d5ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 20 May 2021 11:24:06 +0100 Subject: [PATCH] merge handlers into single toggle handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic168e3e0d06d732642dc222f5a3dd056fdb74b6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115862 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- dbaccess/source/ui/inc/WCPage.hxx | 3 +-- dbaccess/source/ui/misc/WCPage.cxx | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx index d56f983199bb..f340d0c4757e 100644 --- a/dbaccess/source/ui/inc/WCPage.hxx +++ b/dbaccess/source/ui/inc/WCPage.hxx @@ -40,8 +40,7 @@ namespace dbaui std::unique_ptr m_xFT_KeyName; std::unique_ptr m_xEdKeyName; - DECL_LINK( AppendDataClickHdl, weld::Button&, void ); - DECL_LINK( RadioChangeHdl, weld::Button&, void ); + DECL_LINK( RadioChangeHdl, weld::ToggleButton&, void ); DECL_LINK( KeyClickHdl, weld::ToggleButton&, void ); bool checkAppendData(); diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx index 3362f17250fe..64abfd101dfd 100644 --- a/dbaccess/source/ui/misc/WCPage.cxx +++ b/dbaccess/source/ui/misc/WCPage.cxx @@ -66,13 +66,12 @@ OCopyTable::OCopyTable(weld::Container* pPage, OCopyTableWizard* pWizard) m_xCB_PrimaryColumn->set_sensitive(m_bPKeyAllowed); - m_xRB_AppendData->connect_clicked( LINK( this, OCopyTable, AppendDataClickHdl ) ); + m_xRB_AppendData->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) ); + m_xRB_DefData->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) ); + m_xRB_Def->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) ); + m_xRB_View->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) ); - m_xRB_DefData->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) ); - m_xRB_Def->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) ); - m_xRB_View->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) ); - - m_xCB_PrimaryColumn->connect_toggled(LINK( this, OCopyTable, KeyClickHdl ) ); + m_xCB_PrimaryColumn->connect_toggled(LINK( this, OCopyTable, KeyClickHdl ) ); m_xFT_KeyName->set_sensitive(false); m_xEdKeyName->set_sensitive(false); @@ -89,11 +88,6 @@ OCopyTable::~OCopyTable() { } -IMPL_LINK_NOARG( OCopyTable, AppendDataClickHdl, weld::Button&, void ) -{ - SetAppendDataRadio(); -} - void OCopyTable::SetAppendDataRadio() { m_pParent->EnableNextButton(true); @@ -103,10 +97,17 @@ void OCopyTable::SetAppendDataRadio() m_pParent->setOperation(CopyTableOperation::AppendData); } -IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Button&, rButton, void) +IMPL_LINK(OCopyTable, RadioChangeHdl, weld::ToggleButton&, rButton, void) { - m_pParent->EnableNextButton(&rButton != m_xRB_View.get()); - bool bKey = m_bPKeyAllowed && &rButton != m_xRB_View.get(); + if (!rButton.get_active()) + return; + if (m_xRB_AppendData->get_active()) + { + SetAppendDataRadio(); + return; + } + m_pParent->EnableNextButton(m_xRB_View->get_active()); + bool bKey = m_bPKeyAllowed && m_xRB_View->get_active(); m_xFT_KeyName->set_sensitive(bKey && m_xCB_PrimaryColumn->get_active()); m_xEdKeyName->set_sensitive(bKey && m_xCB_PrimaryColumn->get_active()); m_xCB_PrimaryColumn->set_sensitive(bKey);