[Libreoffice-commits] core.git: sw/source
Justin Luth
justin_luth at sil.org
Mon Feb 5 06:06:48 UTC 2018
sw/source/ui/config/mailconfigpage.cxx | 5 ++---
sw/source/uibase/dbui/mmconfigitem.cxx | 26 ++++++++++++++------------
2 files changed, 16 insertions(+), 15 deletions(-)
New commits:
commit beb17b18b1621d057aab255051e7265efecf17b3
Author: Justin Luth <justin_luth at sil.org>
Date: Mon Jan 29 17:42:40 2018 +0300
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/48851
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx
index 5cd8ebe377ef..71b9b773ffc2 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -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());
}
diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx
index ee4645e1801d..e1a66d04a86e 100644
--- a/sw/source/uibase/dbui/mmconfigitem.cxx
+++ b/sw/source/uibase/dbui/mmconfigitem.cxx
@@ -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();
}
}
More information about the Libreoffice-commits
mailing list