Kaydet (Commit) beb17b18 authored tarafından Justin Luth's avatar Justin Luth

mailmerge UI: always write the SMTP port to config

I think that the m_bDefaultPort approach (from OOo days)
was attempting to allow toggling between Secure/Insecure defaults,
which didn't work well. Now that toggling works well,
remove this logic so that a working configuration won't be broken
in the future if some defaults change again.

Change-Id: I92f29892070016e230870648c3b99c0f2d087806
Reviewed-on: https://gerrit.libreoffice.org/48851Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst 467d3690
......@@ -175,9 +175,7 @@ bool SwMailConfigPage::FillItemSet( SfxItemSet* /*rSet*/ )
if(m_pServerED->IsValueChangedFromSaved())
m_pConfigItem->SetMailServer(m_pServerED->GetText());
if(m_pPortNF->IsModified())
m_pConfigItem->SetMailPort(static_cast<sal_Int16>(m_pPortNF->GetValue()));
m_pConfigItem->SetMailPort(static_cast<sal_Int16>(m_pPortNF->GetValue()));
m_pConfigItem->SetSecureConnection(m_pSecureCB->IsChecked());
m_pConfigItem->Commit();
......@@ -231,6 +229,7 @@ IMPL_LINK(SwMailConfigPage, SecureHdl, Button*, pBox, void)
{
bool bEnable = static_cast<CheckBox*>(pBox)->IsChecked();
m_pConfigItem->SetSecureConnection(bEnable);
m_pConfigItem->SetMailPort(static_cast<sal_Int16>(m_pPortNF->GetValue()));
m_pPortNF->SetValue(m_pConfigItem->GetMailPort());
}
......
......@@ -132,7 +132,6 @@ class SwMailMergeConfigItem_Impl : public utl::ConfigItem
sal_Int16 m_nMailPort;
bool m_bIsMailReplyTo;
bool m_bIsDefaultPort;
bool m_bIsSecureConnection;
bool m_bIsAuthentication;
......@@ -196,9 +195,8 @@ SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() :
m_bIsSMPTAfterPOP(false),
m_nInServerPort( POP_SECURE_PORT ),
m_bInServerPOP( true ),
m_nMailPort(0),
m_nMailPort(SECURE_PORT),
m_bIsMailReplyTo(false),
m_bIsDefaultPort(false),
m_bIsSecureConnection(true),
m_bIsAuthentication(false),
......@@ -256,7 +254,7 @@ SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() :
case 16: pValues[nProp] >>= m_bIsMailReplyTo; break;
case 17: pValues[nProp] >>= m_sMailReplyTo; break;
case 18: pValues[nProp] >>= m_sMailServer; break;
case 19: m_bIsDefaultPort = !(pValues[nProp] >>= m_nMailPort); break;
case 19: pValues[nProp] >>= m_nMailPort; break;
case 20: pValues[nProp] >>= m_bIsSecureConnection; break;
case 21: pValues[nProp] >>= m_bIsAuthentication; break;
case 22: pValues[nProp] >>= m_sMailUserName; break;
......@@ -527,9 +525,7 @@ void SwMailMergeConfigItem_Impl::ImplCommit()
case 16: pValues[nProp] <<= m_bIsMailReplyTo; break;
case 17: pValues[nProp] <<= m_sMailReplyTo; break;
case 18: pValues[nProp] <<= m_sMailServer; break;
case 19: if(!m_bIsDefaultPort)
pValues[nProp] <<= m_nMailPort;
break;
case 19: pValues[nProp] <<= m_nMailPort; break;
case 20: pValues[nProp] <<= m_bIsSecureConnection; break;
case 21: pValues[nProp] <<= m_bIsAuthentication; break;
case 22: pValues[nProp] <<= m_sMailUserName; break;
......@@ -1381,17 +1377,23 @@ void SwMailMergeConfigItem::SetMailServer(const OUString& rAddress)
sal_Int16 SwMailMergeConfigItem::GetMailPort() const
{
return m_pImpl->m_bIsDefaultPort ?
(m_pImpl->m_bIsSecureConnection ? SECURE_PORT : DEFAULT_PORT) :
m_pImpl->m_nMailPort;
// provide appropriate TCP port, based on SSL/STARTTLS status, if current port is one of the defaults
switch (m_pImpl->m_nMailPort)
{
case SECURE_PORT:
case DEFAULT_PORT:
return m_pImpl->m_bIsSecureConnection ? SECURE_PORT : DEFAULT_PORT;
break;
default:
return m_pImpl->m_nMailPort;
}
}
void SwMailMergeConfigItem::SetMailPort(sal_Int16 nSet)
{
if(m_pImpl->m_nMailPort != nSet || m_pImpl->m_bIsDefaultPort)
if(m_pImpl->m_nMailPort != nSet)
{
m_pImpl->m_nMailPort = nSet;
m_pImpl->m_bIsDefaultPort = false;
m_pImpl->SetModified();
}
}
......
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