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 <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Samuel Mehrbrodt
2020-03-16 11:55:23 +01:00
parent bbdb751a10
commit 10136818b4
2 changed files with 9 additions and 6 deletions
+4 -2
View File
@@ -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(); }
+5 -4
View File
@@ -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 ||