summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMnikolenko ProductEngine <mnikolenko@productengine.com>2015-03-18 18:11:09 +0200
committerMnikolenko ProductEngine <mnikolenko@productengine.com>2015-03-18 18:11:09 +0200
commitf30b54b64fcb6667571bf2340b396fb700ff6965 (patch)
tree434582cf1153b6a471265ac766ea13e6c8ae69be /indra
parentfc33f396d46d5425ea2737731c6ba23d81b323bd (diff)
MAINT-4993 FIXED Favorite landmarks randomly reorder between sessions or when adding or removing a landmark from favorites
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llfavoritesbar.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 6c5b5be720..4ee81f4afa 100755
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -1653,6 +1653,17 @@ void LLFavoritesOrderStorage::cleanup()
mSortIndexes.swap(aTempMap);
}
+// See also LLInventorySort where landmarks in the Favorites folder are sorted.
+class LLViewerInventoryItemSort
+{
+public:
+ bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
+ {
+ return LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID())
+ < LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID());
+ }
+};
+
void LLFavoritesOrderStorage::saveOrder()
{
LLInventoryModel::cat_array_t cats;
@@ -1660,6 +1671,7 @@ void LLFavoritesOrderStorage::saveOrder()
LLIsType is_type(LLAssetType::AT_LANDMARK);
LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
gInventory.collectDescendentsIf(favorites_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
+ std::sort(items.begin(), items.end(), LLViewerInventoryItemSort());
saveItemsOrder(items);
}
@@ -1685,16 +1697,7 @@ void LLFavoritesOrderStorage::saveItemsOrder( const LLInventoryModel::item_array
gInventory.notifyObservers();
}
-// See also LLInventorySort where landmarks in the Favorites folder are sorted.
-class LLViewerInventoryItemSort
-{
-public:
- bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
- {
- return LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID())
- < LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID());
- }
-};
+
// * @param source_item_id - LLUUID of the source item to be moved into new position
// * @param target_item_id - LLUUID of the target item before which source item should be placed.