[Libreoffice-commits] core.git: sw/source

Justin Luth justin_luth at sil.org
Sun Jan 28 13:36:08 UTC 2018


 sw/source/ui/config/mailconfigpage.cxx |   11 +++++++++++
 sw/source/uibase/dbui/mmconfigitem.cxx |   21 +++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 972cb3ea9949325d74b9d7d919765e22df0101d7
Author: Justin Luth <justin_luth at sil.org>
Date:   Thu Jan 18 18:49:07 2018 +0300

    mailconfig UI: default POP port 995 and toggle with IMAP ports
    
    SSL is now default, so change POP3's default to port 995.
    Also, suggest appropriate secure/insecure ports for
    IMAP and POP as the user switches between them.
    
    Change-Id: Ib930504956a222d0d6eb3cad969907751602c106
    Reviewed-on: https://gerrit.libreoffice.org/48212
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx
index df0984ea5f72..c3928d35eccb 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -107,6 +107,7 @@ class SwAuthenticationSettingsDialog : public SfxModalDialog
     DECL_LINK(OKHdl_Impl, Button*, void);
     DECL_LINK( CheckBoxHdl_Impl, Button*, void);
     DECL_LINK(RadioButtonHdl_Impl, Button*, void);
+    DECL_LINK(InServerHdl_Impl, Button*, void);
 
 public:
     SwAuthenticationSettingsDialog(SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem);
@@ -423,6 +424,9 @@ SwAuthenticationSettingsDialog::SwAuthenticationSettingsDialog(
     m_pSeparateAuthenticationRB->SetClickHdl( aRBLink );
     m_pSMTPAfterPOPRB->SetClickHdl( aRBLink );
     m_pOKPB->SetClickHdl( LINK( this, SwAuthenticationSettingsDialog, OKHdl_Impl));
+    Link<Button*,void> aInServerLink = LINK( this, SwAuthenticationSettingsDialog, InServerHdl_Impl );
+    m_pPOP3RB->SetClickHdl( aInServerLink );
+    m_pIMAPRB->SetClickHdl( aInServerLink );
 
     m_pAuthenticationCB->Check( rConfigItem.IsAuthentication() );
     if(rConfigItem.IsSMTPAfterPOP())
@@ -535,4 +539,11 @@ IMPL_LINK_NOARG(SwAuthenticationSettingsDialog, RadioButtonHdl_Impl, Button*, vo
     m_pInPasswordED->Enable(bNotSeparate);
 }
 
+IMPL_LINK_NOARG( SwAuthenticationSettingsDialog, InServerHdl_Impl, Button*, void)
+{
+    bool bPOP = m_pPOP3RB->IsChecked();
+    rConfigItem.SetInServerPOP(bPOP);
+    m_pPortNF->SetValue(rConfigItem.GetInServerPort());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx
index 92fbccf8381d..ee4645e1801d 100644
--- a/sw/source/uibase/dbui/mmconfigitem.cxx
+++ b/sw/source/uibase/dbui/mmconfigitem.cxx
@@ -62,6 +62,9 @@ const char cDataCommandType[]        = "DataSource/DataCommandType";
 #define SECURE_PORT     587
 #define DEFAULT_PORT    25
 #define POP_PORT        110
+#define POP_SECURE_PORT     995
+#define IMAP_PORT           143
+#define IMAP_SECURE_PORT    993
 
 struct DBAddressDataAssignment
 {
@@ -191,7 +194,7 @@ SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() :
         m_bIsGreetingLineInMail(false),
         m_bIsIndividualGreetingLineInMail(false),
         m_bIsSMPTAfterPOP(false),
-        m_nInServerPort( POP_PORT ),
+        m_nInServerPort( POP_SECURE_PORT ),
         m_bInServerPOP( true ),
         m_nMailPort(0),
         m_bIsMailReplyTo(false),
@@ -1479,7 +1482,21 @@ void SwMailMergeConfigItem::SetInServerName(const OUString& rServer)
 
 sal_Int16           SwMailMergeConfigItem::GetInServerPort() const
 {
-    return m_pImpl->m_nInServerPort;
+    // provide appropriate TCP port as user toggles between POP/IMAP if current port is one of the defaults
+    switch (m_pImpl->m_nInServerPort)
+    {
+    case POP_SECURE_PORT:
+    case POP_PORT:
+    case IMAP_SECURE_PORT:
+    case IMAP_PORT:
+        if ( m_pImpl->m_bInServerPOP )
+            return m_pImpl->m_bIsSecureConnection ? POP_SECURE_PORT : POP_PORT;
+        else
+            return m_pImpl->m_bIsSecureConnection ? IMAP_SECURE_PORT : IMAP_PORT;
+        break;
+    default:
+        return m_pImpl->m_nInServerPort;
+    }
 }
 
 void SwMailMergeConfigItem::SetInServerPort(sal_Int16 nSet)


More information about the Libreoffice-commits mailing list