summaryrefslogtreecommitdiff
path: root/indra/newview/llwearableitemslist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llwearableitemslist.cpp')
-rw-r--r--indra/newview/llwearableitemslist.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index 948fe55e0d..0576862dfb 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -936,6 +936,7 @@ LLContextMenu* LLWearableItemsList::ContextMenu::createMenu()
// Register handlers for attachments.
registrar.add("Attachment.Detach",
boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids));
+ registrar.add("Attachment.Favorite", boost::bind(toggle_linked_favorite, selected_id));
registrar.add("Attachment.Touch", boost::bind(handle_attachment_touch, selected_id));
registrar.add("Attachment.Profile", boost::bind(show_item_profile, selected_id));
registrar.add("Object.Attach", boost::bind(LLViewerAttachMenu::attachObjects, ids, _2));
@@ -967,6 +968,7 @@ 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
U32 n_touchable = 0; // number of touchable items among the selected ones
+ U32 n_favorites = 0; // number of favorite items among the selected ones
bool can_be_worn = true;
@@ -990,6 +992,11 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
const bool is_editable = get_is_item_editable(id);
const bool is_touchable = enable_attachment_touch(id);
const bool is_already_worn = gAgentWearables.selfHasWearable(wearable_type);
+
+ LLUUID linked_id = item->getLinkedUUID();
+ LLViewerInventoryItem* linked_item = gInventory.getItem(linked_id);
+ const bool is_favorite = linked_item->getIsFavorite();
+
if (is_worn)
{
++n_worn;
@@ -1010,10 +1017,14 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
{
++n_already_worn;
}
+ if (is_favorite)
+ {
+ ++n_favorites;
+ }
if (can_be_worn)
{
- can_be_worn = get_can_item_be_worn(item->getLinkedUUID());
+ can_be_worn = get_can_item_be_worn(linked_id);
}
} // for
@@ -1035,6 +1046,8 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
setMenuItemEnabled(menu, "create_new", LLAppearanceMgr::instance().canAddWearables(ids));
setMenuItemVisible(menu, "show_original", !standalone);
setMenuItemEnabled(menu, "show_original", n_items == 1 && n_links == n_items);
+ setMenuItemVisible(menu, "favorites_add", n_favorites < n_items);
+ setMenuItemVisible(menu, "favorites_remove", n_favorites > 0);
setMenuItemVisible(menu, "take_off", mask == MASK_CLOTHING && n_worn == n_items);
setMenuItemVisible(menu, "detach", mask == MASK_ATTACHMENT && n_worn == n_items);
setMenuItemVisible(menu, "take_off_or_detach", mask == (MASK_ATTACHMENT|MASK_CLOTHING));