From 1d6ebfbb573bca573c60d666d12a401c1f21d37d Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Thu, 13 May 2010 16:53:29 -0400
Subject: [PATCH] EXT-4088 : FIXED : INFRASTRUCTURE : Change
 LLFolderView::getSelectionList to return a selection

Function signature change to return a selection instead of taking one as an argument.
---
 indra/newview/llfolderview.cpp            | 9 ++++-----
 indra/newview/llfolderview.h              | 2 +-
 indra/newview/llfolderviewitem.cpp        | 6 ++++++
 indra/newview/llfolderviewitem.h          | 2 +-
 indra/newview/llinventorypanel.cpp        | 6 ++----
 indra/newview/llpanellandmarks.cpp        | 4 ++--
 indra/newview/llpanelmaininventory.cpp    | 3 +--
 indra/newview/llpanelobjectinventory.cpp  | 2 +-
 indra/newview/llpaneloutfitsinventory.cpp | 9 +++------
 indra/newview/llsidepanelinventory.cpp    | 3 +--
 indra/newview/llviewermessage.cpp         | 5 ++---
 11 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index eba4cdfa310..2ae11aa2b54 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -846,16 +846,16 @@ void LLFolderView::clearSelection()
 	mSelectThisID.setNull();
 }
 
-BOOL LLFolderView::getSelectionList(std::set<LLUUID> &selection) const
+std::set<LLUUID> LLFolderView::getSelectionList() const
 {
+	std::set<LLUUID> selection;
 	for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); 
 		 item_it != mSelectedItems.end(); 
 		 ++item_it)
 	{
 		selection.insert((*item_it)->getListener()->getUUID());
 	}
-
-	return (selection.size() != 0);
+	return selection;
 }
 
 BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source)
@@ -2070,8 +2070,7 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata)
 	}
 
 
-	std::set<LLUUID> selected_items;
-	getSelectionList(selected_items);
+	std::set<LLUUID> selected_items = getSelectionList();
 
 	LLMultiPreview* multi_previewp = NULL;
 	LLMultiProperties* multi_propertiesp = NULL;
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 38d7a47eba7..0dfdbd364bd 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -164,7 +164,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 
 	virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items);
 
-	virtual BOOL getSelectionList(std::set<LLUUID> &selection) const;
+	virtual std::set<LLUUID> getSelectionList() const;
 
 	// make sure if ancestor is selected, descendents are not
 	void sanitizeSelection();
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index fd5fafdfe51..54e9bd53833 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -387,6 +387,12 @@ void LLFolderViewItem::extendSelectionFromRoot(LLFolderViewItem* selection)
 	getRoot()->extendSelection(selection, NULL, selected_items);
 }
 
+std::set<LLUUID> LLFolderViewItem::getSelectionList() const
+{
+	std::set<LLUUID> selection;
+	return selection;
+}
+
 EInventorySortGroup LLFolderViewItem::getSortGroup()  const
 { 
 	return SG_ITEM; 
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index 655ad89e990..57c722afa48 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -231,7 +231,7 @@ class LLFolderViewItem : public LLView
 	virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items){ return FALSE; }
 
 	// gets multiple-element selection
-	virtual BOOL getSelectionList(std::set<LLUUID> &selection) const {return TRUE;}
+	virtual std::set<LLUUID> getSelectionList() const;
 
 	// Returns true is this object and all of its children can be removed (deleted by user)
 	virtual BOOL isRemovable();
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index dd1e039cb14..000bcdd265d 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -775,8 +775,7 @@ void LLInventoryPanel::doCreate(const LLSD& userdata)
 
 bool LLInventoryPanel::beginIMSession()
 {
-	std::set<LLUUID> selected_items;
-	mFolderRoot->getSelectionList(selected_items);
+	std::set<LLUUID> selected_items = mFolderRoot->getSelectionList();
 
 	std::string name;
 	static int session_num = 1;
@@ -873,8 +872,7 @@ bool LLInventoryPanel::beginIMSession()
 
 bool LLInventoryPanel::attachObject(const LLSD& userdata)
 {
-	std::set<LLUUID> selected_items;
-	mFolderRoot->getSelectionList(selected_items);
+	std::set<LLUUID> selected_items = mFolderRoot->getSelectionList();
 
 	std::string joint_name = userdata.asString();
 	LLViewerJointAttachment* attachmentp = NULL;
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index bcc852cf4c5..6634bc948d4 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -993,8 +993,8 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
 	}
 	else if("create_pick" == command_name)
 	{
-		std::set<LLUUID> selection;
-		if ( mCurrentSelectedList && mCurrentSelectedList->getRootFolder()->getSelectionList(selection) )
+		std::set<LLUUID> selection = mCurrentSelectedList->getRootFolder()->getSelectionList();
+		if ( mCurrentSelectedList && !selection.empty() )
 		{
 			return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() );
 		}
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index a84280c2131..327196d9ba9 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -1099,8 +1099,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
 		if (root)
 		{
 			can_delete = TRUE;
-			std::set<LLUUID> selection_set;
-			root->getSelectionList(selection_set);
+			std::set<LLUUID> selection_set = root->getSelectionList();
 			if (selection_set.empty()) return FALSE;
 			for (std::set<LLUUID>::iterator iter = selection_set.begin();
 				 iter != selection_set.end();
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 6a112f35ddd..de16f9d343d 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -1489,7 +1489,7 @@ void LLPanelObjectInventory::updateInventory()
 	BOOL inventory_has_focus = FALSE;
 	if (mHaveInventory)
 	{
-		mFolders->getSelectionList(selected_items);
+		selected_items = mFolders->getSelectionList();
 		inventory_has_focus = gFocusMgr.childHasKeyboardFocus(mFolders);
 	}
 
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index 111894b31cb..660615df5a7 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -493,8 +493,7 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 			LLFolderView* root = getActivePanel()->getRootFolder();
 			if (root)
 			{
-				std::set<LLUUID> selection_set;
-				root->getSelectionList(selection_set);
+				std::set<LLUUID> selection_set = root->getSelectionList();
 				can_delete = (selection_set.size() > 0);
 				for (std::set<LLUUID>::iterator iter = selection_set.begin();
 					 iter != selection_set.end();
@@ -515,8 +514,7 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 		LLFolderView* root = getActivePanel()->getRootFolder();
 		if (root)
 		{
-			std::set<LLUUID> selection_set;
-			root->getSelectionList(selection_set);
+			std::set<LLUUID> selection_set = root->getSelectionList();
 			can_delete = (selection_set.size() > 0);
 			for (std::set<LLUUID>::iterator iter = selection_set.begin();
 				 iter != selection_set.end();
@@ -568,8 +566,7 @@ bool LLPanelOutfitsInventory::hasItemsSelected()
 		LLFolderView* root = getActivePanel()->getRootFolder();
 		if (root)
 		{
-			std::set<LLUUID> selection_set;
-			root->getSelectionList(selection_set);
+			std::set<LLUUID> selection_set = root->getSelectionList();
 			has_items_selected = (selection_set.size() > 0);
 		}
 	}
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index fa543f13711..65b9184fe58 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -323,8 +323,7 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem()
 U32 LLSidepanelInventory::getSelectedCount()
 {
 	LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
-	std::set<LLUUID> selection_list;
-	panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(selection_list);
+	std::set<LLUUID> selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();
 	return selection_list.size();
 }
 
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 28c1a1ad3a1..4b7c7f297b8 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -796,7 +796,7 @@ class LLViewerInventoryMoveFromWorldObserver : public LLInventoryMoveFromWorldOb
 		mSelectedItems.clear();
 		if (mActivePanel)
 		{
-			mActivePanel->getRootFolder()->getSelectionList(mSelectedItems);
+			mSelectedItems = mActivePanel->getRootFolder()->getSelectionList();
 		}
 		mSelectedItems.erase(mMoveIntoFolderID);
 	}
@@ -829,8 +829,7 @@ class LLViewerInventoryMoveFromWorldObserver : public LLInventoryMoveFromWorldOb
 		}
 
 		// get selected items (without destination folder)
-		selected_items_t selected_items;
-		mActivePanel->getRootFolder()->getSelectionList(selected_items);
+		selected_items_t selected_items = mActivePanel->getRootFolder()->getSelectionList();
 		selected_items.erase(mMoveIntoFolderID);
 
 		// compare stored & current sets of selected items
-- 
GitLab