diff options
author | Henry Castro <hcastro@collabora.com> | 2020-12-25 13:29:42 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-04-09 11:57:57 +0200 |
commit | 8a31c30b3daeb70e280d17c1cf0b562a3a1009f3 (patch) | |
tree | 89281f88eb0ba533c164e53ff7db3422cadb2fdb /vcl/jsdialog | |
parent | c413cba7db9811689b52258b249b21a62c9419da (diff) |
jsdialog: use the "WindowShow/WindowHide" to notify
If the "Macro Security Warning" message dialog is
disabled the idle notifier, then it is used, the
"WindowShow/Window Hide" events to notify client side.
Change-Id: I48281cf5b76285a86f951eb057454610e266b85f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108290
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'vcl/jsdialog')
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 8fba06677b74..19f8780d2740 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -894,6 +894,11 @@ JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, VclPtr<vcl::Window> a : SalInstanceMessageDialog(pDialog, pBuilder, bTakeOwnership) , JSDialogSender(m_xMessageDialog, aContentWindow, "dialog") { + if (aContentWindow && aContentWindow->IsDisableIdleNotify()) + { + pDialog->AddEventListener(LINK(this, JSMessageDialog, on_window_event)); + m_bNotifyCreated = false; + } } void JSMessageDialog::set_primary_text(const OUString& rText) @@ -908,6 +913,21 @@ void JSMessageDialog::set_secondary_text(const OUString& rText) notifyDialogState(); } +IMPL_LINK_NOARG(JSMessageDialog, on_dump_status, void*, void) { JSDialogSender::dumpStatus(); } + +IMPL_LINK(JSMessageDialog, on_window_event, VclWindowEvent&, rEvent, void) +{ + if (rEvent.GetId() == VclEventId::WindowShow && !m_bNotifyCreated) + { + Application::PostUserEvent(LINK(this, JSMessageDialog, on_dump_status)); + m_bNotifyCreated = true; + } + else if (rEvent.GetId() == VclEventId::WindowHide || rEvent.GetId() == VclEventId::WindowClose) + { + sendClose(); + } +} + JSCheckButton::JSCheckButton(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership, |