QTfrontend/ui/page/pagescheme.cpp
changeset 7792 5e7bdcc8cff3
parent 6952 7f70f37bbf08
child 7794 ab7b94c03bc9
--- 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());
+        }
     }
 }