From b4576f3da4d90139fc5140962d13cb91dab98797 Mon Sep 17 00:00:00 2001 From: Giuseppe Castagno Date: Fri, 28 Aug 2015 18:52:36 +0200 Subject: tdf#82744: fix WebDAV lock/unlock behaviour - part 3 Changes done to the code in sfx2, ucbhelper, ucb, unotools in no particular order - add method helpers to call the ucb lock/unlock - add lock/unlock 'real' management - make DateChange property retrieval working for WebDAV as well - add check for changed content of a WebDAV file, in order to reload it correctly when 'Edit Mode' command is activated from GUI - Unlock WebDAV file while saving only if explicitly enabled Needed in order to avoid the small window of file unlocked state that opens while saving a file. When saving LO actually does as follows: - unlock the prevoius version of the file - prepares operations to save the modified version - lock the new file - save the new version - the lock method is enabled if the DAV resource supports it. In case the lock is not supported, for example example DAV with lock disabled, the lock method is disabled. Exception: when the resource is first created and the lock is not supported: a lock command is sent anyway, because if the resource is not yet present, there is no method to detect the lock/unlock availability in this case. - cppcheck:noExplicitConstructor Change-Id: I0aa876c4e3364d86e5740977b97f3db9a01e4491 Reviewed-on: https://gerrit.libreoffice.org/17189 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky --- ucbhelper/source/client/content.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'ucbhelper') diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx index 8edaa5a1cd6a..3ee7688646a9 100644 --- a/ucbhelper/source/client/content.cxx +++ b/ucbhelper/source/client/content.cxx @@ -1096,7 +1096,28 @@ bool Content::isDocument() SAL_WNOUNREACHABLE_CODE_POP +void Content::lock() + throw( CommandAbortedException, RuntimeException, Exception ) +{ + Command aCommand; + aCommand.Name = rtl::OUString::createFromAscii( "lock" ); + aCommand.Handle = -1; // n/a + m_xImpl->executeCommand( aCommand ); + +} + +void Content::unlock() + throw( CommandAbortedException, RuntimeException, Exception ) +{ + + Command aCommand; + aCommand.Name = rtl::OUString::createFromAscii( "unlock" ); + aCommand.Handle = -1; // n/a + + m_xImpl->executeCommand( aCommand ); + +} // Content_Impl Implementation. -- cgit