From ec1fc19a7ef79ae27e68735e43dc9166397871f7 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Fri, 12 Mar 2010 17:03:19 +0100 Subject: respect --grid and --login (and --loginuri over --grid). --- linden/indra/newview/llpanellogin.cpp | 32 ++++++++++++++++++++++++-------- linden/indra/newview/llstartup.cpp | 21 ++++++++++++++------- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index d3e295d..64a8a1f 100644 --- a/linden/indra/newview/llpanellogin.cpp +++ b/linden/indra/newview/llpanellogin.cpp @@ -634,7 +634,23 @@ void LLPanelLogin::addServer(const std::string& server) } else { - std::string last_grid = gSavedSettings.getString("LastSelectedGrid"); + std::string last_grid = gSavedSettings.getString("CmdLineGridChoice");//imprudence TODO:errorcheck + std::string cmd_line_login_uri = gSavedSettings.getLLSD("CmdLineLoginURI").asString(); + if (!last_grid.empty()&& cmd_line_login_uri.empty())//don't use --grid if --loginuri is also given + { + //give user chance to change their mind, even with --grid set + gSavedSettings.setString("CmdLineGridChoice",""); + } + else if (!cmd_line_login_uri.empty()) + { + last_grid = cmd_line_login_uri; + //also clear --grid no matter if it was given + gSavedSettings.setString("CmdLineGridChoice",""); + } + else if (last_grid.empty()) + { + last_grid = gSavedSettings.getString("LastSelectedGrid"); + } if (last_grid.empty()) last_grid = defaultGrid; grids->setSimple(last_grid); } @@ -876,17 +892,17 @@ void LLPanelLogin::loadLoginPage() location = "home"; } } - + std::string firstname, lastname; - if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3) - { - LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo"); + if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3) + { + LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo"); firstname = cmd_line_login[0].asString(); lastname = cmd_line_login[1].asString(); - password = cmd_line_login[2].asString(); - } - + password = cmd_line_login[2].asString(); + } + if (firstname.empty()) { firstname = gSavedSettings.getString("FirstName"); diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 11bd87b..993e6e2 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -683,9 +683,9 @@ bool idle_startup() show_connect_box = firstname.empty() || lastname.empty() || web_login_key.isNull(); } - else if((gSavedSettings.getLLSD("UserLoginInfo").size() == 3) && !LLStartUp::shouldAutoLogin()) - { - LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo"); + else if((gSavedSettings.getLLSD("UserLoginInfo").size() == 3) && !LLStartUp::shouldAutoLogin()) + { + LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo"); firstname = cmd_line_login[0].asString(); lastname = cmd_line_login[1].asString(); @@ -700,7 +700,7 @@ bool idle_startup() show_connect_box = false; #endif gSavedSettings.setBOOL("AutoLogin", TRUE); - } + } else if (gSavedSettings.getBOOL("AutoLogin")) { firstname = gSavedSettings.getString("FirstName"); @@ -877,13 +877,20 @@ bool idle_startup() gDebugInfo["LoginName"] = firstname + " " + lastname; } - gHippoGridManager->setCurrentGridAsConnected(); + std::string cmd_line_grid_choice = gSavedSettings.getString("CmdLineGridChoice"); + std::string cmd_line_login_uri = gSavedSettings.getLLSD("CmdLineLoginURI").asString(); + if(!cmd_line_grid_choice.empty() && cmd_line_login_uri.empty()) + { + gHippoGridManager->setCurrentGrid(cmd_line_grid_choice); + } + + gHippoGridManager->setCurrentGridAsConnected(); // create necessary directories // *FIX: these mkdir's should error check gDirUtilp->setLindenUserDir(gHippoGridManager->getCurrentGridNick(), firstname, lastname); - LLFile::mkdir(gDirUtilp->getLindenUserDir()); + LLFile::mkdir(gDirUtilp->getLindenUserDir()); - // Set PerAccountSettingsFile to the default value. + // Set PerAccountSettingsFile to the default value. gSavedSettings.setString("PerAccountSettingsFile", gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount") -- cgit v1.1