sw/source/ui/envelp/labprt.cxx | 44 ++++++++++++++++++++--------------------- sw/source/ui/envelp/labprt.hxx | 3 +- 2 files changed, 24 insertions(+), 23 deletions(-)
New commits: commit 157fb80b9c147c2ab18cb81ee48eab0c8e54b36a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu May 20 11:12:38 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu May 20 16:44:07 2021 +0200 split handlers into button click and radiobutton toggle Change-Id: I375d75518b09a14dd3a5033f2be394fb3e891838 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115866 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx index edede9718984..b145fa3187b2 100644 --- a/sw/source/ui/envelp/labprt.cxx +++ b/sw/source/ui/envelp/labprt.cxx @@ -41,10 +41,10 @@ SwLabPrtPage::SwLabPrtPage(weld::Container* pPage, weld::DialogController* pCont SetExchangeSupport(); // Install handlers - Link<weld::Button&,void> aLk = LINK(this, SwLabPrtPage, CountHdl); - m_xPageButton->connect_clicked( aLk ); - m_xSingleButton->connect_clicked( aLk ); - m_xPrtSetup->connect_clicked( aLk ); + Link<weld::ToggleButton&,void> aLk = LINK(this, SwLabPrtPage, CountHdl); + m_xPageButton->connect_toggled(aLk); + m_xSingleButton->connect_toggled(aLk); + m_xPrtSetup->connect_clicked(LINK(this, SwLabPrtPage, PrtSetupHdl)); SvtCommandOptions aCmdOpts; if (aCmdOpts.Lookup(SvtCommandOptions::CMDOPTION_DISABLED, "Print")) @@ -58,30 +58,30 @@ SwLabPrtPage::~SwLabPrtPage() pPrinter.disposeAndClear(); } -IMPL_LINK( SwLabPrtPage, CountHdl, weld::Button&, rButton, void ) +IMPL_LINK( SwLabPrtPage, PrtSetupHdl, weld::Button&, rButton, void ) { - if (&rButton == m_xPrtSetup.get()) - { - // Call printer setup - if (!pPrinter) - pPrinter = VclPtr<Printer>::Create(); - - PrinterSetupDialog aDlg(GetFrameWeld()); - aDlg.SetPrinter(pPrinter); - aDlg.run(); - rButton.grab_focus(); - m_xPrinterInfo->set_label(pPrinter->GetName()); + // Call printer setup + if (!pPrinter) + pPrinter = VclPtr<Printer>::Create(); + + PrinterSetupDialog aDlg(GetFrameWeld()); + aDlg.SetPrinter(pPrinter); + aDlg.run(); + rButton.grab_focus(); + m_xPrinterInfo->set_label(pPrinter->GetName()); +} + +IMPL_LINK(SwLabPrtPage, CountHdl, weld::ToggleButton&, rButton, void) +{ + if (!rButton.get_active()) return; - } - const bool bEnable = &rButton == m_xSingleButton.get(); + + const bool bEnable = m_xSingleButton->get_active(); m_xSingleGrid->set_sensitive(bEnable); m_xSynchronCB->set_sensitive(!bEnable); - OSL_ENSURE(!bEnable || &rButton == m_xPageButton.get(), "NewButton?" ); - if ( bEnable ) - { + if (bEnable) m_xColField->grab_focus(); - } } std::unique_ptr<SfxTabPage> SwLabPrtPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet) diff --git a/sw/source/ui/envelp/labprt.hxx b/sw/source/ui/envelp/labprt.hxx index 4f1673a7215c..79b1e95f023f 100644 --- a/sw/source/ui/envelp/labprt.hxx +++ b/sw/source/ui/envelp/labprt.hxx @@ -40,7 +40,8 @@ class SwLabPrtPage : public SfxTabPage std::unique_ptr<weld::Label> m_xPrinterInfo; std::unique_ptr<weld::Button> m_xPrtSetup; - DECL_LINK(CountHdl, weld::Button&, void); + DECL_LINK(CountHdl, weld::ToggleButton&, void); + DECL_LINK(PrtSetupHdl, weld::Button&, void); SwLabDlg* GetParentSwLabDlg() { return static_cast<SwLabDlg*>(GetDialogController()); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits