// static void LLPanelLogin::getLocation(std::string &location) { if (!sInstance) { llwarns << "Attempted getLocation with no login view shown" << llendl; return; } LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo"); location = combo->getValue().asString(); }
void FloaterGridManager::getLocation(std::string &location) { if (!FloaterGridManager::getInstance()) { llwarns << "Attempted getLocation with no login view shown" << llendl; return; } LLComboBox* combo = FloaterGridManager::getInstance()->getChild<LLComboBox>("start_location_combo"); location = combo->getValue().asString(); }
void LLPanelEmerald::onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata) { LLComboBox* box = (LLComboBox*)ctrl; if(box) { glggHunSpell->newDictSelection(box->getValue().asString()); //LLPanelEmerald* panel = (LLPanelEmerald*)userdata;//box->getParent(); if(sInstance)sInstance->refresh(); } //LLPanelEmerald* panel = (LLPanelEmerald*)userdata; //if(panel)panel->refresh(); }
// static void LLFloaterBlacklist::onClickAdd(void* user_data) { LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data; if(!floaterp) return; LLUUID add_id(floaterp->childGetValue("id_edit").asString()); if(add_id.isNull()) return; std::string name(floaterp->childGetValue("name_edit").asString()); if(name.size() == 0) return; LLComboBox* mTypeComboBox = floaterp->getChild<LLComboBox>("asset_combo"); LLSD indata; indata["entry_type"] = (LLAssetType::EType)mTypeComboBox->getValue().asInteger(); indata["entry_name"] = name; indata["entry_agent"] = gAgent.getID().asString(); addEntry(add_id,indata); }
void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) { LLComboBox* box = (LLComboBox*)ctrl; if(box) { if (box->getName() == "stand") { stand_iterator = box->getCurrentIndex(); if (mAOStandTimer) mAOStandTimer->reset(); ChangeStand(TRUE); } else { std::string stranim = box->getValue().asString(); for (std::vector<struct_combobox>::iterator iter = mComboBoxes.begin(); iter != mComboBoxes.end(); ++iter) { if (box->getName() == iter->name) { gSavedPerAccountSettings.setString("PhoenixAODefault"+iter->name,stranim); int boxstate = iter->state; for (std::vector<struct_default_anims>::iterator iter = mAODefaultAnims.begin(); iter != mAODefaultAnims.end(); ++iter) { if (boxstate == iter->state) { iter->ao_id = GetAnimIDByName(stranim); if (getAnimationState() == boxstate) // only play anim for the current state, change sits for example { startAOMotion(iter->ao_id,TRUE,TRUE); } return; } } } } } } }
void FSPanelPrefs::onBeamDelete() { LLComboBox* comboBox = findChild<LLComboBox>("FSBeamShape_combo"); if (comboBox) { std::string filename = comboBox->getValue().asString() + ".xml"; std::string path_name1(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "beams", filename)); std::string path_name2(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "beams", filename)); if (gDirUtilp->fileExists(path_name1)) { LLFile::remove(path_name1); gSavedSettings.setString("FSBeamShape", ""); } if (gDirUtilp->fileExists(path_name2)) { LLFile::remove(path_name2); gSavedSettings.setString("FSBeamShape", ""); } } refreshBeamLists(); }
void PanelPreferenceFirestorm::onBeamColorDelete() { LLComboBox* comboBox = getChild<LLComboBox>("BeamColor_combo"); if(comboBox != NULL) { std::string filename = comboBox->getValue().asString()+".xml"; std::string path_name1(gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS , "beamsColors", filename)); std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "beamsColors", filename)); if(gDirUtilp->fileExists(path_name1)) { LLFile::remove(path_name1); gSavedSettings.setString("FSBeamColorFile","===OFF==="); } if(gDirUtilp->fileExists(path_name2)) { LLFile::remove(path_name2); gSavedSettings.setString("FSBeamColorFile","===OFF==="); } } refreshBeamLists(); }
// static void LLPanelLogin::updateGridCombo(std::string grid_nick) { LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); if (grid_nick.empty()) { // The user twiddled with the grid choice ui. // apply the selection to the grid setting. //std::string grid_label; //S32 grid_index; grid_nick = combo->getValue().asString(); // HippoGridInfo *gridInfo = gHippoGridManager->getGrid(mCurGrid); // if (gridInfo) { // //childSetText("gridnick", gridInfo->getGridNick()); // //platform->setCurrentByIndex(gridInfo->getPlatform()); // //childSetText("gridname", gridInfo->getGridName()); // LLPanelLogin::setFields( gridInfo->getFirstName(), gridInfo->getLastName(), gridInfo->getAvatarPassword(), 1 ); // } } else { combo->setSimple(grid_nick); } gHippoGridManager->setCurrentGrid(grid_nick); llinfos << "current grid set to " << grid_nick << llendl; // grid changed so show new splash screen (possibly) loadLoginPage(); // save grid choice to settings gSavedSettings.setString("LastSelectedGrid", grid_nick); }
// static void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*) { LLComboBox* box = (LLComboBox*)ctrl; if (!box) return; std::string value = box->getValue().asString(); U8 click_action = string_value_to_click_action(value); if (click_action == CLICK_ACTION_BUY) { LLSaleInfo sale_info; LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); if (!sale_info.isForSale()) { LLNotificationsUtil::add("CantSetBuyObject"); // Set click action back to its old value U8 click_action = 0; LLSelectMgr::getInstance()->selectionGetClickAction(&click_action); std::string item_value = click_action_to_string_value(click_action); box->setValue(LLSD(item_value)); return; } } else if (click_action == CLICK_ACTION_PAY) { // Verify object has script with money() handler LLSelectionPayable payable; bool can_pay = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&payable); if (!can_pay) { // Warn, but do it anyway. LLNotificationsUtil::add("ClickActionNotPayable"); } } LLSelectMgr::getInstance()->selectionSetClickAction(click_action); }
void FSPanelLogin::onSelectUser() { LL_INFOS("AppInit") << "onSelectUser()" << LL_ENDL; if (!sInstance) { return; } LLComboBox* combo = sInstance->getChild<LLComboBox>("username_combo"); if (combo->getValue().asString() == sInstance->mPreviousUsername) { return; } LLSD combo_val = combo->getSelectedValue(); if (combo_val.isUndefined()) { // Previously unknown username was entered if (!sInstance->mPasswordModified) { // Clear password unless manually entered sInstance->getChild<LLLineEditor>("password_edit")->clear(); } sInstance->addFavoritesToStartLocation(); sInstance->mPreviousUsername = combo->getValue().asString(); sInstance->getChild<LLButton>("remove_user_btn")->setEnabled(FALSE); return; } // Saved username was either selected or entered; continue... const std::string cred_name = combo_val.asString(); LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(cred_name); sInstance->setFields(credential); sInstance->mPasswordModified = FALSE; sInstance->getChild<LLButton>("remove_user_btn")->setEnabled(TRUE); size_t arobase = cred_name.find("@"); if (arobase != std::string::npos && arobase + 1 < cred_name.length()) { const std::string grid_name = cred_name.substr(arobase + 1, cred_name.length() - arobase - 1); // Grid has changed - set new grid and update server combo if (LLGridManager::getInstance()->getGrid() != grid_name) { try { LLGridManager::getInstance()->setGridChoice(grid_name); } catch (LLInvalidGridName ex) { LL_WARNS("AppInit") << "Could not set grid '" << ex.name() << "'" << LL_ENDL; } updateServer(); } } sInstance->addFavoritesToStartLocation(); }
// static void LLPanelLogin::onClickConnect(void *) { if (sInstance && sInstance->mCallback) { // tell the responder we're not here anymore if ( gResponsePtr ) gResponsePtr->setParent( 0 ); // JC - Make sure the fields all get committed. sInstance->setFocus(FALSE); LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); LLSD combo_val = combo->getSelectedValue(); if (combo_val.isUndefined()) { combo_val = combo->getValue(); } if(combo_val.isUndefined()) { LLNotificationsUtil::add("StartRegionEmpty"); return; } try { LLGridManager::getInstance()->setGridChoice(combo_val.asString()); } catch (LLInvalidGridName ex) { LLSD args; args["GRID"] = combo_val.asString(); LLNotificationsUtil::add("InvalidGrid", args); return; } updateStartSLURL(); std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString(); if(username.empty()) { // user must type in something into the username field LLNotificationsUtil::add("MustHaveAccountToLogIn"); } else { LLPointer<LLCredential> cred; BOOL remember; getFields(cred, remember); std::string identifier_type; cred->identifierType(identifier_type); LLSD allowed_credential_types; LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types); // check the typed in credential type against the credential types expected by the server. for(LLSD::array_iterator i = allowed_credential_types.beginArray(); i != allowed_credential_types.endArray(); i++) { if(i->asString() == identifier_type) { // yay correct credential type sInstance->mCallback(0, sInstance->mCallbackData); return; } } // Right now, maingrid is the only thing that is picky about // credential format, as it doesn't yet allow account (single username) // format creds. - Rox. James, we wanna fix the message when we change // this. LLNotificationsUtil::add("InvalidCredentialFormat"); } } }
// 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; }
// static void LLPanelLogin::onClickConnect(void *) { if (sInstance && sInstance->mCallback) { // JC - Make sure the fields all get committed. sInstance->setFocus(FALSE); LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); LLSD combo_val = combo->getSelectedValue(); if (combo_val.isUndefined()) { combo_val = combo->getValue(); } if(combo_val.isUndefined()) { LLNotificationsUtil::add("StartRegionEmpty"); return; } std::string new_combo_value = combo_val.asString(); if (!new_combo_value.empty()) { std::string match = "://"; size_t found = new_combo_value.find(match); if (found != std::string::npos) new_combo_value.erase( 0,found+match.length()); } try { LLGridManager::getInstance()->setGridChoice(new_combo_value); } catch (LLInvalidGridName ex) { LLSD args; args["GRID"] = ex.name(); LLNotificationsUtil::add("InvalidGrid", args); return; } updateStartSLURL(); std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString(); gSavedSettings.setString("UserLoginInfo", credential_name()); LLSD blocked = FSData::getInstance()->allowed_login(); if (!blocked.isMap()) //hack for testing for an empty LLSD { if(username.empty()) { LLSD args; args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel(); // user must type in something into the username field LLNotificationsUtil::add("MustHaveAccountToLogIn", args); } else { LLPointer<LLCredential> cred; BOOL remember; getFields(cred, remember); std::string identifier_type; cred->identifierType(identifier_type); LLSD allowed_credential_types; LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types); // check the typed in credential type against the credential types expected by the server. for(LLSD::array_iterator i = allowed_credential_types.beginArray(); i != allowed_credential_types.endArray(); i++) { if(i->asString() == identifier_type) { // yay correct credential type sInstance->mCallback(0, sInstance->mCallbackData); return; } } // Right now, maingrid is the only thing that is picky about // credential format, as it doesn't yet allow account (single username) // format creds. - Rox. James, we wanna fix the message when we change // this. LLNotificationsUtil::add("InvalidCredentialFormat"); } } } }
// 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. // LLPointer<LLCredential> credential; <- SA: is this ever used? LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); LLSD combo_val = combo->getSelectedValue(); if (combo_val.isUndefined()) { combo_val = combo->getValue(); } // <AW: opensim> std::string new_combo_value = combo_val.asString(); if (!new_combo_value.empty()) { std::string match = "://"; size_t found = new_combo_value.find(match); if (found != std::string::npos) new_combo_value.erase( 0,found+match.length()); } // e.g user clicked into loginpage if(LLGridManager::getInstance()->getGrid() == new_combo_value) { return; } try { LLGridManager::getInstance()->setGridChoice(new_combo_value); } catch (LLInvalidGridName ex) { // do nothing } // </AW: opensim> //Clear the PW for security reasons, if the Grid changed manually. sInstance->getChild<LLLineEditor>("password_edit")->clear(); LL_INFOS("AppInit") << "onSelectServer " << new_combo_value << LL_ENDL; combo = sInstance->getChild<LLComboBox>("start_location_combo"); // combo->setCurrentByIndex(1); <- SA: Why??? LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation"))); // This new selection will override preset uris // from the command line. updateServer(); updateLoginPanelLinks(); }