summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Yap <jhwelch@gmail.com>2014-12-10 11:09:28 -0500
committerJonathan Yap <jhwelch@gmail.com>2014-12-10 11:09:28 -0500
commit0db67883470dc3e4381672bfbb40f3ef920a4a01 (patch)
tree1e934597c8e97711f86844158088cb797e269614
parent68413474c4479eee9bdbeb34ea131475ba1d646e (diff)
STORM-2091 "Empty Trash"/"Empty Lost and Found" menu item is active even if empty
-rwxr-xr-xdoc/contributions.txt1
-rw-r--r--indra/newview/llinventorybridge.cpp16
-rw-r--r--indra/newview/llpanelmaininventory.cpp10
-rw-r--r--indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml6
4 files changed, 33 insertions, 0 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 521be7b7e2..7f186c9f6d 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -751,6 +751,7 @@ Jonathan Yap
STORM-2088
STORM-2094
STORM-2099
+ STORM-2091
Kadah Coba
STORM-1060
STORM-1843
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index eebb6a0384..07a14fe53c 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -3736,6 +3736,14 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
// This is the lost+found folder.
items.push_back(std::string("Empty Lost And Found"));
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array);
+ if (0 == cat_array->size() && 0 == item_array->size())
+ {
+ disabled_items.push_back(std::string("Empty Lost And Found"));
+ }
+
disabled_items.push_back(std::string("New Folder"));
disabled_items.push_back(std::string("New Script"));
disabled_items.push_back(std::string("New Note"));
@@ -3780,6 +3788,14 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
{
// This is the trash.
items.push_back(std::string("Empty Trash"));
+
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array);
+ if (0 == cat_array->size() && 0 == item_array->size())
+ {
+ disabled_items.push_back(std::string("Empty Trash"));
+ }
}
else if(isItemInTrash())
{
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index eb40616a9c..e646d889dd 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -1194,6 +1194,16 @@ bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata)
BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
{
const std::string command_name = userdata.asString();
+ if (command_name == "not_empty")
+ {
+ LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
+ if (!current_item) return FALSE;
+ const LLUUID& item_id = static_cast<LLFolderViewModelItemInventory*>(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 (command_name == "delete")
{
return getActivePanel()->isSelectionRemovable();
diff --git a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
index 06d0b849a3..bccda8a247 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
@@ -95,6 +95,9 @@
<on_click
function="Inventory.GearDefault.Custom.Action"
parameter="empty_lostnfound" />
+ <on_enable
+ function="Inventory.GearDefault.Enable"
+ parameter="not_empty" />
</menu_item_call>
<menu_item_separator
layout="topleft" />
@@ -152,5 +155,8 @@
<on_click
function="Inventory.GearDefault.Custom.Action"
parameter="empty_trash" />
+ <on_enable
+ function="Inventory.GearDefault.Enable"
+ parameter="not_empty" />
</menu_item_call>
</toggleable_menu>