Example #1
0
// static
void LLFloaterProperties::onClickUpdate(void* user_data)
{
	LLFloaterProperties* floaterp = (LLFloaterProperties*)user_data;
	if(floaterp)
	{
		LLViewerInventoryItem* item = (LLViewerInventoryItem*)floaterp->findItem();
		if(item)
		{
			std::string str(floaterp->childGetValue("item_text").asString());
			std::string::size_type pos;
			while((pos = str.find("    ")) != std::string::npos)
			{
				str.replace(pos, 4, "\t");
			}
			
			std::istringstream strm(str);
			item->importLegacyStream(strm);

			if(floaterp->mObjectID.isNull())
			{
				// This is in the agent's inventory.
				item->updateServer(FALSE);
				gInventory.updateItem(item);
				gInventory.notifyObservers();

				item->setComplete(FALSE);
				item->fetchFromServer();
			}
			else
			{
				// This is in an object's contents.
				LLViewerObject* object = gObjectList.findObject(floaterp->mObjectID);
				if(object)
				{
					object->updateInventory(
						item,
						TASK_INVENTORY_ITEM_KEY,
						false);
					object->fetchInventoryFromServer();
				}
			}
		}
	}
}