diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-10-04 14:36:34 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-04 14:42:52 +0200 |
commit | dd11a1e57a2565560803dc3fef5fccc9e7157105 (patch) | |
tree | 4adf17c00e21a17b0137a286ce1547b0e56bea2f /uui/source/passwordcontainer.cxx | |
parent | c25cb8a641723ab098980bb842caf75c0dc9b059 (diff) |
Fixes/improvements on previous commit
* UUIInteractionHandler still needs to implement XInitialization.
* Moved ambiguating InteractionHandler typedef out of the way.
* Removed InteractionHandler.createDefault, as it was originally stated that "it
is strongly recommended that [the "Parent"] property is supplied."
* Added back documentation about Parent and Context.
* Simplified some call-sites to directly use XInteractionHandler2.
Change-Id: I1029b8f3cf079171c75920cafaaa44b5bbada883
Diffstat (limited to 'uui/source/passwordcontainer.cxx')
-rw-r--r-- | uui/source/passwordcontainer.cxx | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx index 5a688c622197..0005fe976668 100644 --- a/uui/source/passwordcontainer.cxx +++ b/uui/source/passwordcontainer.cxx @@ -23,7 +23,7 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/task/NoMasterException.hpp" #include "com/sun/star/task/PasswordContainer.hpp" -#include "com/sun/star/task/XInteractionHandler.hpp" +#include "com/sun/star/task/XInteractionHandler2.hpp" #include "com/sun/star/ucb/AuthenticationRequest.hpp" #include "com/sun/star/ucb/URLAuthenticationRequest.hpp" #include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp" @@ -120,9 +120,11 @@ bool PasswordContainerHelper::handleAuthenticationRequest( uno::Reference< ucb::XInteractionSupplyAuthentication > const & xSupplyAuthentication, rtl::OUString const & rURL, - uno::Reference< task::XInteractionHandler > const & xIH ) + uno::Reference< task::XInteractionHandler2 > const & xIH ) SAL_THROW((uno::RuntimeException)) { + uno::Reference< task::XInteractionHandler > xIH1(xIH, uno::UNO_QUERY); + // Is continuation even a XInteractionSupplyAuthentication2, which // is derived from XInteractionSupplyAuthentication? uno::Reference< ucb::XInteractionSupplyAuthentication2 > @@ -167,12 +169,12 @@ bool PasswordContainerHelper::handleAuthenticationRequest( { task::UrlRecord aRec; if ( !rURL.isEmpty() ) - aRec = m_xPasswordContainer->find(rURL, xIH); + aRec = m_xPasswordContainer->find(rURL, xIH1); if ( aRec.UserList.getLength() == 0 ) { // compat: try server name. - aRec = m_xPasswordContainer->find(rRequest.ServerName, xIH); + aRec = m_xPasswordContainer->find(rRequest.ServerName, xIH1); } if ( fillContinuation( false, @@ -191,13 +193,13 @@ bool PasswordContainerHelper::handleAuthenticationRequest( task::UrlRecord aRec; if ( !rURL.isEmpty() ) aRec = m_xPasswordContainer->findForName( - rURL, rRequest.UserName, xIH); + rURL, rRequest.UserName, xIH1); if ( aRec.UserList.getLength() == 0 ) { // compat: try server name. aRec = m_xPasswordContainer->findForName( - rRequest.ServerName, rRequest.UserName, xIH); + rRequest.ServerName, rRequest.UserName, xIH1); } if ( fillContinuation( false, @@ -223,10 +225,12 @@ bool PasswordContainerHelper::addRecord( rtl::OUString const & rURL, rtl::OUString const & rUsername, uno::Sequence< rtl::OUString > const & rPasswords, - uno::Reference< task::XInteractionHandler > const & xIH, + uno::Reference< task::XInteractionHandler2 > const & xIH, bool bPersist ) SAL_THROW((uno::RuntimeException)) { + uno::Reference< task::XInteractionHandler > xIH1(xIH, uno::UNO_QUERY); + try { if ( !rUsername.isEmpty() ) @@ -246,13 +250,13 @@ bool PasswordContainerHelper::addRecord( m_xPasswordContainer->addPersistent( rURL, rUsername, rPasswords, - xIH ); + xIH1 ); } else m_xPasswordContainer->add( rURL, rUsername, rPasswords, - xIH ); + xIH1 ); } else { @@ -346,7 +350,7 @@ PasswordContainerInteractionHandler::getSupportedServiceNames_Static() //========================================================================= // -// XInteractionHandler methods. +// XInteractionHandler2 methods. // //========================================================================= @@ -356,14 +360,23 @@ PasswordContainerInteractionHandler::handle( const uno::Reference< task::XInteractionRequest >& rRequest ) throw ( uno::RuntimeException ) { + handleInteractionRequest( rRequest ); +} + +// virtual +sal_Bool SAL_CALL +PasswordContainerInteractionHandler::handleInteractionRequest( + const uno::Reference< task::XInteractionRequest >& rRequest ) + throw ( uno::RuntimeException ) +{ if ( !rRequest.is() ) - return; + return false; uno::Any aAnyRequest( rRequest->getRequest() ); ucb::AuthenticationRequest aAuthenticationRequest; if ( !( aAnyRequest >>= aAuthenticationRequest ) ) - return; + return false; rtl::OUString aURL; ucb::URLAuthenticationRequest aURLAuthenticationRequest; @@ -386,7 +399,7 @@ PasswordContainerInteractionHandler::handle( } if ( !xSupplyAuthentication.is() ) - return; + return false; // Try to obtain credentials from password container. if ( m_aPwContainerHelper. @@ -401,7 +414,9 @@ PasswordContainerInteractionHandler::handle( { // successfully handled xSupplyAuthentication->select(); + return true; } + return false; } //========================================================================= |