From 10136818b4ef138fc2d5ec3af194beffed009480 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Mon, 16 Mar 2020 10:40:13 +0100 Subject: Some more places to check for AllowOverrideLocking option Change-Id: Id09f691ef7e3fbae03771a43af1c7b1d940365bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90554 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- sfx2/source/view/viewfrm.cxx | 6 ++++-- uui/source/iahndl-locking.cxx | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 3bf812e439a6..8616da00b358 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -169,13 +169,15 @@ private: public: SfxQueryOpenAsTemplate(weld::Window* pParent, bool bAllowIgnoreLock, LockFileEntry& rLockData) : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, - VclButtonsType::NONE, - QueryString(bAllowIgnoreLock, rLockData))) + VclButtonsType::NONE, "")) { m_xQueryBox->add_button(SfxResId(STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN), RET_YES); + bAllowIgnoreLock + = bAllowIgnoreLock && officecfg::Office::Common::Misc::AllowOverrideLocking::get(); if (bAllowIgnoreLock) m_xQueryBox->add_button(SfxResId(STR_QUERY_OPENASTEMPLATE_OPEN_BTN), RET_IGNORE); m_xQueryBox->add_button(GetStandardText( StandardButtonType::Cancel ), RET_CANCEL); + m_xQueryBox->set_primary_text(QueryString(bAllowIgnoreLock, rLockData)); m_xQueryBox->set_default_response(RET_YES); } short run() { return m_xQueryBox->run(); } diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx index 07a69699e9b8..52b9d2108347 100644 --- a/uui/source/iahndl-locking.cxx +++ b/uui/source/iahndl-locking.cxx @@ -79,13 +79,14 @@ handleLockedDocumentRequest_( std::vector< OUString > aArguments; aArguments.push_back( aDocumentURL ); + bool bAllowOverride = xRetry.is() && officecfg::Office::Common::Misc::AllowOverrideLocking::get(); + sal_Int32 nResult = RET_CANCEL; if ( nMode == UUI_DOC_LOAD_LOCK ) { aArguments.push_back( !aInfo.isEmpty() ? aInfo : Translate::get( STR_UNKNOWNUSER, aResLocale) ); - bool bAllowOverride = xRetry.is() && officecfg::Office::Common::Misc::AllowOverrideLocking::get(); aArguments.push_back( bAllowOverride ? Translate::get( STR_OPENLOCKED_ALLOWIGNORE_MSG, aResLocale ) : "" ); @@ -93,7 +94,7 @@ handleLockedDocumentRequest_( aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - OpenLockedQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is()); + OpenLockedQueryBox aDialog(pParent, aResLocale, aMessage, bAllowOverride); nResult = aDialog.run(); } else if ( nMode == UUI_DOC_SAVE_LOCK ) @@ -102,12 +103,12 @@ handleLockedDocumentRequest_( ? aInfo : Translate::get( STR_UNKNOWNUSER, aResLocale ) ); - aMessage = Translate::get(xRetry.is() ? STR_OVERWRITE_IGNORELOCK_MSG : STR_TRYLATER_MSG, + aMessage = Translate::get(bAllowOverride ? STR_OVERWRITE_IGNORELOCK_MSG : STR_TRYLATER_MSG, aResLocale); aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - TryLaterQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is()); + TryLaterQueryBox aDialog(pParent, aResLocale, aMessage, bAllowOverride); nResult = aDialog.run(); } else if ( nMode == UUI_DOC_OWN_LOAD_LOCK || -- cgit