summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-02-01 16:04:49 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-12 08:28:46 +0000
commita9abfefd469f5988bd116427d42d799e17264013 (patch)
tree1c92de3f3a37a90c5a96524636d82c0eee73fdda /fpicker
parenta6c5dfc9470c261f11efa35bcad98ef7ac632aaa (diff)
Fix tdf#97500 Reinstate missing file error dialog on WebDAV
Bug introduced with my fix to tdf#96669 in commit 5fc2910fc872bbd1184aaab7c842dff593d2449b. Reverted previous fix and write a new version in fpicker instead. On WebDAV better check if the stream opens first, then check IsDocument property, because it may be a folder name. Change-Id: I72ce728329e4194080db6fa4cc4d98fecf7672e9 Reviewed-on: https://gerrit.libreoffice.org/22214 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org> (cherry picked from commit f12e483589888f87843026ceff5ae3c1e615ca02) Reviewed-on: https://gerrit.libreoffice.org/22283 Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> Tested-by: jan iversen <jani@documentfoundation.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx26
1 files changed, 23 insertions, 3 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 91d2bc61c1cd..29d22d67157d 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -7,6 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "RemoteFilesDialog.hxx"
+#include <comphelper/stillreadwriteinteraction.hxx>
class FileViewContainer : public vcl::Window
{
@@ -1416,10 +1417,29 @@ bool RemoteFilesDialog::ContentIsDocument( const OUString& rURL )
{
Reference< XInteractionHandler > xInteractionHandler(
InteractionHandler::createWithParent( m_xContext, nullptr ), UNO_QUERY_THROW );
- Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
- ::ucbhelper::Content aContent( rURL, xEnv, m_xContext );
+ //check if WebDAV or not
+ if ( !INetURLObject( rURL ).isAnyKnownWebDAVScheme() )
+ {
+ // no webdav, use the interaction handler as is
+ Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
+ ::ucbhelper::Content aContent( rURL, xEnv, m_xContext );
- return aContent.isDocument();
+ return aContent.isDocument();
+ }
+ else
+ {
+ // It's a webdav URL, so use the same open sequence as in normal open process.
+ // Let's use a comphelper::StillReadWriteInteraction to trap errors here without showing the user.
+ // This sequence will result in an exception if the target URL resource is not present
+ comphelper::StillReadWriteInteraction* pInteraction = new comphelper::StillReadWriteInteraction(xInteractionHandler,xInteractionHandler);
+ css::uno::Reference< css::task::XInteractionHandler > xInteraction(static_cast< css::task::XInteractionHandler* >(pInteraction), css::uno::UNO_QUERY);
+
+ Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteraction, Reference< XProgressHandler >() );
+ ::ucbhelper::Content aContent( rURL, xEnv, m_xContext );
+
+ aContent.openStream();
+ return aContent.isDocument();
+ }
}
catch( const Exception& )
{