diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-02-18 19:09:07 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-02-18 22:13:57 +0100 |
commit | dc324bbffad071bc5a115b2faae1ac97ad216711 (patch) | |
tree | e3a58005de3e26f08ed44b7bd927b32332e98c28 | |
parent | 76aea63d8055e9bb8d2edc85a739c9a48a7f8d96 (diff) |
uitest: fix small race condition when launching modeless dialogs
Change-Id: I44f7af1b44badce6ed09eeca0bb19760b5f22aa9
Reviewed-on: https://gerrit.libreoffice.org/49942
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | include/vcl/dialog.hxx | 2 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 23 |
2 files changed, 14 insertions, 11 deletions
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 979c62c199dc..e2ad43bcbf48 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -176,6 +176,8 @@ class VCL_DLLPUBLIC ModelessDialog : public Dialog public: explicit ModelessDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, Dialog::InitFlag eFlag = Dialog::InitFlag::Default ); + + void Activate() override; }; class VCL_DLLPUBLIC ModalDialog : public Dialog diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 0219f2a806d2..cdad91241c35 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -731,17 +731,6 @@ void Dialog::StateChanged( StateChangedType nType ) ImplInitSettings(); Invalidate(); } - - if (!mbModalMode && nType == StateChangedType::Visible) - { - css::uno::Reference< css::uno::XComponentContext > xContext( - comphelper::getProcessComponentContext() ); - css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_QUERY_THROW); - css::document::DocumentEvent aObject; - aObject.EventName = "ModelessDialogVisible"; - xEventBroadcaster->documentEventOccured(aObject); - UITestLogger::getInstance().log("Modeless Dialog Visible"); - } } void Dialog::DataChanged( const DataChangedEvent& rDCEvt ) @@ -1302,4 +1291,16 @@ ModalDialog::ModalDialog( vcl::Window* pParent, const OUString& rID, const OUStr { } +void ModelessDialog::Activate() +{ + css::uno::Reference< css::uno::XComponentContext > xContext( + comphelper::getProcessComponentContext() ); + css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_QUERY_THROW); + css::document::DocumentEvent aObject; + aObject.EventName = "ModelessDialogVisible"; + xEventBroadcaster->documentEventOccured(aObject); + UITestLogger::getInstance().log("Modeless Dialog Visible"); + Dialog::Activate(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |