summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-03-27 19:06:33 -0400
committerNat Goodspeed <nat@lindenlab.com>2012-03-27 19:06:33 -0400
commitb8561da34d5d733670b6b1eabf483871ec6c18b0 (patch)
tree2fcd5fe4278e52a534dc9e73438205e32c581c16
parentfdd018783a0cc06a467443ca7c9ea0876a87ef49 (diff)
CHOP-854: Make LLInventoryModel::removeItem() call changeItemParent().
The body of removeItem() was already nearly identical to the body of changeItemParent(); this eliminates the redundancy. Improve logging for changeItemParent().
-rw-r--r--indra/newview/llinventorymodel.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 6cc0d6768e..de52f3a18d 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1022,8 +1022,16 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item,
const LLUUID& new_parent_id,
BOOL restamp)
{
- if (item->getParentUUID() != new_parent_id)
+ if (item->getParentUUID() == new_parent_id)
{
+ LL_DEBUGS("Inventory") << "'" << item->getName() << "' (" << item->getUUID()
+ << ") is already in folder " << new_parent_id << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS("Inventory") << "Moving '" << item->getName() << "' (" << item->getUUID()
+ << ") from " << item->getParentUUID() << " to folder "
+ << new_parent_id << LL_ENDL;
LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
update.push_back(old_folder);
@@ -2983,21 +2991,15 @@ void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderT
void LLInventoryModel::removeItem(const LLUUID& item_id)
{
LLViewerInventoryItem* item = getItem(item_id);
- const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if (item && item->getParentUUID() != new_parent)
+ if (! item)
{
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(new_parent, 1);
- update.push_back(new_folder);
- accountForUpdate(update);
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setParent(new_parent);
- new_item->updateParentOnServer(TRUE);
- updateItem(new_item);
- notifyObservers();
+ LL_WARNS("Inventory") << "couldn't find inventory item " << item_id << LL_ENDL;
+ }
+ else
+ {
+ const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LL_INFOS("Inventory") << "Moving to Trash (" << new_parent << "):" << LL_ENDL;
+ changeItemParent(item, new_parent, TRUE);
}
}