summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodel.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-03-27 22:39:31 -0400
committerNat Goodspeed <nat@lindenlab.com>2012-03-27 22:39:31 -0400
commitb7e0e44e3246299b639f787e3ab9b8e59cdc05c3 (patch)
tree475ea883c65a66f97d5db24a4c1041073e60a596 /indra/newview/llinventorymodel.cpp
parentb8561da34d5d733670b6b1eabf483871ec6c18b0 (diff)
CHOP-854: Use new LLInventoryModel::removeObject() to discard offer.
Introduce new LLInventoryModel::removeCategory() method comparable to removeItem(), but for folder objects (using changeCategoryParent() rather than changeItemParent()). Introduce removeObject() method that calls one of the above, depending on runtime object type.
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rw-r--r--indra/newview/llinventorymodel.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index de52f3a18d..1ede6bc1c9 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -46,6 +46,7 @@
#include "llviewerregion.h"
#include "llcallbacklist.h"
#include "llvoavatarself.h"
+#include <typeinfo>
//#define DIFF_INVENTORY_FILES
#ifdef DIFF_INVENTORY_FILES
@@ -3003,6 +3004,44 @@ void LLInventoryModel::removeItem(const LLUUID& item_id)
}
}
+void LLInventoryModel::removeCategory(const LLUUID& category_id)
+{
+ LLViewerInventoryCategory* cat = getCategory(category_id);
+ if (! cat)
+ {
+ LL_WARNS("Inventory") << "couldn't find inventory folder " << category_id << LL_ENDL;
+ }
+ else
+ {
+ const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LL_INFOS("Inventory") << "Moving to Trash (" << new_parent << "):" << LL_ENDL;
+ changeCategoryParent(cat, new_parent, TRUE);
+ }
+}
+
+void LLInventoryModel::removeObject(const LLUUID& object_id)
+{
+ LLInventoryObject* obj = getObject(object_id);
+ if (dynamic_cast<LLViewerInventoryItem*>(obj))
+ {
+ removeItem(object_id);
+ }
+ else if (dynamic_cast<LLViewerInventoryCategory*>(obj))
+ {
+ removeCategory(object_id);
+ }
+ else if (obj)
+ {
+ LL_WARNS("Inventory") << "object ID " << object_id
+ << " is an object of unrecognized class "
+ << typeid(*obj).name() << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Inventory") << "object ID " << object_id << " not found" << LL_ENDL;
+ }
+}
+
const LLUUID &LLInventoryModel::getRootFolderID() const
{
return mRootFolderID;