From 7ed270ff9dfdbc905dbee70907d3057a5ae490e7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 6 Feb 2013 18:11:52 -0800 Subject: CHUI-735 : Fixed! Move the delete key handling from the llfolderview to the llinventorypanel level. --- indra/newview/llinventorypanel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 019ba8f5b2..0653a097f5 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1365,6 +1365,14 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) LLInventoryAction::doToSelected(mInventory, mFolderRoot, "open"); handled = TRUE; } + break; + case KEY_DELETE: + if (mask == MASK_NONE) + { + LLInventoryAction::doToSelected(mInventory, mFolderRoot, "delete"); + handled = TRUE; + } + break; } return handled; } -- cgit v1.2.3 From dac026a7d6ad932ef185b4e5c5b5efd7b059e911 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 7 Feb 2013 13:27:32 -0800 Subject: CHUI-735 : Fixed! Handle the backspace case, suppress the search string handling from LLFolderView (it's in the search edit field now). --- indra/newview/llinventorypanel.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 0653a097f5..578b83fd28 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1367,6 +1367,9 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) } 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 (mask == MASK_NONE) { LLInventoryAction::doToSelected(mInventory, mFolderRoot, "delete"); -- cgit v1.2.3 From 5ecac2e900054526c5e9e2fe5610f470ad06df32 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 8 Feb 2013 22:38:54 -0800 Subject: CHUI-735 : Fixed! Refactor the code to move isSelectionRemovable() to the LLInventoryPanel level. Use it when using the delete key. --- indra/newview/llinventorypanel.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 578b83fd28..1357b613bb 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1370,7 +1370,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) 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 (mask == MASK_NONE) + if (isSelectionRemovable() && (mask == MASK_NONE)) { LLInventoryAction::doToSelected(mInventory, mFolderRoot, "delete"); handled = TRUE; @@ -1380,6 +1380,36 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) return handled; } +bool LLInventoryPanel::isSelectionRemovable() +{ + bool can_delete = false; + if (mFolderRoot) + { + std::set selection_set = mFolderRoot->getSelectionList(); + if (!selection_set.empty()) + { + can_delete = true; + for (std::set::iterator iter = selection_set.begin(); + iter != selection_set.end(); + ++iter) + { + LLFolderViewItem *item = *iter; + const LLFolderViewModelItemInventory *listener = static_cast(item->getViewModelItem()); + if (!listener) + { + can_delete = false; + } + else + { + can_delete &= listener->isItemRemovable(); + can_delete &= !listener->isItemInTrash(); + } + } + } + } + return can_delete; +} + /************************************************************************/ /* Recent Inventory Panel related class */ /************************************************************************/ -- cgit v1.2.3