diff options
author | Alexei Arabadji <aarabadji@productengine.com> | 2010-07-27 15:59:11 +0300 |
---|---|---|
committer | Alexei Arabadji <aarabadji@productengine.com> | 2010-07-27 15:59:11 +0300 |
commit | 8c2ccb5ed3b2acdf562acf0c1a180215d49742c8 (patch) | |
tree | f960e6e08ce9fe33cb0c036dfb50e10b3bdc42ce /indra/newview/llwearableitemslist.cpp | |
parent | 0c8cddecc16d5bd25a2eb5159333ada1dec59259 (diff) |
EXT-7015 FIXED Avoided wearing item moved to trash.
Details:
Disabled wear button and hidden related context menu entries if base object of inventory link is in trash.
reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/806/
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llwearableitemslist.cpp')
-rw-r--r-- | indra/newview/llwearableitemslist.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index b614860b74..1ce89b13ac 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -767,6 +767,9 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu U32 n_links = 0; // number of links among the selected items U32 n_editable = 0; // number of editable items among the selected ones + bool item_in_trash = false; + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { LLUUID id = *it; @@ -802,16 +805,22 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu { ++n_already_worn; } + + // if any in trash + if (!item_in_trash) + { + item_in_trash = gInventory.isObjectDescendentOf(item->getLinkedUUID(), trash_id); + } } // for bool standalone = mParent ? mParent->isStandalone() : false; // *TODO: eliminate multiple traversals over the menu items - setMenuItemVisible(menu, "wear_wear", n_already_worn == 0 && n_worn == 0); + setMenuItemVisible(menu, "wear_wear", n_already_worn == 0 && n_worn == 0 && !item_in_trash); setMenuItemEnabled(menu, "wear_wear", n_already_worn == 0 && n_worn == 0); - setMenuItemVisible(menu, "wear_add", mask == MASK_CLOTHING && n_worn == 0 && n_already_worn != 0); + setMenuItemVisible(menu, "wear_add", mask == MASK_CLOTHING && n_worn == 0 && n_already_worn != 0 && !item_in_trash); setMenuItemEnabled(menu, "wear_add", n_items == 1 && canAddWearable(ids.front()) && n_already_worn != 0); - setMenuItemVisible(menu, "wear_replace", n_worn == 0 && n_already_worn != 0); + setMenuItemVisible(menu, "wear_replace", n_worn == 0 && n_already_worn != 0 && !item_in_trash); //visible only when one item selected and this item is worn setMenuItemVisible(menu, "edit", !standalone && mask & (MASK_CLOTHING|MASK_BODYPART) && n_worn == n_items && n_worn == 1); setMenuItemEnabled(menu, "edit", n_editable == 1 && n_worn == 1 && n_items == 1); |