mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Fix profile deletion bug
This commit is contained in:
parent
2ab65bc85b
commit
0e1df59cd3
@ -350,7 +350,7 @@ void ProfileSelector::on_buttonDestroyProfile_clicked()
|
|||||||
Profile * profile = Profiles::profiles[name];
|
Profile * profile = Profiles::profiles[name];
|
||||||
QString path = profile->Get(PrefMacro(STR_GEN_DataFolder));
|
QString path = profile->Get(PrefMacro(STR_GEN_DataFolder));
|
||||||
|
|
||||||
bool reallydelete = false;
|
bool verified = true;
|
||||||
if (profile->user->hasPassword()) {
|
if (profile->user->hasPassword()) {
|
||||||
QDialog dialog(this, Qt::Dialog);
|
QDialog dialog(this, Qt::Dialog);
|
||||||
QLineEdit *e = new QLineEdit(&dialog);
|
QLineEdit *e = new QLineEdit(&dialog);
|
||||||
@ -371,19 +371,19 @@ void ProfileSelector::on_buttonDestroyProfile_clicked()
|
|||||||
tries++;
|
tries++;
|
||||||
|
|
||||||
if (profile->user->checkPassword(e->text())) {
|
if (profile->user->checkPassword(e->text())) {
|
||||||
reallydelete = true;
|
verified = true;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (tries < 3) {
|
if (tries < 3) {
|
||||||
QMessageBox::warning(this, STR_MessageBox_Error, tr("You entered an incorrect password"), QMessageBox::Ok);
|
QMessageBox::warning(this, STR_MessageBox_Error, tr("You entered an incorrect password"), QMessageBox::Ok);
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::warning(this, STR_MessageBox_Error,
|
QMessageBox::warning(this, STR_MessageBox_Error,
|
||||||
tr("If you're trying to delete because you forgot the password, you need to delete it manually."),
|
tr("If you're trying to delete because you forgot the password, you need to either reset it or delete the profile folder manually."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (tries < 3);
|
} while (tries < 3);
|
||||||
if (!reallydelete) return;
|
if (!verified) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog confirmdlg;
|
QDialog confirmdlg;
|
||||||
@ -410,8 +410,6 @@ void ProfileSelector::on_buttonDestroyProfile_clicked()
|
|||||||
QMessageBox::information(NULL, tr("Sorry"), tr("You need to enter DELETE in capital letters."), QMessageBox::Ok);
|
QMessageBox::information(NULL, tr("Sorry"), tr("You need to enter DELETE in capital letters."), QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reallydelete) {
|
|
||||||
qDebug() << "Deleting Profile" << name;
|
qDebug() << "Deleting Profile" << name;
|
||||||
if (profile == p_profile) {
|
if (profile == p_profile) {
|
||||||
// Shut down if active
|
// Shut down if active
|
||||||
@ -430,7 +428,7 @@ void ProfileSelector::on_buttonDestroyProfile_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateProfileList();
|
updateProfileList();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user