summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-11-02 12:24:49 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2020-11-25 15:47:01 +0100
commit708a8b7f1d869580741787e71a9248757bb1541e (patch)
tree6bbb2dfb930321e8e00b8ca9cc0bf2b5b7734fd9
parent6581a8a322cc2b83385722ae3042a885a7423f19 (diff)
jsdialog: execute checkbox action
Change-Id: Ib19997f600404cc9555acbfaf87acac32f8aa5fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106562 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--include/vcl/jsdialog/executor.hxx2
-rw-r--r--include/vcl/weld.hxx2
-rw-r--r--vcl/jsdialog/executor.cxx14
3 files changed, 18 insertions, 0 deletions
diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index e49190f31e5f..5dde733a3823 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -22,6 +22,8 @@ public:
static void trigger_changed(weld::ComboBox& rComboBox) { rComboBox.signal_changed(); }
+ static void trigger_toggled(weld::ToggleButton& rButton) { rButton.signal_toggled(); }
+
static void trigger_row_activated(weld::TreeView& rTreeView)
{
rTreeView.signal_row_activated();
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 04285ee63778..a4c07aeebede 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1301,6 +1301,8 @@ public:
class VCL_DLLPUBLIC ToggleButton : virtual public Button
{
+ friend class ::LOKTrigger;
+
protected:
Link<ToggleButton&, void> m_aToggleHdl;
TriState m_eSavedValue = TRISTATE_FALSE;
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 9863d0c2edb9..93dae7db3a2d 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -97,6 +97,20 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
}
}
}
+ else if (sControlType == "checkbox")
+ {
+ auto pCheckButton = dynamic_cast<weld::CheckButton*>(pWidget);
+ if (pCheckButton)
+ {
+ if (sAction == "change")
+ {
+ bool bChecked = rData["data"] == "true";
+ pCheckButton->set_state(bChecked ? TRISTATE_TRUE : TRISTATE_FALSE);
+ LOKTrigger::trigger_toggled(*static_cast<weld::ToggleButton*>(pCheckButton));
+ return true;
+ }
+ }
+ }
else if (sControlType == "drawingarea")
{
auto pArea = dynamic_cast<weld::DrawingArea*>(pWidget);