summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorypanel.cpp
diff options
context:
space:
mode:
authormberezhnoy <mberezhnoy@productengine.com>2013-02-09 10:47:47 +0200
committermberezhnoy <mberezhnoy@productengine.com>2013-02-09 10:47:47 +0200
commitfd9d1f985e93cf5eec196f9b6ba0c08c67d49aea (patch)
treef7d8c470d385eb3bdeffe5383651dcec05e74702 /indra/newview/llinventorypanel.cpp
parent64fe330620459be18ee4dd54866386a8f6a76ab8 (diff)
parent5ecac2e900054526c5e9e2fe5610f470ad06df32 (diff)
merging
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r--indra/newview/llinventorypanel.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 019ba8f5b2..1357b613bb 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -1365,10 +1365,51 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask )
LLInventoryAction::doToSelected(mInventory, mFolderRoot, "open");
handled = TRUE;
}
+ break;
+ 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(mInventory, mFolderRoot, "delete");
+ handled = TRUE;
+ }
+ break;
}
return handled;
}
+bool LLInventoryPanel::isSelectionRemovable()
+{
+ bool can_delete = false;
+ if (mFolderRoot)
+ {
+ std::set<LLFolderViewItem*> selection_set = mFolderRoot->getSelectionList();
+ if (!selection_set.empty())
+ {
+ can_delete = true;
+ for (std::set<LLFolderViewItem*>::iterator iter = selection_set.begin();
+ iter != selection_set.end();
+ ++iter)
+ {
+ LLFolderViewItem *item = *iter;
+ const LLFolderViewModelItemInventory *listener = static_cast<const LLFolderViewModelItemInventory*>(item->getViewModelItem());
+ if (!listener)
+ {
+ can_delete = false;
+ }
+ else
+ {
+ can_delete &= listener->isItemRemovable();
+ can_delete &= !listener->isItemInTrash();
+ }
+ }
+ }
+ }
+ return can_delete;
+}
+
/************************************************************************/
/* Recent Inventory Panel related class */
/************************************************************************/