diff options
-rw-r--r-- | cui/source/options/optinet2.cxx | 35 | ||||
-rw-r--r-- | cui/source/options/webconninfo.cxx | 46 | ||||
-rw-r--r-- | offapi/com/sun/star/task/XMasterPasswordHandling2.idl | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/task/XPasswordContainer2.idl | 10 | ||||
-rw-r--r-- | offapi/com/sun/star/task/XUrlContainer.idl | 2 | ||||
-rw-r--r-- | svl/source/inc/passwordcontainer.hxx | 12 | ||||
-rw-r--r-- | uui/source/passwordcontainer.cxx | 60 | ||||
-rw-r--r-- | uui/source/passwordcontainer.hxx | 4 |
8 files changed, 58 insertions, 113 deletions
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 7202ce06ad77..27e334b4801a 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -93,9 +93,8 @@ #include <comphelper/string.hxx> #include "com/sun/star/ui/dialogs/TemplateDescription.hpp" -#include "com/sun/star/task/XMasterPasswordHandling2.hpp" #include "com/sun/star/task/PasswordContainer.hpp" -#include "com/sun/star/task/XPasswordContainer.hpp" +#include "com/sun/star/task/XPasswordContainer2.hpp" #include "securityoptions.hxx" #include "webconninfo.hxx" #include "certpath.hxx" @@ -709,9 +708,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl) { try { - Reference< task::XMasterPasswordHandling > xMasterPasswd( - task::PasswordContainer::create(comphelper::getProcessComponentContext()), - UNO_QUERY_THROW ); + Reference< task::XPasswordContainer2 > xMasterPasswd( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); if ( maSavePasswordsCB.IsChecked() ) { @@ -765,11 +763,10 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordHdl) { try { - Reference< task::XMasterPasswordHandling > xMasterPasswd( - task::PasswordContainer::create(comphelper::getProcessComponentContext()), - UNO_QUERY ); + Reference< task::XPasswordContainer2 > xMasterPasswd( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); - if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() ) + if ( xMasterPasswd->isPersistentStoringAllowed() ) xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ); } catch (const Exception&) @@ -782,9 +779,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordCBHdl) { try { - Reference< task::XMasterPasswordHandling2 > xMasterPasswd( - task::PasswordContainer::create(comphelper::getProcessComponentContext()), - UNO_QUERY_THROW ); + Reference< task::XPasswordContainer2 > xMasterPasswd( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); if ( maMasterPasswordCB.IsChecked() ) { @@ -827,11 +823,10 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl) { try { - Reference< task::XMasterPasswordHandling > xMasterPasswd( - task::PasswordContainer::create(comphelper::getProcessComponentContext()), - UNO_QUERY ); + Reference< task::XPasswordContainer2 > xMasterPasswd( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); - if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) ) + if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) ) { svx::WebConnectionInfoDialog aDlg( this ); aDlg.Execute(); @@ -962,9 +957,8 @@ void SvxSecurityTabPage::InitControls() // initialize the password saving checkbox try { - Reference< task::XMasterPasswordHandling > xMasterPasswd( - task::PasswordContainer::create(comphelper::getProcessComponentContext()), - UNO_QUERY_THROW ); + Reference< task::XPasswordContainer2 > xMasterPasswd( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); if ( xMasterPasswd->isPersistentStoringAllowed() ) { @@ -972,8 +966,7 @@ void SvxSecurityTabPage::InitControls() maShowConnectionsPB.Enable( sal_True ); maSavePasswordsCB.Check( sal_True ); - Reference< task::XMasterPasswordHandling2 > xMasterPasswd2( xMasterPasswd, UNO_QUERY ); - if ( xMasterPasswd2.is() && xMasterPasswd2->isDefaultMasterPasswordUsed() ) + if ( xMasterPasswd->isDefaultMasterPasswordUsed() ) maMasterPasswordCB.Check( sal_False ); else { diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx index 198d1fc4d578..0bfdd2527cbf 100644 --- a/cui/source/options/webconninfo.cxx +++ b/cui/source/options/webconninfo.cxx @@ -29,11 +29,9 @@ #include <dialmgr.hxx> #include <cuires.hrc> #include <sal/macros.h> -#include <com/sun/star/task/UrlRecord.hpp> #include <com/sun/star/task/PasswordContainer.hpp> -#include <com/sun/star/task/XPasswordContainer.hpp> -#include <com/sun/star/task/XMasterPasswordHandling.hpp> -#include "com/sun/star/task/XUrlContainer.hpp" +#include <com/sun/star/task/UrlRecord.hpp> +#include <com/sun/star/task/XPasswordContainer2.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/docpasswordrequest.hxx> #include "webconninfo.hxx" @@ -183,19 +181,17 @@ void WebConnectionInfoDialog::FillPasswordList() { try { - uno::Reference< task::XMasterPasswordHandling > xMasterPasswd( - task::PasswordContainer::create(comphelper::getProcessComponentContext()), - uno::UNO_QUERY ); + uno::Reference< task::XPasswordContainer2 > xMasterPasswd( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); - if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() ) + if ( xMasterPasswd->isPersistentStoringAllowed() ) { - uno::Reference< task::XPasswordContainer > xPasswdContainer( xMasterPasswd, uno::UNO_QUERY_THROW ); uno::Reference< task::XInteractionHandler > xInteractionHandler( comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); - uno::Sequence< task::UrlRecord > aURLEntries = xPasswdContainer->getAllPersistent( xInteractionHandler ); + uno::Sequence< task::UrlRecord > aURLEntries = xMasterPasswd->getAllPersistent( xInteractionHandler ); sal_Int32 nCount = 0; for ( sal_Int32 nURLInd = 0; nURLInd < aURLEntries.getLength(); nURLInd++ ) { @@ -212,11 +208,8 @@ void WebConnectionInfoDialog::FillPasswordList() // remember pos of first url container entry. m_nPos = nCount; - uno::Reference< task::XUrlContainer > xUrlContainer( - xPasswdContainer, uno::UNO_QUERY_THROW ); - uno::Sequence< rtl::OUString > aUrls - = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ ); + = xMasterPasswd->getUrls( sal_True /* OnlyPersistent */ ); for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ ) { @@ -243,9 +236,8 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemovePasswordHdl) ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 ); ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); - uno::Reference< task::XPasswordContainer > xPasswdContainer( - task::PasswordContainer::create(comphelper::getProcessComponentContext()), - uno::UNO_QUERY_THROW ); + uno::Reference< task::XPasswordContainer2 > xPasswdContainer( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); if ( nPos < m_nPos ) @@ -254,9 +246,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemovePasswordHdl) } else { - uno::Reference< task::XUrlContainer > xUrlContainer( - xPasswdContainer, uno::UNO_QUERY_THROW ); - xUrlContainer->removeUrl( aURL ); + xPasswdContainer->removeUrl( aURL ); } m_aPasswordsLB.RemoveEntry( pEntry ); } @@ -272,19 +262,16 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemoveAllPasswordsHdl) { try { - uno::Reference< task::XPasswordContainer > xPasswdContainer( - task::PasswordContainer::create(comphelper::getProcessComponentContext()), - uno::UNO_QUERY_THROW ); + uno::Reference< task::XPasswordContainer2 > xPasswdContainer( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); // should the master password be requested before? xPasswdContainer->removeAllPersistent(); - uno::Reference< task::XUrlContainer > xUrlContainer( - xPasswdContainer, uno::UNO_QUERY_THROW ); uno::Sequence< rtl::OUString > aUrls - = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ ); + = xPasswdContainer->getUrls( sal_True /* OnlyPersistent */ ); for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ ) - xUrlContainer->removeUrl( aUrls[ nURLIdx ] ); + xPasswdContainer->removeUrl( aUrls[ nURLIdx ] ); m_aPasswordsLB.Clear(); } @@ -322,9 +309,8 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl) uno::Sequence< ::rtl::OUString > aPasswd( 1 ); aPasswd[0] = aNewPass; - uno::Reference< task::XPasswordContainer > xPasswdContainer( - task::PasswordContainer::create(comphelper::getProcessComponentContext()), - uno::UNO_QUERY_THROW ); + uno::Reference< task::XPasswordContainer2 > xPasswdContainer( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); xPasswdContainer->addPersistent( aURL, aUserName, aPasswd, xInteractionHandler ); } diff --git a/offapi/com/sun/star/task/XMasterPasswordHandling2.idl b/offapi/com/sun/star/task/XMasterPasswordHandling2.idl index 8842030db072..bb1c5401a990 100644 --- a/offapi/com/sun/star/task/XMasterPasswordHandling2.idl +++ b/offapi/com/sun/star/task/XMasterPasswordHandling2.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module task { /** allows to change the master password, or let it be requested and checked. */ -interface XMasterPasswordHandling2 : XMasterPasswordHandling +published interface XMasterPasswordHandling2 : XMasterPasswordHandling { /** allows to let the default password be used diff --git a/offapi/com/sun/star/task/XPasswordContainer2.idl b/offapi/com/sun/star/task/XPasswordContainer2.idl index d22a28f1432f..0c551d5e5371 100644 --- a/offapi/com/sun/star/task/XPasswordContainer2.idl +++ b/offapi/com/sun/star/task/XPasswordContainer2.idl @@ -19,14 +19,16 @@ #ifndef __com_sun_star_task_XPasswordContainer2_idl__ #define __com_sun_star_task_XPasswordContainer2_idl__ +#include <com/sun/star/task/XMasterPasswordHandling2.idl> #include <com/sun/star/task/XPasswordContainer.idl> -#include <com/sun/star/task/XMasterPasswordHandling.idl> - +#include <com/sun/star/task/XUrlContainer.idl> module com { module sun { module star { module task { /** Provides a unified interface for the PasswordContainer service to implement. + + @since LibreOffice 3.7 */ published interface XPasswordContainer2 { @@ -44,7 +46,9 @@ published interface XPasswordContainer2 Use this interface to store\retrieve passwords. </p> */ - [optional] interface com::sun::star::task::XMasterPasswordHandling; + interface com::sun::star::task::XMasterPasswordHandling2; + + interface com::sun::star::task::XUrlContainer; }; diff --git a/offapi/com/sun/star/task/XUrlContainer.idl b/offapi/com/sun/star/task/XUrlContainer.idl index d872f2b73e2b..46bcbeca8aa9 100644 --- a/offapi/com/sun/star/task/XUrlContainer.idl +++ b/offapi/com/sun/star/task/XUrlContainer.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module task { @since OOo 3.2 */ -/*published*/ interface XUrlContainer : com::sun::star::uno::XInterface +published interface XUrlContainer : com::sun::star::uno::XInterface { /** Add a URL to the container. diff --git a/svl/source/inc/passwordcontainer.hxx b/svl/source/inc/passwordcontainer.hxx index 43b8d780993f..6b69b3ce2c3b 100644 --- a/svl/source/inc/passwordcontainer.hxx +++ b/svl/source/inc/passwordcontainer.hxx @@ -22,15 +22,13 @@ #include <list> #include <vector> #include <map> -#include <com/sun/star/task/XPasswordContainer.hpp> -#include <com/sun/star/task/XUrlContainer.hpp> +#include <com/sun/star/task/XPasswordContainer2.hpp> #include <com/sun/star/task/PasswordRequestMode.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/task/XMasterPasswordHandling2.hpp> -#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase3.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/factory.hxx> @@ -233,10 +231,8 @@ enum PasswordState { cancelled }; -class PasswordContainer : public ::cppu::WeakImplHelper5< - ::com::sun::star::task::XPasswordContainer, - ::com::sun::star::task::XMasterPasswordHandling2, - ::com::sun::star::task::XUrlContainer, +class PasswordContainer : public ::cppu::WeakImplHelper3< + ::com::sun::star::task::XPasswordContainer2, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XEventListener > { diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx index bf54620cf342..546d795bded4 100644 --- a/uui/source/passwordcontainer.cxx +++ b/uui/source/passwordcontainer.cxx @@ -21,12 +21,9 @@ #include "cppuhelper/factory.hxx" #include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/task/PasswordContainer.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/XMasterPasswordHandling.hpp" -#include "com/sun/star/task/XPasswordContainer.hpp" -#include "com/sun/star/task/XUrlContainer.hpp" #include "com/sun/star/ucb/AuthenticationRequest.hpp" #include "com/sun/star/ucb/URLAuthenticationRequest.hpp" #include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp" @@ -113,22 +110,9 @@ namespace uui { //========================================================================= PasswordContainerHelper::PasswordContainerHelper( - uno::Reference< uno::XComponentContext > const & xContext ) -{ - OSL_ENSURE(xContext.is(), "no service factory given!"); - if (xContext.is()) - try - { - m_xPasswordContainer - = uno::Reference< task::XPasswordContainer >( - task::PasswordContainer::create(xContext), - uno::UNO_QUERY); - } - catch (uno::Exception const &) - {} - OSL_ENSURE(m_xPasswordContainer.is(), - "unable to instanciate password container service"); -} + uno::Reference< uno::XComponentContext > const & xContext ): + m_xPasswordContainer(task::PasswordContainer::create(xContext)) +{} //========================================================================= bool PasswordContainerHelper::handleAuthenticationRequest( @@ -153,20 +137,11 @@ bool PasswordContainerHelper::handleAuthenticationRequest( bDefaultUseSystemCredentials ); } - uno::Reference< task::XPasswordContainer > xContainer( - m_xPasswordContainer ); - uno::Reference< task::XUrlContainer > xUrlContainer( - m_xPasswordContainer, uno::UNO_QUERY ); - OSL_ENSURE( xUrlContainer.is(), "Got no XUrlContainer!" ); - - if ( !xContainer.is() || !xUrlContainer.is() ) - return false; - if ( bCanUseSystemCredentials ) { // Runtime / Persistent info avail for current auth request? - rtl::OUString aResult = xUrlContainer->findUrl( + rtl::OUString aResult = m_xPasswordContainer->findUrl( rURL.isEmpty() ? rRequest.ServerName : rURL ); if ( !aResult.isEmpty() ) { @@ -183,7 +158,7 @@ bool PasswordContainerHelper::handleAuthenticationRequest( } } - // xContainer works with userName passwdSequences pairs: + // m_xPasswordContainer works with userName passwdSequences pairs: if (rRequest.HasUserName && rRequest.HasPassword) { try @@ -192,12 +167,12 @@ bool PasswordContainerHelper::handleAuthenticationRequest( { task::UrlRecord aRec; if ( !rURL.isEmpty() ) - aRec = xContainer->find(rURL, xIH); + aRec = m_xPasswordContainer->find(rURL, xIH); if ( aRec.UserList.getLength() == 0 ) { // compat: try server name. - aRec = xContainer->find(rRequest.ServerName, xIH); + aRec = m_xPasswordContainer->find(rRequest.ServerName, xIH); } if ( fillContinuation( false, @@ -215,13 +190,13 @@ bool PasswordContainerHelper::handleAuthenticationRequest( { task::UrlRecord aRec; if ( !rURL.isEmpty() ) - aRec = xContainer->findForName( + aRec = m_xPasswordContainer->findForName( rURL, rRequest.UserName, xIH); if ( aRec.UserList.getLength() == 0 ) { // compat: try server name. - aRec = xContainer->findForName( + aRec = m_xPasswordContainer->findForName( rRequest.ServerName, rRequest.UserName, xIH); } @@ -263,13 +238,10 @@ bool PasswordContainerHelper::addRecord( if ( bPersist ) { - uno::Reference< task::XMasterPasswordHandling > xMPH( - m_xPasswordContainer, uno::UNO_QUERY_THROW ); - // If persistent storing of passwords is not yet // allowed, enable it. - if ( !xMPH->isPersistentStoringAllowed() ) - xMPH->allowPersistentStoring( sal_True ); + if ( !m_xPasswordContainer->isPersistentStoringAllowed() ) + m_xPasswordContainer->allowPersistentStoring( sal_True ); m_xPasswordContainer->addPersistent( rURL, rUsername, @@ -284,13 +256,7 @@ bool PasswordContainerHelper::addRecord( } else { - uno::Reference< task::XUrlContainer > - xContainer( m_xPasswordContainer, uno::UNO_QUERY ); - OSL_ENSURE( xContainer.is(), "Got no XUrlContainer!" ); - if ( !xContainer.is() ) - return false; - - xContainer->addUrl( rURL, bPersist ); + m_xPasswordContainer->addUrl( rURL, bPersist ); } } catch ( task::NoMasterException const & ) diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx index a755fc5115ec..31434a3f0da1 100644 --- a/uui/source/passwordcontainer.hxx +++ b/uui/source/passwordcontainer.hxx @@ -25,7 +25,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/XPasswordContainer.hpp" +#include "com/sun/star/task/XPasswordContainer2.hpp" namespace com { namespace sun { @@ -133,7 +133,7 @@ public: private: com::sun::star::uno::Reference< - com::sun::star::task::XPasswordContainer > m_xPasswordContainer; + com::sun::star::task::XPasswordContainer2 > m_xPasswordContainer; }; // ============================================================================ |