diff options
-rw-r--r-- | indra/newview/llfolderview.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 60 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.h | 4 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 43 | ||||
-rw-r--r-- | indra/newview/lloutfitslist.cpp | 2 |
6 files changed, 38 insertions, 87 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index bad0d8cd8f..1fa194ab19 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -1059,19 +1059,7 @@ void LLFolderView::removeCutItems() iter != objects.end(); ++iter) { - const LLUUID& item_id = (*iter); - LLInventoryObject *obj = gInventory.getObject(item_id); - if (obj) - { - if (LLAssetType::AT_CATEGORY == obj->getType()) - { - remove_category(&gInventory, item_id); - } - else - { - remove_item(&gInventory, item_id); - } - } + gInventory.removeObject(*iter); } } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index cae04ccb49..b86c453d61 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2948,7 +2948,7 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re { // move it to the trash LLPreview::hide(mUUID); - remove_category(getInventoryModel(), mUUID); + getInventoryModel()->removeCategory(mUUID); return TRUE; } return FALSE; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 94d1b19726..ab5b082915 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -108,64 +108,6 @@ void append_path(const LLUUID& id, std::string& path) path.append(temp); } -// Move the item to the trash. Works for folders and objects. -// Caution: This method assumes that the item is removable! -void remove_item(LLInventoryModel* model, const LLUUID& id) -{ - LLViewerInventoryItem* item = model->getItem(id); - if (!item) - return; - - if (item->getType() == LLAssetType::AT_CATEGORY) - { - // Call the general helper function to delete a folder - remove_category(model, id); - } - else - { - // Get the trash UUID - LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false); - if (trash_id.notNull()) - { - // Finally, move the item to the trash - model->changeItemParent(item, trash_id, true); - } - } -} - -void remove_category(LLInventoryModel* model, const LLUUID& cat_id) -{ - if (!model || !get_is_category_removable(model, cat_id)) - { - return; - } - - // Look for any gestures and deactivate them - LLInventoryModel::cat_array_t descendent_categories; - LLInventoryModel::item_array_t descendent_items; - gInventory.collectDescendents(cat_id, descendent_categories, descendent_items, FALSE); - - for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin(); - iter != descendent_items.end(); - ++iter) - { - const LLViewerInventoryItem* item = (*iter); - const LLUUID& item_id = item->getUUID(); - if (item->getType() == LLAssetType::AT_GESTURE - && LLGestureMgr::instance().isGestureActive(item_id)) - { - LLGestureMgr::instance().deactivateGesture(item_id); - } - } - - LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (cat) - { - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - model->changeCategoryParent(cat, trash_id, TRUE); - } -} - void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name) { LLViewerInventoryCategory* cat; @@ -610,7 +552,7 @@ void move_to_outbox_cb_action(const LLSD& payload) if (cat_array->empty() && item_array->empty()) { - remove_category(&gInventory, parent); + gInventory.removeCategory(parent); } if (parent == top_level_folder) diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 535d831e47..5cf9c528b0 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -57,10 +57,6 @@ void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id); void show_item_original(const LLUUID& item_uuid); -void remove_item(LLInventoryModel* model, const LLUUID& id); - -void remove_category(LLInventoryModel* model, const LLUUID& cat_id); - void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name); void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& parent_id, const LLUUID& root_copy_id = LLUUID::null); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 1ea4cb63f6..85ecb133d0 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -47,6 +47,7 @@ #include "llviewerregion.h" #include "llcallbacklist.h" #include "llvoavatarself.h" +#include "llgesturemgr.h" #include <typeinfo> //#define DIFF_INVENTORY_FILES @@ -3032,23 +3033,47 @@ void LLInventoryModel::removeItem(const LLUUID& item_id) else { const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH); - LL_INFOS("Inventory") << "Moving to Trash (" << new_parent << "):" << LL_ENDL; - changeItemParent(item, new_parent, TRUE); + if (new_parent.notNull()) + { + LL_INFOS("Inventory") << "Moving to Trash (" << new_parent << "):" << LL_ENDL; + changeItemParent(item, new_parent, TRUE); + } } } void LLInventoryModel::removeCategory(const LLUUID& category_id) { - LLViewerInventoryCategory* cat = getCategory(category_id); - if (! cat) + if (! get_is_category_removable(this, category_id)) { - LL_WARNS("Inventory") << "couldn't find inventory folder " << category_id << LL_ENDL; + return; } - else + + // Look for any gestures and deactivate them + LLInventoryModel::cat_array_t descendent_categories; + LLInventoryModel::item_array_t descendent_items; + collectDescendents(category_id, descendent_categories, descendent_items, FALSE); + + for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin(); + iter != descendent_items.end(); + ++iter) { - const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH); - LL_INFOS("Inventory") << "Moving to Trash (" << new_parent << "):" << LL_ENDL; - changeCategoryParent(cat, new_parent, TRUE); + const LLViewerInventoryItem* item = (*iter); + const LLUUID& item_id = item->getUUID(); + if (item->getType() == LLAssetType::AT_GESTURE + && LLGestureMgr::instance().isGestureActive(item_id)) + { + LLGestureMgr::instance().deactivateGesture(item_id); + } + } + + LLViewerInventoryCategory* cat = getCategory(category_id); + if (cat) + { + const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); + if (trash_id.notNull()) + { + changeCategoryParent(cat, trash_id, TRUE); + } } } diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 1dc4d796ab..ef5ef2ddc8 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -640,7 +640,7 @@ void LLOutfitsList::onOutfitsRemovalConfirmation(const LLSD& notification, const if (mSelectedOutfitUUID.notNull()) { - remove_category(&gInventory, mSelectedOutfitUUID); + gInventory.removeCategory(mSelectedOutfitUUID); } } |