diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2017-06-20 19:38:37 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2017-06-20 19:38:37 +0300 |
commit | dca1a4c350fa69abf38a9d8fb3c256d60ab556e5 (patch) | |
tree | 74b468455751e296c15ebfe66d3060c2c4df0add /indra | |
parent | e553e6feb2d9ad624d7dd24366d9a21c1dd093b9 (diff) |
MAINT-7508 Fixed Trash says that it will delete items, but some items are being ignored
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llviewerinventory.cpp | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index da6b18bb77..6c9fe5e39b 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1511,67 +1511,64 @@ void purge_descendents_of(const LLUUID& id, LLPointer<LLInventoryCallback> cb) LLPointer<LLViewerInventoryCategory> cat = gInventory.getCategory(id); if (cat.notNull()) { - if (LLClipboard::instance().hasContents() && LLClipboard::instance().isCutMode()) + if (LLClipboard::instance().hasContents()) { - // Something on the clipboard is in "cut mode" and needs to be preserved - LL_DEBUGS(LOG_INV) << "purge_descendents_of clipboard case " << cat->getName() - << " iterate and purge non hidden items" << LL_ENDL; - LLInventoryModel::cat_array_t* categories; - LLInventoryModel::item_array_t* items; - // Get the list of direct descendants in tha categoy passed as argument - gInventory.getDirectDescendentsOf(id, categories, items); - std::vector<LLUUID> list_uuids; - // Make a unique list with all the UUIDs of the direct descendants (items and categories are not treated differently) - // Note: we need to do that shallow copy as purging things will invalidate the categories or items lists - for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); it != categories->end(); ++it) - { - list_uuids.push_back((*it)->getUUID()); - } - for (LLInventoryModel::item_array_t::const_iterator it = items->begin(); it != items->end(); ++it) + // Remove items from clipboard or it will remain active even if there is nothing to paste/copy + LLInventoryModel::cat_array_t categories; + LLInventoryModel::item_array_t items; + gInventory.collectDescendents(id, categories, items, TRUE); + + for (LLInventoryModel::cat_array_t::const_iterator it = categories.begin(); it != categories.end(); ++it) { - list_uuids.push_back((*it)->getUUID()); + if (LLClipboard::instance().isOnClipboard((*it)->getUUID())) + { + // No sense in removing single items, partial 'paste' will result in confusion only + LLClipboard::instance().reset(); + break; + } } - // Iterate through the list and only purge the UUIDs that are not on the clipboard - for (std::vector<LLUUID>::const_iterator it = list_uuids.begin(); it != list_uuids.end(); ++it) + if (LLClipboard::instance().hasContents()) { - if (!LLClipboard::instance().isOnClipboard(*it)) + for (LLInventoryModel::item_array_t::const_iterator it = items.begin(); it != items.end(); ++it) { - remove_inventory_object(*it, NULL); + if (LLClipboard::instance().isOnClipboard((*it)->getUUID())) + { + LLClipboard::instance().reset(); + break; + } } } } - else + + if (AISAPI::isAvailable()) { - if (AISAPI::isAvailable()) + if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN) { - if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN) - { - LL_WARNS() << "Purging not fetched folder: " << cat->getName() << LL_ENDL; - } - AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t(); - AISAPI::PurgeDescendents(id, cr); + LL_WARNS() << "Purging not fetched folder: " << cat->getName() << LL_ENDL; } - else // no cap + AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t(); + AISAPI::PurgeDescendents(id, cr); + } + else // no cap + { + // Fast purge + LL_DEBUGS(LOG_INV) << "purge_descendents_of fast case " << cat->getName() << LL_ENDL; + + // send it upstream + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("PurgeInventoryDescendents"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("InventoryData"); + msg->addUUID("FolderID", id); + gAgent.sendReliableMessage(); + + // Update model immediately because there is no callback mechanism. + gInventory.onDescendentsPurgedFromServer(id); + if (cb) { - // Fast purge - LL_DEBUGS(LOG_INV) << "purge_descendents_of fast case " << cat->getName() << LL_ENDL; - - // send it upstream - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("PurgeInventoryDescendents"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("InventoryData"); - msg->addUUID("FolderID", id); - gAgent.sendReliableMessage(); - - // Update model immediately because there is no callback mechanism. - gInventory.onDescendentsPurgedFromServer(id); - if (cb) - { - cb->fire(id); - } + cb->fire(id); } } } |