summaryrefslogtreecommitdiff
path: root/indra/newview/llfavoritesbar.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2016-01-15 16:55:04 -0500
committerOz Linden <oz@lindenlab.com>2016-01-15 16:55:04 -0500
commitbc22e587439a2822e5228508e7a4a1e2ec0121c5 (patch)
tree442540d0c2760617a2c0cf0cb9ba1973ab6fb298 /indra/newview/llfavoritesbar.cpp
parent317644f5d575ecd4e734c9a5327f2a062ebf914a (diff)
parent5a5c023e291990a463b1a91846ce82c70da8daab (diff)
merge changes for 4.0.1-release
Diffstat (limited to 'indra/newview/llfavoritesbar.cpp')
-rw-r--r--indra/newview/llfavoritesbar.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 8f3eaaa207..b779d8f461 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -655,11 +655,12 @@ void LLFavoritesBarCtrl::changed(U32 mask)
LLInventoryModel::cat_array_t cats;
LLIsType is_type(LLAssetType::AT_LANDMARK);
gInventory.collectDescendentsIf(mFavoriteFolderId, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
-
+
for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
{
LLFavoritesOrderStorage::instance().getSLURL((*i)->getAssetUUID());
}
+
updateButtons();
if (!mItemsChangedTimer.getStarted())
{
@@ -751,7 +752,11 @@ void LLFavoritesBarCtrl::updateButtons()
if(mGetPrevItems)
{
- LLFavoritesOrderStorage::instance().mPrevFavorites = mItems;
+ for (LLInventoryModel::item_array_t::iterator it = mItems.begin(); it != mItems.end(); it++)
+ {
+ LLFavoritesOrderStorage::instance().mFavoriteNames[(*it)->getUUID()]= (*it)->getName();
+ }
+ LLFavoritesOrderStorage::instance().mPrevFavorites = mItems;
mGetPrevItems = false;
}
@@ -778,7 +783,7 @@ void LLFavoritesBarCtrl::updateButtons()
const LLViewerInventoryItem *item = mItems[first_changed_item_index].get();
if (item)
{
- // an child's order and mItems should be same
+ // an child's order and mItems should be same
if (button->getLandmarkId() != item->getUUID() // sort order has been changed
|| button->getLabelSelected() != item->getName() // favorite's name has been changed
|| button->getRect().mRight < rightest_point) // favbar's width has been changed
@@ -1617,7 +1622,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
{
LLSD user_llsd = fav_llsd[av_name.getUserName()];
- if (user_llsd.beginArray()->has("id"))
+ if ((user_llsd.beginArray()!= user_llsd.endArray()) && user_llsd.beginArray()->has("id"))
{
for (LLSD::array_iterator iter = user_llsd.beginArray();iter != user_llsd.endArray(); ++iter)
{
@@ -1783,10 +1788,20 @@ BOOL LLFavoritesOrderStorage::saveFavoritesRecord(bool pref_changed)
gInventory.collectDescendentsIf(favorite_folder, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
std::sort(items.begin(), items.end(), LLFavoritesSort());
+ bool name_changed = false;
+
+ for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++)
+ {
+ if(mFavoriteNames[(*it)->getUUID()] != ((*it)->getName()))
+ {
+ mFavoriteNames[(*it)->getUUID()] = (*it)->getName();
+ name_changed = true;
+ }
+ }
- if((items != mPrevFavorites) || pref_changed)
+ if((items != mPrevFavorites) || name_changed || pref_changed)
{
- std::string filename = getStoredFavoritesFilename();
+ std::string filename = getStoredFavoritesFilename();
if (!filename.empty())
{
llifstream in_file;