[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/source

Caolán McNamara caolanm at redhat.com
Tue May 29 10:34:20 UTC 2018


 vcl/source/app/salvtables.cxx |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

New commits:
commit 096692d397b086775d68a29a905d8883184b70a4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 28 17:29:17 2018 +0100

    toggle should trigger only through ui
    
    Change-Id: I15619dad2189f81a074f8b9649c4e8b756120f2c
    Reviewed-on: https://gerrit.libreoffice.org/54971
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 2c6fdac648ae..1579aae20222 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -991,6 +991,7 @@ class SalInstanceRadioButton : public SalInstanceButton, public virtual weld::Ra
 {
 private:
     VclPtr<::RadioButton> m_xRadioButton;
+    bool m_bBlockNotify;
 
     DECL_LINK(ToggleHdl, ::RadioButton&, void);
 
@@ -998,13 +999,16 @@ public:
     SalInstanceRadioButton(::RadioButton* pButton, bool bTakeOwnership)
         : SalInstanceButton(pButton, bTakeOwnership)
         , m_xRadioButton(pButton)
+        , m_bBlockNotify(false)
     {
         m_xRadioButton->SetToggleHdl(LINK(this, SalInstanceRadioButton, ToggleHdl));
     }
 
     virtual void set_active(bool active) override
     {
+        m_bBlockNotify = true;
         m_xRadioButton->Check(active);
+        m_bBlockNotify = false;
     }
 
     virtual bool get_active() const override
@@ -1030,6 +1034,8 @@ public:
 
 IMPL_LINK_NOARG(SalInstanceRadioButton, ToggleHdl, ::RadioButton&, void)
 {
+    if (m_bBlockNotify)
+        return;
     signal_toggled();
 }
 
@@ -1037,6 +1043,7 @@ class SalInstanceToggleButton : public SalInstanceButton, public virtual weld::T
 {
 private:
     VclPtr<PushButton> m_xToggleButton;
+    bool m_bBlockNotify;
 
     DECL_LINK(ToggleListener, VclWindowEvent&, void);
 
@@ -1044,6 +1051,7 @@ public:
     SalInstanceToggleButton(PushButton* pButton, bool bTakeOwnership)
         : SalInstanceButton(pButton, bTakeOwnership)
         , m_xToggleButton(pButton)
+        , m_bBlockNotify(false)
     {
     }
 
@@ -1056,7 +1064,9 @@ public:
 
     virtual void set_active(bool active) override
     {
+        m_bBlockNotify = true;
         m_xToggleButton->Check(active);
+        m_bBlockNotify = false;
     }
 
     virtual bool get_active() const override
@@ -1066,7 +1076,9 @@ public:
 
     virtual void set_inconsistent(bool inconsistent) override
     {
+        m_bBlockNotify = false;
         m_xToggleButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE);
+        m_bBlockNotify = true;
     }
 
     virtual bool get_inconsistent() const override
@@ -1083,6 +1095,8 @@ public:
 
 IMPL_LINK(SalInstanceToggleButton, ToggleListener, VclWindowEvent&, rEvent, void)
 {
+    if (m_bBlockNotify)
+        return;
     if (rEvent.GetId() == VclEventId::PushbuttonToggle)
         signal_toggled();
 }
@@ -1091,19 +1105,23 @@ class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::Ch
 {
 private:
     VclPtr<CheckBox> m_xCheckButton;
+    bool m_bBlockNotify;
 
     DECL_LINK(ToggleHdl, CheckBox&, void);
 public:
     SalInstanceCheckButton(CheckBox* pButton, bool bTakeOwnership)
         : SalInstanceButton(pButton, bTakeOwnership)
         , m_xCheckButton(pButton)
+        , m_bBlockNotify(false)
     {
         m_xCheckButton->SetToggleHdl(LINK(this, SalInstanceCheckButton, ToggleHdl));
     }
 
     virtual void set_active(bool active) override
     {
+        m_bBlockNotify = true;
         m_xCheckButton->Check(active);
+        m_bBlockNotify = false;
     }
 
     virtual bool get_active() const override
@@ -1113,7 +1131,9 @@ public:
 
     virtual void set_inconsistent(bool inconsistent) override
     {
+        m_bBlockNotify = true;
         m_xCheckButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE);
+        m_bBlockNotify = false;
     }
 
     virtual bool get_inconsistent() const override
@@ -1129,6 +1149,8 @@ public:
 
 IMPL_LINK_NOARG(SalInstanceCheckButton, ToggleHdl, CheckBox&, void)
 {
+    if (m_bBlockNotify)
+        return;
     signal_toggled();
 }
 


More information about the Libreoffice-commits mailing list