summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/app_settings/settings.xml11
-rwxr-xr-xindra/newview/llinventorybridge.cpp1
-rwxr-xr-xindra/newview/llinventorymodel.cpp29
-rwxr-xr-xindra/newview/llinventorymodel.h5
-rwxr-xr-xindra/newview/skins/default/xui/en/notifications.xml12
5 files changed, 58 insertions, 0 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index aef2438dc7..d5de494434 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4845,6 +4845,17 @@
<key>Value</key>
<integer>7</integer>
</map>
+ <key>InventoryTrashMaxCapacity</key>
+ <map>
+ <key>Comment</key>
+ <string>Maximum capacity of the Trash folder. User will ve offered to clean it up when exceeded.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>U32</string>
+ <key>Value</key>
+ <integer>5000</integer>
+ </map>
<key>MarketplaceListingsSortOrder</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 9782c792c9..907491a390 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -2065,6 +2065,7 @@ BOOL LLItemBridge::removeItem()
}
LLNotifications::instance().forceResponse(params, 0);
+ model->checkTrashOverflow();
return TRUE;
}
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;
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index ac336e347c..0782ec5255 100755
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -258,6 +258,9 @@ public:
// Follow parent chain to the top.
bool getObjectTopmostAncestor(const LLUUID& object_id, LLUUID& result) const;
+
+private:
+ U32 getDescendentsCountRecursive(const LLUUID& id, U32 max_item_limit);
//--------------------------------------------------------------------
// Find
@@ -399,6 +402,8 @@ public:
/// removeItem() or removeCategory(), whichever is appropriate
void removeObject(const LLUUID& object_id);
+ void checkTrashOverflow();
+
protected:
void updateLinkedObjectsFromPurge(const LLUUID& baseobj_id);
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 3831b52c2c..f8d76eff58 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -5992,6 +5992,18 @@ Are you sure you want to permanently delete the contents of your Trash?
<notification
icon="alertmodal.tga"
+ name="TrashIsFull"
+ type="alertmodal">
+Your trash is overflowing. This may cause problems logging in.
+ <tag>confirm</tag>
+ <usetemplate
+ name="okcancelbuttons"
+ notext="I will empty trash later"
+ yestext="Empty trash now"/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="ConfirmClearBrowserCache"
type="alertmodal">
Are you sure you want to delete your travel, web, and search history?