From d6f8efae246db921b8d52fc1f86bbf667931dd93 Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Mon, 6 Dec 2010 18:05:44 +0200 Subject: STORM-34 FIXED Saving of user's favorites into file and showing them in "Start at" combobox on login screen was implemented. Implementation details: - File is saved on exit from viewer and not immediately on changes as was written in spec. It is done to make this file consistent with favorites order: order of favorites is saved on exit, so if favorites info is saved in other moment earlier, crashing viewer or other unexpected way of finishing its work (i.e. via Windows task bar) would cause inconsistence between favorites order saved per account and one from this new file. - File is saved in user_settings\stored_favorites.xml. - If you uncheck the option in Preferences and press OK, the file gets immediately deleted (according to spec). Issues that require further changes: - Currently only favorites of last logged in user are shown in login screen. Showing favorites of multiple users will be implemented later when design for it is approved by Esbee. - Preference is now global for all users, because design states it may be changed before login, and we don't have account info at the moment. But it doesn't seem to be a good idea, so changes in design are needed. - Currently the way of retrieving SLURLs needs optimization in a separate ticket. More detailed design approved by Esbee is needed to develop it further, perhaps in new tickets. --- indra/newview/llpanellogin.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index cf567fb208..16ea303c77 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -262,11 +262,45 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, gResponsePtr = LLIamHereLogin::build( this ); LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr ); - + + // Show last logged in user favorites in "Start at" combo if corresponding option is enabled. + if (gSavedSettings.getBOOL("ShowFavoritesOnLogin")) + { + addFavoritesToStartLocation(); + } + updateLocationCombo(false); } +void LLPanelLogin::addFavoritesToStartLocation() +{ + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); + LLSD fav_llsd; + llifstream file; + file.open(filename); + if (!file.is_open()) return; + LLComboBox* combo = getChild("start_location_combo"); + combo->addSeparator(); + LLSDSerialize::fromXML(fav_llsd, file); + for (LLSD::map_const_iterator iter = fav_llsd.beginMap(); + iter != fav_llsd.endMap(); ++iter) + { + LLSD user_llsd = iter->second; + for (LLSD::array_const_iterator iter1 = user_llsd.beginArray(); + iter1 != user_llsd.endArray(); ++iter1) + { + std::string label = (*iter1)["name"].asString(); + std::string value = (*iter1)["slurl"].asString(); + if(label != "" && value != "") + { + combo->add(label, value); + } + } + + } +} + // force the size to be correct (XML doesn't seem to be sufficient to do this) // (with some padding so the other login screen doesn't show through) void LLPanelLogin::reshapeBrowser() -- cgit v1.2.3 From 32750132db47eb335c56f6c880902cf7195e1825 Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Thu, 9 Dec 2010 19:54:40 +0200 Subject: STORM-34 ADDITIONAL_FIX Implemented storing of multi-user favorites and showing them on login screen. - Changed the way SLURLs are cached a little, because previous one introduced problems with theit order. - Also allowed saving of favorites to disk even if not all of them received SLURL info - this is done to avoid favorites not saving when there is at least one "dead" landmark among them. - "Username" field on login screen is now not a lineeditor, but combobox (to enable autocompletion), but without button (Esbee asked for this in ticket for security reasons, and perhaps for visual consistency). - Elements of this combobox are names of users whose favorites we have saved in file. - Contents of "Start at:" combobox are changed depending on changes in "Username"- if username is present in favorites file, favorites for this user are added there. - New callback was added to LLCombobox and used in this fix, because present ones weren't enough to easily track changes in text entry. --- indra/newview/llpanellogin.cpp | 68 +++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 17 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 16ea303c77..c50e8c48b5 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -266,26 +266,51 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, // Show last logged in user favorites in "Start at" combo if corresponding option is enabled. if (gSavedSettings.getBOOL("ShowFavoritesOnLogin")) { - addFavoritesToStartLocation(); + addUsersWithFavoritesToUsername(); + getChild("username_combo")->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this)); } updateLocationCombo(false); } -void LLPanelLogin::addFavoritesToStartLocation() +void LLPanelLogin::addUsersWithFavoritesToUsername() { + LLComboBox* combo = getChild("username_combo"); + if (!combo) return; std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); LLSD fav_llsd; llifstream file; file.open(filename); if (!file.is_open()) return; + LLSDSerialize::fromXML(fav_llsd, file); + for (LLSD::map_const_iterator iter = fav_llsd.beginMap(); + iter != fav_llsd.endMap(); ++iter) + { + combo->add(iter->first); + } +} + +void LLPanelLogin::addFavoritesToStartLocation() +{ LLComboBox* combo = getChild("start_location_combo"); - combo->addSeparator(); + if (!combo) return; + int num_items = combo->getItemCount(); + for (int i = num_items - 1; i > 2; i--) + { + combo->remove(i); + } + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); + LLSD fav_llsd; + llifstream file; + file.open(filename); + if (!file.is_open()) return; LLSDSerialize::fromXML(fav_llsd, file); for (LLSD::map_const_iterator iter = fav_llsd.beginMap(); iter != fav_llsd.endMap(); ++iter) { + if(iter->first != getChild("username_combo")->getSimple()) continue; + combo->addSeparator(); LLSD user_llsd = iter->second; for (LLSD::array_const_iterator iter1 = user_llsd.beginArray(); iter1 != user_llsd.endArray(); ++iter1) @@ -297,7 +322,7 @@ void LLPanelLogin::addFavoritesToStartLocation() combo->add(label, value); } } - + break; } } @@ -461,13 +486,14 @@ void LLPanelLogin::giveFocus() if( sInstance ) { // Grab focus and move cursor to first blank input field - std::string username = sInstance->getChild("username_edit")->getValue().asString(); + std::string username = sInstance->getChild("username_combo")->getValue().asString(); std::string pass = sInstance->getChild("password_edit")->getValue().asString(); BOOL have_username = !username.empty(); BOOL have_pass = !pass.empty(); LLLineEditor* edit = NULL; + LLComboBox* combo = NULL; if (have_username && !have_pass) { // User saved his name but not his password. Move @@ -477,7 +503,7 @@ void LLPanelLogin::giveFocus() else { // User doesn't have a name, so start there. - edit = sInstance->getChild("username_edit"); + combo = sInstance->getChild("username_combo"); } if (edit) @@ -485,6 +511,10 @@ void LLPanelLogin::giveFocus() edit->setFocus(TRUE); edit->selectAll(); } + else if (combo) + { + combo->setFocus(TRUE); + } } #endif } @@ -498,8 +528,8 @@ void LLPanelLogin::showLoginWidgets() // *TODO: Append all the usual login parameters, like first_login=Y etc. std::string splash_screen_url = sInstance->getString("real_url"); web_browser->navigateTo( splash_screen_url, "text/html" ); - LLUICtrl* username_edit = sInstance->getChild("username_edit"); - username_edit->setFocus(TRUE); + LLUICtrl* username_combo = sInstance->getChild("username_combo"); + username_combo->setFocus(TRUE); } // static @@ -543,15 +573,19 @@ void LLPanelLogin::setFields(LLPointer credential, login_id += " "; login_id += lastname; } - sInstance->getChild("username_edit")->setValue(login_id); + sInstance->getChild("username_combo")->setLabel(login_id); } else if((std::string)identifier["type"] == "account") { - sInstance->getChild("username_edit")->setValue((std::string)identifier["account_name"]); + sInstance->getChild("username_combo")->setLabel((std::string)identifier["account_name"]); } else { - sInstance->getChild("username_edit")->setValue(std::string()); + sInstance->getChild("username_combo")->setLabel(std::string()); + } + if (gSavedSettings.getBOOL("ShowFavoritesOnLogin")) + { + sInstance->addFavoritesToStartLocation(); } // if the password exists in the credential, set the password field with // a filler to get some stars @@ -600,7 +634,7 @@ void LLPanelLogin::getFields(LLPointer& credential, authenticator = credential->getAuthenticator(); } - std::string username = sInstance->getChild("username_edit")->getValue().asString(); + std::string username = sInstance->getChild("username_combo")->getValue().asString(); LLStringUtil::trim(username); std::string password = sInstance->getChild("password_edit")->getValue().asString(); @@ -692,15 +726,15 @@ BOOL LLPanelLogin::areCredentialFieldsDirty() } else { - std::string username = sInstance->getChild("username_edit")->getValue().asString(); + std::string username = sInstance->getChild("username_combo")->getValue().asString(); LLStringUtil::trim(username); std::string password = sInstance->getChild("password_edit")->getValue().asString(); - LLLineEditor* ctrl = sInstance->getChild("username_edit"); - if(ctrl && ctrl->isDirty()) + LLComboBox* combo = sInstance->getChild("username_combo"); + if(combo && combo->isDirty()) { return true; } - ctrl = sInstance->getChild("password_edit"); + LLLineEditor* ctrl = sInstance->getChild("password_edit"); if(ctrl && ctrl->isDirty()) { return true; @@ -1007,7 +1041,7 @@ void LLPanelLogin::onClickConnect(void *) return; } updateStartSLURL(); - std::string username = sInstance->getChild("username_edit")->getValue().asString(); + std::string username = sInstance->getChild("username_combo")->getValue().asString(); if(username.empty()) -- cgit v1.2.3 From c02d6a319f378d5dcc34c51b20f556f175d2a40a Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Thu, 23 Dec 2010 18:15:54 +0200 Subject: STORM-34 ADDITIONAL_FIX Made saving favorites in file per-account preference instead of per-machine. - Made changes in code of floater preferences and panel login that were required because of turning the setting per-account. - Added new method to LLFloaterPreference that looks for current user's record in saved favorites file and removes it. --- indra/newview/llpanellogin.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index c50e8c48b5..347190da51 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -263,12 +263,9 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr ); - // Show last logged in user favorites in "Start at" combo if corresponding option is enabled. - if (gSavedSettings.getBOOL("ShowFavoritesOnLogin")) - { - addUsersWithFavoritesToUsername(); - getChild("username_combo")->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this)); - } + // Show last logged in user favorites in "Start at" combo. + addUsersWithFavoritesToUsername(); + getChild("username_combo")->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this)); updateLocationCombo(false); @@ -583,10 +580,7 @@ void LLPanelLogin::setFields(LLPointer credential, { sInstance->getChild("username_combo")->setLabel(std::string()); } - if (gSavedSettings.getBOOL("ShowFavoritesOnLogin")) - { - sInstance->addFavoritesToStartLocation(); - } + sInstance->addFavoritesToStartLocation(); // if the password exists in the credential, set the password field with // a filler to get some stars LLSD authenticator = credential->getAuthenticator(); -- cgit v1.2.3 From 6b7a7081c31607bada575dd2f0a226bc5d721fc2 Mon Sep 17 00:00:00 2001 From: Kent Quirk Date: Wed, 19 Jan 2011 10:28:39 -0500 Subject: STORM-725: add os to updater query url --- indra/newview/llpanellogin.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index c143aff2d4..8d3b1fd7a0 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -35,6 +35,7 @@ #include "llsecondlifeurls.h" #include "v4color.h" +#include "llappviewer.h" #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcommandhandler.h" // for secondlife:///app/login/ @@ -859,6 +860,13 @@ void LLPanelLogin::loadLoginPage() char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridLabel().c_str(), 0); oStr << "&grid=" << curl_grid; curl_free(curl_grid); + + // add OS info + char * os_info = curl_escape(LLAppViewer::instance()->getOSInfo().getOSStringSimple().c_str(), 0); + oStr << "&os=" << os_info; + curl_free(os_info); + + gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid()); gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor()); -- cgit v1.2.3