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>
diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index e49190f..5dde733 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 04285ee..a4c07ae 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 9863d0c..93dae7d 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);