diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2012-04-14 22:23:24 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2012-04-14 22:23:24 -0400 |
commit | ee87fd975faf403707908cd3c7d37f8431df46ac (patch) | |
tree | b5bd5b42f7248db3aeeb92013eb18d983d7da505 /indra/newview/llinventoryfunctions.cpp | |
parent | 11bbd7e10e0f9a3c4848e0b19acf4e4bd286a02a (diff) |
DRTVWR-136: Remove redundant remove_(item|category)() functions.
Incoming changes from two different project repos left viewer-development with
LLInventoryModel::removeItem() and removeCategory() plus free functions
remove_item() and remove_category() in llinventoryfunctions.cpp.
remove_category() was actually the better implementation; migrated its body
into LLInventoryModel::removeCategory(). Clearly the previous state of affairs
-- with LLInventoryModel::removeItem() plus a remove_category() free function
in a very different source file -- fooled two different developers into
overlooking the other of the pair. Unfortunately we each added different
"missing" functions, leaving us with a complete set of four.
Fix existing references to remove_item() and remove_category() free functions.
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 60 |
1 files changed, 1 insertions, 59 deletions
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) |