[Libreoffice-commits] core.git: include/vcl vcl/jsdialog

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 28 13:32:54 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 d7f3e68f849d11f6e02019b4a788982cae71d37b
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: Mon Dec 28 14:32:13 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108397
    Tested-by: Jenkins

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 fd9fb9260587..648c1746b15e 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1589,6 +1589,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 933149efde05..cfb36dd858be 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -128,14 +128,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 160ef1b512bc..aa1febfe5d2a 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -860,7 +860,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