added checkbox to disable password storage
This commit is contained in:
parent
a27bc20887
commit
2487476fcc
2 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
#include <QSettings>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QGridLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include "dlg_connect.h"
|
||||
|
@ -27,6 +28,9 @@ DlgConnect::DlgConnect(QWidget *parent)
|
|||
passwordEdit = new QLineEdit(settings.value("password").toString());
|
||||
passwordLabel->setBuddy(passwordEdit);
|
||||
passwordEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
savePasswordCheckBox = new QCheckBox(tr("&Save password"));
|
||||
savePasswordCheckBox->setChecked(settings.value("save_password", 1).toInt());
|
||||
|
||||
okButton = new QPushButton(tr("&OK"));
|
||||
okButton->setDefault(true);
|
||||
|
@ -41,6 +45,7 @@ DlgConnect::DlgConnect(QWidget *parent)
|
|||
grid->addWidget(playernameEdit, 2, 1);
|
||||
grid->addWidget(passwordLabel, 3, 0);
|
||||
grid->addWidget(passwordEdit, 3, 1);
|
||||
grid->addWidget(savePasswordCheckBox, 4, 0, 1, 2);
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->addStretch();
|
||||
|
@ -67,7 +72,8 @@ void DlgConnect::actOk()
|
|||
settings.setValue("hostname", hostEdit->text());
|
||||
settings.setValue("port", portEdit->text());
|
||||
settings.setValue("playername", playernameEdit->text());
|
||||
settings.setValue("password", passwordEdit->text());
|
||||
settings.setValue("password", savePasswordCheckBox->isChecked() ? passwordEdit->text() : QString());
|
||||
settings.setValue("save_password", savePasswordCheckBox->isChecked() ? 1 : 0);
|
||||
settings.endGroup();
|
||||
|
||||
accept();
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QCheckBox;
|
||||
|
||||
class DlgConnect : public QDialog {
|
||||
Q_OBJECT
|
||||
|
@ -20,6 +21,7 @@ private slots:
|
|||
private:
|
||||
QLabel *hostLabel, *portLabel, *playernameLabel, *passwordLabel;
|
||||
QLineEdit *hostEdit, *portEdit, *playernameEdit, *passwordEdit;
|
||||
QCheckBox *savePasswordCheckBox;
|
||||
QPushButton *okButton, *cancelButton;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue