Commits

Anonymous committed 7065632

Fix for EXT-8446: Start location field cleared on login
Reviewed by Merov

  • Participants
  • Parent commits b03065d

Comments (0)

Files changed (2)

File indra/newview/llpanellogin.cpp

 	mCallback(callback),
 	mCallbackData(cb_data),
 	mHtmlAvailable( TRUE ),
+	mLocationUpdated( FALSE ),
 	mListener(new LLPanelLoginListener(this))
 {
 	setFocusRoot(TRUE);
 		LLSLURL slurl(gSavedSettings.getString("LoginLocation"));
 		LLStartUp::setStartSLURL(slurl);
 	}
-	updateLocationCombo(false);
+
+	LLComboBox* location_choice_combo = sInstance->getChild<LLComboBox>("start_location_combo");
+	location_choice_combo->setFocusLostCallback(boost::bind(onLocationComboLostFocus, _1));
 
 	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
 	server_choice_combo->setCommitCallback(onSelectServer, NULL);
 		return;
 	}	
 	
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
-	
-	switch(LLStartUp::getStartSLURL().getType())
+	if ( ! sInstance->mLocationUpdated )
 	{
-		case LLSLURL::LOCATION:
+		LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+
+		// get combo box to a known state so we can test its dirty state later
+		combo->resetDirty();
+
+		switch(LLStartUp::getStartSLURL().getType())
 		{
-			
-			combo->setCurrentByIndex( 2 );	
-			combo->setTextEntry(LLStartUp::getStartSLURL().getLocationString());	
-			break;
+			case LLSLURL::LOCATION:
+			{
+				
+				combo->setCurrentByIndex( 2 );	
+				combo->setTextEntry(LLStartUp::getStartSLURL().getLocationString());	
+				break;
+			}
+			case LLSLURL::HOME_LOCATION:
+				combo->setCurrentByIndex(1);
+				break;
+			default:
+				combo->setCurrentByIndex(0);
+				break;
 		}
-		case LLSLURL::HOME_LOCATION:
-			combo->setCurrentByIndex(1);
-			break;
-		default:
-			combo->setCurrentByIndex(0);
-			break;
 	}
 	
 	BOOL show_start = TRUE;
 		combo_val = combo->getValue();
 	}
 	
-	combo = sInstance->getChild<LLComboBox>("start_location_combo");	
-	combo->setCurrentByIndex(1);
 	LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation")));
 	LLGridManager::getInstance()->setGridChoice(combo_val.asString());
 	// This new selection will override preset uris
 	// from the command line.
 	updateServer();
-	updateLocationCombo(false);
 	updateLoginPanelLinks();
 }
 
 	}
 }
 
+void LLPanelLogin::onLocationComboLostFocus(LLFocusableElement* fe)
+{
+	if (!sInstance)
+	{
+		return;
+	}
+
+	LLComboBox* combo = sInstance->getChild< LLComboBox> ( "start_location_combo" );
+	if ( fe == combo )
+	{
+		if ( combo->isDirty() )
+		{
+			sInstance->mLocationUpdated = TRUE;
+		}
+		else
+		{
+			sInstance->mLocationUpdated = FALSE;
+		}
+	}
+}
+
 void LLPanelLogin::updateLoginPanelLinks()
 {
 	LLSD grid_data;

File indra/newview/llpanellogin.h

 	static void onPassKey(LLLineEditor* caller, void* user_data);
 	static void onSelectServer(LLUICtrl*, void*);
 	static void onServerComboLostFocus(LLFocusableElement*);
+	static void onLocationComboLostFocus(LLFocusableElement*);
 	static void updateServerCombo();
 	static void updateStartSLURL();
 	
 	static LLPanelLogin* sInstance;
 	static BOOL		sCapslockDidNotification;
 	BOOL			mHtmlAvailable;
+	BOOL			mLocationUpdated;
 };
 
 std::string load_password_from_disk(void);