From ca967ce0a2e8fe6831c7e3496b786b07c0aef704 Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Mon, 5 May 2014 11:00:52 +0300
Subject: [PATCH] MAINT-3974 FIXED Update and save favorites order when
 LLItemCopiedCallback is triggered.

---
 indra/newview/llfavoritesbar.cpp | 11 +++++++++++
 indra/newview/llfavoritesbar.h   |  2 ++
 2 files changed, 13 insertions(+)

diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index a2d07595872..046f3717c66 100755
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -327,6 +327,7 @@ class LLItemCopiedCallback : public LLInventoryCallback
 
 			gInventory.updateItem(item);
 			gInventory.notifyObservers();
+			LLFavoritesOrderStorage::instance().saveOrder();
 		}
 
 		LLView::getWindow()->setCursor(UI_CURSOR_ARROW);
@@ -1641,6 +1642,16 @@ void LLFavoritesOrderStorage::cleanup()
 	mSortIndexes.swap(aTempMap);
 }
 
+void LLFavoritesOrderStorage::saveOrder()
+{
+	LLInventoryModel::cat_array_t cats;
+	LLInventoryModel::item_array_t items;
+	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);
+	saveItemsOrder(items);
+}
+
 void LLFavoritesOrderStorage::saveItemsOrder( const LLInventoryModel::item_array_t& items )
 {
 	int sortField = 0;
diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h
index 211d3c4ce35..5ca1d3e8edf 100755
--- a/indra/newview/llfavoritesbar.h
+++ b/indra/newview/llfavoritesbar.h
@@ -203,6 +203,8 @@ class LLFavoritesOrderStorage : public LLSingleton<LLFavoritesOrderStorage>
 	// Is used to save order for Favorites folder.
 	void saveItemsOrder(const LLInventoryModel::item_array_t& items);
 
+	void saveOrder();
+
 	void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
 
 	/**
-- 
GitLab