diff options
-rw-r--r-- | indra/newview/llpanellogin.cpp | 63 | ||||
-rw-r--r-- | indra/newview/llpanellogin.h | 2 |
2 files changed, 47 insertions, 18 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 144839b554..30f0a5ba39 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -167,6 +167,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mCallback(callback), mCallbackData(cb_data), mHtmlAvailable( TRUE ), + mLocationUpdated( FALSE ), mListener(new LLPanelLoginListener(this)) { setFocusRoot(TRUE); @@ -226,7 +227,9 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, 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); @@ -675,23 +678,29 @@ void LLPanelLogin::updateLocationCombo( bool force_visible ) 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; @@ -1140,14 +1149,11 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*) 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(); } @@ -1165,6 +1171,27 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe) } } +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; diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index aa6884ea97..cbf2b1fcf3 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -100,6 +100,7 @@ private: 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(); @@ -117,6 +118,7 @@ private: static LLPanelLogin* sInstance; static BOOL sCapslockDidNotification; BOOL mHtmlAvailable; + BOOL mLocationUpdated; }; std::string load_password_from_disk(void); |