[Libreoffice-commits] core.git: cui/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu May 20 11:43:01 UTC 2021


 cui/source/dialogs/insdlg.cxx  |   11 +++++++----
 cui/source/dialogs/linkdlg.cxx |   32 ++++++++++++++++++--------------
 cui/source/inc/insdlg.hxx      |    2 +-
 cui/source/inc/linkdlg.hxx     |    3 +--
 4 files changed, 27 insertions(+), 21 deletions(-)

New commits:
commit 12bd5e0ae116c0f18c980f3b2ce515432545d0c4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 20 09:40:45 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu May 20 13:42:18 2021 +0200

    use toggle instead of click for RadioButton
    
    Change-Id: Ice24a1b823301834a6bf7d7956df2e804657f6e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115855
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 4f1662a45e61..266710a83e4c 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -105,8 +105,11 @@ IMPL_LINK_NOARG(SvInsertOleDlg, BrowseHdl, weld::Button&, void)
     }
 }
 
-IMPL_LINK_NOARG(SvInsertOleDlg, RadioHdl, weld::Button&, void)
+IMPL_LINK(SvInsertOleDlg, RadioHdl, weld::ToggleButton&, rButton, void)
 {
+    if (!rButton.get_active())
+        return;
+
     if (m_xRbNewObject->get_active())
     {
         m_xObjectTypeFrame->show();
@@ -137,9 +140,9 @@ SvInsertOleDlg::SvInsertOleDlg(weld::Window* pParent, const Reference<embed::XSt
                                       m_xLbObjecttype->get_height_rows(6));
     m_xLbObjecttype->connect_row_activated(LINK(this, SvInsertOleDlg, DoubleClickHdl));
     m_xBtnFilepath->connect_clicked(LINK( this, SvInsertOleDlg, BrowseHdl));
-    Link<weld::Button&,void> aLink( LINK( this, SvInsertOleDlg, RadioHdl ) );
-    m_xRbNewObject->connect_clicked( aLink );
-    m_xRbObjectFromfile->connect_clicked( aLink );
+    Link<weld::ToggleButton&,void> aLink( LINK( this, SvInsertOleDlg, RadioHdl ) );
+    m_xRbNewObject->connect_toggled( aLink );
+    m_xRbObjectFromfile->connect_toggled( aLink );
     m_xRbNewObject->set_active(true);
 }
 
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index cc26e551b994..b452526e8376 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -113,8 +113,8 @@ SvBaseLinksDlg::SvBaseLinksDlg(weld::Window * pParent, LinkManager* pMgr, bool b
 
     m_xTbLinks->connect_changed( LINK( this, SvBaseLinksDlg, LinksSelectHdl ) );
     m_xTbLinks->connect_row_activated( LINK( this, SvBaseLinksDlg, LinksDoubleClickHdl ) );
-    m_xRbAutomatic->connect_clicked( LINK( this, SvBaseLinksDlg, AutomaticClickHdl ) );
-    m_xRbManual->connect_clicked( LINK( this, SvBaseLinksDlg, ManualClickHdl ) );
+    m_xRbAutomatic->connect_toggled( LINK( this, SvBaseLinksDlg, ToggleHdl ) );
+    m_xRbManual->connect_toggled( LINK( this, SvBaseLinksDlg, ToggleHdl ) );
     m_xPbUpdateNow->connect_clicked( LINK( this, SvBaseLinksDlg, UpdateNowClickHdl ) );
     m_xPbChangeSource->connect_clicked( LINK( this, SvBaseLinksDlg, ChangeSourceClickHdl ) );
     if(!bHtmlMode)
@@ -221,22 +221,26 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, LinksDoubleClickHdl, weld::TreeView&, bool )
     return true;
 }
 
-IMPL_LINK_NOARG( SvBaseLinksDlg, AutomaticClickHdl, weld::Button&, void )
+IMPL_LINK(SvBaseLinksDlg, ToggleHdl, weld::ToggleButton&, rButton, void)
 {
-    int nPos;
-    SvBaseLink* pLink = GetSelEntry( &nPos );
-    if( pLink && !isClientFileType( pLink->GetObjType() ) &&
-        SfxLinkUpdateMode::ALWAYS != pLink->GetUpdateMode() )
-        SetType( *pLink, nPos, SfxLinkUpdateMode::ALWAYS );
-}
+    if (!rButton.get_active())
+        return;
 
-IMPL_LINK_NOARG( SvBaseLinksDlg, ManualClickHdl, weld::Button&, void )
-{
     int nPos;
     SvBaseLink* pLink = GetSelEntry( &nPos );
-    if( pLink && !isClientFileType( pLink->GetObjType() ) &&
-        SfxLinkUpdateMode::ONCALL != pLink->GetUpdateMode())
-        SetType( *pLink, nPos, SfxLinkUpdateMode::ONCALL );
+
+    if (m_xRbAutomatic->get_active())
+    {
+        if( pLink && !isClientFileType( pLink->GetObjType() ) &&
+            SfxLinkUpdateMode::ALWAYS != pLink->GetUpdateMode() )
+            SetType( *pLink, nPos, SfxLinkUpdateMode::ALWAYS );
+    }
+    else
+    {
+        if( pLink && !isClientFileType( pLink->GetObjType() ) &&
+            SfxLinkUpdateMode::ONCALL != pLink->GetUpdateMode())
+            SetType( *pLink, nPos, SfxLinkUpdateMode::ONCALL );
+    }
 }
 
 IMPL_LINK_NOARG(SvBaseLinksDlg, UpdateNowClickHdl, weld::Button&, void)
diff --git a/cui/source/inc/insdlg.hxx b/cui/source/inc/insdlg.hxx
index 4134128fcdd8..87d6395dfb91 100644
--- a/cui/source/inc/insdlg.hxx
+++ b/cui/source/inc/insdlg.hxx
@@ -64,7 +64,7 @@ class SvInsertOleDlg : public InsertObjectDialog_Impl
 
     DECL_LINK(DoubleClickHdl, weld::TreeView&, bool);
     DECL_LINK(BrowseHdl, weld::Button&, void);
-    DECL_LINK(RadioHdl, weld::Button&, void);
+    DECL_LINK(RadioHdl, weld::ToggleButton&, void);
     bool IsCreateNew() const override { return m_xRbNewObject->get_active(); }
 
 public:
diff --git a/cui/source/inc/linkdlg.hxx b/cui/source/inc/linkdlg.hxx
index 3549ef0eb291..8a6453cbc71a 100644
--- a/cui/source/inc/linkdlg.hxx
+++ b/cui/source/inc/linkdlg.hxx
@@ -58,8 +58,7 @@ class SvBaseLinksDlg : public weld::GenericDialogController
 
     DECL_LINK(LinksSelectHdl, weld::TreeView&, void);
     DECL_LINK(LinksDoubleClickHdl, weld::TreeView&, bool);
-    DECL_LINK(AutomaticClickHdl, weld::Button&, void);
-    DECL_LINK(ManualClickHdl, weld::Button&, void);
+    DECL_LINK(ToggleHdl, weld::ToggleButton&, void);
     DECL_LINK(UpdateNowClickHdl, weld::Button&, void);
     DECL_LINK(ChangeSourceClickHdl, weld::Button&, void);
     DECL_LINK(BreakLinkClickHdl, weld::Button&, void);


More information about the Libreoffice-commits mailing list