Kaydet (Commit) 5c40918d authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: rhbz#668057 Some Support locking files on more than just file

üst 571b26b8
...@@ -171,13 +171,11 @@ uno::Reference< io::XInputStream > DocumentLockFile::OpenStream() ...@@ -171,13 +171,11 @@ uno::Reference< io::XInputStream > DocumentLockFile::OpenStream()
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( ::ucbhelper::Content aSourceContent( m_aURL, xEnv );
xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ),
uno::UNO_QUERY_THROW );
// the file can be opened readonly, no locking will be done // the file can be opened readonly, no locking will be done
return xSimpleFileAccess->openFileRead( m_aURL ); return aSourceContent.openStream();
} }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
...@@ -224,11 +222,10 @@ void DocumentLockFile::RemoveFile() ...@@ -224,11 +222,10 @@ void DocumentLockFile::RemoveFile()
|| !aFileData[LOCKFILE_USERURL_ID].equals( aNewEntry[LOCKFILE_USERURL_ID] ) ) || !aFileData[LOCKFILE_USERURL_ID].equals( aNewEntry[LOCKFILE_USERURL_ID] ) )
throw io::IOException(); // not the owner, access denied throw io::IOException(); // not the owner, access denied
uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( ::ucbhelper::Content aCnt(m_aURL, xEnv);
xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), aCnt.executeCommand(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),
uno::UNO_QUERY_THROW ); uno::makeAny(sal_Bool(sal_True)));
xSimpleFileAccess->kill( m_aURL );
} }
} // namespace svt } // namespace svt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment