More ProfileSelect fixes

This commit is contained in:
Mark Watkins 2011-10-02 14:10:40 +10:00
parent e570e0cedc
commit eed9aea63a

View File

@ -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,7 +190,11 @@ 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 {
int tries=0;
do {
QDialog dialog(this,Qt::Dialog); QDialog dialog(this,Qt::Dialog);
QLineEdit *e=new QLineEdit(&dialog); QLineEdit *e=new QLineEdit(&dialog);
e->setEchoMode(QLineEdit::Password); e->setEchoMode(QLineEdit::Password);
@ -204,18 +208,19 @@ void ProfileSelect::on_listView_activated(const QModelIndex &index)
if (QCryptographicHash::hash(ba,QCryptographicHash::Sha1).toHex()==(*profile)["Password"]) { if (QCryptographicHash::hash(ba,QCryptographicHash::Sha1).toHex()==(*profile)["Password"]) {
m_selectedProfile=name; m_selectedProfile=name;
pref["Profile"]=name; pref["Profile"]=name;
} else { accept();
m_tries++;
if (m_tries>2) {
QMessageBox::warning(this,"Error","You entered an Incorrect Password too many times. Exiting!",QMessageBox::Ok);
this->reject();
} else {
QMessageBox::warning(this,"Error","Incorrect Password",QMessageBox::Ok);
}
return; 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);
} }
accept(); } while (tries<3);
}
reject();
return;
} }
void ProfileSelect::on_listView_customContextMenuRequested(const QPoint &pos) void ProfileSelect::on_listView_customContextMenuRequested(const QPoint &pos)