summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llinventorypanel.cpp32
-rw-r--r--indra/newview/llinventorypanel.h1
-rw-r--r--indra/newview/llpanelmaininventory.cpp22
3 files changed, 33 insertions, 22 deletions
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<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 */
/************************************************************************/
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 6eb85fbad2..00a90325ad 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -162,6 +162,7 @@ public:
void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus);
void setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb);
void clearSelection();
+ bool isSelectionRemovable();
LLInventoryFilter& getFilter();
const LLInventoryFilter& getFilter() const;
void setFilterTypes(U64 filter, LLInventoryFilter::EFilterType = LLInventoryFilter::FILTERTYPE_OBJECT);
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 82b79db60a..d6535c88e9 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -1112,27 +1112,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
const std::string command_name = userdata.asString();
if (command_name == "delete")
{
- BOOL can_delete = FALSE;
- LLFolderView* root = getActivePanel()->getRootFolder();
- if (root)
- {
- can_delete = TRUE;
- std::set<LLFolderViewItem*> selection_set = root->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 = static_cast<const LLFolderViewModelItemInventory*>(item->getViewModelItem());
- llassert(listener);
- if (!listener) return FALSE;
- can_delete &= listener->isItemRemovable();
- can_delete &= !listener->isItemInTrash();
- }
- return can_delete;
- }
- return FALSE;
+ return getActivePanel()->isSelectionRemovable();
}
if (command_name == "save_texture")
{