diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-05-10 11:03:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-05-10 22:26:42 +0200 |
commit | 243aad91e17960405b472eadd9f9976fec8b7028 (patch) | |
tree | 3cfb26989fe47cead9e7890d7c340ffdeafe44fb /vcl | |
parent | 8da6a8fcf1a71588a22bf4afae8d5e54b7b0bcad (diff) |
Related: tdf#125198 centralize notifyWindow:created to one place
Change-Id: I2729cb85f156ddafec69cc3280e9d8544f7c6182
Reviewed-on: https://gerrit.libreoffice.org/72117
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/dialog.cxx | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index c1921d238c67..7f7fc3a9ef7d 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -752,23 +752,25 @@ void Dialog::StateChanged( StateChangedType nType ) { if (nType == StateChangedType::InitShow) { - if (comphelper::LibreOfficeKit::isActive() && !GetLOKNotifier()) + DoInitialLayout(); + + const bool bKitActive = comphelper::LibreOfficeKit::isActive(); + if (bKitActive) { - vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr); - if (pViewShell) + if (!GetLOKNotifier()) + SetLOKNotifier(mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr)); + + 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); } } - DoInitialLayout(); - if ( !HasChildPathFocus() || HasFocus() ) GrabFocusToFirstControl(); if ( !(GetStyle() & WB_CLOSEABLE) ) @@ -889,12 +891,7 @@ bool Dialog::ImplStartExecute() if (bModal) { if (bKitActive && !GetLOKNotifier()) - { - if (vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr)) - { - SetLOKNotifier(pViewShell); - } - } + SetLOKNotifier(mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr)); switch ( Application::GetDialogCancelMode() ) { @@ -925,19 +922,6 @@ bool Dialog::ImplStartExecute() std::abort(); } - if (bKitActive) - { - if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) - { - 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()); - pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems); - } - } - #ifdef DBG_UTIL vcl::Window* pParent = GetParent(); if ( pParent ) |