EXT-7972 FIXED (My Outfits: Add \"Add to current outfit\" menu item into gear menu)

- Added menu item 'Wear - Add to Current Outfit' (menu_outfit_gear.xml).
- Added menu item handler onAdd().

Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/657/

--HG--
branch : product-engine
master
Andrew Polunin 2010-06-25 17:00:45 +03:00
parent 66ce337a32
commit 9bc4e69c91
2 changed files with 33 additions and 0 deletions

View File

@ -88,6 +88,8 @@ public:
registrar.add("Gear.Delete", boost::bind(&LLOutfitListGearMenu::onDelete, this));
registrar.add("Gear.Create", boost::bind(&LLOutfitListGearMenu::onCreate, this, _2));
registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenu::onAdd, this));
enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitsList::isActionEnabled, mOutfitList, _2));
enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenu::onVisible, this, _2));
@ -146,6 +148,16 @@ private:
}
}
void onAdd()
{
const LLUUID& selected_id = getSelectedOutfitID();
if (selected_id.notNull())
{
LLAppearanceMgr::getInstance()->addCategoryToCurrentOutfit(selected_id);
}
}
void onTakeOff()
{
// Take off selected items if there are any
@ -648,6 +660,17 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata)
&& LLAppearanceMgr::getInstance()->getBaseOutfitUUID() == mSelectedOutfitUUID )
|| hasWornItemSelected();
}
if (command_name == "wear_add")
{
if (gAgentWearables.isCOFChangeInProgress())
{
return false;
}
return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID);
}
return false;
}

View File

@ -15,6 +15,16 @@
function="Gear.OnVisible"
parameter="wear" />
</menu_item_call>
<menu_item_call
label="Wear - Add to Current Outfit"
layout="topleft"
name="wear_add">
<on_click
function="Gear.WearAdd" />
<on_enable
function="Gear.OnEnable"
parameter="wear_add" />
</menu_item_call>
<menu_item_call
label="Take Off - Remove from Current Outfit"
layout="topleft"