diff options
author | Merov Linden <merov@lindenlab.com> | 2015-02-03 22:04:58 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2015-02-03 22:04:58 -0800 |
commit | ab91c83881ae182de2ebf8e99d31db2c5bd39f08 (patch) | |
tree | 39571eef81809063eeb1f766d063867f5d4fcdc9 /indra/newview/llinventoryfunctions.cpp | |
parent | 626d465894b0147b9cbefb15f7cfd8db38d72f00 (diff) |
DD-296 : Implement listing validation after we get all copied items confirmation from the server
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 97d6bf004b..6721a9e4f4 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -130,6 +130,25 @@ S32 count_stock_folders(LLInventoryModel::cat_array_t& categories) return count; } +// Helper funtion : Count the number of items (not folders) in the descending hierarchy +S32 count_descendants_items(const LLUUID& cat_id) +{ + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); + + S32 count = item_array->size(); + + 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++) + { + LLViewerInventoryCategory* category = *iter; + count += count_descendants_items(category->getUUID()); + } + + return count; +} + // Helper function : Returns true if the hierarchy contains nocopy items bool contains_nocopy_items(const LLUUID& id) { @@ -360,6 +379,12 @@ void copy_inventory_category(LLInventoryModel* model, 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())); + } // Copy all the items LLInventoryModel::item_array_t item_array_copy = *item_array; @@ -377,6 +402,8 @@ void copy_inventory_category(LLInventoryModel* model, 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 { @@ -1443,6 +1470,8 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol return false; } } + + open_marketplace_listings(); return true; } @@ -1477,11 +1506,10 @@ bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU { // Reparent the folder gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + // Check the destination folder recursively for no copy items and promote the including folders if any + validate_marketplacelistings(dest_cat); } - // Check the destination folder recursively for no copy items and promote the including folders if any - validate_marketplacelistings(dest_cat); - // Update the modified folders update_marketplace_category(src_folder); update_marketplace_category(dest_folder); |