From b6d634d74c0231173d6b43357b7cd3cecb76407d Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Wed, 18 Nov 2020 12:14:35 +0100 Subject: jsdialog: remember dialog instance & handle close MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1b10d12edfa7ffca1061f50b5219baae1ac3caeb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106706 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- vcl/jsdialog/executor.cxx | 12 ++++++++++++ vcl/jsdialog/jsdialogbuilder.cxx | 3 +++ 2 files changed, 15 insertions(+) (limited to 'vcl/jsdialog') 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(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 58c8c64d1108..13b438022e7e 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -365,6 +365,9 @@ std::unique_ptr JSInstanceBuilder::weld_dialog(const OString& id) std::unique_ptr 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"); -- cgit