From f0cd44a6a2c4001111e82425cf2bd4fee63fad27 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 13 Nov 2009 16:18:53 -0500
Subject: [PATCH] EXT-2482 : Newly created folders have wrong default type

Removed AT_ROOT_CATEGORY and FT_ROOT_CATEGORY since those types are unused.  Changed FT_CATEGORY to FT_ROOT_INVENTORY to make its purpose more clear.

This change assumes that no agent inventories have category type 9 for either inventory type or folder preferred type.

--HG--
branch : avatar-pipeline
---
 indra/llcommon/llassettype.h           |  5 -----
 indra/llcommon/llfoldertype.cpp        |  3 +--
 indra/llcommon/llfoldertype.h          | 17 +++--------------
 indra/llinventory/llinventorytype.cpp  |  2 +-
 indra/newview/llfloaterbuy.cpp         |  4 ----
 indra/newview/llfloaterbuycontents.cpp |  6 +-----
 indra/newview/llinventorybridge.cpp    |  5 -----
 indra/newview/llinventorymodel.cpp     |  4 ++--
 indra/newview/llviewerassettype.cpp    |  1 -
 indra/newview/llviewerfoldertype.cpp   |  3 +--
 indra/newview/llviewermenu.cpp         |  3 +--
 indra/newview/llviewermessage.cpp      |  6 ++----
 12 files changed, 12 insertions(+), 47 deletions(-)

diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index ec2290d30e8..c7bbc2e74aa 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -78,11 +78,6 @@ class LL_COMMON_API LLAssetType
 			// Holds a collection of inventory items.
 			// It's treated as an item in the inventory and therefore needs a type.
 
-		AT_ROOT_CATEGORY = 9,
-			// A user's root inventory category.
-			// We decided to expose it visually, so it seems logical to fold
-			// it into the asset types.
-
 		AT_LSL_TEXT = 10,
 		AT_LSL_BYTECODE = 11,
 			// The LSL is the scripting language. 
diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp
index 9107b11597e..079e670b1ab 100644
--- a/indra/llcommon/llfoldertype.cpp
+++ b/indra/llcommon/llfoldertype.cpp
@@ -72,8 +72,7 @@ LLFolderDictionary::LLFolderDictionary()
 	addEntry(LLFolderType::FT_CLOTHING, 			new FolderEntry("clothing",	TRUE));
 	addEntry(LLFolderType::FT_OBJECT, 				new FolderEntry("object",	TRUE));
 	addEntry(LLFolderType::FT_NOTECARD, 			new FolderEntry("notecard",	TRUE));
-	addEntry(LLFolderType::FT_CATEGORY, 			new FolderEntry("category",	TRUE));
-	addEntry(LLFolderType::FT_ROOT_CATEGORY, 		new FolderEntry("root",		TRUE));
+	addEntry(LLFolderType::FT_ROOT_INVENTORY, 		new FolderEntry("root_inv",	TRUE));
 	addEntry(LLFolderType::FT_LSL_TEXT, 			new FolderEntry("lsltext",	TRUE));
 	addEntry(LLFolderType::FT_BODYPART, 			new FolderEntry("bodypart",	TRUE));
 	addEntry(LLFolderType::FT_TRASH, 				new FolderEntry("trash",	TRUE));
diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h
index 5374ffd829a..7aa77f7f7e4 100644
--- a/indra/llcommon/llfoldertype.h
+++ b/indra/llcommon/llfoldertype.h
@@ -52,23 +52,18 @@ class LL_COMMON_API LLFolderType
 
 		FT_LANDMARK = 3,
 
-		// FT_SCRIPT = 4,
-
 		FT_CLOTHING = 5,
 
 		FT_OBJECT = 6,
 
 		FT_NOTECARD = 7,
 
-		FT_CATEGORY = 8,
-
-		FT_ROOT_CATEGORY = 9,
+		FT_ROOT_INVENTORY = 8,
+			// We'd really like to change this to 9 since AT_CATEGORY is 8,
+			// but "My Inventory" has been type 8 for a long time.
 
 		FT_LSL_TEXT = 10,
 
-		// FT_LSL_BYTECODE = 11,
-		// FT_TEXTURE_TGA = 12,
-
 		FT_BODYPART = 13,
 
 		FT_TRASH = 14,
@@ -77,16 +72,10 @@ class LL_COMMON_API LLFolderType
 
 		FT_LOST_AND_FOUND = 16,
 
-		// FT_SOUND_WAV = 17,
-		// FT_IMAGE_TGA = 18,
-		// FT_IMAGE_JPEG = 19,
-
 		FT_ANIMATION = 20,
 
 		FT_GESTURE = 21,
 
-		// FT_SIMSTATE = 22,
-
 		FT_FAVORITE = 23,
 
 		FT_ENSEMBLE_START = 26,
diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp
index 0e71c0d12d8..4ef5df0b289 100644
--- a/indra/llinventory/llinventorytype.cpp
+++ b/indra/llinventory/llinventorytype.cpp
@@ -106,7 +106,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
 	LLInventoryType::IT_OBJECT,			// AT_OBJECT
 	LLInventoryType::IT_NOTECARD,		// AT_NOTECARD
 	LLInventoryType::IT_CATEGORY,		// AT_CATEGORY
-	LLInventoryType::IT_ROOT_CATEGORY,	// AT_ROOT_CATEGORY
+	LLInventoryType::IT_NONE,			// (null entry)
 	LLInventoryType::IT_LSL,			// AT_LSL_TEXT
 	LLInventoryType::IT_LSL,			// AT_LSL_BYTECODE
 	LLInventoryType::IT_TEXTURE,		// AT_TEXTURE_TGA
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index cefd7a38080..c8df6c61358 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -230,10 +230,6 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
 		if (obj->getType() == LLAssetType::AT_CATEGORY)
 			continue;
 
-		// Skip root folders, so we know we have inventory items only
-		if (obj->getType() == LLAssetType::AT_ROOT_CATEGORY) 
-			continue;
-
 		// Skip the mysterious blank InventoryObject 
 		if (obj->getType() == LLAssetType::AT_NONE)
 			continue;
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index 32802f6a200..a99d0c918dd 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -187,10 +187,6 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 		if (asset_type == LLAssetType::AT_CATEGORY)
 			continue;
 
-		// Skip root folders, so we know we have inventory items only
-		if (asset_type == LLAssetType::AT_ROOT_CATEGORY) 
-			continue;
-
 		LLInventoryItem* inv_item = (LLInventoryItem*)((LLInventoryObject*)(*it));
 		inv_type = inv_item->getInventoryType();
 
@@ -286,7 +282,7 @@ void LLFloaterBuyContents::onClickBuy()
 
 	// Put the items where we put new folders.
 	LLUUID category_id;
-	category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CATEGORY);
+	category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ROOT_INVENTORY);
 
 	// *NOTE: doesn't work for multiple object buy, which UI does not
 	// currently support sale info is used for verification only, if
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 6087df33b96..7d2922b5610 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -892,7 +892,6 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			new_listener = new LLWearableBridge(inventory, uuid, asset_type, inv_type, (EWearableType)flags);
 			break;
 		case LLAssetType::AT_CATEGORY:
-		case LLAssetType::AT_ROOT_CATEGORY:
 			if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
 			{
 				// Create a link folder handler instead.
@@ -2847,10 +2846,6 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		BOOL is_movable = TRUE;
 		switch( inv_item->getActualType() )
 		{
-		case LLAssetType::AT_ROOT_CATEGORY:
-			is_movable = FALSE;
-			break;
-
 		case LLAssetType::AT_CATEGORY:
 			is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
 			break;
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 3354a430010..3a1d457877d 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -341,7 +341,7 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType t, bo
 const LLUUID &LLInventoryModel::findCatUUID(LLFolderType::EType preferred_type) const
 {
 	const LLUUID &root_id = gInventory.getRootFolderID();
-	if(LLFolderType::FT_CATEGORY == preferred_type)
+	if(LLFolderType::FT_ROOT_INVENTORY == preferred_type)
 	{
 		return root_id;
 	}
@@ -2465,7 +2465,7 @@ void LLInventoryModel::buildParentChildMap()
 			{
 				cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND));
 			}
-			else if(LLFolderType::FT_CATEGORY == pref)
+			else if(LLFolderType::FT_ROOT_INVENTORY == pref)
 			{
 				// it's the root
 				cat->setParent(LLUUID::null);
diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp
index c974171c2c2..b382ff63069 100644
--- a/indra/newview/llviewerassettype.cpp
+++ b/indra/newview/llviewerassettype.cpp
@@ -71,7 +71,6 @@ LLViewerAssetDictionary::LLViewerAssetDictionary()
 	addEntry(LLViewerAssetType::AT_OBJECT, 				new ViewerAssetEntry(DAD_OBJECT));
 	addEntry(LLViewerAssetType::AT_NOTECARD, 			new ViewerAssetEntry(DAD_NOTECARD));
 	addEntry(LLViewerAssetType::AT_CATEGORY, 			new ViewerAssetEntry(DAD_CATEGORY));
-	addEntry(LLViewerAssetType::AT_ROOT_CATEGORY, 		new ViewerAssetEntry(DAD_ROOT_CATEGORY));
 	addEntry(LLViewerAssetType::AT_LSL_TEXT, 			new ViewerAssetEntry(DAD_SCRIPT));
 	addEntry(LLViewerAssetType::AT_LSL_BYTECODE, 		new ViewerAssetEntry(DAD_NONE));
 	addEntry(LLViewerAssetType::AT_TEXTURE_TGA, 		new ViewerAssetEntry(DAD_NONE));
diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp
index 384538364f0..6aabcb11b82 100644
--- a/indra/newview/llviewerfoldertype.cpp
+++ b/indra/newview/llviewerfoldertype.cpp
@@ -109,8 +109,7 @@ LLViewerFolderDictionary::LLViewerFolderDictionary()
 	addEntry(LLFolderType::FT_CLOTHING, 			new ViewerFolderEntry("Clothing",				"inv_folder_clothing.tga"));
 	addEntry(LLFolderType::FT_OBJECT, 				new ViewerFolderEntry("Objects",				"inv_folder_object.tga"));
 	addEntry(LLFolderType::FT_NOTECARD, 			new ViewerFolderEntry("Notecards",				"inv_folder_notecard.tga"));
-	addEntry(LLFolderType::FT_CATEGORY, 			new ViewerFolderEntry("New Folder",				"inv_folder_plain_closed.tga"));
-	addEntry(LLFolderType::FT_ROOT_CATEGORY, 		new ViewerFolderEntry("Inventory",				""));
+	addEntry(LLFolderType::FT_ROOT_INVENTORY, 		new ViewerFolderEntry("My Inventory",			""));
 	addEntry(LLFolderType::FT_LSL_TEXT, 			new ViewerFolderEntry("Scripts",				"inv_folder_script.tga"));
 	addEntry(LLFolderType::FT_BODYPART, 			new ViewerFolderEntry("Body Parts",				"inv_folder_bodypart.tga"));
 	addEntry(LLFolderType::FT_TRASH, 				new ViewerFolderEntry("Trash",					"inv_folder_trash.tga"));
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 4cc1d986bb4..68a9aaef757 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -3879,8 +3879,7 @@ void god_force_inv_owner_permissive(LLViewerObject* object,
 	InventoryObjectList::const_iterator inv_end = inventory->end();
 	for ( ; inv_it != inv_end; ++inv_it)
 	{
-		if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY)
-		   && ((*inv_it)->getType() != LLAssetType::AT_ROOT_CATEGORY))
+		if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY))
 		{
 			LLInventoryObject* obj = *inv_it;
 			LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem((LLViewerInventoryItem*)obj);
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 4088eafe16c..f0c1823def0 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -4833,8 +4833,7 @@ void container_inventory_arrived(LLViewerObject* object,
 		InventoryObjectList::const_iterator end = inventory->end();
 		for ( ; it != end; ++it)
 		{
-			if ((*it)->getType() != LLAssetType::AT_CATEGORY &&
-				(*it)->getType() != LLAssetType::AT_ROOT_CATEGORY)
+			if ((*it)->getType() != LLAssetType::AT_CATEGORY)
 			{
 				LLInventoryObject* obj = (LLInventoryObject*)(*it);
 				LLInventoryItem* item = (LLInventoryItem*)(obj);
@@ -4869,8 +4868,7 @@ void container_inventory_arrived(LLViewerObject* object,
 		// one actual object
 		InventoryObjectList::iterator it = inventory->begin();
 
-		if ((*it)->getType() == LLAssetType::AT_CATEGORY ||
-			(*it)->getType() == LLAssetType::AT_ROOT_CATEGORY)
+		if ((*it)->getType() == LLAssetType::AT_CATEGORY)
 		{
 			++it;
 		}
-- 
GitLab