diff options
author | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-08-06 17:30:31 +0200 |
---|---|---|
committer | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-08-08 10:55:49 +0000 |
commit | f60eaab748add19683e66c7e4bc073c9ce7887f7 (patch) | |
tree | 3dc22884c71aa237bf1e3b2d28a1d9bb10dc45c7 | |
parent | 0bab74d6357c6438cfb38d56dd8f75217af6bd2a (diff) |
Related: tdf#99312, add specialized interaction handler
Needed to manage https certificates and authentication whenever
needed.
Change-Id: If20b85a9b349b203a8c46d453afa823629d114cb
Reviewed-on: https://gerrit.libreoffice.org/27927
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
-rw-r--r-- | filter/CppunitTest_filter_eps_test.mk | 1 | ||||
-rw-r--r-- | sax/CppunitTest_sax_xmlimport.mk | 1 | ||||
-rw-r--r-- | unotools/source/ucbhelper/ucbstreamhelper.cxx | 19 | ||||
-rw-r--r-- | vcl/CppunitTest_vcl_filters_test.mk | 1 |
4 files changed, 20 insertions, 2 deletions
diff --git a/filter/CppunitTest_filter_eps_test.mk b/filter/CppunitTest_filter_eps_test.mk index d49f10e05aeb..befc029d6cfe 100644 --- a/filter/CppunitTest_filter_eps_test.mk +++ b/filter/CppunitTest_filter_eps_test.mk @@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_use_components,filter_eps_test,\ i18npool/util/i18npool \ ucb/source/core/ucb1 \ ucb/source/ucp/file/ucpfile1 \ + uui/util/uui \ )) $(eval $(call gb_CppunitTest_use_configuration,filter_eps_test)) diff --git a/sax/CppunitTest_sax_xmlimport.mk b/sax/CppunitTest_sax_xmlimport.mk index 14b6488ec192..80263316ba1d 100644 --- a/sax/CppunitTest_sax_xmlimport.mk +++ b/sax/CppunitTest_sax_xmlimport.mk @@ -48,6 +48,7 @@ $(eval $(call gb_CppunitTest_use_components,sax_xmlimport,\ sax/source/expatwrap/expwrap \ ucb/source/core/ucb1 \ ucb/source/ucp/file/ucpfile1 \ + uui/util/uui \ )) $(eval $(call gb_CppunitTest_use_configuration,sax_xmlimport)) diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx index 51d4f65ef1e7..133fa28e3c4f 100644 --- a/unotools/source/ucbhelper/ucbstreamhelper.cxx +++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx @@ -20,12 +20,14 @@ #include <rtl/ustring.hxx> #include <unotools/ucbstreamhelper.hxx> #include <comphelper/processfactory.hxx> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/CommandAbortedException.hpp> #include <com/sun/star/ucb/UniversalContentBroker.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/ucb/InsertCommandArgument.hpp> #include <com/sun/star/io/XActiveDataStreamer.hpp> +#include <comphelper/simplefileaccessinteraction.hxx> #include <ucbhelper/content.hxx> #include <unotools/streamwrap.hxx> #include <ucblockbytes.hxx> @@ -140,7 +142,14 @@ static SvStream* lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMo SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode ) { - return lcl_CreateStream( rFileName, eOpenMode, Reference < XInteractionHandler >(), true /* bEnsureFileExists */ ); + // related tdf#99312 + // create a specialized interaction handler to manages Web certificates and Web credentials when needed + Reference< XInteractionHandler > xIH( + css::task::InteractionHandler::createWithParent( comphelper::getProcessComponentContext(), nullptr ) ); + Reference < XInteractionHandler > xIHScoped( static_cast< XInteractionHandler *> ( + new comphelper::SimpleFileAccessInteraction( xIH ) ) ); + + return lcl_CreateStream( rFileName, eOpenMode, xIHScoped, true /* bEnsureFileExists */ ); } SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode, @@ -152,7 +161,13 @@ SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode e SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode, bool bFileExists ) { - return lcl_CreateStream( rFileName, eOpenMode, Reference < XInteractionHandler >(), !bFileExists ); + // related tdf#99312 + // create a specialized interaction handler to manages Web certificates and Web credentials when needed + Reference< XInteractionHandler > xIH( + css::task::InteractionHandler::createWithParent( comphelper::getProcessComponentContext(), nullptr ) ); + Reference < XInteractionHandler > xIHScoped( static_cast< XInteractionHandler *> ( + new comphelper::SimpleFileAccessInteraction( xIH ) ) ); + return lcl_CreateStream( rFileName, eOpenMode, xIHScoped,!bFileExists ); } SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream ) diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk index e1c30dfd5542..15efa5e1cfab 100644 --- a/vcl/CppunitTest_vcl_filters_test.mk +++ b/vcl/CppunitTest_vcl_filters_test.mk @@ -44,6 +44,7 @@ $(eval $(call gb_CppunitTest_use_components,vcl_filters_test,\ i18npool/util/i18npool \ ucb/source/core/ucb1 \ ucb/source/ucp/file/ucpfile1 \ + uui/util/uui \ )) $(eval $(call gb_CppunitTest_use_configuration,vcl_filters_test)) |