From 4422fd381230056cf990129087a131d4c6139120 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 6 Jan 2015 13:21:38 -0500 Subject: STORM-2091 A few small changes per code review requests. --- indra/newview/llinventorybridge.cpp | 2 ++ indra/newview/llpanelmaininventory.cpp | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 07a14fe53c..199c90c705 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3739,6 +3739,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array); + // Enable Empty menu item only when there is something to act upon. if (0 == cat_array->size() && 0 == item_array->size()) { disabled_items.push_back(std::string("Empty Lost And Found")); @@ -3792,6 +3793,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array); + // Enable Empty menu item only when there is something to act upon. if (0 == cat_array->size() && 0 == item_array->size()) { disabled_items.push_back(std::string("Empty Trash")); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index e646d889dd..f9ec3df333 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1196,13 +1196,17 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) const std::string command_name = userdata.asString(); if (command_name == "not_empty") { + BOOL status = FALSE; LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (!current_item) return FALSE; - const LLUUID& item_id = static_cast(current_item->getViewModelItem())->getUUID(); - LLInventoryModel::cat_array_t* cat_array; - LLInventoryModel::item_array_t* item_array; - gInventory.getDirectDescendentsOf(item_id, cat_array, item_array); - return (0 == cat_array->size() && 0 == item_array->size()); + if (current_item) + { + const LLUUID& item_id = static_cast(current_item->getViewModelItem())->getUUID(); + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(item_id, cat_array, item_array); + status = (0 == cat_array->size() && 0 == item_array->size()); + } + return status; } if (command_name == "delete") { -- cgit v1.2.3