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