diff options
author | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2015-07-18 18:29:13 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-07-22 16:17:04 +0000 |
commit | bc9a8ddbb7081f79e915c841e56fd1c40f0df6f9 (patch) | |
tree | 952e65dd815f91b23689251da794d1ff2a609119 /unotools | |
parent | 786573068dce1f71c53057f98b5822c401c9f3ff (diff) |
tdf#82744: fix WebDAV lock/unlock behaviour - part 2
Changes done to the code in framework, comphelper and unotools,
in no particular order
- add an interaction handler dedicated to WebDAV
The stock interaction handler can be missing depending on the need of
the framework performing its tasks, so a dedicated handler is
provided, this one is always present.
- force opening of a WebDAV file.
A WebDAV file sould be open r/o even if explicitly requested to open
as r/w.
This is a limitation of current WebDAV implementation, not of the
standard.
This change is needed in order to reopen correctly a file as
requested by a 'Edit Mode' GUI command.
Change-Id: I5368fa2c0511f1630e6d6139c6a986d33aa19082
Reviewed-on: https://gerrit.libreoffice.org/17182
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/misc/mediadescriptor.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/unotools/source/misc/mediadescriptor.cxx b/unotools/source/misc/mediadescriptor.cxx index c85194b45542..f874a979ccf0 100644 --- a/unotools/source/misc/mediadescriptor.cxx +++ b/unotools/source/misc/mediadescriptor.cxx @@ -153,7 +153,13 @@ const OUString& MediaDescriptor::PROP_INTERACTIONHANDLER() return sProp; } -const OUString& MediaDescriptor::PROP_JUMPMARK() +const OUString& MediaDescriptor::PROP_AUTHENTICATIONHANDLER() +{ + static const OUString sProp("AuthenticationHandler"); + return sProp; +} + + const OUString& MediaDescriptor::PROP_JUMPMARK() { static const OUString sProp("JumpMark"); return sProp; @@ -601,7 +607,11 @@ bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, bool bLockFi MediaDescriptor::PROP_INTERACTIONHANDLER(), css::uno::Reference< css::task::XInteractionHandler >()); - comphelper::StillReadWriteInteraction* pInteraction = new comphelper::StillReadWriteInteraction(xOrgInteraction); + css::uno::Reference< css::task::XInteractionHandler > xAuthenticationInteraction = getUnpackedValueOrDefault( + MediaDescriptor::PROP_AUTHENTICATIONHANDLER(), + css::uno::Reference< css::task::XInteractionHandler >()); + + comphelper::StillReadWriteInteraction* pInteraction = new comphelper::StillReadWriteInteraction(xOrgInteraction,xAuthenticationInteraction); css::uno::Reference< css::task::XInteractionHandler > xInteraction(static_cast< css::task::XInteractionHandler* >(pInteraction), css::uno::UNO_QUERY); css::uno::Reference< css::ucb::XProgressHandler > xProgress; @@ -676,7 +686,16 @@ bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, bool bLockFi "unotools.misc", "caught Exception \"" << e.Message << "\" while opening <" << sURL << ">"); - return false; + // If the protocol is webdav, then we need to treat the stream as readonly, even if the + // operation was requested as read/write explicitly (the WebDAV UCB implementation is monodirectional + // read or write not both at the same time). + OUString aScheme; + css::uno::Reference< css::ucb::XContentIdentifier > xContId( + aContent.get().is() ? aContent.get()->getIdentifier() : 0 ); + if ( xContId.is() ) + aScheme = xContId->getContentProviderScheme(); + if(!aScheme.equalsIgnoreAsciiCaseAscii( "http" ) && !aScheme.equalsIgnoreAsciiCaseAscii( "https" )) + return false; } xStream.clear(); xInputStream.clear(); |