merge handlers into single toggle handler

Change-Id: Ic168e3e0d06d732642dc222f5a3dd056fdb74b6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115862
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2021-05-20 11:24:06 +01:00
parent 256c834c30
commit 3f8e50f9b2
2 changed files with 16 additions and 16 deletions

View file

@ -40,8 +40,7 @@ namespace dbaui
std::unique_ptr<weld::Label> m_xFT_KeyName;
std::unique_ptr<weld::Entry> 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();

View file

@ -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);