[Libreoffice-commits] core.git: uui/source uui/uiconfig

Stephan Bergmann sbergman at redhat.com
Mon May 2 21:24:34 UTC 2016


 uui/source/logindlg.cxx        |   38 ++++++++++++++++++++++++++------------
 uui/source/logindlg.hxx        |    5 ++++-
 uui/uiconfig/ui/logindialog.ui |   28 ++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 13 deletions(-)

New commits:
commit f88554edd46d2dc8d6c8eaba74c89ccd3e537104
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon May 2 23:20:11 2016 +0200

    Related tdf#98644: In login dialog, give a hint that the password was wrong
    
    ...by changing the dialog text from "Enter user name and password for..." to "Wrong
    user name and password for..." when an old password is already given.
    
    Change-Id: Ie167c5ea263e9f75e0269c528dc88b69270208f3

diff --git a/uui/source/logindlg.cxx b/uui/source/logindlg.cxx
index 8cf4e58..740c847 100644
--- a/uui/source/logindlg.cxx
+++ b/uui/source/logindlg.cxx
@@ -61,6 +61,12 @@ void LoginDialog::dispose()
     ModalDialog::dispose();
 }
 
+void LoginDialog::SetPassword( const OUString& rNew )
+{
+    m_pPasswordED->SetText( rNew );
+    SetRequest();
+}
+
 void LoginDialog::HideControls_Impl( sal_uInt16 nFlags )
 {
     if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH )
@@ -128,6 +134,23 @@ void LoginDialog::EnableUseSysCredsControls_Impl( bool bUseSysCredsEnabled )
     m_pAccountED->Enable( !bUseSysCredsEnabled );
 }
 
+void LoginDialog::SetRequest()
+{
+    bool oldPwd = !m_pPasswordED->GetText().isEmpty();
+    OUString aRequest;
+    if (m_pAccountFT->IsVisible() && !m_realm.isEmpty())
+    {
+        aRequest = get<FixedText>(oldPwd ? "wrongloginrealm" : "loginrealm")
+            ->GetText();
+        aRequest = aRequest.replaceAll("%2", m_realm);
+    }
+    else
+        aRequest = get<FixedText>(oldPwd ? "wrongrequestinfo" : "requestinfo")
+            ->GetText();
+    aRequest = aRequest.replaceAll("%1", m_server);
+    m_pRequestInfo->SetText(aRequest);
+}
+
 IMPL_LINK_NOARG_TYPED(LoginDialog, OKHdl_Impl, Button*, void)
 {
     // trim the strings
@@ -165,7 +188,8 @@ IMPL_LINK_NOARG_TYPED(LoginDialog, UseSysCredsHdl_Impl, Button*, void)
 
 LoginDialog::LoginDialog(vcl::Window* pParent, sal_uInt16 nFlags,
     const OUString& rServer, const OUString& rRealm)
-    : ModalDialog(pParent, "LoginDialog", "uui/ui/logindialog.ui")
+    : ModalDialog(pParent, "LoginDialog", "uui/ui/logindialog.ui"),
+      m_server(rServer), m_realm(rRealm)
 {
     get(m_pErrorFT, "errorft");
     get(m_pErrorInfo, "errorinfo");
@@ -183,20 +207,10 @@ LoginDialog::LoginDialog(vcl::Window* pParent, sal_uInt16 nFlags,
     get(m_pUseSysCredsCB, "syscreds");
     get(m_pOKBtn, "ok");
 
-    OUString aRequest;
-    if ((nFlags & LF_NO_ACCOUNT) != 0 && !rRealm.isEmpty())
-    {
-        aRequest = get<FixedText>("loginrealm")->GetText();
-        aRequest = aRequest.replaceAll("%2", rRealm);
-    }
-    else
-        aRequest = m_pRequestInfo->GetText();
-
     if ( !( ( nFlags & LF_NO_USESYSCREDS ) == LF_NO_USESYSCREDS ) )
       EnableUseSysCredsControls_Impl( m_pUseSysCredsCB->IsChecked() );
 
-    aRequest = aRequest.replaceAll("%1", rServer);
-    m_pRequestInfo->SetText(aRequest);
+    SetRequest();
 
     m_pPathED->SetMaxTextLen( _MAX_PATH );
     m_pNameED->SetMaxTextLen( _MAX_PATH );
diff --git a/uui/source/logindlg.hxx b/uui/source/logindlg.hxx
index 567c401..e5e7d98 100644
--- a/uui/source/logindlg.hxx
+++ b/uui/source/logindlg.hxx
@@ -55,9 +55,12 @@ class LoginDialog : public ModalDialog
     VclPtr<CheckBox>       m_pSavePasswdBtn;
     VclPtr<CheckBox>       m_pUseSysCredsCB;
     VclPtr<OKButton>       m_pOKBtn;
+    OUString m_server;
+    OUString m_realm;
 
     void            HideControls_Impl( sal_uInt16 nFlags );
     void            EnableUseSysCredsControls_Impl( bool bUseSysCredsEnabled );
+    void            SetRequest();
 
     DECL_LINK_TYPED(OKHdl_Impl, Button*, void);
     DECL_LINK_TYPED(PathHdl_Impl, Button*, void);
@@ -72,7 +75,7 @@ public:
     OUString        GetName() const                             { return m_pNameED->GetText(); }
     void            SetName( const OUString& rNewName )           { m_pNameED->SetText( rNewName ); }
     OUString        GetPassword() const                         { return m_pPasswordED->GetText(); }
-    void            SetPassword( const OUString& rNew )           { m_pPasswordED->SetText( rNew ); }
+    void            SetPassword( const OUString& rNew );
     OUString        GetAccount() const                          { return m_pAccountED->GetText(); }
     bool            IsSavePassword() const                      { return m_pSavePasswdBtn->IsChecked(); }
     void            SetSavePassword( bool bSave )               { m_pSavePasswdBtn->Check( bSave ); }
diff --git a/uui/uiconfig/ui/logindialog.ui b/uui/uiconfig/ui/logindialog.ui
index ca47ea5..806d8f5 100644
--- a/uui/uiconfig/ui/logindialog.ui
+++ b/uui/uiconfig/ui/logindialog.ui
@@ -251,6 +251,34 @@
               </packing>
             </child>
             <child>
+              <object class="GtkLabel" id="wrongloginrealm">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Wrong user name and password for:
+“%2” on %1</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+                <property name="width">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="wrongrequestinfo">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Wrong user name and password for:
+%1</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+                <property name="width">2</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkLabel" id="requestinfo">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>


More information about the Libreoffice-commits mailing list