diff options
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 81 | ||||
| -rw-r--r-- | indra/newview/llinventoryfunctions.h | 2 | 
2 files changed, 45 insertions, 38 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 0da4331af8..030c967019 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -398,61 +398,66 @@ void copy_inventory_category(LLInventoryModel* model,  							 LLViewerInventoryCategory* cat,  							 const LLUUID& parent_id,  							 const LLUUID& root_copy_id, -                             bool move_no_copy_items ) +							 bool move_no_copy_items )  {  	// Create the initial folder -	LLUUID new_cat_uuid = gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName()); +	inventory_func_type func = boost::bind(©_inventory_category_content, _1, model, cat, root_copy_id, move_no_copy_items); +	gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName(), func); +} + +void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& root_copy_id, bool move_no_copy_items) +{  	model->notifyObservers(); -	 +  	// We need to exclude the initial root of the copy to avoid recursively copying the copy, etc...  	LLUUID root_id = (root_copy_id.isNull() ? new_cat_uuid : root_copy_id);  	// Get the content of the folder  	LLInventoryModel::cat_array_t* cat_array;  	LLInventoryModel::item_array_t* item_array; -	gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array); -     -    // If root_copy_id is null, tell the marketplace model we'll be waiting for new items to be copied over for this folder -    if (root_copy_id.isNull()) -    { -        LLMarketplaceData::instance().setValidationWaiting(root_id,count_descendants_items(cat->getUUID())); -    } +	gInventory.getDirectDescendentsOf(cat->getUUID(), cat_array, item_array); + +	// If root_copy_id is null, tell the marketplace model we'll be waiting for new items to be copied over for this folder +	if (root_copy_id.isNull()) +	{ +		LLMarketplaceData::instance().setValidationWaiting(root_id, count_descendants_items(cat->getUUID())); +	}  	// Copy all the items  	LLInventoryModel::item_array_t item_array_copy = *item_array;  	for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)  	{  		LLInventoryItem* item = *iter; -        LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid)); +		LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid)); -        if (item->getIsLinkType()) -        { -            link_inventory_object(new_cat_uuid, item->getLinkedUUID(), cb); -        } -        else if(!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) -        { -            // If the item is nocopy, we do nothing or, optionally, move it -            if (move_no_copy_items) -            { -                // Reparent the item -                LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) item; -                gInventory.changeItemParent(viewer_inv_item, new_cat_uuid, true); -            } -            // Decrement the count in root_id since that one item won't be copied over -            LLMarketplaceData::instance().decrementValidationWaiting(root_id); -        } -        else -        { -            copy_inventory_item( -                                gAgent.getID(), -                                item->getPermissions().getOwner(), -                                item->getUUID(), -                                new_cat_uuid, -                                std::string(), -                                cb); -        } +		if (item->getIsLinkType()) +		{ +			link_inventory_object(new_cat_uuid, item->getLinkedUUID(), cb); +		} +		else if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) +		{ +			// If the item is nocopy, we do nothing or, optionally, move it +			if (move_no_copy_items) +			{ +				// Reparent the item +				LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *)item; +				gInventory.changeItemParent(viewer_inv_item, new_cat_uuid, true); +			} +			// Decrement the count in root_id since that one item won't be copied over +			LLMarketplaceData::instance().decrementValidationWaiting(root_id); +		} +		else +		{ +			copy_inventory_item( +				gAgent.getID(), +				item->getPermissions().getOwner(), +				item->getUUID(), +				new_cat_uuid, +				std::string(), +				cb); +		}  	} -	 +  	// Copy all the folders  	LLInventoryModel::cat_array_t cat_array_copy = *cat_array;  	for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index d454d7e00b..fd106bc2d8 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -72,6 +72,8 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s  void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& parent_id, const LLUUID& root_copy_id = LLUUID::null, bool move_no_copy_items = false); +void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& root_copy_id, bool move_no_copy_items); +  // Generates a string containing the path to the item specified by item_id.  void append_path(const LLUUID& id, std::string& path);  | 
