From 9aa710945685a2cae8cfc622f3dc3d900c1ab4c9 Mon Sep 17 00:00:00 2001
From: Andrew Dyukov <adyukov@productengine.com>
Date: Fri, 18 Jun 2010 12:56:02 +0300
Subject: [PATCH] EXT-7847 FIXED Disabled "trash" button if an item is selected
 inside selected outfit.

- Added bool mItemSelected variable and getter for it to determine if the selection inside outfit exists, and used it when determining whether to enable "Trash" button in My Outfits.

Reviewed by Vadim Savchuk and Neal Orman at https://codereview.productengine.com/secondlife/r/600/

--HG--
branch : product-engine
---
 indra/newview/lloutfitslist.cpp           | 8 ++++++++
 indra/newview/lloutfitslist.h             | 9 +++++++++
 indra/newview/llpaneloutfitsinventory.cpp | 3 ++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 8dd849f9475..c5043e1c3d7 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -161,6 +161,7 @@ LLOutfitsList::LLOutfitsList()
 	,	mAccordion(NULL)
 	,	mListCommands(NULL)
 	,	mIsInitialized(false)
+	,	mItemSelected(false)
 {
 	mCategoriesObserver = new LLInventoryCategoriesObserver();
 
@@ -418,6 +419,11 @@ boost::signals2::connection LLOutfitsList::addSelectionChangeCallback(selection_
 	return mSelectionChangeSignal.connect(cb);
 }
 
+bool LLOutfitsList::hasItemSelected()
+{
+	return mItemSelected;
+}
+
 //////////////////////////////////////////////////////////////////////////
 // Private methods
 //////////////////////////////////////////////////////////////////////////
@@ -503,6 +509,8 @@ void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUI
 		mSelectedListsMap.clear();
 	}
 
+	mItemSelected = list && (list->getSelectedItem() != NULL);
+
 	mSelectedListsMap.insert(wearables_lists_map_value_t(category_id, list));
 	setSelectedOutfitUUID(category_id);
 }
diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h
index c984389f877..df65f7187b4 100644
--- a/indra/newview/lloutfitslist.h
+++ b/indra/newview/lloutfitslist.h
@@ -94,6 +94,11 @@ class LLOutfitsList : public LLPanel
 
 	boost::signals2::connection addSelectionChangeCallback(selection_change_callback_t cb);
 
+	/**
+	 * Returns true if there is a selection inside currently selected outfit
+	 */
+	bool hasItemSelected();
+
 private:
 	/**
 	 * Reads xml with accordion tab and Flat list from xml file.
@@ -183,6 +188,10 @@ class LLOutfitsList : public LLPanel
 	LLListContextMenu*			mOutfitMenu;
 
 	bool							mIsInitialized;
+	/**
+	 * True if there is a selection inside currently selected outfit
+	 */
+	bool							mItemSelected;
 };
 
 #endif //LL_LLOUTFITSLIST_H
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index 2405b95e7dd..714d9cd4c5f 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -661,7 +661,8 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 		else // "My Outfits" tab active
 		{
 			const LLUUID& selected_outfit = mMyOutfitsPanel->getSelectedOutfitUUID();
-			can_delete = LLAppearanceMgr::instance().getCanRemoveOutfit(selected_outfit);
+			// first condition prevents trash btn from enabling when items are selected inside outfit (EXT-7847)
+			can_delete = !mMyOutfitsPanel->hasItemSelected() && LLAppearanceMgr::instance().getCanRemoveOutfit(selected_outfit);
 		}
 
 		return can_delete;
-- 
GitLab