diff --git a/uppsrc/ide/Credentials.cpp b/uppsrc/ide/Credentials.cpp index 2f7b97afd..a098b77ad 100644 --- a/uppsrc/ide/Credentials.cpp +++ b/uppsrc/ide/Credentials.cpp @@ -70,6 +70,7 @@ bool GetCredentials(const String& url, const String& dir, String& username, Stri struct CredentialDlg : WithCredentialLayout { void Hints(const Vector& url_hints); + void Sync() { password.Password(!show_password); } CredentialDlg(); }; @@ -82,6 +83,8 @@ void CredentialDlg::Hints(const Vector& url_hints) CredentialDlg::CredentialDlg() { CtrlLayoutOKCancel(*this, "Credentials"); + Sync(); + show_password << [=] { Sync(); }; } struct CredentialsDlg : WithCredentialsLayout { @@ -177,6 +180,13 @@ void CredentialsDlg::Sync() clear.Enable(list.GetCount()); edit.Enable(list.IsCursor()); remove.Enable(list.IsCursor()); + + list.ColumnAt(2) + .SetConvert(show_passwords ? StdConvert() + : LambdaConvert([](const Value& v) { + return String('*', (~v).GetCount()); + }) + ); } CredentialsDlg::CredentialsDlg(const Vector& url_hints) diff --git a/uppsrc/ide/urepo.lay b/uppsrc/ide/urepo.lay index 3d2704dc4..8a4452f3b 100644 --- a/uppsrc/ide/urepo.lay +++ b/uppsrc/ide/urepo.lay @@ -40,8 +40,8 @@ LAYOUT(CredentialLayout, 368, 116) ITEM(Upp::EditString, username, LeftPosZ(112, 248).TopPosZ(32, 19)) ITEM(Upp::Label, dv___4, SetLabel(t_("Password")).LeftPosZ(8, 92).TopPosZ(56, 19)) ITEM(Upp::EditString, password, LeftPosZ(112, 248).TopPosZ(56, 19)) + ITEM(Upp::Option, show_password, SetLabel(t_("Show password")).LeftPosZ(8, 108).TopPosZ(84, 20)) ITEM(Upp::Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(228, 64).BottomPosZ(8, 24)) ITEM(Upp::Button, ok, SetLabel(t_("OK")).LeftPosZ(296, 64).BottomPosZ(8, 24)) - ITEM(Upp::Option, show_passwords, SetLabel(t_("Show password")).LeftPosZ(8, 108).TopPosZ(84, 20)) END_LAYOUT