summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-01-14 10:16:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-01-14 15:38:23 +0000
commit3a991451cdff7ca92f4da84808abcf58ca26290e (patch)
tree148f430b5b9e57cd73d12cedc4401a2be8eef884
parent49c8951d22d0c2da2de9e3a0154251b98b7816e6 (diff)
Resolves: rhbz#668057 lock sftp urls too
-rw-r--r--sfx2/source/doc/docfile.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index f76f878b2b..44469f0587 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1006,6 +1006,16 @@ sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< ::rtl::OUStri
return nResult;
}
+namespace
+{
+ bool isSuitableProtocolForLocking(const String & rLogicName)
+ {
+ INetURLObject aUrl( rLogicName );
+ INetProtocol eProt = aUrl.GetProtocol();
+ return eProt == INET_PROT_FILE || eProt == INET_PROT_SFTP;
+ }
+}
+
//------------------------------------------------------------------
sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
{
@@ -1076,8 +1086,8 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
// do further checks only if the file not readonly in fs
if ( !bContentReadonly )
{
- // the special file locking should be used only for file URLs
- if ( ::utl::LocalFileHelper::IsLocalFile( aLogicName ) )
+ // the special file locking should be used only for suitable URLs
+ if ( isSuitableProtocolForLocking( aLogicName ) )
{
// in case of storing the document should request the output before locking
@@ -1090,7 +1100,7 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
sal_Int8 bUIStatus = LOCK_UI_NOLOCK;
// check whether system file locking has been used, the default value is false
- sal_Bool bUseSystemLock = IsSystemFileLockingUsed();
+ sal_Bool bUseSystemLock = ::utl::LocalFileHelper::IsLocalFile( aLogicName ) && IsSystemFileLockingUsed();
// TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem
// if system lock is used the writeable stream should be available