diff options
| author | Oz Linden <oz@lindenlab.com> | 2011-04-21 20:22:46 -0400 | 
|---|---|---|
| committer | Oz Linden <oz@lindenlab.com> | 2011-04-21 20:22:46 -0400 | 
| commit | 79dceafdfd767e264e3a21e12cb73e52f57cfe06 (patch) | |
| tree | 39c4eba740058615a959bd5f7054d1181a1ea238 /indra | |
| parent | b0183ebc6535fab259daf7175dad58c778910709 (diff) | |
| parent | 73cfc64bee057d0f76ab2ca574681dd3fc18e7a8 (diff) | |
merge changes for storm-1145
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llfloaterpreference.cpp | 36 | ||||
| -rw-r--r-- | indra/newview/llfloaterpreference.h | 4 | ||||
| -rw-r--r-- | indra/newview/llpanellogin.cpp | 37 | ||||
| -rw-r--r-- | indra/newview/llviewerinventory.cpp | 29 | 
4 files changed, 66 insertions, 40 deletions
| diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 1a9d0af9af..c72cf13745 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -286,8 +286,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)  	mOriginalIMViaEmail(false),  	mLanguageChanged(false),  	mAvatarDataInitialized(false), -	mDoubleClickActionDirty(false), -	mFavoritesRecordMayExist(false) +	mDoubleClickActionDirty(false)  {  	//Build Floater is now Called from 	LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); @@ -565,34 +564,6 @@ void LLFloaterPreference::apply()  		updateDoubleClickSettings();  		mDoubleClickActionDirty = false;  	} - -	if (mFavoritesRecordMayExist && !gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin")) -	{ -		removeFavoritesRecordOfUser();		 -	} -} - -void LLFloaterPreference::removeFavoritesRecordOfUser() -{ -	mFavoritesRecordMayExist = false; -	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); -	 -	LLAvatarName av_name; -	LLAvatarNameCache::get( gAgentID, &av_name ); -	if (fav_llsd.has(av_name.getLegacyName())) -	{ -		fav_llsd.erase(av_name.getLegacyName()); -	} -	 -	llofstream out_file; -	out_file.open(filename); -	LLSDSerialize::toPrettyXML(fav_llsd, out_file); -  }  void LLFloaterPreference::cancel() @@ -678,11 +649,6 @@ void LLFloaterPreference::onOpen(const LLSD& key)  		getChildView("maturity_desired_combobox")->setVisible( false);  	} -	if (LLStartUp::getStartupState() == STATE_STARTED) -	{ -		mFavoritesRecordMayExist = gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"); -	} -  	// Forget previous language changes.  	mLanguageChanged = false; diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 5d5e066ec5..4d8a2489be 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -159,8 +159,6 @@ public:  	void buildPopupLists();  	static void refreshSkin(void* data); -	// Remove record of current user's favorites from file on disk. -	void removeFavoritesRecordOfUser();  private:  	static std::string sSkin;  	// set true if state of double-click action checkbox or radio-group was changed by user @@ -172,8 +170,6 @@ private:  	bool mAvatarDataInitialized;  	bool mOriginalHideOnlineStatus; -	// Record of current user's favorites may be stored in file on disk. -	bool mFavoritesRecordMayExist;  	std::string mDirectoryVisibility;  	LLAvatarData mAvatarProperties; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 7820ac3ecd..979d96ca0d 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -81,6 +81,9 @@ const S32 MAX_PASSWORD = 16;  LLPanelLogin *LLPanelLogin::sInstance = NULL;  BOOL LLPanelLogin::sCapslockDidNotification = FALSE; +// Helper for converting a user name into the canonical "Firstname Lastname" form. +// For new accounts without a last name "Resident" is added as a last name. +static std::string canonicalize_username(const std::string& name);  class LLLoginRefreshHandler : public LLCommandHandler  { @@ -302,7 +305,14 @@ void LLPanelLogin::addFavoritesToStartLocation()  	for (LLSD::map_const_iterator iter = fav_llsd.beginMap();  		iter != fav_llsd.endMap(); ++iter)  	{ -		if(iter->first != getChild<LLComboBox>("username_combo")->getSimple()) continue; +		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; +  		combo->addSeparator();  		LLSD user_llsd = iter->second;  		for (LLSD::array_const_iterator iter1 = user_llsd.beginArray(); @@ -1186,3 +1196,28 @@ void LLPanelLogin::onModeChangeConfirm(const LLSD& original_value, const LLSD& n  		break;  	}  } + +std::string canonicalize_username(const std::string& name) +{ +	std::string cname = name; +	LLStringUtil::trim(cname); + +	// determine if the username is a first/last form or not. +	size_t separator_index = cname.find_first_of(" ._"); +	std::string first = cname.substr(0, separator_index); +	std::string last; +	if (separator_index != cname.npos) +	{ +		last = cname.substr(separator_index+1, cname.npos); +		LLStringUtil::trim(last); +	} +	else +	{ +		// ...on Linden grids, single username users as considered to have +		// last name "Resident" +		last = "Resident"; +	} + +	// Username in traditional "firstname lastname" form. +	return first + ' ' + last; +} diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 519514d99c..42750f8b3f 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1450,6 +1450,9 @@ private:  	void saveFavoritesSLURLs(); +	// Remove record of current user's favorites from file on disk. +	void removeFavoritesRecordOfUser(); +  	void onLandmarkLoaded(const LLUUID& asset_id, LLLandmark* landmark);  	void storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl); @@ -1534,6 +1537,10 @@ void LLFavoritesOrderStorage::destroyClass()  	{  		LLFavoritesOrderStorage::instance().saveFavoritesSLURLs();  	} +	else +	{ +		LLFavoritesOrderStorage::instance().removeFavoritesRecordOfUser(); +	}  }  void LLFavoritesOrderStorage::load() @@ -1602,6 +1609,28 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs()  	LLSDSerialize::toPrettyXML(fav_llsd, file);  } +void LLFavoritesOrderStorage::removeFavoritesRecordOfUser() +{ +	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); + +	LLAvatarName av_name; +	LLAvatarNameCache::get( gAgentID, &av_name ); +	if (fav_llsd.has(av_name.getLegacyName())) +	{ +		fav_llsd.erase(av_name.getLegacyName()); +	} + +	llofstream out_file; +	out_file.open(filename); +	LLSDSerialize::toPrettyXML(fav_llsd, out_file); + +} +  void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmark* landmark)  {  	if (!landmark) return; | 
