vcl/inc/jsdialog/jsdialogbuilder.hxx | 5 +++++ vcl/jsdialog/jsdialogbuilder.cxx | 20 ++++++++++++++++++++ vcl/source/window/builder.cxx | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-)
New commits: commit aa6969a67ba66295738fa4707a73d78eba358b0f Author: Henry Castro <[email protected]> AuthorDate: Fri Dec 25 13:29:42 2020 -0400 Commit: Henry Castro <[email protected]> CommitDate: Tue Jan 19 13:54:47 2021 +0100 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 <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109149 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 8c9c7930b94f..eec95e714d64 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -332,6 +332,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 67cf8ec6fbac..6e2b1453f0ab 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -915,6 +915,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) @@ -929,6 +934,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 591052362598..8a5c3783830d 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -191,7 +191,8 @@ weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString || rUIFile == "modules/scalc/ui/pivotfielddialog.ui" || rUIFile == "modules/scalc/ui/datafieldoptionsdialog.ui" || rUIFile == "svx/ui/fontworkgallerydialog.ui" - || rUIFile == "cui/ui/macroselectordialog.ui") + || rUIFile == "cui/ui/macroselectordialog.ui" + || rUIFile == "uui/ui/macrowarnmedium.ui") { bUseJSBuilder = true; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
