Kaydet (Commit) 3475d91b authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, cleanup some usage of getProcessServiceFactory()

Change-Id: Id97ae7a16141b5c5df380f5838bba11cb08c9223
üst 286a8622
...@@ -318,90 +318,86 @@ IMPL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*, EMPTYARG) ...@@ -318,90 +318,86 @@ IMPL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*, EMPTYARG)
void SwTestAccountSettingsDialog::Test() void SwTestAccountSettingsDialog::Test()
{ {
uno::Reference<XMultiServiceFactory> rMgr = ::comphelper::getProcessServiceFactory(); uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
rtl::OUString sException; rtl::OUString sException;
bool bIsLoggedIn = false; bool bIsLoggedIn = false;
bool bIsServer = 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; xInMailService = xMailServiceProvider->create(
uno::Reference< mail::XMailServiceProvider > xMailServiceProvider( m_pParent->m_pConfigItem->IsInServerPOP() ?
mail::MailServiceProvider::create( mail::MailServiceType_POP3 : mail::MailServiceType_IMAP);
comphelper::getComponentContext(rMgr)));
uno::Reference< mail::XMailService > xMailService =
xMailServiceProvider->create(
mail::MailServiceType_SMTP);
if(m_bStop) if(m_bStop)
return; return;
uno::Reference<XConnectionListener> xConnectionListener(new SwConnectionListener()); //authenticate at the POP or IMAP server first
uno::Reference<XAuthenticator> xAuthenticator =
if(m_pParent->m_pConfigItem->IsAuthentication() && new SwAuthenticator(
m_pParent->m_pConfigItem->IsSMTPAfterPOP()) m_pParent->m_pConfigItem->GetInServerUserName(),
{ m_pParent->m_pConfigItem->GetInServerPassword(),
xInMailService = xMailServiceProvider->create( this);
m_pParent->m_pConfigItem->IsInServerPOP() ?
mail::MailServiceType_POP3 : mail::MailServiceType_IMAP); xInMailService->addConnectionListener(xConnectionListener);
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;
//check connection //check connection
uno::Reference< uno::XCurrentContext> xConnectionContext = uno::Reference< uno::XCurrentContext> xConnectionContext =
new SwConnectionContext( new SwConnectionContext(
m_pParent->m_aServerED.GetText(), m_pParent->m_pConfigItem->GetInServerName(),
sal::static_int_cast< sal_Int16, sal_Int64 >(m_pParent->m_aPortNF.GetValue()), m_pParent->m_pConfigItem->GetInServerPort(),
m_pParent->m_aSecureCB.IsChecked() ? OUString("Ssl") : OUString("Insecure")); ::rtl::OUString("Insecure"));
xMailService->connect(xConnectionContext, xAuthenticator); xInMailService->connect(xConnectionContext, xAuthenticator);
bIsLoggedIn = xMailService->isConnected();
if( xInMailService.is() )
xInMailService->disconnect();
if( xMailService->isConnected())
xMailService->disconnect();
}
catch (const uno::Exception& e)
{
sException = e.Message;
} }
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 ); Image aFailedImg = m_aImageList.GetImage( FN_FORMULA_CANCEL );
......
...@@ -276,7 +276,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl) ...@@ -276,7 +276,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl)
{ {
SvTreeListEntry* pSelect = m_aListLB.FirstSelected(); SvTreeListEntry* pSelect = m_aListLB.FirstSelected();
uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
if(pSelect && xMgr.is()) if(pSelect)
{ {
String sCommand = m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1); String sCommand = m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1);
if ( !sCommand.Len() ) if ( !sCommand.Len() )
......
...@@ -1215,7 +1215,6 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, ...@@ -1215,7 +1215,6 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
// for adding as fields -> insert a "NextField" after // for adding as fields -> insert a "NextField" after
// every data set // every data set
SwDBFormatData aDBFormatData; SwDBFormatData aDBFormatData;
Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
aDBFormatData.xFormatter = Reference<util::XNumberFormatter>(util::NumberFormatter::create(xContext), UNO_QUERY_THROW) ; aDBFormatData.xFormatter = Reference<util::XNumberFormatter>(util::NumberFormatter::create(xContext), UNO_QUERY_THROW) ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment