vcl/inc/jsdialog/jsdialogbuilder.hxx | 3 +++ vcl/jsdialog/jsdialogbuilder.cxx | 9 ++++++++- vcl/source/control/FormattedField.cxx | 5 +++-- 3 files changed, 14 insertions(+), 3 deletions(-)
New commits: commit 55905119d9e313cb8d28791e8ec22b967db14a03 Author: Dennis Francis <[email protected]> AuthorDate: Fri Oct 31 16:38:55 2025 +0530 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Tue Nov 11 14:18:23 2025 +0100 lok: formatted-spin-button is ignoring input Calling Edit::SetText() via SalInstanceFormattedSpinButton::set_text() on a FormattedField does not parse and store the value using its formatter at least in the jsdialog case. Signed-off-by: Dennis Francis <[email protected]> Change-Id: Ia20ba0f260a6c5e78b19dff328899d974658de94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193391 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 4499f096d78e..8618a8c9a828 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -591,6 +591,9 @@ public: virtual void do_set_text(const OUString& rText) override; void set_text_without_notify(const OUString& rText); + +private: + VclPtr<::FormattedField> m_pFmtSpin; }; class JSMessageDialog final : public JSWidget<SalInstanceMessageDialog, ::MessageDialog> diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 4c12ba5415d2..fc919817be8e 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1412,12 +1412,19 @@ JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::Formatte SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget<SalInstanceFormattedSpinButton, ::FormattedField>(pSender, pSpin, pBuilder, bTakeOwnership) + , m_pFmtSpin(pSpin) { } void JSFormattedSpinButton::do_set_text(const OUString& rText) { - SalInstanceFormattedSpinButton::do_set_text(rText); + if (!m_pFmtSpin) + return; + + disable_notify_events(); + m_pFmtSpin->SetValueFromString(rText); + enable_notify_events(); + sendUpdate(); } commit 7124d5f51074d13eae3475293fe212a49fc6a6b6 Author: Dennis Francis <[email protected]> AuthorDate: Fri Oct 31 16:26:56 2025 +0530 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Tue Nov 11 14:18:11 2025 +0100 lok: FormattedField: ensure formatter has min and max If not use the limits of a 32 bit integer. Without this check if min/max are not set already, the json min/max will be set to 0/0 which is problematic in web clients where it rejects all inputs. Signed-off-by: Dennis Francis <[email protected]> Change-Id: I9fa2bb68b47626ad42bae51e52e4b14baecb82fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193390 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/vcl/source/control/FormattedField.cxx b/vcl/source/control/FormattedField.cxx index 8aa587f4de32..5da7040d1f4a 100644 --- a/vcl/source/control/FormattedField.cxx +++ b/vcl/source/control/FormattedField.cxx @@ -258,8 +258,9 @@ void FormattedField::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) // weld::TimeFormatter uses h24 format rJsonWriter.put("type", "time"); } - rJsonWriter.put("min", rFormatter.GetMinValue()); - rJsonWriter.put("max", rFormatter.GetMaxValue()); + + rJsonWriter.put("min", rFormatter.HasMinValue() ? rFormatter.GetMinValue() : std::numeric_limits<sal_Int32>::min()); + rJsonWriter.put("max", rFormatter.HasMaxValue() ? rFormatter.GetMaxValue() : std::numeric_limits<sal_Int32>::max()); rJsonWriter.put("value", rFormatter.GetValue()); rJsonWriter.put("step", rFormatter.GetSpinSize()); }
