summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2019-12-10 20:34:51 -0400
committerHenry Castro <hcastro@collabora.com>2019-12-11 03:18:24 +0100
commitb7e4b1a27b55dff4792ccd32b0c6658956dcf27a (patch)
tree9b27dbed0270c06bd1ad82c1acb4d7b3ef39fc17
parent293754a03cab35530abdac56f56d2eae13d14fa8 (diff)
lok: dialog: check if exists a LOK Window Notifier
When the dialog is about to show, it requires to send to client side the "created" message. However, in the constructor has already assigned a notifier from the parent window. Change-Id: I1120ad1c1c70449048d6739b8564d1c1f6b1c7e3 Reviewed-on: https://gerrit.libreoffice.org/84908 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r--vcl/source/window/dialog.cxx28
1 files changed, 18 insertions, 10 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index a8e5240ec68c..d3710414385b 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -752,18 +752,26 @@ void Dialog::StateChanged( StateChangedType nType )
{
if (nType == StateChangedType::InitShow)
{
- if (comphelper::LibreOfficeKit::isActive() && !GetLOKNotifier())
+ if (comphelper::LibreOfficeKit::isActive())
{
- vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr);
- if (pViewShell)
+ std::vector<vcl::LOKPayloadItem> aItems;
+ aItems.emplace_back("type", "dialog");
+ aItems.emplace_back("size", GetSizePixel().toString());
+ if (!GetText().isEmpty())
+ aItems.emplace_back("title", GetText().toUtf8());
+
+ if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
{
- SetLOKNotifier(pViewShell);
- std::vector<vcl::LOKPayloadItem> aItems;
- aItems.emplace_back("type", "dialog");
- aItems.emplace_back("size", GetSizePixel().toString());
- if (!GetText().isEmpty())
- aItems.emplace_back("title", GetText().toUtf8());
- pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
+ pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
+ }
+ else
+ {
+ vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr);
+ if (pViewShell)
+ {
+ SetLOKNotifier(pViewShell);
+ pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
+ }
}
}