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 14:09:25 +0100
commit71fad56863301f47f19fdd47ab93099ad098474e (patch)
tree6b55287b924215cec427b43046b15547c24b2e0d /sfx2
parentd8d148c96d7cdd96948240ac30b3aeacfb5aa7ca (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/66080 Tested-by: Jenkins Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> 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.cxx40
1 files changed, 9 insertions, 31 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index ec8f0735c438..36a7565a3c1a 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -55,6 +55,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>
@@ -739,32 +740,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://");
@@ -869,7 +844,9 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
if ( !impl_hasHelpInstalled() )
{
- incBusy(pWindow);
+ TopLevelWindowLocker aBusy;
+
+ 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"));
@@ -878,18 +855,19 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
OUString sPrimText = xQueryBox->get_primary_text();
xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString));
short OnlineHelpBox = xQueryBox->run();
- decBusy(pWindow);
+ xQueryBox.reset();
+ aBusy.decBusy();
- if(OnlineHelpBox == RET_OK)
+ if (OnlineHelpBox == RET_OK)
{
if ( impl_showOnlineHelp( aHelpURL ) )
return true;
else
{
- incBusy(pWindow);
+ aBusy.incBusy(pWindow);
NoHelpErrorBox aErrBox(pWindow ? pWindow->GetFrameWeld() : nullptr);
aErrBox.run();
- decBusy(pWindow);
+ aBusy.decBusy();
return false;
}
}