1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Code cleanup

This commit is contained in:
Dubslow 2015-02-02 21:28:20 -06:00
parent 8d999efae7
commit 625eb3cf5b
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA
3 changed files with 5 additions and 4 deletions

View File

@ -27,7 +27,7 @@ SetPasswordDialog::SetPasswordDialog(QString body, QString extraButton, QWidget*
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->passwordlineEdit, SIGNAL(textChanged(QString)), this, SLOT(onPasswordEdit())); connect(ui-> passwordlineEdit, SIGNAL(textChanged(QString)), this, SLOT(onPasswordEdit()));
connect(ui->repasswordlineEdit, SIGNAL(textChanged(QString)), this, SLOT(onPasswordEdit())); connect(ui->repasswordlineEdit, SIGNAL(textChanged(QString)), this, SLOT(onPasswordEdit()));
ui->body->setText(body + "\n" + tr("The passwords don't match.")); ui->body->setText(body + "\n" + tr("The passwords don't match."));
@ -37,7 +37,7 @@ SetPasswordDialog::SetPasswordDialog(QString body, QString extraButton, QWidget*
{ {
QPushButton* third = new QPushButton(extraButton); QPushButton* third = new QPushButton(extraButton);
ui->buttonBox->addButton(third, QDialogButtonBox::YesRole); ui->buttonBox->addButton(third, QDialogButtonBox::YesRole);
connect(third, &QPushButton::clicked, this, [=](){this->done(2);}); connect(third, &QPushButton::clicked, this, [&](){this->done(Tertiary);});
} }
} }

View File

@ -28,6 +28,7 @@ class SetPasswordDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
enum ReturnCode {Rejected=QDialog::Rejected, Accepted=QDialog::Accepted, Tertiary};
explicit SetPasswordDialog(QString body, QString extraButton, QWidget* parent = 0); explicit SetPasswordDialog(QString body, QString extraButton, QWidget* parent = 0);
~SetPasswordDialog(); ~SetPasswordDialog();
QString getPassword(); QString getPassword();

View File

@ -88,7 +88,7 @@ bool PrivacyForm::setChatLogsPassword()
QString newpw = dialog->getPassword(); QString newpw = dialog->getPassword();
if (r == 2) if (r == SetPasswordDialog::Tertiary)
core->useOtherPassword(Core::ptHistory); core->useOtherPassword(Core::ptHistory);
else if (haveEncHist) else if (haveEncHist)
core->setPassword(newpw, Core::ptHistory, reinterpret_cast<uint8_t*>(salt.data())); core->setPassword(newpw, Core::ptHistory, reinterpret_cast<uint8_t*>(salt.data()));
@ -195,7 +195,7 @@ bool PrivacyForm::setToxPassword()
QString newpw = dialog->getPassword(); QString newpw = dialog->getPassword();
delete dialog; delete dialog;
if (r == 2) if (r == SetPasswordDialog::Tertiary)
core->useOtherPassword(Core::ptMain); core->useOtherPassword(Core::ptMain);
else else
core->setPassword(newpw, Core::ptMain); core->setPassword(newpw, Core::ptMain);