From 83235caca899ba8088a24b8713ba49f52e4ba8ec Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 10 Jan 2013 13:27:23 +0200 Subject: fdo#46808, convert code to use new-style service constructor Change-Id: I1b50f7ef6c01d13abd15ba3a76bd683a0151a914 --- dbaccess/source/ui/dlg/ConnectionHelper.cxx | 49 +++++++++++++---------------- 1 file changed, 21 insertions(+), 28 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index 9193dbc8533e..9dad8a6b0304 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include "UITools.hxx" @@ -290,42 +291,34 @@ DBG_NAME(OConnectionHelper) if (eType == ::dbaccess::DST_THUNDERBIRD) profileType = MozillaProductType_Thunderbird; - Reference xFactory = ::comphelper::getProcessServiceFactory(); - OSL_ENSURE( xFactory.is(), "can't get service factory" ); + Reference xContext = ::comphelper::getProcessComponentContext(); + Reference xMozillaBootstrap = MozillaBootstrap::create(xContext); - Reference xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) ); - OSL_ENSURE( xInstance.is(), "failed to create instance" ); - Reference xMozillaBootstrap = Reference(xInstance,UNO_QUERY); - OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" ); + // collect all Mozilla Profiles + ::com::sun::star::uno::Sequence< ::rtl::OUString > list; - if (xMozillaBootstrap.is()) - { - // collect all Mozilla Profiles - ::com::sun::star::uno::Sequence< ::rtl::OUString > list; - - xMozillaBootstrap->getProfileList( profileType, list ); - const ::rtl::OUString * pArray = list.getConstArray(); + xMozillaBootstrap->getProfileList( profileType, list ); + const ::rtl::OUString * pArray = list.getConstArray(); - sal_Int32 count = list.getLength(); + sal_Int32 count = list.getLength(); - StringBag aProfiles; - for (sal_Int32 index=0; index < count; index++) - aProfiles.insert(pArray[index]); + StringBag aProfiles; + for (sal_Int32 index=0; index < count; index++) + aProfiles.insert(pArray[index]); - // execute the select dialog - ODatasourceSelectDialog aSelector(GetParent(), aProfiles); - ::rtl::OUString sOldProfile=getURLNoPrefix(); + // execute the select dialog + ODatasourceSelectDialog aSelector(GetParent(), aProfiles); + ::rtl::OUString sOldProfile=getURLNoPrefix(); - if (!sOldProfile.isEmpty()) - aSelector.Select(sOldProfile); - else - aSelector.Select(xMozillaBootstrap->getDefaultProfile(profileType)); + if (!sOldProfile.isEmpty()) + aSelector.Select(sOldProfile); + else + aSelector.Select(xMozillaBootstrap->getDefaultProfile(profileType)); - if ( RET_OK == aSelector.Execute() ) - setURLNoPrefix(aSelector.GetSelected()); - break; - } + if ( RET_OK == aSelector.Execute() ) + setURLNoPrefix(aSelector.GetSelected()); + break; } default: break; -- cgit