QTfrontend/hwform.cpp
changeset 9184 8bf450fe6cc8
parent 9182 f92e205bc167
child 9197 e4e366013e9a
child 9219 0a4b6bb69f99
--- a/QTfrontend/hwform.cpp	Mon May 27 21:39:52 2013 +0300
+++ b/QTfrontend/hwform.cpp	Wed Jun 12 04:53:04 2013 +0300
@@ -195,6 +195,7 @@
 #endif
 
 	previousCampaignName = "";
+	previousTeamName = "";
     UpdateTeamsLists();
     InitCampaignPage();
     UpdateCampaignPage(0);
@@ -1893,7 +1894,7 @@
 void HWForm::UpdateCampaignPage(int index)
 {
     Q_UNUSED(index);
-
+    
     HWTeam team(ui.pageCampaign->CBTeam->currentText());
     ui.pageCampaign->CBMission->clear();
 
@@ -1906,11 +1907,16 @@
     // if the campaign name changes update the campaignMissionDescriptions list
     // this will be used later in UpdateCampaignPageMission() to update
     // the mission description in the campaign page
-    bool updateMissionList = false;    
+    bool updateMissionList = false;
     QSettings * m_info;
-    if(previousCampaignName.compare(campaignName)!=0) 
+    if(previousCampaignName.compare(campaignName)!=0 || 
+			previousTeamName.compare(tName) != 0) 
     {
+		if (previousTeamName.compare(tName) != 0 && 
+				previousTeamName.compare("") != 0)
+			index = qMin(m + 1, n);
 		previousCampaignName = campaignName;
+		previousTeamName = tName;
 		updateMissionList = true;
 		// the following code was based on pagetraining.cpp
 		DataManager & dataMgr = DataManager::instance();    
@@ -1946,6 +1952,7 @@
     }
     if(updateMissionList)
 		delete m_info;
+
     UpdateCampaignPageMission(index);
 }