diff options
author | Noel Grandin <noel@peralex.com> | 2012-09-05 09:47:35 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-11 18:51:54 +0200 |
commit | 77897f5994bd18c3b771e51abce5ee6be01322fc (patch) | |
tree | 83e748eae69283ba5fde7ccc6bab32f23c34ad77 | |
parent | a9b9ffacac74310c38f152cb9bcc56fe06b0e1d6 (diff) |
fdo#46808, Adapt task::PasswordContainer UNO service to new style
Create a merged XPasswordContainer2 interface for this service to implement.
Which is backwards-compatible, but does not require creating a new service.
Change-Id: I245b566b43e4646f10914b0aee13b2a0b0e296ae
-rw-r--r-- | cui/source/options/optinet2.cxx | 16 | ||||
-rw-r--r-- | cui/source/options/webconninfo.cxx | 16 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/task/PasswordContainer.idl | 22 | ||||
-rw-r--r-- | offapi/com/sun/star/task/XPasswordContainer2.idl | 55 | ||||
-rw-r--r-- | offapi/type_reference/types.rdb | bin | 7655424 -> 7655424 bytes | |||
-rw-r--r-- | uui/source/iahndl-authentication.cxx | 4 | ||||
-rw-r--r-- | uui/source/passwordcontainer.cxx | 20 | ||||
-rw-r--r-- | uui/source/passwordcontainer.hxx | 6 |
9 files changed, 85 insertions, 57 deletions
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 51ba59543806..7202ce06ad77 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -94,6 +94,7 @@ #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 "securityoptions.hxx" #include "webconninfo.hxx" @@ -709,8 +710,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl) try { Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), + task::PasswordContainer::create(comphelper::getProcessComponentContext()), UNO_QUERY_THROW ); if ( maSavePasswordsCB.IsChecked() ) @@ -766,8 +766,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordHdl) try { Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), + task::PasswordContainer::create(comphelper::getProcessComponentContext()), UNO_QUERY ); if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() ) @@ -784,8 +783,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordCBHdl) try { Reference< task::XMasterPasswordHandling2 > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), + task::PasswordContainer::create(comphelper::getProcessComponentContext()), UNO_QUERY_THROW ); if ( maMasterPasswordCB.IsChecked() ) @@ -830,8 +828,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl) try { Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), + task::PasswordContainer::create(comphelper::getProcessComponentContext()), UNO_QUERY ); if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) ) @@ -966,8 +963,7 @@ void SvxSecurityTabPage::InitControls() try { Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), + task::PasswordContainer::create(comphelper::getProcessComponentContext()), UNO_QUERY_THROW ); if ( xMasterPasswd->isPersistentStoringAllowed() ) diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx index 0f43f19cb069..198d1fc4d578 100644 --- a/cui/source/options/webconninfo.cxx +++ b/cui/source/options/webconninfo.cxx @@ -30,6 +30,7 @@ #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" @@ -183,8 +184,7 @@ void WebConnectionInfoDialog::FillPasswordList() try { uno::Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), + task::PasswordContainer::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY ); if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() ) @@ -244,9 +244,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemovePasswordHdl) ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); uno::Reference< task::XPasswordContainer > xPasswdContainer( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.PasswordContainer" ) ) ), + task::PasswordContainer::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY_THROW ); sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); @@ -275,9 +273,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemoveAllPasswordsHdl) try { uno::Reference< task::XPasswordContainer > xPasswdContainer( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.PasswordContainer" ) ) ), + task::PasswordContainer::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY_THROW ); // should the master password be requested before? @@ -327,9 +323,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl) aPasswd[0] = aNewPass; uno::Reference< task::XPasswordContainer > xPasswdContainer( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.PasswordContainer" ) ) ), + task::PasswordContainer::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY_THROW ); xPasswdContainer->addPersistent( aURL, aUserName, aPasswd, xInteractionHandler ); diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index db5f8ccec969..20eafe067baa 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -270,6 +270,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/task,\ InteractionRequestStringResolver \ JobExecutor \ OfficeRestartManager \ + PasswordContainer \ PasswordContainerInteractionHandler \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/text,\ @@ -1216,7 +1217,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/task,\ AsyncJob \ InteractionHandler \ Job \ - PasswordContainer \ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/text,\ AccessibleEndnoteView \ @@ -3616,6 +3616,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/task,\ XMasterPasswordHandling \ XMasterPasswordHandling2 \ XPasswordContainer \ + XPasswordContainer2 \ XRestartManager \ XStatusIndicator \ XStatusIndicatorFactory \ diff --git a/offapi/com/sun/star/task/PasswordContainer.idl b/offapi/com/sun/star/task/PasswordContainer.idl index 830feef57523..69f9b3b15a68 100644 --- a/offapi/com/sun/star/task/PasswordContainer.idl +++ b/offapi/com/sun/star/task/PasswordContainer.idl @@ -30,8 +30,7 @@ module com { module sun { module star { module task { - published interface XPasswordContainer; - published interface XMasterPasswordHandling; + published interface XPasswordContainer2; }; }; }; }; @@ -57,24 +56,7 @@ module com { module sun { module star { module task { non-persistent way explicitly. </p> */ -published service PasswordContainer -{ - /** handles passwords - - <p> - Use this interface to store\retrieve passwords. - </p> - */ - interface com::sun::star::task::XPasswordContainer; - - /** handles passwords - - <p> - Use this interface to store\retrieve passwords. - </p> - */ - [optional] interface com::sun::star::task::XMasterPasswordHandling; -}; +published service PasswordContainer : com::sun::star::task::XPasswordContainer2; }; }; }; }; #endif diff --git a/offapi/com/sun/star/task/XPasswordContainer2.idl b/offapi/com/sun/star/task/XPasswordContainer2.idl new file mode 100644 index 000000000000..d22a28f1432f --- /dev/null +++ b/offapi/com/sun/star/task/XPasswordContainer2.idl @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_task_XPasswordContainer2_idl__ +#define __com_sun_star_task_XPasswordContainer2_idl__ + +#include <com/sun/star/task/XPasswordContainer.idl> +#include <com/sun/star/task/XMasterPasswordHandling.idl> + + +module com { module sun { module star { module task { + +/** + Provides a unified interface for the PasswordContainer service to implement. +*/ +published interface XPasswordContainer2 +{ + /** handles passwords + + <p> + Use this interface to store\retrieve passwords. + </p> + */ + interface com::sun::star::task::XPasswordContainer; + + /** handles passwords + + <p> + Use this interface to store\retrieve passwords. + </p> + */ + [optional] interface com::sun::star::task::XMasterPasswordHandling; +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex e6e15796737f..753f0bcddc16 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 0a03af980cb5..6e03e22f1b04 100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "comphelper/componentcontext.hxx" + #include "com/sun/star/task/DocumentPasswordRequest.hpp" #include "com/sun/star/task/DocumentPasswordRequest2.hpp" #include "com/sun/star/task/DocumentMSPasswordRequest.hpp" @@ -204,7 +206,7 @@ handleAuthenticationRequest_( ////////////////////////// // First, try to obtain credentials from password container service. - uui::PasswordContainerHelper aPwContainerHelper(xServiceFactory); + uui::PasswordContainerHelper aPwContainerHelper(comphelper::ComponentContext(xServiceFactory).getUNOContext()); if (aPwContainerHelper.handleAuthenticationRequest(rRequest, xSupplyAuthentication, rURL, diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx index eec9c1045d68..bf54620cf342 100644 --- a/uui/source/passwordcontainer.cxx +++ b/uui/source/passwordcontainer.cxx @@ -17,9 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "comphelper/componentcontext.hxx" #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/XInteractionHandler.hpp" #include "com/sun/star/task/XMasterPasswordHandling.hpp" @@ -111,19 +113,15 @@ namespace uui { //========================================================================= PasswordContainerHelper::PasswordContainerHelper( - uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory ) + uno::Reference< uno::XComponentContext > const & xContext ) { - OSL_ENSURE(xServiceFactory.is(), "no service factory given!"); - if (xServiceFactory.is()) + OSL_ENSURE(xContext.is(), "no service factory given!"); + if (xContext.is()) try { m_xPasswordContainer = uno::Reference< task::XPasswordContainer >( - xServiceFactory-> - createInstance( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.PasswordContainer"))), + task::PasswordContainer::create(xContext), uno::UNO_QUERY); } catch (uno::Exception const &) @@ -308,8 +306,8 @@ bool PasswordContainerHelper::addRecord( //========================================================================= PasswordContainerInteractionHandler::PasswordContainerInteractionHandler( - const uno::Reference< lang::XMultiServiceFactory >& xSMgr ) -: m_aPwContainerHelper( xSMgr ) + const uno::Reference< uno::XComponentContext >& xContext ) +: m_aPwContainerHelper( xContext ) { } @@ -452,7 +450,7 @@ PasswordContainerInteractionHandler_CreateInstance( throw( uno::Exception ) { lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >( - new PasswordContainerInteractionHandler( rSMgr ) ); + new PasswordContainerInteractionHandler( comphelper::ComponentContext(rSMgr).getUNOContext() ) ); return uno::Reference< uno::XInterface >::query( pX ); } diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx index 61ee44bd5818..a755fc5115ec 100644 --- a/uui/source/passwordcontainer.hxx +++ b/uui/source/passwordcontainer.hxx @@ -49,8 +49,8 @@ class PasswordContainerHelper public: PasswordContainerHelper( com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > const & - xServiceFactory ); + com::sun::star::uno::XComponentContext > const & + xContext ); // ------------------------------------------------------------------------ @@ -145,7 +145,7 @@ class PasswordContainerInteractionHandler : public: PasswordContainerInteractionHandler( const com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory >& rXSMgr ); + com::sun::star::uno::XComponentContext >& xContext ); virtual ~PasswordContainerInteractionHandler(); // XServiceInfo |