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

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 1 05:46:00 UTC 2019


 sw/source/ui/dbui/mmresultdialogs.cxx |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

New commits:
commit a1573b2e2fda77b7b7d605fe36f5a28f86a3e91b
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Mon Sep 30 11:02:05 2019 +0000
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Tue Oct 1 07:45:24 2019 +0200

    tdf#116234 Apply email settings just set
    
    Email configuration that is entered in the SwMailConfigDlg
    dialog is written to the (global) configuration, while
    the existing SwMailMergeConfig item 'xConfigItem'
    was not updated, so the newly entered values for
    the email server connection weren't applied for
    the current mail merge previously.
    
    In order to have them take effect, take over the
    new settings to 'xConfigItem' from the global
    config where those were just set.
    
    Change-Id: If0dae3ce26af797ffa728dca96f08dce3197557c
    Reviewed-on: https://gerrit.libreoffice.org/79847
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index ef96c5b31029..2b7d5e2ab2d2 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -124,6 +124,35 @@ static OUString lcl_GetColumnValueOf(const OUString& rColumn, Reference < contai
     return sRet;
 }
 
+/**
+ * Replace email server settings in rConfigItem with those set in Writer's global
+ * mail merge config settings.
+ */
+static void lcl_UpdateEmailSettingsFromGlobalConfig(SwMailMergeConfigItem& rConfigItem)
+{
+    // newly created SwMailMergeConfigItem is initialized with values from (global) config
+    SwMailMergeConfigItem aConfigItem;
+
+    // take over email-related settings
+    rConfigItem.SetMailDisplayName(aConfigItem.GetMailDisplayName());
+    rConfigItem.SetMailAddress(aConfigItem.GetMailAddress());
+    rConfigItem.SetMailReplyTo(aConfigItem.GetMailReplyTo());
+    rConfigItem.SetMailReplyTo(aConfigItem.IsMailReplyTo());
+    rConfigItem.SetMailServer(aConfigItem.GetMailServer());
+    rConfigItem.SetMailPort(aConfigItem.GetMailPort());
+    rConfigItem.SetSecureConnection(aConfigItem.IsSecureConnection());
+    // authentication settings
+    rConfigItem.SetAuthentication(aConfigItem.IsAuthentication());
+    rConfigItem.SetSMTPAfterPOP(aConfigItem.IsSMTPAfterPOP());
+    rConfigItem.SetMailUserName(aConfigItem.GetMailUserName());
+    rConfigItem.SetMailPassword(aConfigItem.GetMailPassword());
+    rConfigItem.SetInServerName(aConfigItem.GetInServerName());
+    rConfigItem.SetInServerPort(aConfigItem.GetInServerPort());
+    rConfigItem.SetInServerPOP(aConfigItem.IsInServerPOP());
+    rConfigItem.SetInServerUserName(aConfigItem.GetInServerUserName());
+    rConfigItem.SetInServerPassword(aConfigItem.GetInServerPassword());
+}
+
 class SwSaveWarningBox_Impl : public SwMessageAndEditDialog
 {
     DECL_LINK( ModifyHdl, weld::Entry&, void);
@@ -856,6 +885,10 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi
 
         if(nRet != RET_OK && nRet != RET_YES)
             return; // back to the dialog
+
+        // SwMailConfigDlg writes mail merge email settings only to (global) config,
+        // so copy them to the existing config item
+        lcl_UpdateEmailSettingsFromGlobalConfig(*xConfigItem.get());
     }
     //add the documents
     sal_uInt32 nBegin = 0;


More information about the Libreoffice-commits mailing list