diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 77 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.h | 10 |
3 files changed, 64 insertions, 29 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 0fe236c056..326fc41c1e 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1353,6 +1353,11 @@ BOOL LLAppearanceManager::getIsInCOF(const LLUUID& obj_id) const BOOL LLAppearanceManager::getIsProtectedCOFItem(const LLUUID& obj_id) const { if (!getIsInCOF(obj_id)) return FALSE; + + // For now, don't allow direct deletion from the COF. Instead, force users + // to choose "Detach" or "Take Off". + return TRUE; + /* const LLInventoryObject *obj = gInventory.getObject(obj_id); if (!obj) return FALSE; @@ -1363,4 +1368,5 @@ BOOL LLAppearanceManager::getIsProtectedCOFItem(const LLUUID& obj_id) const if (obj->getActualType() == LLAssetType::AT_LINK_FOLDER) return TRUE; return FALSE; + */ } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index c1259aa89a..f6089f3533 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -181,10 +181,14 @@ BOOL LLInvFVBridge::isItemRemovable() const { return FALSE; } + + // Can't delete an item that's in the library. if(!model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID())) { return FALSE; } + + // Disable delete from COF folder; have users explicitly choose "detach/take off". if (LLAppearanceManager::instance().getIsProtectedCOFItem(mUUID)) { return FALSE; @@ -466,6 +470,8 @@ void hide_context_entries(LLMenuGL& menu, { const LLView::child_list_t *list = menu.getChildList(); + BOOL is_previous_entry_separator = FALSE; + LLView::child_list_t::const_iterator itor; for (itor = list->begin(); itor != list->end(); ++itor) { @@ -488,6 +494,17 @@ void hide_context_entries(LLMenuGL& menu, found = true; } } + + // Don't allow multiple separators in a row (e.g. such as if there are no items + // between two separators). + if (found) + { + const BOOL is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(*itor) != NULL); + if (is_entry_separator && is_previous_entry_separator) + found = false; + is_previous_entry_separator = is_entry_separator; + } + if (!found) { (*itor)->setVisible(FALSE); @@ -582,20 +599,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, items.push_back(std::string("Paste Separator")); - // "Remove link" and "Delete" are the same operation. - if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID)) - { - items.push_back(std::string("Remove Link")); - } - else - { - items.push_back(std::string("Delete")); - } - - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Delete")); - } + addDeleteContextMenuOptions(items, disabled_items); // If multiple items are selected, disable properties (if it exists). if ((flags & FIRST_SELECTED_ITEM) == 0) @@ -643,6 +647,32 @@ void LLInvFVBridge::addTrashContextMenuOptions(menuentry_vec_t &items, items.push_back(std::string("Restore Item")); } +void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items, + menuentry_vec_t &disabled_items) +{ + // Don't allow delete as a direct option from COF folder. + if (isCOFFolder()) + { + return; + } + + const LLInventoryObject *obj = getInventoryObject(); + + // "Remove link" and "Delete" are the same operation. + if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID)) + { + items.push_back(std::string("Remove Link")); + } + else + { + items.push_back(std::string("Delete")); + } + + if (!isItemRemovable()) + { + disabled_items.push_back(std::string("Delete")); + } +} // *TODO: remove this BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const @@ -2477,7 +2507,7 @@ void LLFolderBridge::folderOptionsMenu() if (is_sidepanel) { mItems.push_back("Rename"); - mItems.push_back("Delete"); + addDeleteContextMenuOptions(mItems, disabled_items); } // Only enable calling-card related options for non-system folders. @@ -2647,11 +2677,11 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else { // Want some but not all of the items from getClipboardEntries for outfits. - if (cat && cat->getPreferredType()==LLFolderType::FT_OUTFIT) + if (cat && (cat->getPreferredType() == LLFolderType::FT_OUTFIT)) { mItems.push_back(std::string("Rename")); - mItems.push_back(std::string("Delete")); + addDeleteContextMenuOptions(mItems, mDisabledItems); // EXT-4030: disallow deletion of currently worn outfit const LLViewerInventoryItem *base_outfit_link = LLAppearanceManager::instance().getBaseOutfitLink(); if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory())) @@ -4190,6 +4220,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) if( get_is_item_worn( mUUID ) ) { + items.push_back(std::string("Attach Separator")); items.push_back(std::string("Detach From Yourself")); } else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing()) @@ -5281,11 +5312,7 @@ void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else { items.push_back(std::string("Properties")); - items.push_back(std::string("Delete")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Delete")); - } + addDeleteContextMenuOptions(items, disabled_items); } hide_context_entries(menu, items, disabled_items); } @@ -5326,11 +5353,7 @@ void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else { items.push_back(std::string("Find Original")); - items.push_back(std::string("Delete")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Delete")); - } + addDeleteContextMenuOptions(items, disabled_items); } hide_context_entries(menu, items, disabled_items); } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index daa6dbeeba..32504091cb 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -177,8 +177,6 @@ public: void getClipboardEntries(bool show_asset_id, menuentry_vec_t &items, menuentry_vec_t &disabled_items, U32 flags); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual void addTrashContextMenuOptions(menuentry_vec_t &items, - menuentry_vec_t &disabled_items); virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const; virtual BOOL dragOrDrop(MASK mask, BOOL drop, EDragAndDropType cargo_type, @@ -191,6 +189,14 @@ public: // Allow context menus to be customized for side panel. bool isInOutfitsSidePanel() const; + //-------------------------------------------------------------------- + // Convenience functions for adding various common menu options. + //-------------------------------------------------------------------- +protected: + virtual void addTrashContextMenuOptions(menuentry_vec_t &items, + menuentry_vec_t &disabled_items); + virtual void addDeleteContextMenuOptions(menuentry_vec_t &items, + menuentry_vec_t &disabled_items); protected: LLInvFVBridge(LLInventoryPanel* inventory, const LLUUID& uuid); |