From e328dcf4062177c903d3099d0d16477824d23025 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 6 Feb 2012 23:07:41 +0200 Subject: EXP-1849 FIXED Privacy settings could be set to default when modifying other preferences before login. --- indra/llxml/llcontrol.h | 4 +++ indra/newview/llfloaterpreference.cpp | 39 ++++++++++++++++++++++ indra/newview/llfloaterpreference.h | 8 +++-- indra/newview/llstartup.cpp | 1 - .../skins/default/xui/en/floater_preferences.xml | 2 +- 5 files changed, 49 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index bf38a8b062..597031ec70 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -92,6 +92,8 @@ typedef enum e_control_type class LLControlVariable : public LLRefCount { + LOG_CLASS(LLControlVariable); + friend class LLControlGroup; public: @@ -180,6 +182,8 @@ T convert_from_llsd(const LLSD& sd, eControlType type, const std::string& contro //const U32 STRING_CACHE_SIZE = 10000; class LLControlGroup : public LLInstanceTracker { + LOG_CLASS(LLControlGroup); + protected: typedef std::map ctrl_name_table_t; ctrl_name_table_t mNameTable; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 655dde3145..173b0e538c 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1801,7 +1801,46 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl) } } +class LLPanelPreferencePrivacy : public LLPanelPreference +{ +public: + LLPanelPreferencePrivacy() + { + mAccountIndependentSettings.push_back("VoiceCallsFriendsOnly"); + mAccountIndependentSettings.push_back("AutoDisengageMic"); + } + + /*virtual*/ void saveSettings() + { + LLPanelPreference::saveSettings(); + + // Don't save (=erase from the saved values map) per-account privacy settings + // if we're not logged in, otherwise they will be reset to defaults on log off. + if (LLStartUp::getStartupState() != STATE_STARTED) + { + // Erase only common settings, assuming there are no color settings on Privacy page. + for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); ) + { + const std::string setting = it->first->getName(); + if (std::find(mAccountIndependentSettings.begin(), + mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end()) + { + mSavedValues.erase(it++); + } + else + { + ++it; + } + } + } + } + +private: + std::list mAccountIndependentSettings; +}; + static LLRegisterPanelClassWrapper t_pref_graph("panel_preference_graphics"); +static LLRegisterPanelClassWrapper t_pref_privacy("panel_preference_privacy"); BOOL LLPanelPreferenceGraphics::postBuild() { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 7ee3294478..ec5994e917 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -198,15 +198,17 @@ public: virtual void saveSettings(); class Updater; + +protected: + typedef std::map control_values_map_t; + control_values_map_t mSavedValues; + private: //for "Only friends and groups can call or IM me" static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&); //for "Show my Favorite Landmarks at Login" static void showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value); - typedef std::map control_values_map_t; - control_values_map_t mSavedValues; - typedef std::map string_color_map_t; string_color_map_t mSavedColors; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 3923b4510a..0ac8c1fe39 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -880,7 +880,6 @@ bool idle_startup() LLFile::mkdir(gDirUtilp->getLindenUserDir()); // Set PerAccountSettingsFile to the default value. - std::string per_account_settings_file = LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount"); gSavedSettings.setString("PerAccountSettingsFile", gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount"))); diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index 402868bb97..b2662331b0 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -100,7 +100,7 @@ help_topic="preferences_colors_tab" name="colors" />