diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-02-08 16:58:44 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-03-04 15:42:33 +0100 |
commit | 325d349c04a3b1cd6d17990ac9255cc432a4e24b (patch) | |
tree | 3de4d93f77ebaf1fe6137ccdc6cfdcd202775643 /vcl/jsdialog | |
parent | 008c2354075e1b5b63000f6a2da802971a2902e6 (diff) |
jsdialog: handle standard buttons like help
- dump response bindings
- execute help callback
Change-Id: Ib0696b4ba74a186a2b80d49f21a1442d1c520821
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110586
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111958
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl/jsdialog')
-rw-r--r-- | vcl/jsdialog/executor.cxx | 8 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 35 |
2 files changed, 43 insertions, 0 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 8c76e77d8b37..3644dc1bcf9b 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -321,6 +321,14 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat pDialog->response(RET_CANCEL); return true; } + else if (sAction == "response") + { + OString nResponseString + = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US); + int nResponse = std::atoi(nResponseString.getStr()); + pDialog->response(nResponse); + return true; + } } } else if (sControlType == "radiobutton") diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index da0537893a35..c7c8c3735fd5 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -27,6 +27,23 @@ #include <cppuhelper/supportsservice.hxx> #include <utility> +namespace +{ +void response_help(vcl::Window* pWindow) +{ + ::Dialog* pDialog = dynamic_cast<::Dialog*>(pWindow); + if (!pDialog) + return; + + vcl::Window* pButtonWindow = pDialog->get_widget_for_response(RET_HELP); + ::Button* pButton = dynamic_cast<::Button*>(pButtonWindow); + if (!pButton) + return; + + pButton->Click(); +} +} + JSDialogNotifyIdle::JSDialogNotifyIdle(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, std::string sTypeOfJSON) : Idle("JSDialog notify") @@ -748,6 +765,12 @@ void JSDialog::undo_collapse() void JSDialog::response(int response) { + if (response == RET_HELP) + { + response_help(m_xWidget.get()); + return; + } + sendClose(); SalInstanceDialog::response(response); } @@ -922,6 +945,18 @@ void JSMessageDialog::set_secondary_text(const OUString& rText) sendFullUpdate(); } +void JSMessageDialog::response(int response) +{ + if (response == RET_HELP) + { + response_help(m_xWidget.get()); + return; + } + + sendClose(); + SalInstanceMessageDialog::response(response); +} + JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget<SalInstanceCheckButton, ::CheckBox>(pSender, pCheckBox, pBuilder, bTakeOwnership) |