--- a/QTfrontend/hwform.cpp Sun Jan 20 13:49:57 2008 +0000
+++ b/QTfrontend/hwform.cpp Sun Jan 20 13:51:22 2008 +0000
@@ -122,9 +122,9 @@
connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
- connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
+ connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
this, SLOT(UpdateWeapons())); // executed second
- connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
+ connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
this, SLOT(GoBack())); // executed third
GoToPage(ID_PAGE_MAIN);
--- a/QTfrontend/selectWeapon.cpp Sun Jan 20 13:49:57 2008 +0000
+++ b/QTfrontend/selectWeapon.cpp Sun Jan 20 13:51:22 2008 +0000
@@ -27,6 +27,7 @@
#include <QBitmap>
#include <QLineEdit>
#include <QSettings>
+#include <QMessageBox>
QImage getAmmoImage(int num)
{
@@ -149,7 +150,20 @@
void SelWeaponWidget::deleteWeaponsName()
{
if (curWeaponsName=="") return;
- wconf->remove(curWeaponsName);
+
+ if (curWeaponsName=="Default") {
+ QMessageBox impossible(QMessageBox::Warning, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not delete default weapon set"));
+ impossible.exec();
+ return;
+ }
+
+ QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Weapons"), QMessageBox::tr("Really delete this weapon set?"),
+ QMessageBox::Ok | QMessageBox::Cancel);
+
+ if (reallyDelete.exec()==QMessageBox::Ok) {
+ wconf->remove(curWeaponsName);
+ emit weaponsDeleted();
+ }
}
void SelWeaponWidget::setWeaponsName(const QString& name, bool editMode)
--- a/QTfrontend/selectWeapon.h Sun Jan 20 13:49:57 2008 +0000
+++ b/QTfrontend/selectWeapon.h Sun Jan 20 13:51:22 2008 +0000
@@ -60,6 +60,7 @@
signals:
void weaponsChanged();
+ void weaponsDeleted();
private:
QString currentState;