summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-11-18 12:00:03 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2020-12-07 12:19:44 +0100
commit02e7718d25290b702721fa15b03ee538c0506f21 (patch)
treedbbee8e1cf2ab4f07cf107972659539c2a07c237
parent8f4e206520d9b6b5f41f08f5fc911123b4541320 (diff)
jsdialog: turn off tunneling for JSON dialogs
Change-Id: I9a9d359d1769f6c34203bc558efe8189fbf81fd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106929 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107337 Tested-by: Jenkins
-rw-r--r--include/vcl/toolkit/dialog.hxx1
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx1
-rw-r--r--vcl/source/window/dialog.cxx30
3 files changed, 25 insertions, 7 deletions
diff --git a/include/vcl/toolkit/dialog.hxx b/include/vcl/toolkit/dialog.hxx
index 1d3064784bd4..efd2d2f0f6c0 100644
--- a/include/vcl/toolkit/dialog.hxx
+++ b/include/vcl/toolkit/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 13b438022e7e..051c90c7b6db 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -359,6 +359,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 c6aed4909b87..9a237ba5df9f 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -356,8 +356,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
@@ -610,6 +611,8 @@ Dialog::~Dialog()
void Dialog::dispose()
{
+ bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
+
mpDialogImpl.reset();
RemoveFromDlgList();
mpActionArea.clear();
@@ -627,7 +630,8 @@ void Dialog::dispose()
{
if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
{
- pNotifier->notifyWindow(GetLOKWindowId(), "close");
+ if (bTunnelingEnabled)
+ pNotifier->notifyWindow(GetLOKWindowId(), "close");
ReleaseLOKNotifier();
}
}
@@ -734,14 +738,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");
@@ -780,7 +791,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());
@@ -798,7 +810,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());
@@ -986,7 +999,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())
{
@@ -1351,7 +1365,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());