summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-01-10 10:44:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-01-11 11:57:24 +0100
commite94dc6f63a05ab7744b720847c13bd0e2f674417 (patch)
treeaaca480a3a2665a0e6eaa067cc61c5ce97225f34 /sfx2
parentd095a887a9b0cce81b4f828feed759b5d0b3ad3f (diff)
Resolves: tdf#122404 unlock just the toplevels that were locked
push what toplevels got locked to just unlock those ones. otherwise the just dismissed toplevel may still be present in the Application toplevel list. merge all the similar examples of this. Change-Id: I77c0d55d1e4b3bcc3b8d88fef00ba289edd1e831 Reviewed-on: https://gerrit.libreoffice.org/66076 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/sfxhelp.cxx37
1 files changed, 7 insertions, 30 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index e0540ec5e1d9..0510d7f537a2 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -62,6 +62,7 @@
#include <rtl/uri.hxx>
#include <vcl/commandinfoprovider.hxx>
#include <vcl/layout.hxx>
+#include <vcl/waitobj.hxx>
#include <vcl/weld.hxx>
#include <svtools/ehdl.hxx>
#include <svtools/sfxecode.hxx>
@@ -1011,32 +1012,6 @@ 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://");
@@ -1143,9 +1118,11 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
pWindow = GetBestParent(pWindow);
+ TopLevelWindowLocker aBusy;
+
if(bShowOfflineHelpPopUp)
{
- incBusy(pWindow);
+ aBusy.incBusy(pWindow);
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWindow ? pWindow->GetFrameWeld() : nullptr, "sfx/ui/helpmanual.ui"));
std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual"));
std::unique_ptr<weld::CheckButton> m_xHideOfflineHelpCB(xBuilder->weld_check_button("hidedialog"));
@@ -1156,7 +1133,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);
+ aBusy.decBusy();
}
if(!bShowOfflineHelpPopUp)
{
@@ -1164,10 +1141,10 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
return true;
else
{
- incBusy(pWindow);
+ aBusy.incBusy(pWindow);
NoHelpErrorBox aErrBox(pWindow ? pWindow->GetFrameWeld() : nullptr);
aErrBox.run();
- decBusy(pWindow);
+ aBusy.decBusy();
return false;
}
}