diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-11 19:09:24 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-11 19:09:24 +0200 |
commit | 8963c350986fc57cb0cf98387d7bd1c7bf6420a1 (patch) | |
tree | 6fc8a0b83e9406bfaac91a0026466a94d28e8624 /cui | |
parent | fdo#46808, Adapt task::PasswordContainer UNO service to new style (diff) | |
download | core-8963c350986fc57cb0cf98387d7bd1c7bf6420a1.tar.gz core-8963c350986fc57cb0cf98387d7bd1c7bf6420a1.zip |
Improvement on previous commit
Change-Id: I10984b6ac4128ad46f512dade0f4e0084d0b9348
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optinet2.cxx | 35 | ||||
-rw-r--r-- | cui/source/options/webconninfo.cxx | 46 |
2 files changed, 30 insertions, 51 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 ); } |