[Libreoffice-commits] core.git: vcl/inc vcl/jsdialog vcl/source

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 5 15:04:47 UTC 2021


 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 88dc324436af556515317662822eaf5c2c34fd26
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Dec 25 13:29:42 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Tue Jan 5 16:04:04 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 <hcastro at collabora.com>

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;
         }


More information about the Libreoffice-commits mailing list