equal
deleted
inserted
replaced
514 selectScheme->setCurrentIndex(model->rowCount() - 1); |
514 selectScheme->setCurrentIndex(model->rowCount() - 1); |
515 } |
515 } |
516 |
516 |
517 void PageScheme::deleteRow() |
517 void PageScheme::deleteRow() |
518 { |
518 { |
519 QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel); |
519 int numberOfDefaultSchemes = ((AmmoSchemeModel*)mapper->model())->numberOfDefaultSchemes; |
520 |
520 if (selectScheme->currentIndex() < numberOfDefaultSchemes) |
521 if (reallyDelete.exec() == QMessageBox::Ok) |
|
522 { |
521 { |
523 QAbstractItemModel * model = mapper->model(); |
522 QMessageBox::warning(0, QMessageBox::tr("Schemes"), QMessageBox::tr("Cannot delete default scheme '%1'!").arg(selectScheme->currentText())); |
524 model->removeRow(selectScheme->currentIndex()); |
523 } |
|
524 else |
|
525 { |
|
526 QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel); |
|
527 |
|
528 if (reallyDelete.exec() == QMessageBox::Ok) |
|
529 { |
|
530 QAbstractItemModel * model = mapper->model(); |
|
531 model->removeRow(selectScheme->currentIndex()); |
|
532 } |
525 } |
533 } |
526 } |
534 } |
527 |
535 |
528 void PageScheme::schemeSelected(int n) |
536 void PageScheme::schemeSelected(int n) |
529 { |
537 { |