summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodel.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-04-14 22:23:24 -0400
committerNat Goodspeed <nat@lindenlab.com>2012-04-14 22:23:24 -0400
commitee87fd975faf403707908cd3c7d37f8431df46ac (patch)
treeb5bd5b42f7248db3aeeb92013eb18d983d7da505 /indra/newview/llinventorymodel.cpp
parent11bbd7e10e0f9a3c4848e0b19acf4e4bd286a02a (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/llinventorymodel.cpp')
-rw-r--r--indra/newview/llinventorymodel.cpp43
1 files changed, 34 insertions, 9 deletions
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);
+ }
}
}