From 2333a684a3d0f85a59c9937cfa8d8ee6498ff96d Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 30 Sep 2013 17:18:41 -0400 Subject: [PATCH] Feature Request: Allow typing login uris into the grids combo box on the login screen Furthermore, users may now type in grid name, grid nick, or grid login uri into the box and it will resolve to an existing grid they've used before, or (for uris only) try to add the new grid with the data it provides. Input will have trailing and leading spaces trimmed. Thanks to Diva Canto for this brilliant request! --- indra/newview/llpanellogin.cpp | 29 ++++++++++++++++++- .../skins/default/xui/en-us/panel_login.xml | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index c641c95cc..d8b8a1711 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -215,6 +215,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLComboBox *server_choice_combo = getChild("grids_combo"); server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, _1)); + server_choice_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onSelectGrid, server_choice_combo)); // Load all of the grids, sorted, and then add a bar and the current grid at the top updateGridCombo(); @@ -1031,7 +1032,33 @@ void LLPanelLogin::refreshLoginPage() //void LLPanelLogin::onSelectServer() void LLPanelLogin::onSelectGrid(LLUICtrl *ctrl) { - gHippoGridManager->setCurrentGrid(ctrl->getValue()); + std::string grid(ctrl->getValue().asString()); + LLStringUtil::trim(grid); // Guard against copy paste + if (!gHippoGridManager->getGrid(grid)) // We can't get an input grid by name or nick, perhaps a Login URI was entered + { + HippoGridInfo* info(new HippoGridInfo("")); // Start off with empty grid name, otherwise we don't know what to name + info->setLoginUri(grid); + if (info->retrieveGridInfo()) // There's info from this URI + { + grid = info->getGridName(); + if (HippoGridInfo* nick_info = gHippoGridManager->getGrid(info->getGridNick())) // Grid of same nick exists + { + delete info; + grid = nick_info->getGridName(); + } + else // Guess not, try adding this grid + { + gHippoGridManager->addGrid(info); // deletes info if not needed (existing or no name) + } + } + else + { + delete info; + grid = gHippoGridManager->getCurrentGridName(); + } + } + gHippoGridManager->setCurrentGrid(grid); + ctrl->setValue(grid); } void LLPanelLogin::onLocationSLURL() diff --git a/indra/newview/skins/default/xui/en-us/panel_login.xml b/indra/newview/skins/default/xui/en-us/panel_login.xml index b022dfc44..ae63849a1 100644 --- a/indra/newview/skins/default/xui/en-us/panel_login.xml +++ b/indra/newview/skins/default/xui/en-us/panel_login.xml @@ -53,7 +53,7 @@ left="0" mouse_opaque="true" name="grids_combo_text" v_pad="0" width="120"> Grid: -