summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/newview/llpanelobjectinventory.cpp43
-rwxr-xr-xindra/newview/llpanelobjectinventory.h3
2 files changed, 46 insertions, 0 deletions
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index bb063f48a5..6c9616511f 100755
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -2011,3 +2011,46 @@ void LLPanelObjectInventory::clearItemIDs()
mItemMap.clear();
}
+BOOL LLPanelObjectInventory::handleKeyHere( KEY key, MASK mask )
+{
+ BOOL handled = FALSE;
+ switch (key)
+ {
+ case KEY_DELETE:
+ case KEY_BACKSPACE:
+ // 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 (isSelectionRemovable() && mask == MASK_NONE)
+ {
+ LLInventoryAction::doToSelected(&gInventory, mFolders, "delete");
+ handled = TRUE;
+ }
+ break;
+ }
+ return handled;
+}
+
+BOOL LLPanelObjectInventory::isSelectionRemovable()
+{
+ if (!mFolders || !mFolders->getRoot())
+ {
+ return FALSE;
+ }
+ std::set<LLFolderViewItem*> selection_set = mFolders->getRoot()->getSelectionList();
+ if (selection_set.empty())
+ {
+ return FALSE;
+ }
+ for (std::set<LLFolderViewItem*>::iterator iter = selection_set.begin();
+ iter != selection_set.end();
+ ++iter)
+ {
+ LLFolderViewItem *item = *iter;
+ const LLFolderViewModelItemInventory *listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item->getViewModelItem());
+ if (!listener || !listener->isItemRemovable() || listener->isItemInTrash())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h
index f497c695b3..9559f7e886 100755
--- a/indra/newview/llpanelobjectinventory.h
+++ b/indra/newview/llpanelobjectinventory.h
@@ -94,6 +94,9 @@ protected:
void removeItemID(const LLUUID& id);
void clearItemIDs();
+ BOOL handleKeyHere( KEY key, MASK mask );
+ BOOL isSelectionRemovable();
+
private:
std::map<LLUUID, LLFolderViewItem*> mItemMap;