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/lloutfitslist.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/lloutfitslist.cpp')
-rw-r--r-- | indra/newview/lloutfitslist.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 63ffb80ff2..ccde5be900 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -665,7 +665,14 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) } if (command_name == "wear") { - return !gAgentWearables.isCOFChangeInProgress(); + if (gAgentWearables.isCOFChangeInProgress()) + { + return false; + } + uuid_vec_t ids; + getSelectedItemsUUIDs(ids); + + return !ids.empty() && !isSelectedInTrash(); } if (command_name == "take_off") { @@ -711,6 +718,29 @@ void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const } } +bool LLOutfitsList::isSelectedInTrash() +{ + bool res = false; + const LLUUID trash_id = gInventory.findCategoryUUIDForType( + LLFolderType::FT_TRASH); + + uuid_vec_t selected_uuids; + getSelectedItemsUUIDs(selected_uuids); + + for (uuid_vec_t::const_iterator it = selected_uuids.begin(); it != selected_uuids.end(); it++) + { + const LLInventoryItem* item = gInventory.getItem(*it); + if (item != NULL && gInventory.isObjectDescendentOf( + item->getLinkedUUID(), trash_id)) + { + res = true; + break; + } + } + + return res; +} + boost::signals2::connection LLOutfitsList::setSelectionChangeCallback(selection_change_callback_t cb) { return mSelectionChangeSignal.connect(cb); |