summaryrefslogtreecommitdiff
path: root/indra/newview/llfavoritesbar.cpp
diff options
context:
space:
mode:
authorMnikolenko ProductEngine <mnikolenko@productengine.com>2015-10-26 12:25:21 +0200
committerMnikolenko ProductEngine <mnikolenko@productengine.com>2015-10-26 12:25:21 +0200
commit7ea4303aa25960a3aa0971999725a0ca1bcfdec4 (patch)
treeae269c3dea6c3689ffa57444e2fe9574eaa5342f /indra/newview/llfavoritesbar.cpp
parent52d30bbbe94b93da6d56633bff0f6d40fa135ded (diff)
MAINT-5760 Save favorite landmarks after renaming
Diffstat (limited to 'indra/newview/llfavoritesbar.cpp')
-rwxr-xr-xindra/newview/llfavoritesbar.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 8f3eaaa207..d6b86cd746 100755
--- 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
@@ -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;