3#include "DlgInputPassword.h"
4#include "ui_DlgInputPassword.h"
6CDlgInputPassword::CDlgInputPassword(
bool bShow, QString szTitle, QWidget *parent)
11 ui->pbShow->setEnabled(bShow);
12 setWindowTitle(tr(
"Input encrypt key"));
14 QString szDescript = tr(
"The encryption key is used to encrypt the password that is saved to the file.");
15 if(!szTitle.isEmpty())
16 szDescript += tr(
"If you forget the encryption key, please use input %1.").arg(szTitle);
17 ui->lbDescript->setText(szDescript);
19 ui->rbPassword->setVisible(
false);
21 ui->rbPassword->setText(tr(
"Input %1").arg(szTitle));
24CDlgInputPassword::~CDlgInputPassword()
29void CDlgInputPassword::on_pbNo_clicked()
34void CDlgInputPassword::on_pbYes_clicked()
39int CDlgInputPassword::GetValue(InputType &t, QString &password)
41 if(ui->rbKey->isChecked()) t = Encrypt;
42 if(ui->rbPassword->isChecked()) t = Password;
43 password = ui->lePassword->text();
47void CDlgInputPassword::on_pbShow_clicked()
49 switch(ui->lePassword->echoMode())
51 case QLineEdit::Password:
52 ui->lePassword->setEchoMode(QLineEdit::Normal);
53 ui->pbShow->setIcon(QIcon::fromTheme(
"eye-off"));
55 case QLineEdit::Normal:
56 ui->lePassword->setEchoMode(QLineEdit::Password);
57 ui->pbShow->setIcon(QIcon::fromTheme(
"eye-on"));