// static void LLPanelLogin::onSelectServer(LLUICtrl*, void*) { // *NOTE: The paramters for this method are ignored. // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) // calls this method. // The user twiddled with the grid choice ui. // apply the selection to the grid setting. std::string grid_label; S32 grid_index; LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); LLSD combo_val = combo->getValue(); if (LLSD::TypeInteger == combo_val.type()) { grid_index = combo->getValue().asInteger(); if ((S32)GRID_INFO_OTHER == grid_index) { // This happens if the user specifies a custom grid // via command line. grid_label = combo->getSimple(); } } else { // no valid selection, return other grid_index = (S32)GRID_INFO_OTHER; grid_label = combo_val.asString(); } // This new seelction will override preset uris // from the command line. LLViewerLogin* vl = LLViewerLogin::getInstance(); vl->resetURIs(); if(grid_index != GRID_INFO_OTHER) { vl->setGridChoice((EGridInfo)grid_index); } else { vl->setGridChoice(grid_label); } // grid changed so show new splash screen (possibly) loadLoginPage(); }
// static void LLPanelLogin::setFields(const LLSavedLoginEntry& entry, bool takeFocus) { if (!sInstance) { llwarns << "Attempted setFields with no login view shown" << llendl; return; } LLCheckBoxCtrl* remember_pass_check = sInstance->getChild<LLCheckBoxCtrl>("remember_check"); LLComboBox* login_combo = sInstance->getChild<LLComboBox>("first_name_combo"); login_combo->setLabel(entry.getFirstName()); login_combo->resetDirty(); login_combo->resetTextDirty(); LLLineEditor* last_name = sInstance->getChild<LLLineEditor>("last_name_edit"); last_name->setText(entry.getLastName()); last_name->resetDirty(); if (entry.getPassword().empty()) { sInstance->childSetText("password_edit", std::string("")); remember_pass_check->setValue(LLSD(false)); } else { const std::string filler("123456789!123456"); sInstance->childSetText("password_edit", filler); sInstance->mIncomingPassword = filler; sInstance->mMungedPassword = entry.getPassword(); remember_pass_check->setValue(LLSD(true)); } LLComboBox* server_combo = sInstance->getChild<LLComboBox>("server_combo"); if (server_combo->getSimple() != entry.getGridName()) // Avoid loops. { server_combo->setSimple(entry.getGridName()); // Same string as used in login_show(). } LLViewerLogin* vl = LLViewerLogin::getInstance(); if (entry.getGrid() == GRID_INFO_OTHER) { vl->setGridURI(entry.getGridURI().asString()); vl->setHelperURI(entry.getHelperURI().asString()); vl->setLoginPageURI(entry.getLoginPageURI().asString()); } EGridInfo entry_grid = entry.getGrid(); if (entry_grid == GRID_INFO_OTHER || entry_grid != vl->getGridChoice()) { vl->setGridChoice(entry_grid); // grid changed so show new splash screen (possibly) loadLoginPage(); } if (takeFocus) { giveFocus(); } }
// static void LLPanelLogin::onSelectServer(LLUICtrl*, void*) { // *NOTE: The parameters for this method are ignored. // This function is only called by one thread, so we can use a static here. static bool looping; if (looping) return; looping = true; // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) // calls this method. // The user twiddled with the grid choice ui. // apply the selection to the grid setting. std::string grid_name; S32 grid_index; LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); LLSD combo_val = combo->getValue(); if (LLSD::TypeInteger == combo_val.type()) { grid_index = combo->getValue().asInteger(); grid_name = combo->getSimple(); } else { // no valid selection, return other grid_index = (S32)GRID_INFO_OTHER; grid_name = combo_val.asString(); } // This new selection will override preset uris // from the command line. LLViewerLogin* vl = LLViewerLogin::getInstance(); if(grid_index != GRID_INFO_OTHER) { vl->setGridChoice((EGridInfo)grid_index); } else { vl->setGridChoice(grid_name); } // Find a saved login entry that uses this grid, if any. bool found = false; LLSavedLoginsList const& entries = sInstance->mLoginHistoryData.getEntries(); for (LLSavedLoginsList::const_reverse_iterator i = entries.rbegin(); i != entries.rend(); ++i) { if (!i->asLLSD().isMap()) { continue; } if (i->getGridName() == grid_name) { if (!vl->nameEditted()) { // Change the other fields to match this grid. LLPanelLogin::setFields(*i, false); } else // Probably creating a new account. { // Likely the current password is for a different grid. clearPassword(); } found = true; break; } } if (!found) { clearPassword(); // If the grid_name starts with 'http[s]://' then // we have to assume it's a new loginuri, set // on the commandline. if (grid_name.substr(0, 4) == "http") { // Use it as login uri. vl->setGridURI(grid_name); // And set the login page if it was given. std::string loginPage = gSavedSettings.getString("LoginPage"); std::string helperURI = gSavedSettings.getString("CmdLineHelperURI"); if (!loginPage.empty()) vl->setLoginPageURI(loginPage); if (!helperURI.empty()) vl->setHelperURI(helperURI); } } // grid changed so show new splash screen (possibly) loadLoginPage(); looping = false; }