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 | |
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')
-rw-r--r-- | uui/source/iahndl-authentication.cxx | 2 | ||||
-rw-r--r-- | uui/source/iahndl.cxx | 10 | ||||
-rw-r--r-- | uui/source/iahndl.hxx | 4 | ||||
-rw-r--r-- | uui/source/interactionhandler.hxx | 6 | ||||
-rw-r--r-- | uui/source/passwordcontainer.cxx | 41 | ||||
-rw-r--r-- | uui/source/passwordcontainer.hxx | 15 |
6 files changed, 49 insertions, 29 deletions
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index bf09e7e3e1d1..31d26b27a679 100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -186,7 +186,7 @@ void getRememberModes( void handleAuthenticationRequest_( Window * pParent, - uno::Reference< task::XInteractionHandler > const & xIH, + uno::Reference< task::XInteractionHandler2 > const & xIH, uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory, ucb::AuthenticationRequest const & rRequest, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index e09256d9027e..09f904cf2971 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -1107,15 +1107,13 @@ UUIInteractionHelper::getContextProperty() return m_aContextParam; } -uno::Reference< task::XInteractionHandler > +uno::Reference< task::XInteractionHandler2 > UUIInteractionHelper::getInteractionHandler() SAL_THROW((uno::RuntimeException)) { - uno::Reference< task::XInteractionHandler > xIH( - InteractionHandler::createWithParentAndContext(comphelper::getComponentContext(m_xServiceFactory), - m_xWindowParam, m_aContextParam), - UNO_QUERY_THROW); - return xIH; + return InteractionHandler::createWithParentAndContext( + comphelper::getComponentContext(m_xServiceFactory), m_xWindowParam, + m_aContextParam); } namespace { diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index 3266f0b90216..eee766753f92 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -52,7 +52,7 @@ namespace com { namespace sun { namespace star { namespace task { class FutureDocumentVersionProductUpdateRequest; class XInteractionContinuation; - class XInteractionHandler; + class XInteractionHandler2; class XInteractionRequest; } namespace ucb { @@ -161,7 +161,7 @@ private: getContextProperty() SAL_THROW(()); - com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > + com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler2 > getInteractionHandler() SAL_THROW((com::sun::star::uno::RuntimeException)); diff --git a/uui/source/interactionhandler.hxx b/uui/source/interactionhandler.hxx index 8d2147b74641..39acd8624a22 100644 --- a/uui/source/interactionhandler.hxx +++ b/uui/source/interactionhandler.hxx @@ -20,14 +20,16 @@ #ifndef UUI_INTERACTIONHANDLER_HXX #define UUI_INTERACTIONHANDLER_HXX +#include "com/sun/star/lang/XInitialization.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/task/XInteractionHandler2.hpp" -#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/implbase3.hxx" class UUIInteractionHelper; class UUIInteractionHandler: - public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo, + public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo, + com::sun::star::lang::XInitialization, com::sun::star::task::XInteractionHandler2 > { public: 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; } //========================================================================= diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx index 31434a3f0da1..af9fdb16dd9b 100644 --- a/uui/source/passwordcontainer.hxx +++ b/uui/source/passwordcontainer.hxx @@ -24,7 +24,7 @@ #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/lang/XSingleServiceFactory.hpp" -#include "com/sun/star/task/XInteractionHandler.hpp" +#include "com/sun/star/task/XInteractionHandler2.hpp" #include "com/sun/star/task/XPasswordContainer2.hpp" namespace com { @@ -90,7 +90,7 @@ public: xSupplyAuthentication, rtl::OUString const & rURL, com::sun::star::uno::Reference< - com::sun::star::task::XInteractionHandler > const & xIH ) + com::sun::star::task::XInteractionHandler2 > const & xIH ) SAL_THROW( (com::sun::star::uno::RuntimeException) ); /** This member function adds credentials for the given URL to the password @@ -125,7 +125,7 @@ public: com::sun::star::uno::Sequence< rtl::OUString > const & rPasswords, com::sun::star::uno::Reference< - com::sun::star::task::XInteractionHandler > const & xIH, + com::sun::star::task::XInteractionHandler2 > const & xIH, bool bPersist ) SAL_THROW( (com::sun::star::uno::RuntimeException) ); @@ -140,7 +140,7 @@ private: class PasswordContainerInteractionHandler : public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo, - com::sun::star::task::XInteractionHandler > + com::sun::star::task::XInteractionHandler2 > { public: PasswordContainerInteractionHandler( @@ -160,12 +160,17 @@ public: getSupportedServiceNames() throw ( com::sun::star::uno::RuntimeException ); - // XInteractionHandler + // XInteractionHandler2 virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL + handleInteractionRequest( const ::com::sun::star::uno::Reference< + ::com::sun::star::task::XInteractionRequest >& Request ) + throw (::com::sun::star::uno::RuntimeException); + // Non-UNO interfaces static rtl::OUString getImplementationName_Static(); |