Lot of password related changes all over the place.
Password is no longer saved with the connection list. Password is not entered along with other connection credentials. Password is now asked for when required. Still working on saving the password and auto retrieving it from the password manager.
This commit is contained in:
parent
6b9b602c64
commit
2230a4bd61
21 changed files with 508 additions and 195 deletions
70
pglab/PasswordPromptDialog.cpp
Normal file
70
pglab/PasswordPromptDialog.cpp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#include "PasswordPromptDialog.h"
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QLineEdit>
|
||||
|
||||
PasswordPromptDialog::PasswordPromptDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
m_connectionLabel = new QLabel(this);
|
||||
auto dialog_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
|
||||
|
||||
m_passwordLabel = new QLabel(this);
|
||||
m_passwordInput = new QLineEdit(this);
|
||||
m_passwordInput->setEchoMode(QLineEdit::Password);
|
||||
|
||||
m_saveCheck = new QCheckBox(this);
|
||||
|
||||
|
||||
auto mainLayout = new QGridLayout;
|
||||
int row = 0;
|
||||
mainLayout->addWidget(m_connectionLabel, row, 0, 1, 2);
|
||||
++row;
|
||||
mainLayout->addWidget(m_passwordLabel, row, 0);
|
||||
mainLayout->addWidget(m_passwordInput, row, 1);
|
||||
++row;
|
||||
mainLayout->addWidget(m_saveCheck, row, 1);
|
||||
++row;
|
||||
mainLayout->addWidget(dialog_buttons, row, 0, 1 ,2);
|
||||
setLayout(mainLayout);
|
||||
|
||||
m_passwordInput->setFocus();
|
||||
retranslateUi();
|
||||
|
||||
// QMetaObject::connectSlotsByName(BackupDialog);
|
||||
connect(dialog_buttons, &QDialogButtonBox::accepted, this, &PasswordPromptDialog::accept);
|
||||
connect(dialog_buttons, &QDialogButtonBox::rejected, this, &PasswordPromptDialog::reject);
|
||||
}
|
||||
|
||||
void PasswordPromptDialog::retranslateUi()
|
||||
{
|
||||
const char * context = "PasswordPromptDialog";
|
||||
setWindowTitle(QApplication::translate(context, "Connection password", nullptr));
|
||||
m_passwordLabel->setText(QApplication::translate(context, "Password", nullptr));
|
||||
m_passwordInput->setPlaceholderText(QApplication::translate(context, "Enter password", nullptr));
|
||||
m_saveCheck->setText(QApplication::translate(context, "Save password", nullptr));
|
||||
}
|
||||
|
||||
void PasswordPromptDialog::setConnectionDescription(const QString &description)
|
||||
{
|
||||
m_connectionLabel->setText(QString(tr("Please provide password for connection %1")).arg(description));
|
||||
|
||||
}
|
||||
|
||||
QString PasswordPromptDialog::password() const
|
||||
{
|
||||
return m_passwordInput->text();
|
||||
}
|
||||
|
||||
//void PasswordPromptDialog::accept()
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
//void PasswordPromptDialog::reject()
|
||||
//{
|
||||
|
||||
//}
|
||||
Loading…
Add table
Add a link
Reference in a new issue