leslie_linden avatar leslie_linden committed bf153b8

EXP-1541 update -- Route inventory items sent in a Notecard to correct locations rather than auto-sorting by asset type

* New code specifies explicit destination for "copy from notecard" or null, indicating the sim should determine the placement.

Reviewed by Stone.

Comments (0)

Files changed (6)

indra/newview/llfavoritesbar.cpp

 	if (tool_dad->getSource() == LLToolDragAndDrop::SOURCE_NOTECARD)
 	{
 		viewer_item->setType(LLAssetType::AT_LANDMARK);
-		copy_inventory_from_notecard(tool_dad->getObjectID(), tool_dad->getSourceID(), viewer_item.get(), gInventoryCallbacks.registerCB(cb));
+		copy_inventory_from_notecard(favorites_id,
+									 tool_dad->getObjectID(),
+									 tool_dad->getSourceID(),
+									 viewer_item.get(),
+									 gInventoryCallbacks.registerCB(cb));
 	}
 	else
 	{

indra/newview/llinventorybridge.cpp

 		// because they must contain only links to wearable items.
 		accept = !(move_is_into_current_outfit || move_is_into_outfit);
 
-		if(drop)
+		if(accept && drop)
 		{
-			copy_inventory_from_notecard(LLToolDragAndDrop::getInstance()->getObjectID(),
-										 LLToolDragAndDrop::getInstance()->getSourceID(), inv_item);
+			copy_inventory_from_notecard(mUUID,  // Drop to the chosen destination folder
+										 LLToolDragAndDrop::getInstance()->getObjectID(),
+										 LLToolDragAndDrop::getInstance()->getSourceID(),
+										 inv_item);
 		}
 	}
 	else if(LLToolDragAndDrop::SOURCE_LIBRARY == source)

indra/newview/llpreview.cpp

 		// Copy to inventory
 		if (self->mNotecardInventoryID.notNull())
 		{
-			copy_inventory_from_notecard(self->mNotecardObjectID,
-				self->mNotecardInventoryID, item);
+			copy_inventory_from_notecard(LLUUID::null,
+										 self->mNotecardObjectID,
+										 self->mNotecardInventoryID,
+										 item);
 		}
 		else
 		{

indra/newview/llviewerinventory.cpp

 	gAgent.sendReliableMessage();
 }
 
-void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecard_inv_id, const LLInventoryItem *src, U32 callback_id)
+const LLUUID get_folder_by_itemtype(const LLInventoryItem *src)
+{
+	LLUUID retval = LLUUID::null;
+	
+	if (src)
+	{
+		retval = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType()));
+	}
+	
+	return retval;
+}
+
+void copy_inventory_from_notecard(const LLUUID& destination_id,
+								  const LLUUID& object_id,
+								  const LLUUID& notecard_inv_id,
+								  const LLInventoryItem *src,
+								  U32 callback_id)
 {
 	if (NULL == src)
 	{
     body["notecard-id"] = notecard_inv_id;
     body["object-id"] = object_id;
     body["item-id"] = src->getUUID();
-	body["folder-id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType()));
+	body["folder-id"] = destination_id;
     body["callback-id"] = (LLSD::Integer)callback_id;
 
     request["message"] = "CopyInventoryFromNotecard";

indra/newview/llviewerinventory.h

 	const std::string& new_name,
 	LLPointer<LLInventoryCallback> cb);
 
-void copy_inventory_from_notecard(const LLUUID& object_id,
+const LLUUID get_folder_by_itemtype(const LLInventoryItem *src);
+
+void copy_inventory_from_notecard(const LLUUID& destination_id,
+								  const LLUUID& object_id,
 								  const LLUUID& notecard_inv_id,
 								  const LLInventoryItem *src,
 								  U32 callback_id = 0);

indra/newview/llviewertexteditor.cpp

 	{
 		LLVector3d global_pos;
 		landmark->getGlobalPos(global_pos);
-		LLViewerInventoryItem* agent_lanmark =
+		LLViewerInventoryItem* agent_landmark =
 				LLLandmarkActions::findLandmarkForGlobalPos(global_pos);
 
-		if (agent_lanmark)
+		if (agent_landmark)
 		{
-			showInfo(agent_lanmark->getUUID());
+			showInfo(agent_landmark->getUUID());
 		}
 		else
 		{
 			}
 			else
 			{
+				LLInventoryItem* item = item_ptr.get();
 				LLPointer<LLEmbeddedLandmarkCopied> cb = new LLEmbeddedLandmarkCopied();
-				copy_inventory_from_notecard(object_id, notecard_inventory_id, item_ptr.get(), gInventoryCallbacks.registerCB(cb));
+				copy_inventory_from_notecard(get_folder_by_itemtype(item),
+											 object_id,
+											 notecard_inventory_id,
+											 item,
+											 gInventoryCallbacks.registerCB(cb));
 			}
 		}
 	}
 
 void LLViewerTextEditor::copyInventory(const LLInventoryItem* item, U32 callback_id)
 {
-	copy_inventory_from_notecard(mObjectID,
+	copy_inventory_from_notecard(LLUUID::null,  // Don't specify a destination -- let the sim do that
+								 mObjectID,
 								 mNotecardInventoryID,
-								 item, callback_id);
+								 item,
+								 callback_id);
 }
 
 bool LLViewerTextEditor::hasEmbeddedInventory()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.