diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-29 17:55:06 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-29 17:55:06 -0600 |
commit | 124c1e11613ec1691f9b6ff9754152a0f40e369c (patch) | |
tree | 984d9ed8770e9d277e815a00e4c6a343e5086b7f | |
parent | 7252c0b416a44daa8c4d92a9ee61448408490cf2 (diff) | |
download | horizon-124c1e11613ec1691f9b6ff9754152a0f40e369c.tar.gz horizon-124c1e11613ec1691f9b6ff9754152a0f40e369c.tar.bz2 horizon-124c1e11613ec1691f9b6ff9754152a0f40e369c.tar.xz horizon-124c1e11613ec1691f9b6ff9754152a0f40e369c.zip |
Qt UI: Allow passphrase to be viewed in UserAccountWidget
-rw-r--r-- | ui/qt5/useraccountwidget.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ui/qt5/useraccountwidget.cc b/ui/qt5/useraccountwidget.cc index 8caf6fb..85fd71d 100644 --- a/ui/qt5/useraccountwidget.cc +++ b/ui/qt5/useraccountwidget.cc @@ -12,7 +12,9 @@ #include "useraccountwidget.hh" +#include <QAction> #include <QHBoxLayout> +#include <QMenu> #include <QVBoxLayout> UserAccountWidget::UserAccountWidget(QWidget *parent) @@ -41,6 +43,24 @@ UserAccountWidget::UserAccountWidget(QWidget *parent) passphrase->setPlaceholderText(tr("Passphrase")); passphrase->setToolTip(tr("This user's passphrase")); passphrase->setWhatsThis(tr("The passphrase will be used to log in to the computer.")); + QAction *togglePass = passphrase->addAction(QIcon::fromTheme("visibility"), + QLineEdit::TrailingPosition); + togglePass->setToolTip(tr("Show the passphrase")); + togglePass->setData(true); + connect(togglePass, &QAction::triggered, + [=](void) { + if(togglePass->data().toBool() == true) { + togglePass->setData(false); + togglePass->setIcon(QIcon::fromTheme("hint")); + togglePass->setToolTip(tr("Hide the passphrase")); + passphrase->setEchoMode(QLineEdit::Normal); + } else { + togglePass->setData(true); + togglePass->setIcon(QIcon::fromTheme("visibility")); + togglePass->setToolTip(tr("Show the passphrase")); + passphrase->setEchoMode(QLineEdit::Password); + } + }); passAdminLayout->addWidget(passphrase); adminTick = new QCheckBox(tr("Admin")); |