vcl/inc/jsdialog/jsdialogbuilder.hxx |    1 +
 vcl/jsdialog/executor.cxx            |    7 ++++++-
 vcl/jsdialog/jsdialogbuilder.cxx     |    5 +++++
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 035422a44acb5fc19042199013eb01af3790632e
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Wed Dec 8 17:22:37 2021 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Dec 30 10:38:36 2021 +0100

    jsdialog: don't send back typed text for combobox
    
    Do the same what we do for Edit fields for ComboBox entry:
    when content is changed by event coming from the client
    because user typed something - then don't send back updated
    text so it will not disturb typing. It was visible with
    slow debug builds.
    
    Change-Id: Ib73096c4b96ebfdfd038ed56234c31ff32a5cda3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126549
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127732
    Tested-by: Jenkins

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 801dd4860e85..45620803990f 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -490,6 +490,7 @@ public:
     virtual void insert(int pos, const OUString& rStr, const OUString* pId,
                         const OUString* pIconName, VirtualDevice* 
pImageSurface) override;
     virtual void remove(int pos) override;
+    virtual void set_entry_text_without_notify(const OUString& rText);
     virtual void set_entry_text(const OUString& rText) override;
     virtual void set_active(int pos) override;
     virtual bool changed_by_direct_pick() const override;
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 613cf7f5d26d..742e56800eca 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -102,7 +102,12 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& 
rWidget, StringMap& rDat
                 }
                 else if (sAction == "change")
                 {
-                    pCombobox->set_entry_text(rData["data"]);
+                    // it might be other class than JSComboBox
+                    auto pJSCombobox = dynamic_cast<JSComboBox*>(pWidget);
+                    if (pJSCombobox)
+                        
pJSCombobox->set_entry_text_without_notify(rData["data"]);
+                    else
+                        pCombobox->set_entry_text(rData["data"]);
                     LOKTrigger::trigger_changed(*pCombobox);
                     return true;
                 }
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 8036f3d004e5..17a6c3387c55 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1207,6 +1207,11 @@ void JSComboBox::remove(int pos)
     sendUpdate();
 }
 
+void JSComboBox::set_entry_text_without_notify(const OUString& rText)
+{
+    SalInstanceComboBoxWithEdit::set_entry_text(rText);
+}
+
 void JSComboBox::set_entry_text(const OUString& rText)
 {
     SalInstanceComboBoxWithEdit::set_entry_text(rText);

Reply via email to