diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-11-18 12:14:35 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-04-07 13:02:01 +0200 |
commit | 74a39123df3202de60273529fbaafa532c192bd2 (patch) | |
tree | be624f5ab0e201e571d377fcac65eae3f365afd3 /vcl | |
parent | 87ddbb81e651ef7cbe535aabd149c33b4922e51b (diff) |
jsdialog: remember dialog instance & handle close
Change-Id: I1b10d12edfa7ffca1061f50b5219baae1ac3caeb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106706
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/jsdialog/executor.cxx | 12 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 13ffc1a33e06..83d19fd7b657 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -242,6 +242,18 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat } } } + else if (sControlType == "dialog") + { + auto pDialog = dynamic_cast<weld::Dialog*>(pWidget); + if (pDialog) + { + if (sAction == "close") + { + pDialog->response(RET_CANCEL); + return true; + } + } + } } return false; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index f44cd42e97cf..051c90c7b6db 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -366,6 +366,9 @@ std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id) std::unique_ptr<weld::Dialog> pRet(pDialog ? new JSDialog(m_aOwnedToplevel, m_aOwnedToplevel, pDialog, this, false, m_sTypeOfJSON) : nullptr); + + RememberWidget("__DIALOG__", pRet.get()); + if (pDialog) { assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed"); |