QTfrontend/selectWeapon.cpp
changeset 717 490dc8bb5b87
parent 696 d6f32ed6edc8
child 718 f93a38d2c982
--- a/QTfrontend/selectWeapon.cpp	Sun Jan 20 12:15:23 2008 +0000
+++ b/QTfrontend/selectWeapon.cpp	Sun Jan 20 12:21:13 2008 +0000
@@ -121,6 +121,10 @@
     int num = it==weaponItems.end() ? 9 : (*this)[i];
     currentState = QString("%1%2").arg(currentState).arg(num);
   }
+  if (curWeaponsName!="") {
+    // remove old entry
+    wconf->remove(curWeaponsName);
+  }
   wconf->setValue(m_name->text(), currentState);
   emit weaponsChanged();
 }
@@ -141,13 +145,15 @@
   return wconf->value(name).toString();
 }
 
-void SelWeaponWidget::setWeaponsName(const QString& name)
+void SelWeaponWidget::setWeaponsName(const QString& name, bool editMode)
 {
   if(name!="" && wconf->contains(name)) {
     setWeapons(wconf->value(name).toString());
   }
 
-  curWeaponsName=name;
+  if(editMode) curWeaponsName=name;
+  else curWeaponsName="";
+
   m_name->setText(name);
 }