vcl/jsdialog/executor.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
New commits: commit 9bd487c43e72186d3d9023d5fa90da0398811947 Author: Szymon Kłos <[email protected]> AuthorDate: Wed May 26 10:06:35 2021 +0200 Commit: Szymon Kłos <[email protected]> CommitDate: Mon Jul 19 13:54:43 2021 +0200 jsdialog: allow fraction numbers in spinfield Change-Id: I9849c6a798f0ade60606be75125fde98362d26b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119162 Tested-by: Jenkins Reviewed-by: Szymon Kłos <[email protected]> diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 61809d72c358..d35ae301be66 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -176,9 +176,13 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat { if (sAction == "change" || sAction == "value") { + if (rData["data"] == "undefined") + return true; + OString sValue = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US); - int nValue = std::atoi(sValue.getStr()); - pSpinField->set_value(pSpinField->normalize(nValue)); + double nValue = std::atof(sValue.getStr()); + pSpinField->set_value(nValue + * weld::SpinButton::Power10(pSpinField->get_digits())); LOKTrigger::trigger_value_changed(*pSpinField); return true; } commit c3158c6a11fa1d79bce36789768f6811a5a82623 Author: Szymon Kłos <[email protected]> AuthorDate: Wed May 26 09:53:05 2021 +0200 Commit: Szymon Kłos <[email protected]> CommitDate: Mon Jul 19 13:54:28 2021 +0200 jsdialog: normalize value for spinfield Change-Id: Ia65b1342222952cbec1ddfba4b7464172fd2b40c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119161 Tested-by: Jenkins Reviewed-by: Szymon Kłos <[email protected]> diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index c979230e7f31..61809d72c358 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -178,7 +178,7 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat { OString sValue = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US); int nValue = std::atoi(sValue.getStr()); - pSpinField->set_value(nValue); + pSpinField->set_value(pSpinField->normalize(nValue)); LOKTrigger::trigger_value_changed(*pSpinField); return true; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
