diff options
author | Merov Linden <merov@lindenlab.com> | 2014-03-31 16:17:10 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-03-31 16:17:10 -0700 |
commit | ec290cd059d80519ff6891149306586819ac008d (patch) | |
tree | 2b55f5b5c6dae26c1273af98fdf3ac3805b0c943 /indra | |
parent | e624e6ab9ea8c27c2649f6f0391b0f7d1362fda3 (diff) |
DD-18 : WIP : Implement stock folder counting but no propagation so far, also update is not working
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 20 |
2 files changed, 18 insertions, 7 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d0abe6db29..bf56be320f 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1973,8 +1973,9 @@ std::string LLFolderBridge::getLabelSuffix() const } else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { - //llinfos << "Merov : in merchant folder and is a stock folder : id = " << getUUID() << llendl; - std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ")"; + llinfos << "Merov : in merchant folder and is a stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; + std::string stock = llformat("%d", getCategory()->getDescendentCount()); + std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ") (" + stock + ")"; return LLInvFVBridge::getLabelSuffix() + suffix; } else diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index de7a79502d..5e4fb557d5 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -733,6 +733,8 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Reparent the item gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + gInventory.updateCategory(category); + gInventory.notifyObservers(); // Validate the destination : note that this will run the validation code only on one listing folder at most... validate_marketplacelistings(category); @@ -754,6 +756,8 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU // Reparent the folder LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + gInventory.updateCategory(viewer_inv_cat); + gInventory.notifyObservers(); // Check the destination folder recursively for no copy items and promote the including folders if any validate_marketplacelistings(inv_cat); @@ -815,7 +819,8 @@ void validate_marketplacelistings(LLInventoryCategory* cat) LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); const LLFolderType::EType folder_type = cat->getPreferredType(); - LLUUID stock_folder; + LLUUID stock_folder_uuid; + LLViewerInventoryCategory* stock_folder_cat = NULL; LLInventoryModel::item_array_t item_array_copy = *item_array; @@ -836,19 +841,24 @@ void validate_marketplacelistings(LLInventoryCategory* cat) if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (folder_type != LLFolderType::FT_MARKETPLACE_STOCK)) { llinfos << "Merov : Validation warning : no copy item found in non stock folder -> reparent to relevant stock folder!" << llendl; - if (stock_folder.isNull()) + if (stock_folder_uuid.isNull()) { llinfos << "Merov : Validation warning : no appropriate existing stock folder -> create a new stock folder!" << llendl; - stock_folder = gInventory.createNewCategory(viewer_cat->getParentUUID(), LLFolderType::FT_MARKETPLACE_STOCK, viewer_cat->getName()); + stock_folder_uuid = gInventory.createNewCategory(viewer_cat->getParentUUID(), LLFolderType::FT_MARKETPLACE_STOCK, viewer_cat->getName()); + stock_folder_cat = gInventory.getCategory(stock_folder_uuid); } - gInventory.changeItemParent(viewer_inv_item, stock_folder, false); + gInventory.changeItemParent(viewer_inv_item, stock_folder_uuid, false); + gInventory.updateCategory(viewer_cat); + gInventory.updateCategory(stock_folder_cat); + gInventory.notifyObservers(); } } - if (stock_folder.notNull() && (viewer_cat->getDescendentCount() == 0)) + if (stock_folder_uuid.notNull() && (viewer_cat->getDescendentCount() == 0)) { llinfos << "Merov : Validation warning : folder content completely moved to stock folder -> remove empty folder!" << llendl; gInventory.removeCategory(cat->getUUID()); + gInventory.notifyObservers(); return; } |