summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodel.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <andreylproductengine@lindenlab.com>2016-03-31 20:06:51 +0300
committerAndrey Lihatskiy <andreylproductengine@lindenlab.com>2016-03-31 20:06:51 +0300
commita04341efaa63cd6bc47db25c1e4b4bf1e31d90a8 (patch)
treee3fa26cb26eda5321f331d4ca146759693a15c06 /indra/newview/llinventorymodel.cpp
parent0e155c51a95f092dda4f1ee71b4de46c7e98c10d (diff)
parentac6af25508eaa3339ddd294dfe3bc55c3435b796 (diff)
Merged in andreyl_productengine/viewer-lion-marchcat (pull request #30)
MAINT-6238 Warn user if Trash is overflowing
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rwxr-xr-xindra/newview/llinventorymodel.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 1ae8fc418f..1554940a25 100755
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -771,6 +771,22 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id,
}
}
+U32 LLInventoryModel::getDescendentsCountRecursive(const LLUUID& id, U32 max_item_limit)
+{
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendents(id, cats, items, LLInventoryModel::INCLUDE_TRASH);
+
+ U32 items_found = items.size() + cats.size();
+
+ for (U32 i = 0; i < cats.size() && items_found <= max_item_limit; ++i)
+ {
+ items_found += getDescendentsCountRecursive(cats[i]->getUUID(), max_item_limit - items_found);
+ }
+
+ return items_found;
+}
+
void LLInventoryModel::addChangedMaskForLinks(const LLUUID& object_id, U32 mask)
{
const LLInventoryObject *obj = getObject(object_id);
@@ -3333,6 +3349,7 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**)
//----------------------------------------------------------------------------
// Trash: LLFolderType::FT_TRASH, "ConfirmEmptyTrash"
+// Trash: LLFolderType::FT_TRASH, "TrashIsFull" when trash exceeds maximum capacity
// Lost&Found: LLFolderType::FT_LOST_AND_FOUND, "ConfirmEmptyLostAndFound"
bool LLInventoryModel::callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type)
@@ -3414,6 +3431,8 @@ void LLInventoryModel::removeCategory(const LLUUID& category_id)
changeCategoryParent(cat, trash_id, TRUE);
}
}
+
+ checkTrashOverflow();
}
void LLInventoryModel::removeObject(const LLUUID& object_id)
@@ -3444,6 +3463,16 @@ void LLInventoryModel::removeObject(const LLUUID& object_id)
}
}
+void LLInventoryModel::checkTrashOverflow()
+{
+ static const U32 trash_max_capacity = gSavedSettings.getU32("InventoryTrashMaxCapacity");
+ const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if (getDescendentsCountRecursive(trash_id, trash_max_capacity) >= trash_max_capacity)
+ {
+ gInventory.emptyFolderType("TrashIsFull", LLFolderType::FT_TRASH);
+ }
+}
+
const LLUUID &LLInventoryModel::getRootFolderID() const
{
return mRootFolderID;