diff options
author | Andrew Productengine <adyukov@productengine.com> | 2010-12-06 18:05:44 +0200 |
---|---|---|
committer | Andrew Productengine <adyukov@productengine.com> | 2010-12-06 18:05:44 +0200 |
commit | d6f8efae246db921b8d52fc1f86bbf667931dd93 (patch) | |
tree | 463d81d77d942faa47b0b09dd3377e0ff8a79a3c /indra/newview/llpanellogin.cpp | |
parent | 45c7663cef287665945a148cce5751f253ee3a0f (diff) |
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.
Diffstat (limited to 'indra/newview/llpanellogin.cpp')
-rw-r--r-- | indra/newview/llpanellogin.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
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<LLComboBox>("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() |