diff options
author | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-04-19 08:17:48 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-04-22 07:11:43 +0000 |
commit | 37d34e2b6a96569313178ce864096722230cb3b9 (patch) | |
tree | b93f747d3315b8881e41e9a45050fdce3ca1314a | |
parent | bbe51f039dffca2506ea542feb78571b6358b981 (diff) |
Related tdf#88502 a better implementation than the one in...
...commit 70bb8c257e7fc402da60fa70109cece1fe4c69d1.
This commit reverts previous implementation in commit
70bb8c257e7fc402da60fa70109cece1fe4c69d1 and makes use of a dedicated
interaction wrapper instead.
See comphelper::SimpleFileAccessInteraction for details.
Change-Id: Ia037ea14267afaf66d8f9aa2324649264a7cb4bf
Reviewed-on: https://gerrit.libreoffice.org/24275
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | cui/source/options/personalization.cxx | 18 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontent.cxx | 24 |
2 files changed, 19 insertions, 23 deletions
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 57298ae26243..799da445cfc5 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -29,10 +29,12 @@ #include <dialmgr.hxx> #include "cuires.hrc" +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/xml/sax/XParser.hpp> #include <com/sun/star/xml/sax/Parser.hpp> #include "ucbhelper/content.hxx" +#include <comphelper/simplefileaccessinteraction.hxx> using namespace com::sun::star; using namespace ::com::sun::star::uno; @@ -579,10 +581,26 @@ void SearchAndParseThread::execute() return; try { + css:: uno::Reference< task::XInteractionHandler > xIH( + css::task::InteractionHandler::createWithParent( xContext, nullptr ) ); + + xFileAccess->setInteractionHandler( new comphelper::SimpleFileAccessInteraction( xIH ) ); + xStream = xFileAccess->openFileRead( m_aURL ); + if( !xStream.is() ) + { + // in case of a returned CommandFailedException + // SimpleFileAccess serves it, returning an empty stream + sProgress = CUI_RES(RID_SVXSTR_SEARCHERROR); + sProgress = sProgress.replaceAll("%1", m_aURL); + m_pPersonaDialog->SetProgress(sProgress); + return; + } } catch (...) { + // a catch all clause, in case the exception is not + // served elsewhere sProgress = CUI_RES(RID_SVXSTR_SEARCHERROR); sProgress = sProgress.replaceAll("%1", m_aURL); m_pPersonaDialog->SetProgress(sProgress); diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 625e2fe3acd2..e3c1decc962e 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -51,7 +51,6 @@ #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/lang/IllegalAccessException.hpp> #include <com/sun/star/task/PasswordContainerInteractionHandler.hpp> -#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/CommandEnvironment.hpp> #include <com/sun/star/ucb/CommandFailedException.hpp> #include <com/sun/star/ucb/ContentInfoAttribute.hpp> @@ -3436,27 +3435,6 @@ Content::ResourceType Content::getResourceType( } else { - // In case xEnv is present, uses the interaction handler provided - // in xEnv. - // In case xEnv is not present, supply a command env to PROPFIND() - // that contains an interaction handler in order to activate the - // credential dialog if the server request them. - // The command env is needed by lower level function for examples as - // NeonSession_CertificationNotify where it is used to check the server - // certificate or ask the user for a manual confirmation if the certificate - // needs the user visual check. - // xEnv is still used in cancelCommandExecution(), so the cancelling operates - // as the client application (e.g. framework) requested. - css::uno::Reference< css::ucb::XCommandEnvironment > xAuthEnv( xEnv ); - if( !xAuthEnv.is() ) - { - css:: uno::Reference< task::XInteractionHandler > xIH( - css::task::InteractionHandler::createWithParent( m_xContext, nullptr ), css::uno::UNO_QUERY_THROW ); - - xAuthEnv = css::ucb::CommandEnvironment::create( - m_xContext, xIH, css::uno::Reference< ucb::XProgressHandler >() ) ; - } - try { // Try to fetch some frequently used property value, e.g. those @@ -3473,7 +3451,7 @@ Content::ResourceType Content::getResourceType( ContentProperties::UCBNamesToDAVNames( aProperties, aPropNames ); - rResAccess->PROPFIND( DAVZERO, aPropNames, resources, xAuthEnv ); + rResAccess->PROPFIND( DAVZERO, aPropNames, resources, xEnv ); if ( resources.size() == 1 ) { |