diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-11-10 23:36:33 +0200 |
|---|---|---|
| committer | akleshchev <117672381+akleshchev@users.noreply.github.com> | 2023-11-13 19:24:10 +0200 |
| commit | aff01e2fd4fb5475eb42ce58d1ad997341cb7a94 (patch) | |
| tree | 968058a22b9791f8cf776126c2b1d59d176014b8 /indra/newview/llinventorygallery.cpp | |
| parent | 03e00dab6de28e447942fbb32b6c2604acbdc118 (diff) | |
SL-20575 Fix some deletion issues
- Fixes 'cut' checks for gallery
- Checking if large folder is deletable should be faster now
- For large flat root folders eliminated delay of looking for cof
Might be a good idea to start cashing isItemRemovable if category
version hasn't changed.
Diffstat (limited to 'indra/newview/llinventorygallery.cpp')
| -rw-r--r-- | indra/newview/llinventorygallery.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index ad6c3909ef..3c3da253d3 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -1668,6 +1668,45 @@ void LLInventoryGallery::cut() mFilterSubString.clear(); } + + +bool is_category_removable(const LLUUID& folder_id, bool check_worn) +{ + if (!get_is_category_removable(&gInventory, folder_id)) + { + return false; + } + + // check children + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(folder_id, cat_array, item_array); + + for (LLInventoryModel::item_array_t::value_type& item : *item_array) + { + if (!get_is_item_removable(&gInventory, item->getUUID(), check_worn)) + { + return false; + } + } + + for (LLInventoryModel::cat_array_t::value_type& cat : *cat_array) + { + if (!is_category_removable(cat->getUUID(), check_worn)) + { + return false; + } + } + + const LLUUID mp_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); + if (mp_id.notNull() && gInventory.isObjectDescendentOf(folder_id, mp_id)) + { + return false; + } + + return true; +} + BOOL LLInventoryGallery::canCut() const { if (!getVisible() || !getEnabled() || mSelectedItemIDs.empty()) @@ -1680,7 +1719,7 @@ BOOL LLInventoryGallery::canCut() const LLViewerInventoryCategory* cat = gInventory.getCategory(id); if (cat) { - if (!get_is_category_removable(&gInventory, id)) + if (!get_is_category_and_children_removable(&gInventory, id, true)) { return FALSE; } |
