66
77#include " askpassphrasedialog.h"
88#include " ui_askpassphrasedialog.h"
9+ #include < QGraphicsDropShadowEffect>
910
1011#include " guiconstants.h"
1112#include " guiutil.h"
@@ -24,6 +25,8 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget* parent, WalletModel
2425 mode(mode),
2526 model(model),
2627 context(context),
28+ btnWatch(new QCheckBox()),
29+ btnWatch2(new QCheckBox()),
2730 fCapsLock(false )
2831{
2932 ui->setupUi (this );
@@ -65,6 +68,54 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget* parent, WalletModel
6568 ui->passEdit2 ->setMaxLength (MAX_PASSPHRASE_SIZE);
6669 ui->passEdit3 ->setMaxLength (MAX_PASSPHRASE_SIZE);
6770
71+ QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect ();
72+ shadowEffect->setColor (QColor (0 , 0 , 0 , 22 ));
73+ shadowEffect->setXOffset (0 );
74+ shadowEffect->setYOffset (3 );
75+ shadowEffect->setBlurRadius (6 );
76+
77+ QGraphicsDropShadowEffect* shadowEffect2 = new QGraphicsDropShadowEffect ();
78+ shadowEffect2->setColor (QColor (0 , 0 , 0 , 22 ));
79+ shadowEffect2->setXOffset (0 );
80+ shadowEffect2->setYOffset (3 );
81+ shadowEffect2->setBlurRadius (6 );
82+
83+
84+ ui->layoutEdit ->setGraphicsEffect (shadowEffect);
85+
86+ ui->layoutEdit2 ->setGraphicsEffect (shadowEffect2);
87+
88+ // Button Watch
89+
90+ btnWatch = new QCheckBox (ui->layoutEdit );
91+
92+ btnWatch->setProperty (" cssClass" , " btn-watch-password" );
93+ btnWatch->setChecked (false );
94+ QSize BUTTON_CONTACT_SIZE = QSize (24 , 24 );
95+ btnWatch->setMinimumSize (BUTTON_CONTACT_SIZE);
96+ btnWatch->setMaximumSize (BUTTON_CONTACT_SIZE);
97+
98+ btnWatch->show ();
99+ btnWatch->raise ();
100+
101+ int posXX = ui->layoutEdit ->width () - 30 ;
102+ int posYY = 8 ;
103+ btnWatch->move (450 , posYY);
104+
105+ btnWatch2 = new QCheckBox (ui->layoutEdit2 );
106+
107+ btnWatch2->setProperty (" cssClass" , " btn-watch-password" );
108+ btnWatch2->setChecked (false );
109+
110+ btnWatch2->setMinimumSize (BUTTON_CONTACT_SIZE);
111+ btnWatch2->setMaximumSize (BUTTON_CONTACT_SIZE);
112+
113+ btnWatch2->show ();
114+ btnWatch2->raise ();
115+
116+ btnWatch2->move (450 , posYY);
117+
118+
68119 // Setup Caps Lock detection.
69120 ui->passEdit1 ->installEventFilter (this );
70121 ui->passEdit2 ->installEventFilter (this );
@@ -77,6 +128,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget* parent, WalletModel
77128 ui->warningLabel ->setText (tr (" Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>." ));
78129 ui->passLabel1 ->hide ();
79130 ui->passEdit1 ->hide ();
131+ ui->layoutEdit ->hide ();
80132 setWindowTitle (tr (" Encrypt wallet" ));
81133 break ;
82134 case Mode::UnlockAnonymize:
@@ -85,6 +137,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget* parent, WalletModel
85137 ui->warningLabel ->setText (tr (" This operation needs your wallet passphrase to unlock the wallet." ));
86138 ui->passLabel2 ->hide ();
87139 ui->passEdit2 ->hide ();
140+ ui->layoutEdit2 ->hide ();
88141 ui->passLabel3 ->hide ();
89142 ui->passEdit3 ->hide ();
90143 setWindowTitle (tr (" Unlock wallet" ));
@@ -93,24 +146,39 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget* parent, WalletModel
93146 ui->warningLabel ->setText (tr (" This operation needs your wallet passphrase to decrypt the wallet." ));
94147 ui->passLabel2 ->hide ();
95148 ui->passEdit2 ->hide ();
149+ ui->layoutEdit2 ->hide ();
96150 ui->passLabel3 ->hide ();
97151 ui->passEdit3 ->hide ();
98152 setWindowTitle (tr (" Decrypt wallet" ));
99153 break ;
100154 case Mode::ChangePass: // Ask old passphrase + new passphrase x2
101155 setWindowTitle (tr (" Change passphrase" ));
156+ btnWatch2->hide ();
102157 ui->warningLabel ->setText (tr (" Enter the old and new passphrase to the wallet." ));
103158 break ;
104159 }
105160
106161 textChanged ();
162+ connect (btnWatch2, SIGNAL (clicked ()), this , SLOT (onWatch2Clicked ()));
163+ connect (btnWatch, SIGNAL (clicked ()), this , SLOT (onWatchClicked ()));
107164 connect (ui->passEdit1 , SIGNAL (textChanged (QString)), this , SLOT (textChanged ()));
108165 connect (ui->passEdit2 , SIGNAL (textChanged (QString)), this , SLOT (textChanged ()));
109166 connect (ui->passEdit3 , SIGNAL (textChanged (QString)), this , SLOT (textChanged ()));
110167 connect (ui->pushButtonOk , SIGNAL (clicked ()), this , SLOT (accept ()));
111168 connect (ui->btnEsc , SIGNAL (clicked ()), this , SLOT (close ()));
112169}
113170
171+ void AskPassphraseDialog::onWatchClicked (){
172+ ui->passEdit3 ->setEchoMode (btnWatch->checkState () == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password );
173+ ui->passEdit2 ->setEchoMode (btnWatch->checkState () == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password );
174+ ui->passEdit1 ->setEchoMode (btnWatch->checkState () == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password );
175+ }
176+
177+ void AskPassphraseDialog::onWatch2Clicked (){
178+ ui->passEdit3 ->setEchoMode (btnWatch->checkState () == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password );
179+ ui->passEdit2 ->setEchoMode (btnWatch->checkState () == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password );
180+ }
181+
114182AskPassphraseDialog::~AskPassphraseDialog ()
115183{
116184 // Attempt to overwrite text so that they do not linger around in memory
0 commit comments