Skip to content
Snippets Groups Projects
Commit c437c3b5 authored by Vadim ProductEngine's avatar Vadim ProductEngine
Browse files

EXP-1815 FIXED Favorites list in login screen not populated when display names are disabled.

* Fixed LLAvatarName::getLegacyName() to work when display names are disabled
  (it used to return ' ', i.e. empty first and last name separated with a space).
* Added some debugging messages.
parent 19320842
Branches
Tags
No related merge requests found
......@@ -106,6 +106,11 @@ std::string LLAvatarName::getCompleteName() const
std::string LLAvatarName::getLegacyName() const
{
if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled?
{
return mDisplayName;
}
std::string name;
name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() );
name = mLegacyFirstName;
......
......@@ -216,6 +216,7 @@ void LLPanelLogin::addUsersWithFavoritesToUsername()
void LLPanelLogin::addFavoritesToStartLocation()
{
// Clear the combo.
LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
if (!combo) return;
int num_items = combo->getItemCount();
......@@ -223,6 +224,10 @@ void LLPanelLogin::addFavoritesToStartLocation()
{
combo->remove(i);
}
// Load favorites into the combo.
std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
std::string canonical_user_name = canonicalize_username(user_defined_name);
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
LLSD fav_llsd;
llifstream file;
......@@ -232,15 +237,18 @@ void LLPanelLogin::addFavoritesToStartLocation()
for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
iter != fav_llsd.endMap(); ++iter)
{
std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
// The account name in stored_favorites.xml has Resident last name even if user has
// a single word account name, so it can be compared case-insensitive with the
// user defined "firstname lastname".
S32 res = LLStringUtil::compareInsensitive(canonicalize_username(user_defined_name), iter->first);
if (res != 0) continue;
S32 res = LLStringUtil::compareInsensitive(canonical_user_name, iter->first);
if (res != 0)
{
lldebugs << "Skipping favorites for " << iter->first << llendl;
continue;
}
combo->addSeparator();
lldebugs << "Loading favorites for " << iter->first << llendl;
LLSD user_llsd = iter->second;
for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
iter1 != user_llsd.endArray(); ++iter1)
......
......@@ -1462,6 +1462,7 @@ const std::string& LLViewerInventoryItem::getName() const
class LLFavoritesOrderStorage : public LLSingleton<LLFavoritesOrderStorage>
, public LLDestroyClass<LLFavoritesOrderStorage>
{
LOG_CLASS(LLFavoritesOrderStorage);
public:
/**
* Sets sort index for specified with LLUUID favorite landmark
......@@ -1620,10 +1621,18 @@ void LLFavoritesOrderStorage::load()
void LLFavoritesOrderStorage::saveFavoritesSLURLs()
{
// Do not change the file if we are not logged in yet.
if (!LLLoginInstance::getInstance()->authSuccess()) return;
if (!LLLoginInstance::getInstance()->authSuccess())
{
llwarns << "Cannot save favorites: not logged in" << llendl;
return;
}
std::string user_dir = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "");
if (user_dir.empty()) return;
if (user_dir.empty())
{
llwarns << "Cannot save favorites: empty user dir name" << llendl;
return;
}
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
llifstream in_file;
......@@ -1649,13 +1658,19 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs()
slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]);
if (slurl_iter != mSLURLs.end())
{
lldebugs << "Saving favorite: idx=" << (*it)->getSortField() << ", SLURL=" << slurl_iter->second << ", value=" << value << llendl;
value["slurl"] = slurl_iter->second;
user_llsd[(*it)->getSortField()] = value;
}
else
{
llwarns << "Not saving favorite " << value["name"] << ": no matching SLURL" << llendl;
}
}
LLAvatarName av_name;
LLAvatarNameCache::get( gAgentID, &av_name );
lldebugs << "Saved favorites for " << av_name.getLegacyName() << llendl;
fav_llsd[av_name.getLegacyName()] = user_llsd;
llofstream file;
......@@ -1674,6 +1689,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
LLAvatarName av_name;
LLAvatarNameCache::get( gAgentID, &av_name );
lldebugs << "Removed favorites for " << av_name.getLegacyName() << llendl;
if (fav_llsd.has(av_name.getLegacyName()))
{
fav_llsd.erase(av_name.getLegacyName());
......@@ -1706,6 +1722,7 @@ void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmar
void LLFavoritesOrderStorage::storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl)
{
lldebugs << "Saving landmark SLURL: " << slurl << llendl;
mSLURLs[asset_id] = slurl;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment