From 096b455583aa23d554cd05b1fac8909b7e10e355 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 23 Dec 2018 17:46:48 +0000 Subject: tdf#122273 modal dialog on modeless dialog needs special handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Idb5111b3f795f55c4b5644b5bcc6145106ff1392 Reviewed-on: https://gerrit.libreoffice.org/65583 Tested-by: Jenkins Reviewed-by: Xisco Faulí Tested-by: Xisco Faulí Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sfx2/source/appl/sfxhelp.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 7a29d265ddd0..ebf530a00fb5 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -1010,6 +1010,32 @@ namespace } } +void SfxHelp::incBusy(const vcl::Window* pParent) +{ + // lock any toplevel windows from being closed until busy is over + // ensure any dialogs are reset before entering + vcl::Window *xTopWin = Application::GetFirstTopLevelWindow(); + while (xTopWin) + { + if (xTopWin != pParent) + xTopWin->IncModalCount(); + xTopWin = Application::GetNextTopLevelWindow(xTopWin); + } +} + +void SfxHelp::decBusy(const vcl::Window* pParent) +{ + // unlock any toplevel windows from being closed until busy is over + // ensure any dialogs are reset before entering + vcl::Window *xTopWin = Application::GetFirstTopLevelWindow(); + while (xTopWin) + { + if (xTopWin != pParent) + xTopWin->DecModalCount(); + xTopWin = Application::GetNextTopLevelWindow(xTopWin); + } +} + bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const OUString& rKeyword) { OUStringBuffer aHelpRootURL("vnd.sun.star.help://"); @@ -1118,6 +1144,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const if(bShowOfflineHelpPopUp) { + incBusy(pWindow); std::unique_ptr xBuilder(Application::CreateBuilder(pWindow ? pWindow->GetFrameWeld() : nullptr, "sfx/ui/helpmanual.ui")); std::unique_ptr xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual")); std::unique_ptr m_xHideOfflineHelpCB(xBuilder->weld_check_button("hidedialog")); @@ -1128,6 +1155,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const short OnlineHelpBox = xQueryBox->run(); bShowOfflineHelpPopUp = OnlineHelpBox != RET_OK; aHelpOptions.SetOfflineHelpPopUp(!m_xHideOfflineHelpCB->get_state()); + decBusy(pWindow); } if(!bShowOfflineHelpPopUp) { @@ -1135,8 +1163,10 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const return true; else { + incBusy(pWindow); NoHelpErrorBox aErrBox(pWindow ? pWindow->GetFrameWeld() : nullptr); aErrBox.run(); + decBusy(pWindow); return false; } } -- cgit