SL-19847 Delete key should not allow system folders
parent
417dbeb68e
commit
14aa4dcdc2
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue