diff options
author | Noel Grandin <noel@peralex.com> | 2013-03-08 13:13:22 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-03-20 07:32:51 +0200 |
commit | 3475d91b1ac97d45f6337b9560491f25b3672549 (patch) | |
tree | ed415b461e48ec532af7ab7a90e18d197836880e /sw | |
parent | 286a86221b0b666fb9c54ffc30fdf1fd99a1316d (diff) |
fdo#46808, cleanup some usage of getProcessServiceFactory()
Change-Id: Id97ae7a16141b5c5df380f5838bba11cb08c9223
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/config/mailconfigpage.cxx | 138 | ||||
-rw-r--r-- | sw/source/ui/dbui/addresslistdialog.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 1 |
3 files changed, 68 insertions, 73 deletions
diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index d044096a5c6c..1528670b0ca0 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -318,90 +318,86 @@ IMPL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*, EMPTYARG) void SwTestAccountSettingsDialog::Test() { - uno::Reference<XMultiServiceFactory> rMgr = ::comphelper::getProcessServiceFactory(); + uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); rtl::OUString sException; bool bIsLoggedIn = false; bool bIsServer = false; - if (rMgr.is()) + try { - try + uno::Reference< mail::XMailService > xInMailService; + uno::Reference< mail::XMailServiceProvider > xMailServiceProvider( + mail::MailServiceProvider::create(xContext) ); + uno::Reference< mail::XMailService > xMailService = + xMailServiceProvider->create( + mail::MailServiceType_SMTP); + if(m_bStop) + return; + uno::Reference<XConnectionListener> xConnectionListener(new SwConnectionListener()); + + if(m_pParent->m_pConfigItem->IsAuthentication() && + m_pParent->m_pConfigItem->IsSMTPAfterPOP()) { - uno::Reference< mail::XMailService > xInMailService; - uno::Reference< mail::XMailServiceProvider > xMailServiceProvider( - mail::MailServiceProvider::create( - comphelper::getComponentContext(rMgr))); - uno::Reference< mail::XMailService > xMailService = - xMailServiceProvider->create( - mail::MailServiceType_SMTP); + xInMailService = xMailServiceProvider->create( + m_pParent->m_pConfigItem->IsInServerPOP() ? + mail::MailServiceType_POP3 : mail::MailServiceType_IMAP); if(m_bStop) return; - uno::Reference<XConnectionListener> xConnectionListener(new SwConnectionListener()); - - if(m_pParent->m_pConfigItem->IsAuthentication() && - m_pParent->m_pConfigItem->IsSMTPAfterPOP()) - { - xInMailService = xMailServiceProvider->create( - m_pParent->m_pConfigItem->IsInServerPOP() ? - mail::MailServiceType_POP3 : mail::MailServiceType_IMAP); - if(m_bStop) - return; - //authenticate at the POP or IMAP server first - uno::Reference<XAuthenticator> xAuthenticator = - new SwAuthenticator( - m_pParent->m_pConfigItem->GetInServerUserName(), - m_pParent->m_pConfigItem->GetInServerPassword(), - this); - - xInMailService->addConnectionListener(xConnectionListener); - //check connection - uno::Reference< uno::XCurrentContext> xConnectionContext = - new SwConnectionContext( - m_pParent->m_pConfigItem->GetInServerName(), - m_pParent->m_pConfigItem->GetInServerPort(), - ::rtl::OUString("Insecure")); - xInMailService->connect(xConnectionContext, xAuthenticator); - } - if(m_bStop) - return; - uno::Reference<XAuthenticator> xAuthenticator; - if(m_pParent->m_pConfigItem->IsAuthentication() && - !m_pParent->m_pConfigItem->IsSMTPAfterPOP() && - !m_pParent->m_pConfigItem->GetMailUserName().isEmpty()) - xAuthenticator = - new SwAuthenticator( - m_pParent->m_pConfigItem->GetMailUserName(), - m_pParent->m_pConfigItem->GetMailPassword(), - this); - else - xAuthenticator = new SwAuthenticator(); - - xMailService->addConnectionListener(xConnectionListener); - if(m_bStop) - return; - //just to check if the server exists - xMailService->getSupportedConnectionTypes(); - if(m_bStop) - return; - bIsServer = true; + //authenticate at the POP or IMAP server first + uno::Reference<XAuthenticator> xAuthenticator = + new SwAuthenticator( + m_pParent->m_pConfigItem->GetInServerUserName(), + m_pParent->m_pConfigItem->GetInServerPassword(), + this); + + xInMailService->addConnectionListener(xConnectionListener); //check connection uno::Reference< uno::XCurrentContext> xConnectionContext = new SwConnectionContext( - m_pParent->m_aServerED.GetText(), - sal::static_int_cast< sal_Int16, sal_Int64 >(m_pParent->m_aPortNF.GetValue()), - m_pParent->m_aSecureCB.IsChecked() ? OUString("Ssl") : OUString("Insecure")); - xMailService->connect(xConnectionContext, xAuthenticator); - bIsLoggedIn = xMailService->isConnected(); - if( xInMailService.is() ) - xInMailService->disconnect(); - if( xMailService->isConnected()) - xMailService->disconnect(); - } - catch (const uno::Exception& e) - { - sException = e.Message; + m_pParent->m_pConfigItem->GetInServerName(), + m_pParent->m_pConfigItem->GetInServerPort(), + ::rtl::OUString("Insecure")); + xInMailService->connect(xConnectionContext, xAuthenticator); } + if(m_bStop) + return; + uno::Reference<XAuthenticator> xAuthenticator; + if(m_pParent->m_pConfigItem->IsAuthentication() && + !m_pParent->m_pConfigItem->IsSMTPAfterPOP() && + !m_pParent->m_pConfigItem->GetMailUserName().isEmpty()) + xAuthenticator = + new SwAuthenticator( + m_pParent->m_pConfigItem->GetMailUserName(), + m_pParent->m_pConfigItem->GetMailPassword(), + this); + else + xAuthenticator = new SwAuthenticator(); + + xMailService->addConnectionListener(xConnectionListener); + if(m_bStop) + return; + //just to check if the server exists + xMailService->getSupportedConnectionTypes(); + if(m_bStop) + return; + bIsServer = true; + //check connection + uno::Reference< uno::XCurrentContext> xConnectionContext = + new SwConnectionContext( + m_pParent->m_aServerED.GetText(), + sal::static_int_cast< sal_Int16, sal_Int64 >(m_pParent->m_aPortNF.GetValue()), + m_pParent->m_aSecureCB.IsChecked() ? OUString("Ssl") : OUString("Insecure")); + xMailService->connect(xConnectionContext, xAuthenticator); + bIsLoggedIn = xMailService->isConnected(); + if( xInMailService.is() ) + xInMailService->disconnect(); + if( xMailService->isConnected()) + xMailService->disconnect(); + } + catch (const uno::Exception& e) + { + sException = e.Message; } Image aFailedImg = m_aImageList.GetImage( FN_FORMULA_CANCEL ); diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index eae8e68357ef..2dfe6f5e2bab 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -276,7 +276,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl) { SvTreeListEntry* pSelect = m_aListLB.FirstSelected(); uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - if(pSelect && xMgr.is()) + if(pSelect) { String sCommand = m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1); if ( !sCommand.Len() ) diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 4a89b6eaab10..e475cdf2a163 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1215,7 +1215,6 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, // for adding as fields -> insert a "NextField" after // every data set SwDBFormatData aDBFormatData; - Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); aDBFormatData.xFormatter = Reference<util::XNumberFormatter>(util::NumberFormatter::create(xContext), UNO_QUERY_THROW) ; |