summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-10 13:27:23 +0200
committerNoel Grandin <noel@peralex.com>2013-01-28 08:23:12 +0200
commit83235caca899ba8088a24b8713ba49f52e4ba8ec (patch)
tree0daa506042579dde668c234d0270a3efc78c8620
parent4ce614f50b572f5e80c1d26e7ffe72c1bb07a0d9 (diff)
fdo#46808, convert code to use new-style service constructor
Change-Id: I1b50f7ef6c01d13abd15ba3a76bd683a0151a914
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx49
1 files changed, 21 insertions, 28 deletions
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 <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/mozilla/MozillaBootstrap.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/ucb/XProgressHandler.hpp>
#include "UITools.hxx"
@@ -290,42 +291,34 @@ DBG_NAME(OConnectionHelper)
if (eType == ::dbaccess::DST_THUNDERBIRD)
profileType = MozillaProductType_Thunderbird;
- Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
+ Reference<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ Reference<XMozillaBootstrap> xMozillaBootstrap = MozillaBootstrap::create(xContext);
- Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- Reference<XMozillaBootstrap> xMozillaBootstrap = Reference<XMozillaBootstrap>(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;