From cdb158e9e0cff7070bb68c721cec0e90b0030fb2 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Wed, 6 Jan 2010 12:33:28 -0500
Subject: [PATCH] EXT-3954 : "Wear" button shouldn't be enabled in "Wearing"
 tab EXT-3952 : "Make Outfit" button shouldn't be enabled in "Wearing" tab
 EXT-3955 : "Add to Current Outfit" gear menu option confusing, remove it
 EXT-3961 : Switch order of "Wearing" and "My Outfits" tabs

Most of these are very minor xui/button-state changes.
Also added a new onOpen method to llpaneloutfitsinventory so that it can update its state (notably, which tab is active) when the sidepanel is opened.
---
 indra/newview/llpaneloutfitsinventory.cpp     | 39 ++++++++++++++-----
 indra/newview/llpaneloutfitsinventory.h       |  1 +
 indra/newview/llsidepanelappearance.cpp       |  5 +++
 .../panel_outfits_inventory_gear_default.xml  | 11 ------
 4 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index 8e14074de1..41745e4994 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -84,6 +84,14 @@ BOOL LLPanelOutfitsInventory::postBuild()
 	return TRUE;
 }
 
+// virtual
+void LLPanelOutfitsInventory::onOpen(const LLSD& key)
+{
+	// Make sure we know which tab is selected, update the filter,
+	// and update verbs.
+	onTabChange();
+}
+
 void LLPanelOutfitsInventory::updateVerbs()
 {
 	if (mParent)
@@ -94,6 +102,7 @@ void LLPanelOutfitsInventory::updateVerbs()
 	if (mListCommands)
 	{
 		mListCommands->childSetVisible("look_edit_btn",sShowDebugEditor);
+		updateListCommands();
 	}
 }
 
@@ -176,7 +185,6 @@ void LLPanelOutfitsInventory::onNew()
 
 void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
 {
-	updateListCommands();
 	updateVerbs();
 	if (getRootFolder()->needsAutoRename() && items.size())
 	{
@@ -264,9 +272,11 @@ void LLPanelOutfitsInventory::updateListCommands()
 {
 	bool trash_enabled = isActionEnabled("delete");
 	bool wear_enabled = isActionEnabled("wear");
+	bool make_outfit_enabled = isActionEnabled("make_outfit");
 
 	mListCommands->childSetEnabled("trash_btn", trash_enabled);
 	mListCommands->childSetEnabled("wear_btn", wear_enabled);
+	mListCommands->childSetEnabled("make_outfit_btn", make_outfit_enabled);
 }
 
 void LLPanelOutfitsInventory::onGearButtonClick()
@@ -323,6 +333,7 @@ void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata)
 	{
 		onWearButtonClick();
 	}
+	// Note: This option has been removed from the gear menu.
 	if (command_name == "add")
 	{
 		onAdd();
@@ -391,6 +402,16 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 		}
 		return FALSE;
 	}
+	if (command_name == "wear" ||
+		command_name == "make_outfit")
+	{
+		const BOOL is_my_outfits = (mActivePanel->getName() == "outfitslist_accordionpanel");
+		if (!is_my_outfits)
+		{
+			return FALSE;
+		}
+	}
+   
 	if (command_name == "edit" || 
 		command_name == "wear" ||
 		command_name == "add" ||
@@ -425,17 +446,17 @@ bool LLPanelOutfitsInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropTy
 void LLPanelOutfitsInventory::initTabPanels()
 {
 	mTabPanels.resize(2);
+
+	LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>("cof_accordionpanel");
+	cof_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+	mTabPanels[0] = cof_panel;
 	
 	LLInventoryPanel *myoutfits_panel = getChild<LLInventoryPanel>("outfitslist_accordionpanel");
 	myoutfits_panel->setFilterTypes(1LL << LLFolderType::FT_OUTFIT, LLInventoryFilter::FILTERTYPE_CATEGORY);
 	myoutfits_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-	mTabPanels[0] = myoutfits_panel;
-	mActivePanel = myoutfits_panel;
-
+	mTabPanels[1] = myoutfits_panel;
 
-	LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>("cof_accordionpanel");
-	cof_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-	mTabPanels[1] = cof_panel;
+	mActivePanel = mTabPanels[0];
 
 	for (tabpanels_vec_t::iterator iter = mTabPanels.begin();
 		 iter != mTabPanels.end();
@@ -479,9 +500,7 @@ void LLPanelOutfitsInventory::onTabChange()
 		return;
 	}
 	mActivePanel->setFilterSubString(mFilterSubString);
-
-	bool is_my_outfits = (mActivePanel->getName() == "outfitslist_accordionpanel");
-	mListCommands->childSetEnabled("make_outfit_btn", is_my_outfits);
+	updateVerbs();
 }
 
 LLInventoryPanel* LLPanelOutfitsInventory::getActivePanel()
diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h
index 1e084750a0..e4279b7396 100644
--- a/indra/newview/llpaneloutfitsinventory.h
+++ b/indra/newview/llpaneloutfitsinventory.h
@@ -53,6 +53,7 @@ public:
 	virtual ~LLPanelOutfitsInventory();
 
 	/*virtual*/ BOOL postBuild();
+	/*virtual*/ void onOpen(const LLSD& key);
 	
 	void onSearchEdit(const std::string& string);
 	void onAdd();
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index e2ce534c4f..0aefebce10 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -166,6 +166,11 @@ void LLSidepanelAppearance::onOpen(const LLSD& key)
 	refreshCurrentOutfitName();
 	updateVerbs();
 
+	if (mPanelOutfitsInventory)
+	{
+		mPanelOutfitsInventory->onOpen(key);
+	}
+
 	if(key.size() == 0)
 		return;
 
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory_gear_default.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory_gear_default.xml
index 7b88fca7c3..221e3f997b 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_inventory_gear_default.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory_gear_default.xml
@@ -17,17 +17,6 @@
 		 function="panel_outfits_inventory_gear_default.Enable"
 		 parameter="wear" />
     </menu_item_call>
-    <menu_item_call
-     label="Add To Current Outfit"
-     layout="topleft"
-     name="add">
-        <on_click
-         function="panel_outfits_inventory_gear_default.Custom.Action"
-         parameter="add" />
-        <on_enable
-		 function="panel_outfits_inventory_gear_default.Enable"
-		 parameter="add" />
-    </menu_item_call>
     <menu_item_call
      label="Remove From Current Outfit"
      layout="topleft"
-- 
GitLab