mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 20:20:44 +00:00
More ProfileSelect fixes
This commit is contained in:
parent
e570e0cedc
commit
eed9aea63a
@ -102,7 +102,7 @@ void ProfileSelect::editProfile()
|
|||||||
QMessageBox::warning(this,"Error","Incorrect Password",QMessageBox::Ok);
|
QMessageBox::warning(this,"Error","Incorrect Password",QMessageBox::Ok);
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::warning(this,"Error","You entered the password wrong too many times.",QMessageBox::Ok);
|
QMessageBox::warning(this,"Error","You entered the password wrong too many times.",QMessageBox::Ok);
|
||||||
return;
|
reject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (tries<3);
|
} while (tries<3);
|
||||||
@ -190,32 +190,37 @@ void ProfileSelect::on_listView_activated(const QModelIndex &index)
|
|||||||
if (!profile->Exists("Password")) {
|
if (!profile->Exists("Password")) {
|
||||||
m_selectedProfile=name;
|
m_selectedProfile=name;
|
||||||
pref["Profile"]=name;
|
pref["Profile"]=name;
|
||||||
|
accept();
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
QDialog dialog(this,Qt::Dialog);
|
int tries=0;
|
||||||
QLineEdit *e=new QLineEdit(&dialog);
|
do {
|
||||||
e->setEchoMode(QLineEdit::Password);
|
QDialog dialog(this,Qt::Dialog);
|
||||||
dialog.connect(e,SIGNAL(returnPressed()),&dialog,SLOT(accept()));
|
QLineEdit *e=new QLineEdit(&dialog);
|
||||||
dialog.setWindowTitle("Enter Password");
|
e->setEchoMode(QLineEdit::Password);
|
||||||
QVBoxLayout *lay=new QVBoxLayout();
|
dialog.connect(e,SIGNAL(returnPressed()),&dialog,SLOT(accept()));
|
||||||
dialog.setLayout(lay);
|
dialog.setWindowTitle("Enter Password");
|
||||||
lay->addWidget(e);
|
QVBoxLayout *lay=new QVBoxLayout();
|
||||||
dialog.exec();
|
dialog.setLayout(lay);
|
||||||
QByteArray ba=e->text().toUtf8();
|
lay->addWidget(e);
|
||||||
if (QCryptographicHash::hash(ba,QCryptographicHash::Sha1).toHex()==(*profile)["Password"]) {
|
dialog.exec();
|
||||||
m_selectedProfile=name;
|
QByteArray ba=e->text().toUtf8();
|
||||||
pref["Profile"]=name;
|
if (QCryptographicHash::hash(ba,QCryptographicHash::Sha1).toHex()==(*profile)["Password"]) {
|
||||||
} else {
|
m_selectedProfile=name;
|
||||||
m_tries++;
|
pref["Profile"]=name;
|
||||||
if (m_tries>2) {
|
accept();
|
||||||
QMessageBox::warning(this,"Error","You entered an Incorrect Password too many times. Exiting!",QMessageBox::Ok);
|
return;
|
||||||
this->reject();
|
|
||||||
} else {
|
|
||||||
QMessageBox::warning(this,"Error","Incorrect Password",QMessageBox::Ok);
|
|
||||||
}
|
}
|
||||||
return;
|
tries++;
|
||||||
}
|
if (tries<3) {
|
||||||
|
QMessageBox::warning(this,"Error","Incorrect Password",QMessageBox::Ok);
|
||||||
|
} else {
|
||||||
|
QMessageBox::warning(this,"Error","You entered an Incorrect Password too many times. Exiting!",QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
} while (tries<3);
|
||||||
}
|
}
|
||||||
accept();
|
reject();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileSelect::on_listView_customContextMenuRequested(const QPoint &pos)
|
void ProfileSelect::on_listView_customContextMenuRequested(const QPoint &pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user