diff options
| -rw-r--r-- | indra/newview/lloutfitslist.cpp | 14 | ||||
| -rw-r--r-- | indra/newview/lloutfitslist.h | 11 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitsinventory.cpp | 27 | 
3 files changed, 46 insertions, 6 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 160e516a65..bca292fa4a 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -326,7 +326,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id)  			// 3. Reset currently selected outfit id if it is being removed.  			if (outfit_id == mSelectedOutfitUUID)  			{ -				mSelectedOutfitUUID = LLUUID(); +				setSelectedOutfitUUID(LLUUID());  			}  			// 4. Remove category UUID to accordion tab mapping. @@ -389,6 +389,11 @@ void LLOutfitsList::setFilterSubString(const std::string& string)  	mFilterSubString = string;  } +boost::signals2::connection LLOutfitsList::addSelectionChangeCallback(selection_change_callback_t cb) +{ +	return mSelectionChangeSignal.connect(cb); +} +  //////////////////////////////////////////////////////////////////////////  // Private methods  ////////////////////////////////////////////////////////////////////////// @@ -475,7 +480,12 @@ void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUI  	}  	mSelectedListsMap.insert(wearables_lists_map_value_t(category_id, list)); -	mSelectedOutfitUUID = category_id; +	setSelectedOutfitUUID(category_id); +} + +void LLOutfitsList::setSelectedOutfitUUID(const LLUUID& category_id) +{ +	mSelectionChangeSignal(mSelectedOutfitUUID = category_id);  }  void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl) diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index 01e9ed2a80..478eaa50b3 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -71,6 +71,9 @@ public:  class LLOutfitsList : public LLPanel  {  public: +	typedef boost::function<void (const LLUUID&)> selection_change_callback_t; +	typedef boost::signals2::signal<void (const LLUUID&)> selection_change_signal_t; +  	LLOutfitsList();  	virtual ~LLOutfitsList(); @@ -86,6 +89,8 @@ public:  	const LLUUID& getSelectedOutfitUUID() const { return mSelectedOutfitUUID; } +	boost::signals2::connection addSelectionChangeCallback(selection_change_callback_t cb); +  private:  	/**  	 * Reads xml with accordion tab and Flat list from xml file. @@ -110,6 +115,11 @@ private:  	void changeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id);  	/** +	 * Saves newly selected outfit ID. +	 */ +	void setSelectedOutfitUUID(const LLUUID& category_id); + +	/**  	 * Called upon list refresh event to update tab visibility depending on  	 * the results of applying filter to the title and list items of the tab.  	 */ @@ -139,6 +149,7 @@ private:  	wearables_lists_map_t			mSelectedListsMap;  	LLUUID							mSelectedOutfitUUID; +	selection_change_signal_t		mSelectionChangeSignal;  	std::string 					mFilterSubString; diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 8b451c156c..0e1e94129b 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -555,11 +555,25 @@ void LLPanelOutfitsInventory::onTrashButtonClick()  void LLPanelOutfitsInventory::onClipboardAction(const LLSD& userdata)  {  	std::string command_name = userdata.asString(); -	// TODO: add handling "My Outfits" tab.  	if (isCOFPanelActive())  	{  		getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name);  	} +	else // "My Outfits" tab active +	{ +		if (command_name == "delete") +		{ +			const LLUUID& selected_outfit_id = mMyOutfitsPanel->getSelectedOutfitUUID(); +			if (selected_outfit_id.notNull()) +			{ +				remove_category(&gInventory, selected_outfit_id); +			} +		} +		else +		{ +			llwarns << "Unrecognized action" << llendl; +		} +	}  	updateListCommands();  	updateVerbs();  } @@ -614,7 +628,6 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)  	{  		BOOL can_delete = FALSE; -		// TODO: add handling "My Outfits" tab.  		if (isCOFPanelActive())  		{  			LLFolderView* root = getActivePanel()->getRootFolder(); @@ -630,10 +643,15 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)  					LLFolderViewItem *item = root->getItemByID(item_id);  					can_delete &= item->getListener()->isItemRemovable();  				} -				return can_delete;  			}  		} -		return FALSE; +		else // "My Outfits" tab active +		{ +			const LLUUID& selected_outfit = mMyOutfitsPanel->getSelectedOutfitUUID(); +			can_delete = LLAppearanceMgr::instance().getCanRemoveOutfit(selected_outfit); +		} + +		return can_delete;  	}  	if (command_name == "remove_link")  	{ @@ -730,6 +748,7 @@ void LLPanelOutfitsInventory::initTabPanels()  	mCurrentOutfitPanel->setSelectCallback(boost::bind(&LLPanelOutfitsInventory::onTabSelectionChange, this, mCurrentOutfitPanel, _1, _2));  	mMyOutfitsPanel = getChild<LLOutfitsList>(OUTFITS_TAB_NAME); +	mMyOutfitsPanel->addSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));  	mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs");  	mAppearanceTabs->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onTabChange, this));  | 
