summaryrefslogtreecommitdiff
path: root/ui/qt5
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-29 17:59:06 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-29 17:59:06 -0600
commit068d4b310b51fe9e3069e08617b3943c9d8b6c1e (patch)
treeb39c1a97fbf2b7c18bce653a9c42181f90dc1a66 /ui/qt5
parent124c1e11613ec1691f9b6ff9754152a0f40e369c (diff)
downloadhorizon-068d4b310b51fe9e3069e08617b3943c9d8b6c1e.tar.gz
horizon-068d4b310b51fe9e3069e08617b3943c9d8b6c1e.tar.bz2
horizon-068d4b310b51fe9e3069e08617b3943c9d8b6c1e.tar.xz
horizon-068d4b310b51fe9e3069e08617b3943c9d8b6c1e.zip
Qt UI: Allow passphrase to be viewed in RootPassphrasePage
Diffstat (limited to 'ui/qt5')
-rw-r--r--ui/qt5/rootpwpage.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/ui/qt5/rootpwpage.cc b/ui/qt5/rootpwpage.cc
index ca7de32..f0b8acc 100644
--- a/ui/qt5/rootpwpage.cc
+++ b/ui/qt5/rootpwpage.cc
@@ -12,6 +12,7 @@
#include "rootpwpage.hh"
+#include <QAction>
#include <QFormLayout>
#include <QLabel>
#include <QLineEdit>
@@ -34,6 +35,24 @@ RootPassphrasePage::RootPassphrasePage(QWidget *parent)
rootPW->setWhatsThis(tr("Enter your desired root passphrase here."));
connect(rootPW, &QLineEdit::textChanged,
this, &RootPassphrasePage::completeChanged);
+ QAction *togglePass = rootPW->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"));
+ rootPW->setEchoMode(QLineEdit::Normal);
+ } else {
+ togglePass->setData(true);
+ togglePass->setIcon(QIcon::fromTheme("visibility"));
+ togglePass->setToolTip(tr("Show the passphrase"));
+ rootPW->setEchoMode(QLineEdit::Password);
+ }
+ });
registerField("rootpw", rootPW);
confirmPW = new QLineEdit;
confirmPW->setEchoMode(QLineEdit::Password);
@@ -41,6 +60,24 @@ RootPassphrasePage::RootPassphrasePage(QWidget *parent)
"Confirm your desired root passphrase by typing it again here."));
connect(confirmPW, &QLineEdit::textChanged,
this, &RootPassphrasePage::completeChanged);
+ QAction *toggleConfPass = rootPW->addAction(QIcon::fromTheme("visibility"),
+ QLineEdit::TrailingPosition);
+ toggleConfPass->setToolTip(tr("Show the passphrase"));
+ toggleConfPass->setData(true);
+ connect(toggleConfPass, &QAction::triggered,
+ [=](void) {
+ if(toggleConfPass->data().toBool() == true) {
+ toggleConfPass->setData(false);
+ toggleConfPass->setIcon(QIcon::fromTheme("hint"));
+ toggleConfPass->setToolTip(tr("Hide the passphrase"));
+ confirmPW->setEchoMode(QLineEdit::Normal);
+ } else {
+ toggleConfPass->setData(true);
+ toggleConfPass->setIcon(QIcon::fromTheme("visibility"));
+ toggleConfPass->setToolTip(tr("Show the passphrase"));
+ confirmPW->setEchoMode(QLineEdit::Password);
+ }
+ });
QFormLayout *pwForm = new QFormLayout;
pwForm->addRow(tr("&Passphrase:"), rootPW);
pwForm->addRow(tr("&Confirm Passphrase:"), confirmPW);