--- a/QTfrontend/ui/page/pagescheme.cpp Mon Oct 22 22:30:03 2012 -0400
+++ b/QTfrontend/ui/page/pagescheme.cpp Tue Oct 23 04:40:13 2012 +0200
@@ -516,12 +516,20 @@
void PageScheme::deleteRow()
{
- QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel);
+ int numberOfDefaultSchemes = ((AmmoSchemeModel*)mapper->model())->numberOfDefaultSchemes;
+ if (selectScheme->currentIndex() < numberOfDefaultSchemes)
+ {
+ QMessageBox::warning(0, QMessageBox::tr("Schemes"), QMessageBox::tr("Cannot delete default scheme '%1'!").arg(selectScheme->currentText()));
+ }
+ else
+ {
+ QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel);
- if (reallyDelete.exec() == QMessageBox::Ok)
- {
- QAbstractItemModel * model = mapper->model();
- model->removeRow(selectScheme->currentIndex());
+ if (reallyDelete.exec() == QMessageBox::Ok)
+ {
+ QAbstractItemModel * model = mapper->model();
+ model->removeRow(selectScheme->currentIndex());
+ }
}
}