From fadf35b90a96475cc2af31eab08a982641a6db0e Mon Sep 17 00:00:00 2001
From: AndreyL ProductEngine <andreylproductengine@lindenlab.com>
Date: Thu, 29 May 2014 10:57:16 +0300
Subject: MAINT-4086 FIXED Limit the number items "Replace Current Outfit" or
 "Wear" applies to

---
 indra/newview/app_settings/settings.xml | 11 +++++++++++
 indra/newview/llappearancemgr.cpp       | 16 ++++++++++++++++
 indra/newview/llinventorybridge.cpp     |  4 ++++
 3 files changed, 31 insertions(+)

(limited to 'indra/newview')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index c2555efbb5..f2f457f575 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -15154,6 +15154,17 @@
       <key>Value</key>
       <string />
     </map>
+  <key>WearFolderLimit</key>
+  <map>
+    <key>Comment</key>
+    <string>Limits number of items in the folder that can be replaced/added to current outfit</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>U32</string>
+    <key>Value</key>
+    <integer>125</integer>
+  </map>
 </map>
 </llsd>
 
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index b7fe96727f..c76652c650 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1621,6 +1621,14 @@ bool LLAppearanceMgr::getCanAddToCOF(const LLUUID& outfit_cat_id)
 		items,
 		LLInventoryModel::EXCLUDE_TRASH,
 		not_worn);
+
+	U32 max_items = gSavedSettings.getU32("WearFolderLimit");
+	if (items.size() > max_items)
+	{
+		LL_WARNS() << "Folder contains more wearables than allowed to wear by WearFolderLimit setting" << LL_ENDL;
+		return false;
+	}
+
 	return items.size() > 0;
 }
 
@@ -1647,6 +1655,14 @@ bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id)
 		items,
 		LLInventoryModel::EXCLUDE_TRASH,
 		is_worn);
+
+	U32 max_items = gSavedSettings.getU32("WearFolderLimit");
+	if (items.size() > max_items)
+	{
+		LL_WARNS() << "Folder contains more wearables than allowed to wear by WearFolderLimit setting" << LL_ENDL;
+		return false;
+	}
+
 	return items.size() > 0;
 }
 
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index feb7a0e904..fbaee68cf8 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -3639,6 +3639,10 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags,   menuentry_vec_t&
 		{
 			disabled_items.push_back(std::string("Replace Outfit"));
 		}
+		if (!LLAppearanceMgr::getCanAddToCOF(mUUID))
+		{
+			disabled_items.push_back(std::string("Add To Outfit"));
+		}
 		items.push_back(std::string("Outfit Separator"));
 	}
 }
-- 
cgit v1.2.3