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)
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 );
......
......@@ -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() )
......
......@@ -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) ;
......
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