diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-06-29 21:00:07 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-06-29 21:23:23 +0300 |
commit | 069304ca394d4d6069f00bb976f2d75e82bf675c (patch) | |
tree | f882ecf526effeda207d418049391a315b17cc2f /indra/newview/llfavoritesbar.cpp | |
parent | f6515257a0cc405d6549c5d56302fb0d90176807 (diff) | |
parent | 1e4f2ec07e32a142f35817d3186a124df3f8cd25 (diff) |
Merge branch 'master' (DRTVWR-543) into DRTVWR-559
# Conflicts:
# autobuild.xml
# indra/llrender/llgl.cpp
# indra/newview/CMakeLists.txt
# indra/newview/llvovolume.cpp
Diffstat (limited to 'indra/newview/llfavoritesbar.cpp')
-rw-r--r-- | indra/newview/llfavoritesbar.cpp | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index c13b63433c..a02bb56489 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -772,6 +772,14 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update) } LLFavoritesOrderStorage::instance().mPrevFavorites = mItems; mGetPrevItems = false; + + if (LLFavoritesOrderStorage::instance().isStorageUpdateNeeded()) + { + if (!mItemsChangedTimer.getStarted()) + { + mItemsChangedTimer.start(); + } + } } const LLButton::Params& button_params = getButtonParams(); @@ -1606,7 +1614,7 @@ void LLFavoritesOrderStorage::destroyClass() file.close(); LLFile::remove(filename); } - if(mSaveOnExit) + if(mSaveOnExit || gSavedSettings.getBOOL("UpdateRememberPasswordSetting")) { LLFavoritesOrderStorage::instance().saveFavoritesRecord(true); } @@ -1650,7 +1658,6 @@ void LLFavoritesOrderStorage::load() llifstream in_file; in_file.open(filename.c_str()); LLSD fav_llsd; - LLSD user_llsd; if (in_file.is_open()) { LLSDSerialize::fromXML(fav_llsd, in_file); @@ -1660,12 +1667,12 @@ void LLFavoritesOrderStorage::load() in_file.close(); if (fav_llsd.isMap() && fav_llsd.has(gAgentUsername)) { - user_llsd = fav_llsd[gAgentUsername]; + mStorageFavorites = fav_llsd[gAgentUsername]; S32 index = 0; bool needs_validation = gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"); - for (LLSD::array_iterator iter = user_llsd.beginArray(); - iter != user_llsd.endArray(); ++iter) + for (LLSD::array_iterator iter = mStorageFavorites.beginArray(); + iter != mStorageFavorites.endArray(); ++iter) { // Validation LLUUID fv_id = iter->get("id").asUUID(); @@ -1967,7 +1974,7 @@ BOOL LLFavoritesOrderStorage::saveFavoritesRecord(bool pref_changed) } } - if((items != mPrevFavorites) || name_changed || pref_changed) + if((items != mPrevFavorites) || name_changed || pref_changed || gSavedSettings.getBOOL("UpdateRememberPasswordSetting")) { std::string filename = getStoredFavoritesFilename(); if (!filename.empty()) @@ -1988,6 +1995,12 @@ BOOL LLFavoritesOrderStorage::saveFavoritesRecord(bool pref_changed) LLSD user_llsd; S32 fav_iter = 0; mMissingSLURLs.clear(); + + LLSD save_pass; + save_pass["save_password"] = gSavedSettings.getBOOL("RememberPassword"); + user_llsd[fav_iter] = save_pass; + fav_iter++; + for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++) { LLSD value; @@ -2058,6 +2071,23 @@ void LLFavoritesOrderStorage::showFavoritesOnLoginChanged(BOOL show) } } +bool LLFavoritesOrderStorage::isStorageUpdateNeeded() +{ + if (!mRecreateFavoriteStorage) + { + for (LLSD::array_iterator iter = mStorageFavorites.beginArray(); + iter != mStorageFavorites.endArray(); ++iter) + { + if (mFavoriteNames[iter->get("id").asUUID()] != iter->get("name").asString()) + { + mRecreateFavoriteStorage = true; + return true; + } + } + } + return false; +} + void AddFavoriteLandmarkCallback::fire(const LLUUID& inv_item_id) { if (mTargetLandmarkId.isNull()) return; |