diff options
| author | Andrew Productengine <adyukov@productengine.com> | 2010-12-23 18:15:54 +0200 | 
|---|---|---|
| committer | Andrew Productengine <adyukov@productengine.com> | 2010-12-23 18:15:54 +0200 | 
| commit | c02d6a319f378d5dcc34c51b20f556f175d2a40a (patch) | |
| tree | 5b6faeb8961c6d77f3d54b6dbc6c525773d9a0fa | |
| parent | 32750132db47eb335c56f6c880902cf7195e1825 (diff) | |
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.
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings_per_account.xml | 11 | ||||
| -rw-r--r-- | indra/newview/llfloaterpreference.cpp | 41 | ||||
| -rw-r--r-- | indra/newview/llfloaterpreference.h | 5 | ||||
| -rw-r--r-- | indra/newview/llpanellogin.cpp | 14 | ||||
| -rw-r--r-- | indra/newview/llviewerinventory.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_privacy.xml | 1 | 
7 files changed, 55 insertions, 30 deletions
| diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 871053782b..402a0e85c4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12332,16 +12332,5 @@        <key>Value</key>        <string>name</string>      </map> -    <key>ShowFavoritesOnLogin</key> -    <map> -      <key>Comment</key> -      <string>Determines whether favorites of last logged in user will be saved on exit from viewer and shown on login screen</string> -      <key>Persist</key> -      <integer>1</integer> -      <key>Type</key> -      <string>Boolean</string> -      <key>Value</key> -      <integer>0</integer> -    </map>  </map>  </llsd> diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 705c73cbf7..8efec1cff0 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -160,6 +160,17 @@          <key>Value</key>              <integer>0</integer>          </map> +      <key>ShowFavoritesOnLogin</key> +        <map> +        <key>Comment</key> +             <string>Determines whether favorites of last logged in user will be saved on exit from viewer and shown on login screen</string> +        <key>Persist</key> +             <integer>1</integer> +        <key>Type</key> +             <string>Boolean</string> +        <key>Value</key> +             <integer>0</integer> +        </map>      <!-- End of back compatibility settings -->      </map>  </llsd> diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6500aefb10..84b7fbcce2 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -105,6 +105,7 @@  #include "llteleporthistorystorage.h"  #include "lllogininstance.h"        // to check if logged in yet +#include "llsdserialize.h"  const F32 MAX_USER_FAR_CLIP = 512.f;  const F32 MIN_USER_FAR_CLIP = 64.f; @@ -284,7 +285,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)  	mGotPersonalInfo(false),  	mOriginalIMViaEmail(false),  	mLanguageChanged(false), -	mDoubleClickActionDirty(false) +	mDoubleClickActionDirty(false), +	mFavoritesRecordMayExist(false)  {  	//Build Floater is now Called from 	LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); @@ -330,8 +332,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)  	gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged,  _2));	  	gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged,  _2));	  	gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged,  _2)); - -	mFavoritesFileMayExist = gSavedSettings.getBOOL("ShowFavoritesOnLogin");  }  BOOL LLFloaterPreference::postBuild() @@ -492,12 +492,33 @@ void LLFloaterPreference::apply()  		mDoubleClickActionDirty = false;  	} -	if (mFavoritesFileMayExist && !gSavedSettings.getBOOL("ShowFavoritesOnLogin")) +	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()))  	{ -		mFavoritesFileMayExist = false; -		std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); -		LLFile::remove(filename); +		fav_llsd.erase(av_name.getLegacyName());  	} +	 +	llofstream out_file; +	out_file.open(filename); +	LLSDSerialize::toPrettyXML(fav_llsd, out_file); +  }  void LLFloaterPreference::cancel() @@ -582,6 +603,11 @@ 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; @@ -1285,6 +1311,7 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im  //	getChild<LLUICtrl>("busy_response")->setValue(gSavedSettings.getString("BusyModeResponse2")); +	getChildView("favorites_on_login_check")->setEnabled(TRUE);  	getChildView("log_nearby_chat")->setEnabled(TRUE);  	getChildView("log_instant_messages")->setEnabled(TRUE);  	getChildView("show_timestamps_check_im")->setEnabled(TRUE); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index c95a2472a7..4522d9e6eb 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -152,6 +152,8 @@ 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 @@ -162,7 +164,8 @@ private:  	bool mLanguageChanged;  	bool mOriginalHideOnlineStatus; -	bool mFavoritesFileMayExist; +	// Record of current user's favorites may be stored in file on disk. +	bool mFavoritesRecordMayExist;  	std::string mDirectoryVisibility;  }; 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<LLComboBox>("username_combo")->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this)); -	} +	// Show last logged in user favorites in "Start at" combo. +	addUsersWithFavoritesToUsername(); +	getChild<LLComboBox>("username_combo")->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this));  	updateLocationCombo(false); @@ -583,10 +580,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential,  	{  	  sInstance->getChild<LLComboBox>("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(); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 4fa79b1855..9c7ef7922b 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1527,7 +1527,7 @@ void LLFavoritesOrderStorage::getSLURL(const LLUUID& asset_id)  void LLFavoritesOrderStorage::destroyClass()  {  	LLFavoritesOrderStorage::instance().cleanup(); -	if (gSavedSettings.getBOOL("ShowFavoritesOnLogin")) +	if (gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"))  	{  		LLFavoritesOrderStorage::instance().saveFavoritesSLURLs();  	} diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml index 85d3859f63..9d012550fc 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml @@ -71,6 +71,7 @@       width="350" />      <check_box       control_name="ShowFavoritesOnLogin" +     enabled="false"        height="16"       label="Show my Favorite Landmarks at Login (via 'Start At' drop-down menu)"       layout="topleft" | 
