Don't use lock files when sandboxed on OS X

We won't be allowed to create such files anyway.

Change-Id: Iaba652b9ae3f1d8c7cfeaae493e962d58ad1fb7f
This commit is contained in:
Tor Lillqvist
2013-08-24 01:34:23 +03:00
parent 30881c7663
commit 063b32804c
2 changed files with 29 additions and 2 deletions

View File

@@ -2013,7 +2013,7 @@ void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible)
*/ */
void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo) void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo)
{ {
#if !HAVE_FEATURE_MULTIUSER_ENVIRONMENT #if !HAVE_FEATURE_MULTIUSER_ENVIRONMENT || HAVE_FEATURE_MACOSX_SANDBOX
(void) rInfo; (void) rInfo;
#else #else
if ( rInfo.Document.is() ) if ( rInfo.Document.is() )

View File

@@ -140,13 +140,21 @@ static const sal_Int8 LOCK_UI_TRY = 2;
bool IsSystemFileLockingUsed() bool IsSystemFileLockingUsed()
{ {
#if HAVE_FEATURE_MACOSX_SANDBOX
return true;
#else
return officecfg::Office::Common::Misc::UseDocumentSystemFileLocking::get(); return officecfg::Office::Common::Misc::UseDocumentSystemFileLocking::get();
#endif
} }
//---------------------------------------------------------------- //----------------------------------------------------------------
bool IsOOoLockFileUsed() bool IsOOoLockFileUsed()
{ {
#if HAVE_FEATURE_MACOSX_SANDBOX
return false;
#else
return officecfg::Office::Common::Misc::UseDocumentOOoLockFile::get(); return officecfg::Office::Common::Misc::UseDocumentOOoLockFile::get();
#endif
} }
bool IsLockingUsed() bool IsLockingUsed()
@@ -831,6 +839,21 @@ void SfxMedium::SetEncryptionDataToStorage_Impl()
#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
// FIXME: Hmm actually lock files should be used for sftp: documents
// even if !HAVE_FEATURE_MULTIUSER_ENVIRONMENT. Only the use of lock
// files for *local* documents is unnecessary in that case. But
// actually, the checks for sftp: here are just wishful thinking; I
// don't this there is any support for actually editing documents
// behind sftp: URLs anyway.
//
// Sure, there could perhaps be a 3rd-party extension that brings UCB
// the potential to handle files behind sftp:. But there could also be
// an extension that handles some arbitrary foobar: scheme *and* it
// could be that lock files would be the correct thing to use for
// foobar: documents, too. But the hardcoded test below won't know
// that. Clearly the knowledge whether lock files should be used or
// not for some URL scheme belongs in UCB, not here.
//------------------------------------------------------------------ //------------------------------------------------------------------
sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock ) sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock )
{ {
@@ -946,11 +969,15 @@ namespace
{ {
INetURLObject aUrl( rLogicName ); INetURLObject aUrl( rLogicName );
INetProtocol eProt = aUrl.GetProtocol(); INetProtocol eProt = aUrl.GetProtocol();
#if HAVE_FEATURE_MACOSX_SANDBOX
return eProt == INET_PROT_SFTP;
#else
return eProt == INET_PROT_FILE || eProt == INET_PROT_SFTP; return eProt == INET_PROT_FILE || eProt == INET_PROT_SFTP;
#endif
} }
} }
#endif #endif // HAVE_FEATURE_MULTIUSER_ENVIRONMENT
// returns true if the document can be opened for editing ( even if it should be a copy ) // returns true if the document can be opened for editing ( even if it should be a copy )
// otherwise the document should be opened readonly // otherwise the document should be opened readonly