[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/vcl vcl/jsdialog vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 1 11:18:55 UTC 2020


 include/vcl/dialog.hxx           |    1 +
 vcl/jsdialog/jsdialogbuilder.cxx |    1 +
 vcl/source/window/dialog.cxx     |   30 +++++++++++++++++++++++-------
 3 files changed, 25 insertions(+), 7 deletions(-)

New commits:
commit 779d7c963c2668e9cb066ecb4209277330070b7e
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Nov 18 12:00:03 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Dec 1 12:18:17 2020 +0100

    jsdialog: turn off tunneling for JSON dialogs
    
    Change-Id: I9a9d359d1769f6c34203bc558efe8189fbf81fd3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106929
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 1840635f151f..1f777dfc1629 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -149,6 +149,7 @@ public:
 
     void            SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink);
     void            SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink);
+    void            SetLOKTunnelingState(bool bEnabled);
 
     void            add_button(PushButton* pButton, int nResponse, bool bTransferOwnership);
     void            set_default_response(int nResponse);
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 05903cef6f49..19a652e8e440 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -352,6 +352,7 @@ std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id,
 {
     ::Dialog* pDialog = m_xBuilder->get<::Dialog>(id);
     m_nWindowId = pDialog->GetLOKWindowId();
+    pDialog->SetLOKTunnelingState(false);
 
     InsertWindowToMap(m_nWindowId);
 
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index a754182d3eeb..85f87ad92a54 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -353,8 +353,9 @@ struct DialogImpl
     VclAbstractDialog::AsyncContext maEndCtx;
     Link<const CommandEvent&, bool> m_aPopupMenuHdl;
     Link<void*, vcl::ILibreOfficeKitNotifier*> m_aInstallLOKNotifierHdl;
+    bool    m_bLOKTunneling;
 
-    DialogImpl() : mnResult( -1 ), mbStartedModal( false ) {}
+    DialogImpl() : mnResult( -1 ), mbStartedModal( false ), m_bLOKTunneling( true ) {}
 
 #ifndef NDEBUG
     short get_response(vcl::Window *pWindow) const
@@ -607,6 +608,8 @@ Dialog::~Dialog()
 
 void Dialog::dispose()
 {
+    bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
+
     mpDialogImpl.reset();
     RemoveFromDlgList();
     mpActionArea.clear();
@@ -624,7 +627,8 @@ void Dialog::dispose()
     {
         if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
         {
-            pNotifier->notifyWindow(GetLOKWindowId(), "close");
+            if (bTunnelingEnabled)
+                pNotifier->notifyWindow(GetLOKWindowId(), "close");
             ReleaseLOKNotifier();
         }
     }
@@ -731,14 +735,21 @@ void Dialog::SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNoti
     mpDialogImpl->m_aInstallLOKNotifierHdl = rLink;
 }
 
+void Dialog::SetLOKTunnelingState(bool bEnabled)
+{
+    mpDialogImpl->m_bLOKTunneling = bEnabled;
+}
+
 void Dialog::StateChanged( StateChangedType nType )
 {
+    bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
+
     if (nType == StateChangedType::InitShow)
     {
         DoInitialLayout();
 
         const bool bKitActive = comphelper::LibreOfficeKit::isActive();
-        if (bKitActive)
+        if (bKitActive && bTunnelingEnabled)
         {
             std::vector<vcl::LOKPayloadItem> aItems;
             aItems.emplace_back("type", "dialog");
@@ -777,7 +788,8 @@ void Dialog::StateChanged( StateChangedType nType )
     }
     else if (nType == StateChangedType::Text)
     {
-        if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+        const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
+        if (pNotifier && bTunnelingEnabled)
         {
             std::vector<vcl::LOKPayloadItem> aPayload;
             aPayload.emplace_back("title", GetText().toUtf8());
@@ -795,7 +807,8 @@ void Dialog::StateChanged( StateChangedType nType )
 
     if (!mbModalMode && nType == StateChangedType::Visible)
     {
-        if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+        const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
+        if (pNotifier && bTunnelingEnabled)
         {
             std::vector<vcl::LOKPayloadItem> aPayload;
             aPayload.emplace_back("title", GetText().toUtf8());
@@ -983,7 +996,8 @@ bool Dialog::ImplStartExecute()
     else
         UITestLogger::getInstance().log("Open Modeless " + get_id());
 
-    if (comphelper::LibreOfficeKit::isActive())
+    bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
+    if (comphelper::LibreOfficeKit::isActive() && bTunnelingEnabled)
     {
         if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
         {
@@ -1327,7 +1341,9 @@ void Dialog::Resize()
     if (comphelper::LibreOfficeKit::isDialogPainting())
         return;
 
-    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+    bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
+    const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
+    if (pNotifier && bTunnelingEnabled)
     {
         std::vector<vcl::LOKPayloadItem> aItems;
         aItems.emplace_back("size", GetSizePixel().toString());


More information about the Libreoffice-commits mailing list