From 8963c350986fc57cb0cf98387d7bd1c7bf6420a1 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 11 Sep 2012 19:09:24 +0200 Subject: Improvement on previous commit Change-Id: I10984b6ac4128ad46f512dade0f4e0084d0b9348 --- cui/source/options/webconninfo.cxx | 46 +++++++++++++------------------------- 1 file changed, 16 insertions(+), 30 deletions(-) (limited to 'cui/source/options/webconninfo.cxx') 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 #include #include -#include #include -#include -#include -#include "com/sun/star/task/XUrlContainer.hpp" +#include +#include #include #include #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 ); } -- cgit