diff options
author | Henry Castro <hcastro@collabora.com> | 2020-12-25 13:29:42 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2021-01-05 16:04:04 +0100 |
commit | 88dc324436af556515317662822eaf5c2c34fd26 (patch) | |
tree | cdb095241c93f47efa188ce298d2150662490531 /vcl | |
parent | d67bb09840ccd4ceb6f532d3e466635ef5c6d199 (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')
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 5 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 20 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 3 |
3 files changed, 27 insertions, 1 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 26fd022b1485..c31c3e5fa560 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -343,6 +343,11 @@ public: class JSMessageDialog : public SalInstanceMessageDialog, public JSDialogSender { + DECL_LINK(on_dump_status, void*, void); + DECL_LINK(on_window_event, VclWindowEvent&, void); + + bool m_bNotifyCreated; + public: JSMessageDialog(::MessageDialog* pDialog, VclPtr<vcl::Window> aContentWindow, SalInstanceBuilder* pBuilder, bool bTakeOwnership); 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, diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index ee7c114c851c..dde33eb5bc86 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -204,7 +204,8 @@ weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString || rUIFile == "modules/scalc/ui/ttestdialog.ui" || rUIFile == "modules/scalc/ui/ztestdialog.ui" || rUIFile == "modules/scalc/ui/chisquaretestdialog.ui" - || rUIFile == "modules/scalc/ui/fourieranalysisdialog.ui") + || rUIFile == "modules/scalc/ui/fourieranalysisdialog.ui" + || rUIFile == "uui/ui/macrowarnmedium.ui") { bUseJSBuilder = true; } |