diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-08-24 18:32:38 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-08-25 11:31:42 +0200 |
commit | db6b703d391838c481fd090065f6d329edcd4efa (patch) | |
tree | c17b58ca1f9e0f0beaa3b1b5c89d0e85bdaedaf7 /uui | |
parent | 69cfafef7a28aad7a013bb440e15e23e59ea628c (diff) |
Allow non-modal Dialogs during FileImport/Load
When opening a file that triggers Dialogs (e.g. cannot
read/repair/FileType) the Frame from which it was
initialized gets blocked. This irritates quite some
people. Changed this to a non-modal Dialog so that
the user can continue to work with all opened docs,
open new ones, close and print/PDF/export these.
Change-Id: I048d3de3369527cec20d26396b87439254764b8a
Reviewed-on: https://gerrit.libreoffice.org/41534
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'uui')
-rw-r--r-- | uui/source/alreadyopen.cxx | 2 | ||||
-rw-r--r-- | uui/source/filechanged.cxx | 2 | ||||
-rw-r--r-- | uui/source/iahndl.cxx | 32 | ||||
-rw-r--r-- | uui/source/lockcorrupt.cxx | 2 | ||||
-rw-r--r-- | uui/source/lockfailed.cxx | 2 | ||||
-rw-r--r-- | uui/source/openlocked.cxx | 2 | ||||
-rw-r--r-- | uui/source/trylater.cxx | 2 |
7 files changed, 34 insertions, 10 deletions
diff --git a/uui/source/alreadyopen.cxx b/uui/source/alreadyopen.cxx index 02687af3800b..0c417c0747af 100644 --- a/uui/source/alreadyopen.cxx +++ b/uui/source/alreadyopen.cxx @@ -22,7 +22,7 @@ #include <unotools/resmgr.hxx> AlreadyOpenQueryBox::AlreadyOpenQueryBox( vcl::Window* pParent, const std::locale& rLocale, const OUString& aMessage, bool bIsStoring ) : - MessBox(pParent, MessBoxStyle::NONE, + MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_ALREADYOPEN_TITLE, rLocale), aMessage ) { diff --git a/uui/source/filechanged.cxx b/uui/source/filechanged.cxx index e9d50ce12584..bac5fc67032c 100644 --- a/uui/source/filechanged.cxx +++ b/uui/source/filechanged.cxx @@ -22,7 +22,7 @@ #include "filechanged.hxx" FileChangedQueryBox::FileChangedQueryBox( vcl::Window* pParent, const std::locale& rLocale ) : - MessBox(pParent, MessBoxStyle::NONE, + MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_FILECHANGED_TITLE, rLocale), OUString() ) { diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index d136f047c3f3..7bee920262cf 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -961,11 +961,35 @@ executeMessageBox( vcl::Window * pParent, OUString const & rTitle, OUString const & rMessage, - MessBoxStyle nButtonMask ) + MessBoxStyle nButtonMask, + Dialog::InitFlag eInitFlag) { SolarMutexGuard aGuard; + WinBits nStyle(0); - ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, rTitle, rMessage); + ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, nStyle, rTitle, rMessage, eInitFlag); + + if (Dialog::InitFlag::NoParentCentered == eInitFlag) + { + vcl::Window* pDefaultParent = Dialog::GetDefaultParent(nStyle); + + if (pDefaultParent) + { + // need to 'Show' to have the following tasks do someting, does + // not work without and may even stumble on nullptrs/errors + xBox->Show(); + + // center on parent window + const Point aP(pDefaultParent->GetPosPixel()); + const Size aS(pDefaultParent->GetSizePixel()); + const Size aMySize(xBox->GetSizePixel()); + + xBox->SetPosPixel( + Point( + aP.X() + ((aS.Width() - aMySize.Width()) >> 1), + aP.Y() + ((aS.Height() - aMySize.Height()) >> 1))); + } + } sal_uInt16 aMessResult = xBox->Execute(); DialogMask aResult = DialogMask::NONE; @@ -1110,7 +1134,7 @@ UUIInteractionHelper::handleGenericErrorRequest( aTitle += aErrTitle; executeMessageBox( - getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok ); + getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok, Dialog::InitFlag::NoParentCentered); } else ErrorHandler::HandleError(nErrorCode); @@ -1226,7 +1250,7 @@ UUIInteractionHelper::handleBrokenPackageRequest( utl::ConfigManager::getProductVersion() ); switch ( - executeMessageBox( getParentProperty(), title, aMessage, nButtonMask ) ) + executeMessageBox( getParentProperty(), title, aMessage, nButtonMask, Dialog::InitFlag::NoParentCentered) ) { case DialogMask::ButtonsOk: OSL_ENSURE( xAbort.is(), "unexpected situation" ); diff --git a/uui/source/lockcorrupt.cxx b/uui/source/lockcorrupt.cxx index 5812216b0c4e..cfc2ed31c6a5 100644 --- a/uui/source/lockcorrupt.cxx +++ b/uui/source/lockcorrupt.cxx @@ -24,7 +24,7 @@ #include <vcl/button.hxx> LockCorruptQueryBox::LockCorruptQueryBox(vcl::Window* pParent, const std::locale& rResLocale) - : MessBox(pParent, MessBoxStyle::NONE, Translate::get(STR_LOCKCORRUPT_TITLE, rResLocale), OUString()) + : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKCORRUPT_TITLE, rResLocale), OUString()) { SetImage( ErrorBox::GetStandardImage() ); diff --git a/uui/source/lockfailed.cxx b/uui/source/lockfailed.cxx index 80209ee5fbbc..2dbf09555f73 100644 --- a/uui/source/lockfailed.cxx +++ b/uui/source/lockfailed.cxx @@ -23,7 +23,7 @@ #include <vcl/button.hxx> LockFailedQueryBox::LockFailedQueryBox(vcl::Window* pParent, const std::locale& rResLocale) - : MessBox(pParent, MessBoxStyle::NONE, Translate::get(STR_LOCKFAILED_TITLE, rResLocale), OUString()) + : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKFAILED_TITLE, rResLocale), OUString()) { SetImage( ErrorBox::GetStandardImage() ); diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx index dfd59425e090..84f69bcc7bc8 100644 --- a/uui/source/openlocked.cxx +++ b/uui/source/openlocked.cxx @@ -22,7 +22,7 @@ #include <unotools/resmgr.hxx> OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage ) : - MessBox(pParent, MessBoxStyle::NONE, + MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_OPENLOCKED_TITLE, rResLocale), aMessage ) { diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx index 01a09502b286..2e996d98487e 100644 --- a/uui/source/trylater.cxx +++ b/uui/source/trylater.cxx @@ -22,7 +22,7 @@ #include "trylater.hxx" TryLaterQueryBox::TryLaterQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage) - : MessBox(pParent, MessBoxStyle::NONE, Translate::get(STR_TRYLATER_TITLE, rResLocale), aMessage) + : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_TRYLATER_TITLE, rResLocale), aMessage) { SetImage( QueryBox::GetStandardImage() ); |