diff options
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); |