summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorakl <none@none>2014-02-24 19:30:30 +0200
committerakl <none@none>2014-02-24 19:30:30 +0200
commit16aec9dca7836505b58f5d4306ccf64b096c9fcd (patch)
treefb36a3750705b0cc8851cc4c54267a11172dc219 /indra/newview
parentdd8b32473e652c2d3193c78db21b06ba25e28b67 (diff)
MAINT-2588 FIXED User cannot delete items from content of other object, using 'Delete' button on keyboard.
Diffstat (limited to 'indra/newview')
-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;