sw/source/ui/config/mailconfigpage.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit f679fb89b6d021f12ebeb543a1efe519bd44f96b
Author: Justin Luth <justin_l...@sil.org>
Date:   Fri Jan 19 11:09:29 2018 +0300

    mailconfig UI: pre-fill username from mail address
    
    Be nice to the user. We already asked them for their email address.
    Typically, the username for authentication matches the email
    address, so pre-populate that.
    
    Change-Id: Ia390bdc293510900220c996be13c238d88817b81
    Reviewed-on: https://gerrit.libreoffice.org/48213
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/ui/config/mailconfigpage.cxx 
b/sw/source/ui/config/mailconfigpage.cxx
index 1787465d263b..df0984ea5f72 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -215,6 +215,8 @@ IMPL_LINK(SwMailConfigPage, ReplyToHdl, Button*, pBox, void)
 
 IMPL_LINK_NOARG(SwMailConfigPage, AuthenticationHdl, Button*, void)
 {
+    m_pConfigItem->SetMailAddress(m_pAddressED->GetText());
+
     ScopedVclPtrInstance< SwAuthenticationSettingsDialog > aDlg(this, 
*m_pConfigItem);
     aDlg->Execute();
 }
@@ -503,6 +505,16 @@ IMPL_LINK_NOARG(SwAuthenticationSettingsDialog, 
RadioButtonHdl_Impl, Button*, vo
     bool bNotSeparate = !bSeparate && bIsEnabled;
     bSeparate &= bIsEnabled;
 
+    if ( bSeparate && m_pUserNameED->GetText().isEmpty() )
+        m_pUserNameED->SetText( rConfigItem.GetMailAddress() );
+    else if ( m_pUserNameED->GetText() == rConfigItem.GetMailAddress() )
+        m_pUserNameED->SetText("");
+
+    if ( bNotSeparate && m_pInUsernameED->GetText().isEmpty() )
+        m_pInUsernameED->SetText( rConfigItem.GetMailAddress() );
+    else if ( m_pInUsernameED->GetText() == rConfigItem.GetMailAddress() )
+        m_pInUsernameED->SetText("");
+
     m_pOutgoingServerFT->Enable(bSeparate);
     m_pUserNameFT->Enable(bSeparate);
     m_pUserNameED->Enable(bSeparate);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to