[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/vcl vcl/jsdialog

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 9 07:18:59 UTC 2020


 include/vcl/jsdialog/executor.hxx |    5 +++++
 include/vcl/weld.hxx              |    2 ++
 vcl/jsdialog/executor.cxx         |   10 ++++++++++
 vcl/jsdialog/jsdialogbuilder.cxx  |    2 +-
 4 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit dcb77c4231a497b1ac5f6c3171ae446a27b45e68
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Dec 9 06:28:34 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Dec 9 08:18:26 2020 +0100

    jsdialog: handle value change for spinfields
    
    Change-Id: Ie9ef1017b959f5ef42abe6de4ac18e077d1ceb1e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107446
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index 038b86b30f64..1e2a0806e3e9 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -40,6 +40,11 @@ public:
     {
         rDrawingArea.click(rPos);
     }
+
+    static void trigger_value_changed(weld::SpinButton& rSpinButton)
+    {
+        rSpinButton.signal_value_changed();
+    }
 };
 
 namespace jsdialog
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 6dcd91c97ccb..8e91050cc3a5 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1344,6 +1344,8 @@ public:
 
 class VCL_DLLPUBLIC SpinButton : virtual public Entry
 {
+    friend class ::LOKTrigger;
+
 protected:
     Link<SpinButton&, void> m_aValueChangedHdl;
     Link<SpinButton&, void> m_aOutputHdl;
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 40e870533569..2edbbcdd176f 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -127,14 +127,24 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
             auto pSpinField = dynamic_cast<weld::SpinButton*>(pWidget);
             if (pSpinField)
             {
+                if (sAction == "change")
+                {
+                    OString sValue = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
+                    int nValue = std::atoi(sValue.getStr());
+                    pSpinField->set_value(nValue);
+                    LOKTrigger::trigger_value_changed(*pSpinField);
+                    return true;
+                }
                 if (sAction == "plus")
                 {
                     pSpinField->set_value(pSpinField->get_value() + 1);
+                    LOKTrigger::trigger_value_changed(*pSpinField);
                     return true;
                 }
                 else if (sAction == "minus")
                 {
                     pSpinField->set_value(pSpinField->get_value() - 1);
+                    LOKTrigger::trigger_value_changed(*pSpinField);
                     return true;
                 }
             }
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 85e578390485..a8538dd4a5f8 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -800,7 +800,7 @@ JSSpinButton::JSSpinButton(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Wind
 void JSSpinButton::set_value(int value)
 {
     SalInstanceSpinButton::set_value(value);
-    notifyDialogState();
+    notifyDialogState(true); // if input is limited we can receive the same JSON
 }
 
 JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, VclPtr<vcl::Window> aContentWindow,


More information about the Libreoffice-commits mailing list