summaryrefslogtreecommitdiff
path: root/uui/source/iahndl-locking.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-02-08 18:06:06 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-02-09 05:48:58 +0100
commit2a7057250c8f73fdfb4c65a7525d17e9770459df (patch)
tree2fb8b54e2e00f731818041449362ec2163f908ad /uui/source/iahndl-locking.cxx
parent7d56128654457bfc859217c23a957d1712fd6e1c (diff)
tdf#108210: Allow to ignore a lock file if there's no filesystem lock
Two cases are handled: when a file is being opened, and when it was opened read-only already, and one tries to reopen it in edit mode. The option to ignore locking and open the file anyway is only offered when there is no filesystem lock present on the file. Change-Id: I377d3cae4c949ae64d449634acea8fb3f68a5700 Reviewed-on: https://gerrit.libreoffice.org/49448 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'uui/source/iahndl-locking.cxx')
-rw-r--r--uui/source/iahndl-locking.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
index 53b0e6a2fc77..08b5b5c7fd99 100644
--- a/uui/source/iahndl-locking.cxx
+++ b/uui/source/iahndl-locking.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/task/XInteractionDisapprove.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
#include <unotools/resmgr.hxx>
#include <vcl/svapp.hxx>
@@ -66,7 +67,9 @@ handleLockedDocumentRequest_(
uno::Reference< task::XInteractionApprove > xApprove;
uno::Reference< task::XInteractionDisapprove > xDisapprove;
uno::Reference< task::XInteractionAbort > xAbort;
- getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort);
+ // In case an option to ignore lock and open the file is available
+ uno::Reference< task::XInteractionRetry > xRetry;
+ getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort, &xRetry);
if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() )
return;
@@ -86,11 +89,14 @@ handleLockedDocumentRequest_(
aArguments.push_back( !aInfo.isEmpty()
? aInfo
: Translate::get( STR_UNKNOWNUSER, aResLocale) );
+ aArguments.push_back( xRetry.is()
+ ? Translate::get( STR_OPENLOCKED_ALLOWIGNORE_MSG, aResLocale )
+ : "" );
aMessage = Translate::get(STR_OPENLOCKED_MSG, aResLocale);
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
- ScopedVclPtrInstance< OpenLockedQueryBox > xDialog(pParent, aResLocale, aMessage);
+ ScopedVclPtrInstance< OpenLockedQueryBox > xDialog(pParent, aResLocale, aMessage, xRetry.is());
nResult = xDialog->Execute();
}
else if ( nMode == UUI_DOC_SAVE_LOCK )
@@ -128,6 +134,8 @@ handleLockedDocumentRequest_(
xApprove->select();
else if ( nResult == RET_NO )
xDisapprove->select();
+ else if ( nResult == RET_IGNORE && xRetry.is() )
+ xRetry->select();
else
xAbort->select();
}