From 779bf4bb59e9c8d832de84bc926e8839827735b7 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Fri, 30 Apr 2010 18:07:21 +0300
Subject: [PATCH] Implemented low sub-task EXT-7164 (Implement preserving panel
 inventory item selection across COF wearables lists updates (i.e. when
 changing ordering of wearables - up/down).) - implemented preserving of
 current items selection during lists updates. Reviewed by Mike Antipov at
 https://codereview.productengine.com/secondlife/r/344/

--HG--
branch : product-engine
---
 indra/newview/llcofwearables.cpp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index 36a8031cce8..1925b818f25 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -94,6 +94,16 @@ void LLCOFWearables::onSelectionChange(LLFlatListView* selected_list)
 
 void LLCOFWearables::refresh()
 {
+	typedef std::vector<LLSD> values_vector_t;
+	typedef std::map<LLFlatListView*, values_vector_t> selection_map_t;
+
+	selection_map_t preserve_selection;
+
+	// Save current selection
+	mAttachments->getSelectedValues(preserve_selection[mAttachments]);
+	mClothing->getSelectedValues(preserve_selection[mClothing]);
+	mBodyParts->getSelectedValues(preserve_selection[mBodyParts]);
+
 	clear();
 
 	LLInventoryModel::cat_array_t cats;
@@ -108,6 +118,23 @@ void LLCOFWearables::refresh()
 	LLAppearanceMgr::getInstance()->divvyWearablesByType(cof_items, clothing_by_type);
 	
 	populateClothingList(clothing_by_type);
+
+	// Restore previous selection
+	for (selection_map_t::iterator
+			 iter = preserve_selection.begin(),
+			 iter_end = preserve_selection.end();
+		 iter != iter_end; ++iter)
+	{
+		LLFlatListView* list = iter->first;
+		const values_vector_t& values = iter->second;
+		for (values_vector_t::const_iterator
+				 value_it = values.begin(),
+				 value_it_end = values.end();
+			 value_it != value_it_end; ++value_it)
+		{
+			list->selectItemByValue(*value_it);
+		}
+	}
 }
 
 
-- 
GitLab