diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-03-12 16:26:23 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-03-16 08:53:11 +0100 |
commit | 158884cbe3fd7a760bfc409c895f3b6b56f41e22 (patch) | |
tree | db0f9ab6612f73f8ec26ecc97f28c16a97f68a4c | |
parent | 05e407d7083d598691190090f244c75f1d18915a (diff) |
Add option to disallow opening files locked by other users
Change-Id: I316b80a56b0d6dcb257fbc805fbac3afc93472ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90425
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit 3621c927b4555cb437fb89d28473228cb5d8e11a)
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 6 | ||||
-rw-r--r-- | uui/source/iahndl-locking.cxx | 4 | ||||
-rw-r--r-- | uui/source/openlocked.cxx | 3 |
3 files changed, 11 insertions, 2 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 225567c53a06..31a79ae045a9 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5370,6 +5370,12 @@ </info> <value>true</value> </prop> + <prop oor:name="AllowOverrideLocking" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Whether the user can open a file for editing although it has been locked by another user.</desc> + </info> + <value>true</value> + </prop> <prop oor:name="ShowLinkWarningDialog" oor:type="xs:boolean" oor:nillable="false"> <info> <desc>Determines if a warning dialog should be diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx index 8df6c85b0608..8a9af9c77b35 100644 --- a/uui/source/iahndl-locking.cxx +++ b/uui/source/iahndl-locking.cxx @@ -33,6 +33,7 @@ #include <unotools/resmgr.hxx> #include <vcl/svapp.hxx> +#include <officecfg/Office/Common.hxx> #include <strings.hrc> #include "getcontinuations.hxx" @@ -86,7 +87,8 @@ handleLockedDocumentRequest_( aArguments.push_back( !aInfo.isEmpty() ? aInfo : Translate::get( STR_UNKNOWNUSER, aResLocale) ); - aArguments.push_back( xRetry.is() + bool bAllowOverride = xRetry.is() && officecfg::Office::Common::Misc::AllowOverrideLocking::get(); + aArguments.push_back( bAllowOverride ? Translate::get( STR_OPENLOCKED_ALLOWIGNORE_MSG, aResLocale ) : "" ); aMessage = Translate::get(STR_OPENLOCKED_MSG, aResLocale); diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx index 453067f8e3ae..68d7626630a0 100644 --- a/uui/source/openlocked.cxx +++ b/uui/source/openlocked.cxx @@ -19,6 +19,7 @@ #include <strings.hrc> #include "openlocked.hxx" +#include <officecfg/Office/Common.hxx> #include <unotools/resmgr.hxx> #include <vcl/button.hxx> #include <vcl/svapp.hxx> @@ -29,7 +30,7 @@ OpenLockedQueryBox::OpenLockedQueryBox(weld::Window* pParent, const std::locale& m_xQueryBox->set_title(Translate::get(STR_OPENLOCKED_TITLE, rResLocale)); m_xQueryBox->add_button(Translate::get(STR_OPENLOCKED_OPENREADONLY_BTN, rResLocale), RET_YES); m_xQueryBox->add_button(Translate::get(STR_OPENLOCKED_OPENCOPY_BTN, rResLocale), RET_NO); - if (bEnableOverride) + if (bEnableOverride && officecfg::Office::Common::Misc::AllowOverrideLocking::get()) { // Present option to ignore the (stale?) lock file and open the document m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rResLocale), RET_IGNORE); |