From 0ec8fbec6deaa24506391ef239c50009eebe1eef Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 28 Mar 2014 15:54:36 -0700 Subject: DD-24 : Add FT_MARKETPLACE_STOCK as a new type for folders, implement the promotion code for Drag and Drop, display of stock folders and embryonic marketplace validation --- indra/newview/llinventorymodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ed7fd3cd34..37e11123c6 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2160,12 +2160,12 @@ void LLInventoryModel::buildParentChildMap() // implement it, we would need a set or map of uuid pairs // which would be (folder_id, new_parent_id) to be sent up // to the server. - llinfos << "Lost categroy: " << cat->getUUID() << " - " + llinfos << "Lost category: " << cat->getUUID() << " - " << cat->getName() << llendl; ++lost; // plop it into the lost & found. LLFolderType::EType pref = cat->getPreferredType(); - if(LLFolderType::FT_NONE == pref) + if ((LLFolderType::FT_NONE == pref) || (LLFolderType::FT_MARKETPLACE_STOCK == pref)) { cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND)); } -- cgit v1.3 From 69fb50322eb0de9071ed22d4e62cef11ae811c4d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 31 Mar 2014 20:24:41 -0700 Subject: DD-18 : WIP : Making stock folders update work better --- indra/newview/llinventoryfunctions.cpp | 31 ++++++++++++++++++++++++------- indra/newview/llinventorymodel.cpp | 10 ++++++++-- 2 files changed, 32 insertions(+), 9 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 5e4fb557d5..17bcd333f8 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -723,21 +723,28 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol { dest_folder = create_folder_for_item(inv_item, dest_folder); } - LLViewerInventoryCategory* category = gInventory.getCategory(dest_folder); + LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); // When moving a no copy item into a first level listing folder, we create a stock folder for it - if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (category->getParentUUID() == marketplace_listings_uuid)) + if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (dest_cat->getParentUUID() == marketplace_listings_uuid)) { dest_folder = create_folder_for_item(inv_item, dest_folder); } + // Get the parent folder of the moved item : we may have to update it + LLUUID src_folder = viewer_inv_item->getParentUUID(); + LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); + // Reparent the item gInventory.changeItemParent(viewer_inv_item, dest_folder, false); - gInventory.updateCategory(category); + + // Update the modified folders + gInventory.updateCategory(src_cat); + gInventory.updateCategory(dest_cat); gInventory.notifyObservers(); // Validate the destination : note that this will run the validation code only on one listing folder at most... - validate_marketplacelistings(category); + validate_marketplacelistings(dest_cat); } else { @@ -752,15 +759,25 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU // Check that we have adequate permission on all items being moved. Proceed if we do. if (has_correct_permissions_for_sale(inv_cat)) { - + // Get the destination folder + // *TODO : check that this folder is not full of no-copy items under its root... + LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); + + // Get the parent folder of the moved item : we may have to update it + LLUUID src_folder = inv_cat->getParentUUID(); + LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); + // Reparent the folder LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); - gInventory.updateCategory(viewer_inv_cat); + + // Update the modified folders + gInventory.updateCategory(src_cat); + gInventory.updateCategory(dest_cat); gInventory.notifyObservers(); // Check the destination folder recursively for no copy items and promote the including folders if any - validate_marketplacelistings(inv_cat); + validate_marketplacelistings(dest_cat); } } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 37e11123c6..96a2db5afb 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1027,7 +1027,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) LLViewerInventoryCategory* old_cat = getCategory(cat->getUUID()); if(old_cat) { - // We already have an old category, modify it's values + // We already have an old category, modify its values U32 mask = LLInventoryObserver::NONE; LLUUID old_parent_id = old_cat->getParentUUID(); LLUUID new_parent_id = cat->getParentUUID(); @@ -1052,7 +1052,13 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) { mask |= LLInventoryObserver::LABEL; } - old_cat->copyViewerCategory(cat); + // Under marketplace, category labels are quite complex and need extra upate + const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id)) + { + mask |= LLInventoryObserver::LABEL; + } + old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); } else -- cgit v1.3 From f66de28a7cf735df15d167df270943547bdbde81 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 1 Apr 2014 21:41:18 -0700 Subject: DD-20 : WIP : Implemented the cut and paste code for marketplace. Stock update still not working as expected. --- indra/newview/llinventorybridge.cpp | 90 +++++++++++++++++++++++----------- indra/newview/llinventoryfunctions.cpp | 47 +++++++++++++++--- indra/newview/llinventoryfunctions.h | 4 +- indra/newview/llinventorymodel.cpp | 3 ++ 4 files changed, 105 insertions(+), 39 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bf56be320f..5462b2bef4 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3264,13 +3264,12 @@ void LLFolderBridge::pasteFromClipboard() { const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); - // *TODO : Add marketplace listings case - //const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - //const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); LLDynamicArray objects; LLClipboard::instance().pasteFromClipboard(objects); @@ -3342,21 +3341,35 @@ void LLFolderBridge::pasteFromClipboard() LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id); llassert(vicat); if (vicat) - { - //changeCategoryParent() implicity calls dirtyFilter - changeCategoryParent(model, vicat, parent_id, FALSE); + { + if (move_is_into_marketplacelistings) + { + move_folder_to_marketplacelistings(vicat, parent_id); + } + else + { + //changeCategoryParent() implicity calls dirtyFilter + changeCategoryParent(model, vicat, parent_id, FALSE); + } } } else - { - LLViewerInventoryItem* viitem = dynamic_cast(item); - llassert(viitem); - if (viitem) - { - //changeItemParent() implicity calls dirtyFilter - changeItemParent(model, viitem, parent_id, FALSE); - } - } + { + LLViewerInventoryItem* viitem = dynamic_cast(item); + llassert(viitem); + if (viitem) + { + if (move_is_into_marketplacelistings) + { + move_item_to_marketplacelistings(viitem, parent_id); + } + else + { + //changeItemParent() implicity calls dirtyFilter + changeItemParent(model, viitem, parent_id, FALSE); + } + } + } } else { @@ -3367,22 +3380,41 @@ void LLFolderBridge::pasteFromClipboard() llassert(vicat); if (vicat) { - copy_inventory_category(model, vicat, parent_id); + if (move_is_into_marketplacelistings) + { + move_folder_to_marketplacelistings(vicat, parent_id, true); + } + else + { + copy_inventory_category(model, vicat, parent_id); + } } } - else - { - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - parent_id, - std::string(), - LLPointer(NULL)); - } - } - } - } + else + { + LLViewerInventoryItem* viitem = dynamic_cast(item); + llassert(viitem); + if (viitem) + { + if (move_is_into_marketplacelistings) + { + move_item_to_marketplacelistings(viitem, parent_id, true); + } + else + { + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + parent_id, + std::string(), + LLPointer(NULL)); + } + } + } + } + } + } // Change mode to paste for next paste LLClipboard::instance().setCutMode(false); } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 17bcd333f8..8216830336 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -688,7 +688,15 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold open_outbox(); } -void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder) +///---------------------------------------------------------------------------- +// Marketplace functions +// +// Handles Copy and Move to or within the Marketplace listings folder. +// Handles creation of stock folders, nesting of listings and version folders, +// permission checking and listings validation. +///---------------------------------------------------------------------------- + +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); @@ -705,7 +713,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (linked_category != NULL) { // Move the linked folder directly - move_folder_to_marketplacelistings(linked_category, dest_folder); + move_folder_to_marketplacelistings(linked_category, dest_folder, copy); } else { @@ -733,10 +741,25 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = viewer_inv_item->getParentUUID(); - LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); + LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); - // Reparent the item - gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + if (copy) + { + // Copy the item + copy_inventory_item( + gAgent.getID(), + viewer_inv_item->getPermissions().getOwner(), + viewer_inv_item->getUUID(), + dest_folder, + std::string(), + LLPointer(NULL)); + + } + else + { + // Reparent the item + gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + } // Update the modified folders gInventory.updateCategory(src_cat); @@ -754,7 +777,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol } } -void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder) +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy) { // Check that we have adequate permission on all items being moved. Proceed if we do. if (has_correct_permissions_for_sale(inv_cat)) @@ -767,9 +790,17 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU LLUUID src_folder = inv_cat->getParentUUID(); LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); - // Reparent the folder LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; - gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + if (copy) + { + // Copy the folder + copy_inventory_category(&gInventory, viewer_inv_cat, dest_folder); + } + else + { + // Reparent the folder + gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + } // Update the modified folders gInventory.updateCategory(src_cat); diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 006cc3de68..e6f9ef6d89 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -72,8 +72,8 @@ void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LL void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 operation_id); void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id); -void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder); -void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder); +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy = false); +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false); bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 96a2db5afb..afddde02a4 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1056,7 +1056,10 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id)) { + // *TODO : Need some internal analysis to be less brutal with updates mask |= LLInventoryObserver::LABEL; + mask |= LLInventoryObserver::STRUCTURE; + mask |= LLInventoryObserver::INTERNAL; } old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); -- cgit v1.3 From a98346b0c3b90e75858f6ef98985c1246ad30418 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 2 Apr 2014 18:06:22 -0700 Subject: DD-20 : WIP : Improve Cut and Paste for marketplace. Still some use cases that are not working well --- indra/newview/llinventorybridge.cpp | 22 +++++++++++++++++++--- indra/newview/llinventorybridge.h | 1 + indra/newview/llinventoryfunctions.cpp | 15 ++++++++++++--- indra/newview/llinventorymodel.cpp | 4 +--- 4 files changed, 33 insertions(+), 9 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 5462b2bef4..68418063e7 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1186,6 +1186,22 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid) } } +void LLInvFVBridge::removeObject(LLInventoryModel *model, const LLUUID &uuid) +{ + // Keep track of the parent + LLInventoryItem* itemp = model->getItem(uuid); + LLUUID parent_id = (itemp ? itemp->getParentUUID() : LLUUID::null); + // Remove the object + model->removeObject(uuid); + // Get the parent updated + if (parent_id.notNull()) + { + LLViewerInventoryCategory* parent_cat = model->getCategory(parent_id); + model->updateCategory(parent_cat); + model->notifyObservers(); + } +} + bool LLInvFVBridge::canShare() const { bool can_share = false; @@ -1406,7 +1422,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - gInventory.removeObject(mUUID); + removeObject(model, mUUID); return; } else if ("copy" == action) @@ -1973,7 +1989,7 @@ std::string LLFolderBridge::getLabelSuffix() const } else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { - llinfos << "Merov : in merchant folder and is a stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; + //llinfos << "Merov : getLabelSuffix : 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; @@ -3026,7 +3042,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - gInventory.removeObject(mUUID); + removeObject(model, mUUID); return; } else if ("copy" == action) diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 26c48fdc57..2c0b620395 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -184,6 +184,7 @@ protected: mutable std::string mSearchableName; void purgeItem(LLInventoryModel *model, const LLUUID &uuid); + void removeObject(LLInventoryModel *model, const LLUUID &uuid); virtual void buildDisplayName() const {} }; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 8216830336..aef05fead5 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -90,6 +90,14 @@ BOOL LLInventoryState::sWearNewClothing = FALSE; LLUUID LLInventoryState::sWearNewClothingTransactionID; +// Helper function : callback to update a folder after inventory action happened in the background +void update_folder_cb(const LLUUID& dest_folder) +{ + LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); + gInventory.updateCategory(dest_cat); + gInventory.notifyObservers(); +} + // Generates a string containing the path to the item specified by // item_id. void append_path(const LLUUID& id, std::string& path) @@ -163,13 +171,14 @@ void copy_inventory_category(LLInventoryModel* model, for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) { LLInventoryItem* item = *iter; + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid)); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), new_cat_uuid, std::string(), - LLPointer(NULL)); + cb); } // Copy all the folders @@ -746,14 +755,14 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (copy) { // Copy the item + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, dest_folder)); copy_inventory_item( gAgent.getID(), viewer_inv_item->getPermissions().getOwner(), viewer_inv_item->getUUID(), dest_folder, std::string(), - LLPointer(NULL)); - + cb); } else { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index afddde02a4..269542d383 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1056,11 +1056,9 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id)) { - // *TODO : Need some internal analysis to be less brutal with updates mask |= LLInventoryObserver::LABEL; - mask |= LLInventoryObserver::STRUCTURE; - mask |= LLInventoryObserver::INTERNAL; } + llinfos << "Merov : updateCategory : " << cat->getName() << llendl; old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); } -- cgit v1.3 From 39659f3c034c5cb335e185d1411e808d272f8065 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 3 Apr 2014 15:17:31 -0700 Subject: DD-20 : Handle edge cases a bit more cleanly --- indra/newview/llfloatermarketplacelistings.cpp | 2 +- indra/newview/llinventorybridge.cpp | 3 +-- indra/newview/llinventorymodel.cpp | 1 - indra/newview/llinventorypanel.cpp | 3 ++- 4 files changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 814f1b218a..e8257e52c4 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -466,7 +466,7 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO BOOL handled = (handled_view != NULL); // Pass all drag and drop for this floater to the marketplace listings inventory control - if (!handled || !isAccepted(*accept)) + if (!handled && isAccepted(*accept) && !mPanelListings->getVisible() && mRootFolderId.notNull()) { LLFolderView* root_folder = mPanelListings->getRootFolder(); handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 68418063e7..09fd0527b9 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2345,7 +2345,6 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(cat_id, outbox_id); const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); // check to make sure source is agent inventory, and is represented there. LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); @@ -2633,7 +2632,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { copy_folder_to_outbox(inv_cat, mUUID, cat_id, LLToolDragAndDrop::getOperationId()); } - else if (move_is_into_marketplacelistings && !move_is_from_marketplacelistings) + else if (move_is_into_marketplacelistings) { move_folder_to_marketplacelistings(inv_cat, mUUID); } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 269542d383..96a2db5afb 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1058,7 +1058,6 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) { mask |= LLInventoryObserver::LABEL; } - llinfos << "Merov : updateCategory : " << cat->getName() << llendl; old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 6305275a08..7d774110bd 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -568,7 +568,8 @@ void LLInventoryPanel::modelChanged(U32 mask) else if (!model_item && view_item && viewmodel_item) { // Remove the item's UI. - removeItemID(viewmodel_item->getUUID()); + const LLUUID& idp = viewmodel_item->getUUID(); + removeItemID(idp); view_item->destroyView(); } } -- cgit v1.3 From fc4e9d2572635903449ade6ebf2a45aa9e971023 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 8 Apr 2014 18:12:48 -0700 Subject: DD-18 : Compute stock for all levels, get folders to update more consistently on all actions in the marketplace --- indra/newview/llinventorybridge.cpp | 24 +++---- indra/newview/llinventoryfunctions.cpp | 87 ++++++++++++++++++++------ indra/newview/llinventoryfunctions.h | 1 + indra/newview/llinventorymodel.cpp | 2 +- indra/newview/skins/default/xui/en/strings.xml | 1 + 5 files changed, 78 insertions(+), 37 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 8d87b40e4e..7ff0a445e8 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -652,7 +652,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, items.push_back(std::string("Rename")); if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0)) { - llinfos << "Merov : rename disable, renameable = " << isItemRenameable() << ", flags = " << flags << llendl; disabled_items.push_back(std::string("Rename")); } } @@ -851,7 +850,6 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, menuentry_vec_t &disabled_items) { S32 depth = depth_nesting_in_marketplace(mUUID); - llinfos << "Merov : adding marketplace menu at depth = " << depth << llendl; if (depth == 1) { // Options available at the Listing Folder level @@ -2026,11 +2024,11 @@ std::string LLFolderBridge::getLabelSuffix() const { if (isMarketplaceListingsFolder()) { + std::string suffix = ""; // Listing folder case if (LLMarketplaceData::instance().isListed(getUUID())) { - //llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; - std::string suffix = LLMarketplaceData::instance().getListingID(getUUID()); + suffix = LLMarketplaceData::instance().getListingID(getUUID()); if (suffix.empty()) { suffix = LLTrans::getString("MarketplaceNoID"); @@ -2040,31 +2038,25 @@ std::string LLFolderBridge::getLabelSuffix() const { suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; } - return LLInvFVBridge::getLabelSuffix() + suffix; } // Version folder case else if (LLMarketplaceData::instance().isVersionFolder(getUUID())) { - std::string suffix; if (LLMarketplaceData::instance().getActivationState(getUUID())) { suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; } - return LLInvFVBridge::getLabelSuffix() + suffix; } - // Stock folder case - else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + S32 stock_count = compute_stock_count(getUUID()); + if (stock_count == 0) { - //llinfos << "Merov : getLabelSuffix : 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; + suffix += " (" + LLTrans::getString("MarketplaceNoStock") + ")"; } - else + else if (stock_count != -1) { - //llinfos << "Merov : in merchant folder but not listed : id = " << getUUID() << llendl; - return LLInvFVBridge::getLabelSuffix(); + suffix += " (" + LLTrans::getString("MarketplaceStock") + "=" + llformat("%d", stock_count) + ")"; } + return LLInvFVBridge::getLabelSuffix() + suffix; } else { diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index aef3bc9cca..20cbb06f07 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -122,14 +122,31 @@ void append_path(const LLUUID& id, std::string& path) void update_marketplace_category(const LLUUID& cat_id) { // When changing the marketplace status of a folder, the only thing that needs to happen is - // for all observers of the folder to, possibly, change the display label of said folder. - // At least that's the status for the moment so, even if that function seems small, we - // prefer to encapsulate that behavior here. - if (cat_id.notNull()) + // for all observers of the folder to, possibly, change the display label of the folder + // as well as, potentially, change the display label of all parent folders up to the marketplace root. + + const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + // No marketplace, likely called in error then... + // Or not a descendent of the marketplace listings root, then just do the regular category update + if (marketplace_listings_uuid.isNull() || !gInventory.isObjectDescendentOf(cat_id, marketplace_listings_uuid)) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + gInventory.updateCategory(cat); + gInventory.notifyObservers(); + return; + } + // Explore all the hierarchy of folders up to the root to get them to update + // Note: this is not supposed to be deeper than 4 + LLUUID cur_id = cat_id; + LLInventoryCategory* cur_cat = gInventory.getCategory(cur_id); + while (cur_id != marketplace_listings_uuid) { - gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); + gInventory.addChangedMask(LLInventoryObserver::LABEL, cur_id); gInventory.notifyObservers(); + cur_id = cur_cat->getParentUUID(); + cur_cat = gInventory.getCategory(cur_id); } + return; } void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name) @@ -748,6 +765,41 @@ LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth) return cur_uuid; } +S32 compute_stock_count(LLUUID cat_uuid) +{ + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array); + + // "-1" denotes a folder that doesn't countain any stock folders in its descendents + S32 curr_count = -1; + + LLInventoryCategory* cat = gInventory.getCategory(cat_uuid); + + if (cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + // Note: stock folders are *not* supposed to have nested subfolders so we stop recursion here + LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); + curr_count = viewer_cat->getDescendentCount(); + } + else + { + // Note: marketplace listings have a maximum depth nesting of 4 + 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++) + { + LLInventoryCategory* category = *iter; + S32 count = compute_stock_count(category->getUUID()); + if ((curr_count == -1) || ((count != -1) && (count < curr_count))) + { + curr_count = count; + } + } + } + + return curr_count; +} + void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none @@ -792,7 +844,6 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = viewer_inv_item->getParentUUID(); - LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); if (copy) { @@ -812,13 +863,12 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol gInventory.changeItemParent(viewer_inv_item, dest_folder, false); } - // Update the modified folders - gInventory.updateCategory(src_cat); - gInventory.updateCategory(dest_cat); - gInventory.notifyObservers(); - // Validate the destination : note that this will run the validation code only on one listing folder at most... validate_marketplacelistings(dest_cat); + + // Update the modified folders + update_marketplace_category(src_folder); + update_marketplace_category(dest_folder); } else { @@ -839,7 +889,6 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = inv_cat->getParentUUID(); - LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; if (copy) @@ -853,13 +902,12 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); } - // Update the modified folders - gInventory.updateCategory(src_cat); - gInventory.updateCategory(dest_cat); - gInventory.notifyObservers(); - // 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); } } @@ -948,9 +996,8 @@ void validate_marketplacelistings(LLInventoryCategory* cat) stock_folder_cat = gInventory.getCategory(stock_folder_uuid); } gInventory.changeItemParent(viewer_inv_item, stock_folder_uuid, false); - gInventory.updateCategory(viewer_cat); - gInventory.updateCategory(stock_folder_cat); - gInventory.notifyObservers(); + update_marketplace_category(viewer_cat->getUUID()); + update_marketplace_category(stock_folder_uuid); } } diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 69219c7c42..66f1c99630 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -78,6 +78,7 @@ bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); S32 depth_nesting_in_marketplace(LLUUID cur_uuid); LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth); +S32 compute_stock_count(LLUUID cat_uuid); /** Miscellaneous global functions ** ** diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 96a2db5afb..c0aedd3881 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1013,7 +1013,7 @@ LLInventoryModel::item_array_t* LLInventoryModel::getUnlockedItemArray(const LLU // an existing item with the matching id, or it will add the category. void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) { - if(cat->getUUID().isNull()) + if(!cat || cat->getUUID().isNull()) { return; } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index ce9bbbc8d2..55272750e7 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2274,6 +2274,7 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. no Mkt ID live stock + out of stock Open landmarks -- cgit v1.3 From 87192990592f9abda8314393bdcac3627c15d5ac Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 1 May 2014 17:36:17 -0700 Subject: DD-81 : Fixed the stock folder count update using an inventory observer. This observe other changes as well of interest to marketplace and should improve consistency in general --- indra/newview/llfloatermarketplacelistings.cpp | 4 ++ indra/newview/llinventoryfunctions.cpp | 97 ++++++++++++++++++-------- indra/newview/llinventoryfunctions.h | 4 +- indra/newview/llinventorymodel.cpp | 15 ++-- indra/newview/llmarketplacefunctions.cpp | 66 +++++++++++++++++- indra/newview/llmarketplacefunctions.h | 7 ++ 6 files changed, 153 insertions(+), 40 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index fb6ff211d1..b1b397c77c 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -92,6 +92,10 @@ BOOL LLPanelMarketplaceListings::postBuild() void LLPanelMarketplaceListings::draw() { + if (LLMarketplaceData::instance().checkDirtyCount()) + { + update_all_marketplace_count(); + } LLPanel::draw(); } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 62b626d0c8..413c0d4b4b 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -126,7 +126,6 @@ void update_marketplace_folder_hierarchy(const LLUUID cat_id) // for all observers of the folder to, possibly, change the display label of the folder // so that's the only thing we change on the update mask. gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); - gInventory.notifyObservers(); // Update all descendent folders down LLInventoryModel::cat_array_t* cat_array; @@ -142,55 +141,87 @@ void update_marketplace_folder_hierarchy(const LLUUID cat_id) return; } -void update_marketplace_category(const LLUUID& cat_id) +void update_marketplace_category(const LLUUID& cur_uuid) { - // When changing the marketplace status of a folder, we usually have to change the status of all + // When changing the marketplace status of an item, we usually have to change the status of all // folders in the same listing. This is because the display of each folder is affected by the // overall status of the whole listing. - // Consequently, the only way to correctly update a folder anywhere in the marketplace is to + // Consequently, the only way to correctly update an item anywhere in the marketplace is to // update the whole listing from its listing root. // This is not as bad as it seems as we only update folders, not items, and the folder nesting depth // is limited to 4. // We also take care of degenerated cases so we don't update all folders in the inventory by mistake. - const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - // No marketplace -> likely called too early... or - // Not a descendent of the marketplace listings root -> likely called in error then... - if (marketplace_listings_uuid.isNull() || !gInventory.isObjectDescendentOf(cat_id, marketplace_listings_uuid)) + // Grab marketplace listing data for this item + S32 depth = depth_nesting_in_marketplace(cur_uuid); + if (depth > 0) { - // In those cases, just do the regular category update - LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - gInventory.updateCategory(cat); - gInventory.notifyObservers(); - return; - } + // Retrieve the listing uuid this object is in + LLUUID listing_uuid = nested_parent_id(cur_uuid, depth); - // Grab marketplace listing data for this folder - S32 depth = depth_nesting_in_marketplace(cat_id); - LLUUID listing_uuid = nested_parent_id(cat_id, depth); - - // Verify marketplace data consistency for this listing - if (LLMarketplaceData::instance().isListed(listing_uuid)) - { - LLUUID version_folder_uuid = LLMarketplaceData::instance().getVersionFolderID(listing_uuid); - if (version_folder_uuid.notNull() && !gInventory.isObjectDescendentOf(version_folder_uuid, listing_uuid)) + // Verify marketplace data consistency for this listing + if (LLMarketplaceData::instance().isListed(listing_uuid)) { - // *TODO : Confirm with Producer that this is what we want to happen in that case! - llinfos << "Merov : Unlist as the version folder is not under the listing folder anymore!!" << llendl; - LLMarketplaceData::instance().setVersionFolderID(listing_uuid, LLUUID::null); - LLMarketplaceData::instance().setActivation(listing_uuid, false); + LLUUID version_folder_uuid = LLMarketplaceData::instance().getVersionFolderID(listing_uuid); + if (version_folder_uuid.notNull() && !gInventory.isObjectDescendentOf(version_folder_uuid, listing_uuid)) + { + // *TODO : Confirm with Producer that this is what we want to happen in that case! + llinfos << "Merov : Unlist as the version folder is not under the listing folder anymore!!" << llendl; + LLMarketplaceData::instance().setVersionFolderID(listing_uuid, LLUUID::null); + LLMarketplaceData::instance().setActivation(listing_uuid, false); + } } - if (!gInventory.isObjectDescendentOf(listing_uuid, marketplace_listings_uuid)) + + // Update all descendents starting from the listing root + update_marketplace_folder_hierarchy(listing_uuid); + } + else if (depth < 0) + { + if (LLMarketplaceData::instance().isListed(cur_uuid)) { // *TODO : Confirm with Producer that this is what we want to happen in that case! llinfos << "Merov : Disassociate as the listing folder is not under the marketplace folder anymore!!" << llendl; - LLMarketplaceData::instance().deleteListing(listing_uuid); + LLMarketplaceData::instance().deleteListing(cur_uuid); } } + + return; +} + +// Iterate through the marketplace and flag for label change all categories that countain a stock folder (i.e. stock folders and embedding folders up the hierarchy) +void update_all_marketplace_count(const LLUUID& cat_id) +{ + // Get all descendent folders down + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); - // Update all descendents starting from the listing root - update_marketplace_folder_hierarchy(listing_uuid); + 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++) + { + LLInventoryCategory* category = *iter; + if (category->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + // Listing containing stock folders needs to be updated but not others + // Note: we take advantage of the fact that stock folder *do not* contain sub folders to avoid a recursive call here + update_marketplace_category(category->getUUID()); + } + else + { + // Explore the contained folders recursively + update_all_marketplace_count(category->getUUID()); + } + } +} +void update_all_marketplace_count() +{ + // Get the marketplace root and launch the recursive exploration + const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + if (!marketplace_listings_uuid.isNull()) + { + update_all_marketplace_count(marketplace_listings_uuid); + } return; } @@ -966,6 +997,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Update the modified folders update_marketplace_category(src_folder); update_marketplace_category(dest_folder); + gInventory.notifyObservers(); } else { @@ -1011,6 +1043,7 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU // Update the modified folders update_marketplace_category(src_folder); update_marketplace_category(dest_folder); + gInventory.notifyObservers(); } } @@ -1227,6 +1260,7 @@ void validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ items_vector[i].pop_back(); } update_marketplace_category(folder_uuid); + gInventory.notifyObservers(); } } // Clean up @@ -1248,6 +1282,7 @@ void validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ { // Update the current folder update_marketplace_category(cat->getUUID()); + gInventory.notifyObservers(); } } diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index a31bc9dbdd..aecbe816c4 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -58,8 +58,10 @@ void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id); void show_item_original(const LLUUID& item_uuid); void reset_inventory_filter(); -// Just nudge the category in the global inventory to signal that its marketplace status changed +// Nudge the listing categories in the inventory to signal that their marketplace status changed void update_marketplace_category(const LLUUID& cat_id); +// Nudge all listing categories to signal that their marketplace status changed +void update_all_marketplace_count(); void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index c0aedd3881..0fbccb2f3f 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1441,16 +1441,17 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent) } mModifyMask |= mask; - if (referent.notNull()) + if (referent.notNull() && (mChangedItemIDs.find(referent) == mChangedItemIDs.end())) { mChangedItemIDs.insert(referent); - } + update_marketplace_category(referent); - // Update all linked items. Starting with just LABEL because I'm - // not sure what else might need to be accounted for this. - if (mModifyMask & LLInventoryObserver::LABEL) - { - addChangedMaskForLinks(referent, LLInventoryObserver::LABEL); + // Update all linked items. Starting with just LABEL because I'm + // not sure what else might need to be accounted for this. + if (mModifyMask & LLInventoryObserver::LABEL) + { + addChangedMaskForLinks(referent, LLInventoryObserver::LABEL); + } } } diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 5804bce819..c9e6623b72 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -31,6 +31,7 @@ #include "llagent.h" #include "llhttpclient.h" #include "llinventoryfunctions.h" +#include "llinventoryobserver.h" #include "llsdserialize.h" #include "lltimer.h" #include "lltrans.h" @@ -607,6 +608,54 @@ void LLMarketplaceInventoryImporter::updateImport() // // Direct Delivery : Marketplace tuples and data // +class LLMarketplaceInventoryObserver : public LLInventoryObserver +{ +public: + LLMarketplaceInventoryObserver() {} + virtual ~LLMarketplaceInventoryObserver() {} + virtual void changed(U32 mask); +}; + +void LLMarketplaceInventoryObserver::changed(U32 mask) +{ + // When things are changed in the inventory, this can trigger a host of changes in the marketplace listings folder: + // * stock counts changing : no copy items coming in and out will change the stock count on folders + // * version and listing folders : moving those might invalidate the marketplace data itself + // Since we should cannot raise inventory change while in the observer is called (the list will be cleared once observers are called) + // we need to raise a flag in the inventory to signal that things have been dirtied. + + // That's the only changes that really do make sense for marketplace to worry about + if ((mask & (LLInventoryObserver::INTERNAL | LLInventoryObserver::STRUCTURE)) != 0) + { + const std::set& changed_items = gInventory.getChangedIDs(); + + std::set::const_iterator id_it = changed_items.begin(); + std::set::const_iterator id_end = changed_items.end(); + for (;id_it != id_end; ++id_it) + { + LLInventoryObject* obj = gInventory.getObject(*id_it); + if (LLAssetType::AT_CATEGORY == obj->getType()) + { + // If it's a folder known to the marketplace, let's check it's in proper shape + if (LLMarketplaceData::instance().isListed(*id_it) || LLMarketplaceData::instance().isVersionFolder(*id_it)) + { + LLInventoryCategory* cat = (LLInventoryCategory*)(obj); + validate_marketplacelistings(cat); + } + } + else + { + // If it's not a category, it's an item... + LLInventoryItem* item = (LLInventoryItem*)(obj); + // If it's a no copy item, we may need to update the label count of marketplace listings + if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + LLMarketplaceData::instance().setDirtyCount(); + } + } + } + } +} // Tuple == Item LLMarketplaceTuple::LLMarketplaceTuple() : @@ -637,9 +686,17 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, // Data map LLMarketplaceData::LLMarketplaceData() : mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED), - mStatusUpdatedSignal(NULL) + mStatusUpdatedSignal(NULL), + mDirtyCount(false) { mTestCurrentMarketplaceID = 1234567; + mInventoryObserver = new LLMarketplaceInventoryObserver; + gInventory.addObserver(mInventoryObserver); +} + +LLMarketplaceData::~LLMarketplaceData() +{ + gInventory.removeObserver(mInventoryObserver); } S32 LLMarketplaceData::getTestMarketplaceID() @@ -707,6 +764,7 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id) setListingID(folder_id,listing_id); update_marketplace_category(folder_id); + gInventory.notifyObservers(); return true; } @@ -729,6 +787,7 @@ bool LLMarketplaceData::associateListing(const LLUUID& folder_id, S32 listing_id setListingID(folder_id,listing_id); update_marketplace_category(folder_id); + gInventory.notifyObservers(); return true; } @@ -741,6 +800,7 @@ bool LLMarketplaceData::deleteListing(const LLUUID& folder_id) } mMarketplaceItems.erase(folder_id); update_marketplace_category(folder_id); + gInventory.notifyObservers(); return true; } @@ -842,6 +902,7 @@ bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id) { (it->second).mListingId = listing_id; update_marketplace_category(folder_id); + gInventory.notifyObservers(); return true; } } @@ -861,6 +922,7 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID (it->second).mVersionFolderId = version_id; update_marketplace_category(old_version_id); update_marketplace_category(version_id); + gInventory.notifyObservers(); } return true; } @@ -874,6 +936,7 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); (it->second).mIsActive = activate; update_marketplace_category((it->second).mListingFolderId); + gInventory.notifyObservers(); return true; } // We need to iterate through the list to check it's not a version folder @@ -884,6 +947,7 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) { (it->second).mIsActive = activate; update_marketplace_category((it->second).mListingFolderId); + gInventory.notifyObservers(); return true; } it++; diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 42d76a1ba9..9e2dc871d6 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -125,6 +125,7 @@ namespace SLMErrorCodes } class LLMarketplaceData; +class LLInventoryObserver; // A Marketplace item is known by its tuple class LLMarketplaceTuple @@ -153,6 +154,7 @@ class LLMarketplaceData { public: LLMarketplaceData(); + virtual ~LLMarketplaceData(); // SLM Public typedef boost::signals2::signal status_updated_signal_t; @@ -188,6 +190,9 @@ public: bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); bool setActivation(const LLUUID& folder_id, bool activate); + bool checkDirtyCount() { if (mDirtyCount) { mDirtyCount = false; return true; } else { return false; } } + void setDirtyCount() { mDirtyCount = true; } + // Merov : Test method while waiting for SLM API S32 getTestMarketplaceID(); @@ -199,6 +204,8 @@ private: U32 mMarketPlaceStatus; status_updated_signal_t * mStatusUpdatedSignal; + LLInventoryObserver* mInventoryObserver; + bool mDirtyCount; // Merov : This is for test only, waiting for SLM API S32 mTestCurrentMarketplaceID; -- cgit v1.3 From 23acc30e2709dac1aa54eecda5c1bc6b2b226b5b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 16 May 2014 17:12:22 -0700 Subject: DD-102 : Fix crash when emptying trash containing nested folders. Also avoid getting listings several times --- indra/llui/llfolderviewitem.cpp | 2 ++ indra/newview/llfloatermarketplacelistings.cpp | 19 ++++--------------- indra/newview/llinventorymodel.cpp | 7 +++++-- 3 files changed, 11 insertions(+), 17 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index aa2343226c..3455f970cd 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1477,12 +1477,14 @@ void LLFolderViewFolder::destroyView() while (!mItems.empty()) { LLFolderViewItem *itemp = mItems.back(); + mItems.pop_back(); itemp->destroyView(); // LLFolderViewItem::destroyView() removes entry from mItems } while (!mFolders.empty()) { LLFolderViewFolder *folderp = mFolders.back(); + mFolders.pop_back(); folderp->destroyView(); // LLFolderVievFolder::destroyView() removes entry from mFolders } diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index b1b397c77c..277bd5aaed 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -242,25 +242,15 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key) { initializeMarketPlace(); } - else - { - setup(); + else + { + updateView(); } - - // - // Update the floater view - // - updateView(); - - // - // Trigger fetch of the contents - // - fetchContents(); } void LLFloaterMarketplaceListings::onFocusReceived() { - fetchContents(); + updateView(); } void LLFloaterMarketplaceListings::fetchContents() @@ -484,7 +474,6 @@ void LLFloaterMarketplaceListings::onChanged() LLViewerInventoryCategory* category = gInventory.getCategory(mRootFolderId); if (mRootFolderId.notNull() && category) { - fetchContents(); updateView(); } else diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 0fbccb2f3f..c379fb5f3a 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1217,6 +1217,11 @@ void LLInventoryModel::deleteObject(const LLUUID& id) LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)((LLInventoryObject*)obj); cat_list->removeObj(cat); } + + // Note : We need to tell the inventory observers that those things are going to be deleted *before* the tree is cleared or they won't know what to delete (in views and view models) + addChangedMask(LLInventoryObserver::REMOVE, id); + gInventory.notifyObservers(); + item_list = getUnlockedItemArray(id); if(item_list) { @@ -1229,10 +1234,8 @@ void LLInventoryModel::deleteObject(const LLUUID& id) delete cat_list; mParentChildCategoryTree.erase(id); } - addChangedMask(LLInventoryObserver::REMOVE, id); obj = NULL; // delete obj updateLinkedObjectsFromPurge(id); - gInventory.notifyObservers(); } // Delete a particular inventory item by ID, and remove it from the server. -- cgit v1.3 From 86d75052f65149da6bbe1ade5ea28b6f01aaba17 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 3 Jun 2014 19:46:33 -0700 Subject: DD-84 : Fix all active listing modification actions. Add specific message when listing will unlist. Make update skip consistency check when called from internal level (not public API). --- indra/llui/llfolderview.cpp | 2 +- indra/llui/llfolderviewmodel.h | 2 +- indra/newview/llconversationmodel.h | 2 +- indra/newview/llinventorybridge.cpp | 119 +++++++++++++++++---- indra/newview/llinventorybridge.h | 7 +- indra/newview/llinventoryfunctions.cpp | 36 ++++--- indra/newview/llinventoryfunctions.h | 2 +- indra/newview/llinventorymodel.cpp | 4 +- indra/newview/llmarketplacefunctions.cpp | 18 ++-- indra/newview/llpanelobjectinventory.cpp | 4 +- .../newview/skins/default/xui/en/notifications.xml | 13 +++ 11 files changed, 156 insertions(+), 53 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 0bfe9a803e..537f2ac4d7 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -946,7 +946,7 @@ void LLFolderView::cut() if (listener) { listener->cutToClipboard(); - listener->removeItem(); + //listener->removeItem(); } } diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 8d98363c5f..0b968ecee9 100755 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -169,7 +169,7 @@ public: virtual BOOL isItemCopyable() const = 0; virtual BOOL copyToClipboard() const = 0; - virtual BOOL cutToClipboard() const = 0; + virtual BOOL cutToClipboard() = 0; virtual BOOL isClipboardPasteable() const = 0; virtual void pasteFromClipboard() = 0; diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index dc74506c53..d3d9fbd109 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -86,7 +86,7 @@ public: virtual void move( LLFolderViewModelItem* parent_listener ) { } virtual BOOL isItemCopyable() const { return FALSE; } virtual BOOL copyToClipboard() const { return FALSE; } - virtual BOOL cutToClipboard() const { return FALSE; } + virtual BOOL cutToClipboard() { return FALSE; } virtual BOOL isClipboardPasteable() const { return FALSE; } virtual void pasteFromClipboard() { } virtual void pasteLinkFromClipboard() { } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 47b47bf705..b471b0ca15 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -263,13 +263,50 @@ BOOL LLInvFVBridge::isLibraryItem() const /** * @brief Adds this item into clipboard storage */ -BOOL LLInvFVBridge::cutToClipboard() const +BOOL LLInvFVBridge::cutToClipboard() +{ + const LLInventoryObject* obj = gInventory.getObject(mUUID); + if (obj && isItemMovable() && isItemRemovable()) + { + const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + const BOOL cut_from_marketplacelistings = gInventory.isObjectDescendentOf(mUUID, marketplacelistings_id); + + if (cut_from_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(mUUID)) + { + // Prompt the user if cutting from marketplace active listing + LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInvFVBridge::callback_cutToClipboard, this, _1, _2)); + } + else + { + // Otherwise just do the cut + return perform_cutToClipboard(); + } + } + return FALSE; +} + +// Callback for cutToClipboard if DAMA required... +BOOL LLInvFVBridge::callback_cutToClipboard(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) // YES + { + return perform_cutToClipboard(); + } + return FALSE; +} + +BOOL LLInvFVBridge::perform_cutToClipboard() { const LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj && isItemMovable() && isItemRemovable()) { LLClipboard::instance().setCutMode(true); - return LLClipboard::instance().addToClipboard(mUUID); + if (LLClipboard::instance().addToClipboard(mUUID)) + { + removeObject(&gInventory, mUUID); + return TRUE; + } } return FALSE; } @@ -1480,7 +1517,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - removeObject(model, mUUID); + //removeObject(model, mUUID); return; } else if ("copy" == action) @@ -2455,7 +2492,16 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if ((move_is_from_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(cat_id)) || (move_is_into_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(mUUID))) { - LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_dropCategoryIntoFolder, this, _1, _2, inv_cat)); + if (move_is_from_marketplacelistings && (LLMarketplaceData::instance().isListed(cat_id) || LLMarketplaceData::instance().isVersionFolder(cat_id))) + { + // Move the active version folder or listing folder itself outside marketplace listings will unlist the listing so ask that question specifically + LLNotificationsUtil::add("ConfirmMerchantUnlist", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_dropCategoryIntoFolder, this, _1, _2, inv_cat)); + } + else + { + // Any other case will simply modify but not unlist a listing + LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_dropCategoryIntoFolder, this, _1, _2, inv_cat)); + } return true; } } @@ -2891,7 +2937,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - removeObject(model, mUUID); + //removeObject(model, mUUID); return; } else if ("copy" == action) @@ -3192,20 +3238,53 @@ void LLFolderBridge::updateHierarchyCreationDate(time_t date) void LLFolderBridge::pasteFromClipboard() { LLInventoryModel* model = getInventoryModel(); - if(model && isClipboardPasteable()) + if (model && isClipboardPasteable()) { - const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); - const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + const BOOL paste_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + + if (paste_into_marketplacelistings && !LLMarketplaceData::instance().isListed(mUUID) && LLMarketplaceData::instance().isInActiveFolder(mUUID)) + { + // Prompt the user if pasting in marketplace active version listing (note that pasting right in the listing folder doesn't need a prompt) + LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_pasteFromClipboard, this, _1, _2)); + } + else + { + // Otherwise just do the paste + perform_pasteFromClipboard(); + } + } +} +// Callback for pasteFromClipboard if DAMA required... +void LLFolderBridge::callback_pasteFromClipboard(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) // YES + { + perform_pasteFromClipboard(); + } +} + +void LLFolderBridge::perform_pasteFromClipboard() +{ + LLInventoryModel* model = getInventoryModel(); + if (model && isClipboardPasteable()) + { + + + const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); + const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - - std::vector objects; + + std::vector objects; LLClipboard::instance().pasteFromClipboard(objects); - + if (move_is_into_outbox || move_is_into_marketplacelistings) { std::string error_msg; @@ -3234,15 +3313,15 @@ void LLFolderBridge::pasteFromClipboard() return; } } - + const LLUUID parent_id(mUUID); - + for (std::vector::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) { const LLUUID& item_id = (*iter); - + LLInventoryItem *item = model->getItem(item_id); LLInventoryObject *obj = model->getObject(item_id); if (obj) @@ -3338,12 +3417,12 @@ void LLFolderBridge::pasteFromClipboard() else { copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - parent_id, - std::string(), - LLPointer(NULL)); + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + parent_id, + std::string(), + LLPointer(NULL)); } } } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 418679d17c..410decaf5b 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -114,7 +114,7 @@ public: virtual void move(LLFolderViewModelItem* new_parent_bridge) {} virtual BOOL isItemCopyable() const { return FALSE; } virtual BOOL copyToClipboard() const; - virtual BOOL cutToClipboard() const; + virtual BOOL cutToClipboard(); virtual BOOL isClipboardPasteable() const; virtual BOOL isClipboardPasteableAsLink() const; virtual void pasteFromClipboard() {} @@ -176,6 +176,9 @@ protected: const LLUUID& new_parent, BOOL restamp); void removeBatchNoCheck(std::vector& batch); + + BOOL callback_cutToClipboard(const LLSD& notification, const LLSD& response); + BOOL perform_cutToClipboard(); protected: LLHandle mInventoryPanel; LLFolderView* mRoot; @@ -356,6 +359,8 @@ public: static void staticFolderOptionsMenu(); private: + void callback_pasteFromClipboard(const LLSD& notification, const LLSD& response); + void perform_pasteFromClipboard(); bool mCallingCards; bool mWearables; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 5dc2385f04..f832237b8d 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -141,7 +141,7 @@ void update_marketplace_folder_hierarchy(const LLUUID cat_id) return; } -void update_marketplace_category(const LLUUID& cur_uuid) +void update_marketplace_category(const LLUUID& cur_uuid, bool skip_consistency_enforcement) { // When changing the marketplace status of an item, we usually have to change the status of all // folders in the same listing. This is because the display of each folder is affected by the @@ -160,12 +160,11 @@ void update_marketplace_category(const LLUUID& cur_uuid) LLUUID listing_uuid = nested_parent_id(cur_uuid, depth); // Verify marketplace data consistency for this listing - if (LLMarketplaceData::instance().isListed(listing_uuid)) + if (!skip_consistency_enforcement && LLMarketplaceData::instance().isListed(listing_uuid)) { LLUUID version_folder_uuid = LLMarketplaceData::instance().getVersionFolder(listing_uuid); if (version_folder_uuid.notNull() && !gInventory.isObjectDescendentOf(version_folder_uuid, listing_uuid)) { - // *TODO : Confirm with Producer that this is what we want to happen in that case! LL_INFOS("SLM") << "Unlist as the version folder is not under the listing folder anymore!!" << LL_ENDL; LLMarketplaceData::instance().setVersionFolder(listing_uuid, LLUUID::null); LLMarketplaceData::instance().activateListing(listing_uuid, false); @@ -177,9 +176,8 @@ void update_marketplace_category(const LLUUID& cur_uuid) } else if (depth < 0) { - if (LLMarketplaceData::instance().isListed(cur_uuid)) + if (!skip_consistency_enforcement && LLMarketplaceData::instance().isListed(cur_uuid)) { - // *TODO : Confirm with Producer that this is what we want to happen in that case! LL_INFOS("SLM") << "Disassociate as the listing folder is not under the marketplace folder anymore!!" << LL_ENDL; LLMarketplaceData::instance().clearListing(cur_uuid); } @@ -1928,21 +1926,16 @@ void LLInventoryAction::callback_doToSelected(const LLSD& notification, const LL void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm) { - if ("rename" == action) - { - root->startRenamingSelectedItem(); - return; - } - std::set selected_items = root->getSelectionList(); // Prompt the user for some marketplace active listing edits - if (user_confirm && (("paste" == action) || ("cut" == action) || ("delete" == action))) + if (user_confirm && (("cut" == action) || ("delete" == action) || ("rename" == action) || ("properties" == action) || ("task_properties" == action))) { std::set::iterator set_iter = selected_items.begin(); + LLFolderViewModelItemInventory * viewModel = NULL; for (; set_iter != selected_items.end(); ++set_iter) { - LLFolderViewModelItemInventory * viewModel = dynamic_cast((*set_iter)->getViewModelItem()); + viewModel = dynamic_cast((*set_iter)->getViewModelItem()); if (viewModel && LLMarketplaceData::instance().isInActiveFolder(viewModel->getUUID())) { break; @@ -1950,11 +1943,26 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root } if (set_iter != selected_items.end()) { - LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action)); + if ((("cut" == action) || ("delete" == action)) && (LLMarketplaceData::instance().isListed(viewModel->getUUID()) || LLMarketplaceData::instance().isVersionFolder(viewModel->getUUID()))) + { + // Cut or delete of the active version folder or listing folder itself will unlist the listing so ask that question specifically + LLNotificationsUtil::add("ConfirmMerchantUnlist", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action)); + } + else + { + // Any other case will simply modify but not unlist a listing + LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action)); + } return; } } + if ("rename" == action) + { + root->startRenamingSelectedItem(); + return; + } + if ("delete" == action) { LLSD args; diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 5018e5a53e..d52618d795 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -59,7 +59,7 @@ void show_item_original(const LLUUID& item_uuid); void reset_inventory_filter(); // Nudge the listing categories in the inventory to signal that their marketplace status changed -void update_marketplace_category(const LLUUID& cat_id); +void update_marketplace_category(const LLUUID& cat_id, bool skip_consistency_enforcement = false); // Nudge all listing categories to signal that their marketplace status changed void update_all_marketplace_count(); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 8f8ea8e602..110f514017 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1537,11 +1537,11 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent) } } - mModifyMask |= mask; + mModifyMask |= mask; if (referent.notNull() && (mChangedItemIDs.find(referent) == mChangedItemIDs.end())) { mChangedItemIDs.insert(referent); - update_marketplace_category(referent); + update_marketplace_category(referent, true); if (mask & LLInventoryObserver::ADD) { diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index f6a0a28735..d3d529cedb 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -1318,7 +1318,7 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, cons } mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id, listing_id, version_id, is_listed); - update_marketplace_category(folder_id); + update_marketplace_category(folder_id, true); gInventory.notifyObservers(); return true; } @@ -1334,7 +1334,7 @@ bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update_slm) if (update_slm) { - update_marketplace_category(folder_id); + update_marketplace_category(folder_id, true); gInventory.notifyObservers(); } return true; @@ -1422,11 +1422,9 @@ bool LLMarketplaceData::isInActiveFolder(const LLUUID& obj_id) { S32 depth = depth_nesting_in_marketplace(obj_id); LLUUID listing_uuid = nested_parent_id(obj_id, depth); - // *TODO: use true activation status once SLM is in decent shape again - //bool active = getActivationState(listing_uuid); Hack waiting for SLM to allow activation again... - bool active = true; + bool active = getActivationState(listing_uuid); LLUUID version_uuid = getVersionFolder(listing_uuid); - return (active && gInventory.isObjectDescendentOf(obj_id, version_uuid)); + return (active && ((obj_id == listing_uuid) || (obj_id == version_uuid) || gInventory.isObjectDescendentOf(obj_id, version_uuid))); } // Private Modifiers @@ -1440,7 +1438,7 @@ bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id) (it->second).mListingId = listing_id; - update_marketplace_category(folder_id); + update_marketplace_category(folder_id, true); gInventory.notifyObservers(); return true; } @@ -1461,8 +1459,8 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID (it->second).mVersionFolderId = version_id; - update_marketplace_category(old_version_id); - update_marketplace_category(version_id); + update_marketplace_category(old_version_id, true); + update_marketplace_category(version_id, true); gInventory.notifyObservers(); return true; } @@ -1477,7 +1475,7 @@ bool LLMarketplaceData::setActivationState(const LLUUID& folder_id, bool activat (it->second).mIsActive = activate; - update_marketplace_category((it->second).mListingFolderId); + update_marketplace_category((it->second).mListingFolderId, true); gInventory.notifyObservers(); return true; } diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 665b9ab294..aabd9b89f0 100755 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -130,7 +130,7 @@ public: virtual void move(LLFolderViewModelItem* parent_listener); virtual BOOL isItemCopyable() const; virtual BOOL copyToClipboard() const; - virtual BOOL cutToClipboard() const; + virtual BOOL cutToClipboard(); virtual BOOL isClipboardPasteable() const; virtual void pasteFromClipboard(); virtual void pasteLinkFromClipboard(); @@ -542,7 +542,7 @@ BOOL LLTaskInvFVBridge::copyToClipboard() const return FALSE; } -BOOL LLTaskInvFVBridge::cutToClipboard() const +BOOL LLTaskInvFVBridge::cutToClipboard() { return FALSE; } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 4ed0bb6902..b2533b16ec 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -319,6 +319,19 @@ Initialization with the Marketplace failed because of a system or network error. yestext="OK"/> + + This action will unlist this listing. Do you want to continue? + confirm + + + Date: Wed, 4 Jun 2014 09:58:11 -0700 Subject: DD-84 : Final clean up for this fix --- indra/llui/llfolderview.cpp | 1 - indra/newview/llinventorybridge.cpp | 18 ++++++------------ indra/newview/llinventoryfunctions.cpp | 8 ++++---- indra/newview/llinventoryfunctions.h | 2 +- indra/newview/llinventorymodel.cpp | 2 +- indra/newview/llmarketplacefunctions.cpp | 12 ++++++------ 6 files changed, 18 insertions(+), 25 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 537f2ac4d7..2fb57d55e7 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -946,7 +946,6 @@ void LLFolderView::cut() if (listener) { listener->cutToClipboard(); - //listener->removeItem(); } } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index b471b0ca15..0f62c8555d 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -273,12 +273,12 @@ BOOL LLInvFVBridge::cutToClipboard() if (cut_from_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(mUUID)) { - // Prompt the user if cutting from marketplace active listing + // Prompt the user if cutting from a marketplace active listing LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInvFVBridge::callback_cutToClipboard, this, _1, _2)); } else { - // Otherwise just do the cut + // Otherwise just perform the cut return perform_cutToClipboard(); } } @@ -302,11 +302,9 @@ BOOL LLInvFVBridge::perform_cutToClipboard() if (obj && isItemMovable() && isItemRemovable()) { LLClipboard::instance().setCutMode(true); - if (LLClipboard::instance().addToClipboard(mUUID)) - { - removeObject(&gInventory, mUUID); - return TRUE; - } + BOOL added_to_clipboard = LLClipboard::instance().addToClipboard(mUUID); + removeObject(&gInventory, mUUID); // Always perform the remove even if the object couldn't make it to the clipboard + return added_to_clipboard; } return FALSE; } @@ -1517,7 +1515,6 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - //removeObject(model, mUUID); return; } else if ("copy" == action) @@ -2937,7 +2934,6 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - //removeObject(model, mUUID); return; } else if ("copy" == action) @@ -3245,7 +3241,7 @@ void LLFolderBridge::pasteFromClipboard() if (paste_into_marketplacelistings && !LLMarketplaceData::instance().isListed(mUUID) && LLMarketplaceData::instance().isInActiveFolder(mUUID)) { - // Prompt the user if pasting in marketplace active version listing (note that pasting right in the listing folder doesn't need a prompt) + // Prompt the user if pasting in a marketplace active version listing (note that pasting right under the listing folder root doesn't need a prompt) LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_pasteFromClipboard, this, _1, _2)); } else @@ -3271,8 +3267,6 @@ void LLFolderBridge::perform_pasteFromClipboard() LLInventoryModel* model = getInventoryModel(); if (model && isClipboardPasteable()) { - - const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index f832237b8d..da8c03eb7c 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -141,7 +141,7 @@ void update_marketplace_folder_hierarchy(const LLUUID cat_id) return; } -void update_marketplace_category(const LLUUID& cur_uuid, bool skip_consistency_enforcement) +void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistency_enforcement) { // When changing the marketplace status of an item, we usually have to change the status of all // folders in the same listing. This is because the display of each folder is affected by the @@ -160,7 +160,7 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool skip_consistency_e LLUUID listing_uuid = nested_parent_id(cur_uuid, depth); // Verify marketplace data consistency for this listing - if (!skip_consistency_enforcement && LLMarketplaceData::instance().isListed(listing_uuid)) + if (perform_consistency_enforcement && LLMarketplaceData::instance().isListed(listing_uuid)) { LLUUID version_folder_uuid = LLMarketplaceData::instance().getVersionFolder(listing_uuid); if (version_folder_uuid.notNull() && !gInventory.isObjectDescendentOf(version_folder_uuid, listing_uuid)) @@ -176,7 +176,7 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool skip_consistency_e } else if (depth < 0) { - if (!skip_consistency_enforcement && LLMarketplaceData::instance().isListed(cur_uuid)) + if (perform_consistency_enforcement && LLMarketplaceData::instance().isListed(cur_uuid)) { LL_INFOS("SLM") << "Disassociate as the listing folder is not under the marketplace folder anymore!!" << LL_ENDL; LLMarketplaceData::instance().clearListing(cur_uuid); @@ -1929,7 +1929,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root std::set selected_items = root->getSelectionList(); // Prompt the user for some marketplace active listing edits - if (user_confirm && (("cut" == action) || ("delete" == action) || ("rename" == action) || ("properties" == action) || ("task_properties" == action))) + if (user_confirm && (("delete" == action) || ("rename" == action) || ("properties" == action) || ("task_properties" == action))) { std::set::iterator set_iter = selected_items.begin(); LLFolderViewModelItemInventory * viewModel = NULL; diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index d52618d795..1fcc23cb69 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -59,7 +59,7 @@ void show_item_original(const LLUUID& item_uuid); void reset_inventory_filter(); // Nudge the listing categories in the inventory to signal that their marketplace status changed -void update_marketplace_category(const LLUUID& cat_id, bool skip_consistency_enforcement = false); +void update_marketplace_category(const LLUUID& cat_id, bool perform_consistency_enforcement = true); // Nudge all listing categories to signal that their marketplace status changed void update_all_marketplace_count(); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 110f514017..ea9658e51e 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1541,7 +1541,7 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent) if (referent.notNull() && (mChangedItemIDs.find(referent) == mChangedItemIDs.end())) { mChangedItemIDs.insert(referent); - update_marketplace_category(referent, true); + update_marketplace_category(referent, false); if (mask & LLInventoryObserver::ADD) { diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index d3d529cedb..d8f78ce81a 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -1318,7 +1318,7 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, cons } mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id, listing_id, version_id, is_listed); - update_marketplace_category(folder_id, true); + update_marketplace_category(folder_id, false); gInventory.notifyObservers(); return true; } @@ -1334,7 +1334,7 @@ bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update_slm) if (update_slm) { - update_marketplace_category(folder_id, true); + update_marketplace_category(folder_id, false); gInventory.notifyObservers(); } return true; @@ -1438,7 +1438,7 @@ bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id) (it->second).mListingId = listing_id; - update_marketplace_category(folder_id, true); + update_marketplace_category(folder_id, false); gInventory.notifyObservers(); return true; } @@ -1459,8 +1459,8 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID (it->second).mVersionFolderId = version_id; - update_marketplace_category(old_version_id, true); - update_marketplace_category(version_id, true); + update_marketplace_category(old_version_id, false); + update_marketplace_category(version_id, false); gInventory.notifyObservers(); return true; } @@ -1475,7 +1475,7 @@ bool LLMarketplaceData::setActivationState(const LLUUID& folder_id, bool activat (it->second).mIsActive = activate; - update_marketplace_category((it->second).mListingFolderId, true); + update_marketplace_category((it->second).mListingFolderId, false); gInventory.notifyObservers(); return true; } -- cgit v1.3 From 84b3899af26bdc8995641e3b89882fab4a79add1 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sat, 28 Mar 2015 14:32:50 -0700 Subject: DD-291 : Trigger a GET /listing when receiving a category update --- indra/newview/llinventorymodel.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 1cfa0a9ebf..b44bd38841 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -41,6 +41,7 @@ #include "llinventoryobserver.h" #include "llinventorypanel.h" #include "llnotificationsutil.h" +#include "llmarketplacefunctions.h" #include "llwindow.h" #include "llviewercontrol.h" #include "llpreview.h" @@ -3059,6 +3060,15 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) LL_DEBUGS("Inventory") << "unpacked folder '" << tfolder->getName() << "' (" << tfolder->getUUID() << ") in " << tfolder->getParentUUID() << LL_ENDL; + + // If the parent folder is a listing folder, we also need to update the SLM data + if (LLMarketplaceData::instance().isListed(tfolder->getParentUUID())) + { + // Trigger an SLM listing update + S32 listing_id = LLMarketplaceData::instance().getListingID(tfolder->getParentUUID()); + LLMarketplaceData::instance().getListing(listing_id); + } + if(tfolder->getUUID().notNull()) { folders.push_back(tfolder); -- cgit v1.3 From 0118a862fb63971b8b718ebecf72292b8318e464 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 1 Apr 2015 21:54:07 -0700 Subject: DD-291 : Fix code path on category update in the SLM update case --- indra/newview/llinventorymodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index b44bd38841..9f621b1e88 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3061,15 +3061,15 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) << tfolder->getUUID() << ") in " << tfolder->getParentUUID() << LL_ENDL; - // If the parent folder is a listing folder, we also need to update the SLM data + // If the parent folder is a listing folder, all we need to do is update the SLM data if (LLMarketplaceData::instance().isListed(tfolder->getParentUUID())) { // Trigger an SLM listing update S32 listing_id = LLMarketplaceData::instance().getListingID(tfolder->getParentUUID()); LLMarketplaceData::instance().getListing(listing_id); + // In that case, there is no item to update so no callback -> we skip the rest of the update } - - if(tfolder->getUUID().notNull()) + else if(tfolder->getUUID().notNull()) { folders.push_back(tfolder); LLViewerInventoryCategory* folderp = gInventory.getCategory(tfolder->getUUID()); -- cgit v1.3 From 32e5d99c9d4b14116eb12a49e9349ee7b1802ee4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 2 Apr 2015 21:40:22 -0700 Subject: DD-291 : Use a heavier but more resilient test for listing updates --- indra/newview/llinventorymodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 9f621b1e88..8c4be57aaa 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3062,7 +3062,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) << LL_ENDL; // If the parent folder is a listing folder, all we need to do is update the SLM data - if (LLMarketplaceData::instance().isListed(tfolder->getParentUUID())) + if (depth_nesting_in_marketplace(tfolder->getParentUUID()) == 1) { // Trigger an SLM listing update S32 listing_id = LLMarketplaceData::instance().getListingID(tfolder->getParentUUID()); -- cgit v1.3 From 68771449157d27309ea77119d50dd8da31db1b23 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 9 Apr 2015 16:47:46 -0700 Subject: DD-384, DD-388 : Do not trust cached values for stock folders, do not consider a non fetched stock folder empty --- indra/newview/llinventoryfunctions.cpp | 5 +++++ indra/newview/llinventorymodel.cpp | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 386819b25a..123e55a8ee 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1024,6 +1024,11 @@ S32 compute_stock_count(LLUUID cat_uuid, bool force_count /* false */) } if (cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { + if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN) + { + // If the folder is not completely fetched, we do not want to return any confusing value that could lead to unlisting + return -1; + } // Note: stock folders are *not* supposed to have nested subfolders so we stop recursion here but we count only items (subfolders will be ignored) // Note: we *always* give a stock count for stock folders, it's useful even if the listing is unassociated LLInventoryModel::cat_array_t* cat_array; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 8c4be57aaa..5139564a6d 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1995,17 +1995,22 @@ bool LLInventoryModel::loadSkeleton( // we can safely ignore anything loaded from file, but // not sent down in the skeleton. Must have been removed from inventory. - if(cit == not_cached) + if (cit == not_cached) { continue; } - if(cat->getVersion() != tcat->getVersion()) + else if (cat->getVersion() != tcat->getVersion()) { // if the cached version does not match the server version, // throw away the version we have so we can fetch the // correct contents the next time the viewer opens the folder. tcat->setVersion(NO_VERSION); } + else if (tcat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + // Do not trust stock folders being updated + tcat->setVersion(NO_VERSION); + } else { cached_ids.insert(tcat->getUUID()); -- cgit v1.3 From 1717a7edbd8be48155685afb2ac1601cc971dee6 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 1 May 2015 14:28:58 -0700 Subject: DD-379 : React on update for both listing and version folders --- indra/newview/llinventorymodel.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 5139564a6d..0bad4702e0 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3066,11 +3066,13 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) << tfolder->getUUID() << ") in " << tfolder->getParentUUID() << LL_ENDL; - // If the parent folder is a listing folder, all we need to do is update the SLM data - if (depth_nesting_in_marketplace(tfolder->getParentUUID()) == 1) + // If the folder is a listing or a version folder, all we need to do is update the SLM data + int depth_folder = depth_nesting_in_marketplace(tfolder->getUUID()); + if ((depth_folder == 1) || (depth_folder == 2)) { // Trigger an SLM listing update - S32 listing_id = LLMarketplaceData::instance().getListingID(tfolder->getParentUUID()); + LLUUID listing_uuid = (depth_folder == 1 ? tfolder->getUUID() : tfolder->getParentUUID()); + S32 listing_id = LLMarketplaceData::instance().getListingID(listing_uuid); LLMarketplaceData::instance().getListing(listing_id); // In that case, there is no item to update so no callback -> we skip the rest of the update } -- cgit v1.3