summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorygallery.cpp26
-rw-r--r--indra/newview/llinventorygallery.h1
2 files changed, 26 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())
diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h
index e71e2eddcd..6fbd1556e5 100644
--- a/indra/newview/llinventorygallery.h
+++ b/indra/newview/llinventorygallery.h
@@ -152,6 +152,7 @@ public:
// Copy & paste & delete
static void onDelete(const LLSD& notification, const LLSD& response, const LLUUID& selected_id);
void deleteSelection();
+ bool canDeleteSelection();
void pasteAsLink();
void claimEditHandler();