diff options
Diffstat (limited to 'indra/newview/llinventorygallery.cpp')
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 898bcba494..5edcb3148c 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -934,7 +934,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) #endif // Delete selected items if delete or backspace key hit on the inventory panel // Note: on Mac laptop keyboards, backspace and delete are one and the same - if (mSelectedItemID.notNull()) + if (canDeleteSelection()) { deleteSelection(); } @@ -1411,6 +1411,30 @@ void LLInventoryGallery::deleteSelection() LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryGallery::onDelete, _1, _2, mSelectedItemID)); } +bool LLInventoryGallery::canDeleteSelection() +{ + if (mSelectedItemID.isNull()) + { + return false; + } + + LLViewerInventoryCategory* cat = gInventory.getCategory(mSelectedItemID); + if (cat) + { + if (!get_is_category_removable(&gInventory, mSelectedItemID)) + { + return false; + } + } + else if (!get_is_item_removable(&gInventory, mSelectedItemID)) + { + return false; + } + + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + return !gInventory.isObjectDescendentOf(mSelectedItemID, trash_id); +} + void LLInventoryGallery::pasteAsLink() { if (!LLClipboard::instance().hasContents()) |