summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llinventorymodel.cpp99
-rw-r--r--indra/newview/llinventorymodel.h4
-rw-r--r--indra/newview/llinventoryobserver.h7
-rw-r--r--indra/newview/llinventorypanel.cpp26
4 files changed, 81 insertions, 55 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index ea6dfb8e7a..29096ff718 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -871,46 +871,48 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
// Delete a particular inventory object by ID.
void LLInventoryModel::deleteObject(const LLUUID& id)
{
- // Disabling this; let users manually purge linked objects.
- // purgeLinkedObjects(id);
lldebugs << "LLInventoryModel::deleteObject()" << llendl;
LLPointer<LLInventoryObject> obj = getObject(id);
- if(obj)
+ if (!obj)
{
- lldebugs << "Deleting inventory object " << id << llendl;
- mLastItem = NULL;
- LLUUID parent_id = obj->getParentUUID();
- mCategoryMap.erase(id);
- mItemMap.erase(id);
- //mInventory.erase(id);
- item_array_t* item_list = getUnlockedItemArray(parent_id);
- if(item_list)
- {
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)((LLInventoryObject*)obj);
- item_list->removeObj(item);
- }
- cat_array_t* cat_list = getUnlockedCatArray(parent_id);
- if(cat_list)
- {
- LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)((LLInventoryObject*)obj);
- cat_list->removeObj(cat);
- }
- item_list = getUnlockedItemArray(id);
- if(item_list)
- {
- delete item_list;
- mParentChildItemTree.erase(id);
- }
- cat_list = getUnlockedCatArray(id);
- if(cat_list)
- {
- delete cat_list;
- mParentChildCategoryTree.erase(id);
- }
- addChangedMask(LLInventoryObserver::REMOVE, id);
- obj = NULL; // delete obj
- gInventory.notifyObservers();
+ llwarns << "Deleting non-existent object [ id: " << id << " ] " << llendl;
+ return;
+ }
+
+ lldebugs << "Deleting inventory object " << id << llendl;
+ mLastItem = NULL;
+ LLUUID parent_id = obj->getParentUUID();
+ mCategoryMap.erase(id);
+ mItemMap.erase(id);
+ //mInventory.erase(id);
+ item_array_t* item_list = getUnlockedItemArray(parent_id);
+ if(item_list)
+ {
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)((LLInventoryObject*)obj);
+ item_list->removeObj(item);
}
+ cat_array_t* cat_list = getUnlockedCatArray(parent_id);
+ if(cat_list)
+ {
+ LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)((LLInventoryObject*)obj);
+ cat_list->removeObj(cat);
+ }
+ item_list = getUnlockedItemArray(id);
+ if(item_list)
+ {
+ delete item_list;
+ mParentChildItemTree.erase(id);
+ }
+ cat_list = getUnlockedCatArray(id);
+ if(cat_list)
+ {
+ delete cat_list;
+ mParentChildCategoryTree.erase(id);
+ }
+ addChangedMask(LLInventoryObserver::REMOVE, id);
+ obj = NULL; // delete obj
+ updateLinkedObjectsFromPurge(id);
+ gInventory.notifyObservers();
}
// Delete a particular inventory item by ID, and remove it from the server.
@@ -926,26 +928,23 @@ void LLInventoryModel::purgeObject(const LLUUID &id)
}
}
-void LLInventoryModel::purgeLinkedObjects(const LLUUID &id)
+void LLInventoryModel::updateLinkedObjectsFromPurge(const LLUUID &baseobj_id)
{
- LLInventoryObject* objectp = getObject(id);
- if (!objectp) return;
+ LLInventoryModel::item_array_t item_array = collectLinkedItems(baseobj_id);
- if (objectp->getIsLinkType())
- {
- return;
- }
-
- LLInventoryModel::item_array_t item_array = collectLinkedItems(id);
-
- for (LLInventoryModel::item_array_t::iterator iter = item_array.begin();
+ // REBUILD is expensive, so clear the current change list first else
+ // everything else on the changelist will also get rebuilt.
+ gInventory.notifyObservers();
+ for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
iter != item_array.end();
iter++)
{
- LLViewerInventoryItem *linked_item = (*iter);
- if (linked_item->getUUID() == id) continue;
- purgeObject(linked_item->getUUID());
+ const LLViewerInventoryItem *linked_item = (*iter);
+ const LLUUID &item_id = linked_item->getUUID();
+ if (item_id == baseobj_id) continue;
+ addChangedMask(LLInventoryObserver::REBUILD, item_id);
}
+ gInventory.notifyObservers();
}
// This is a method which collects the descendents of the id
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index d47614e403..c3e04ab93c 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -216,9 +216,9 @@ public:
void deleteObject(const LLUUID& id);
// delete a particular inventory object by ID, and delete it from
- // the server. Also purges linked items via purgeLinkedObjects.
+ // the server. Also updates linked items.
void purgeObject(const LLUUID& id);
- void purgeLinkedObjects(const LLUUID& id);
+ void updateLinkedObjectsFromPurge(const LLUUID& baseobj_id);
// This is a method which collects the descendants of the id
// provided. If the category is not found, no action is
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h
index 4ee6c48cb1..99e6dbe3c8 100644
--- a/indra/newview/llinventoryobserver.h
+++ b/indra/newview/llinventoryobserver.h
@@ -56,11 +56,12 @@ public:
{
NONE = 0,
LABEL = 1, // name changed
- INTERNAL = 2, // internal change, eg, asset uuid different
+ INTERNAL = 2, // internal change (e.g. asset uuid different)
ADD = 4, // something added
REMOVE = 8, // something deleted
- STRUCTURE = 16, // structural change, eg, item or folder moved
- CALLING_CARD = 32, // online, grant status, cancel, etc change
+ STRUCTURE = 16, // structural change (eg item or folder moved)
+ CALLING_CARD = 32, // (eg online, grant status, cancel)
+ REBUILD = 64, // item UI changed (eg item type different)
ALL = 0xffffffff
};
LLInventoryObserver();
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 02d0217321..88e7196ce6 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -293,6 +293,30 @@ void LLInventoryPanel::modelChanged(U32 mask)
view_item->refresh();
}
}
+
+ //////////////////////////////
+ // REBUILD Operation
+ // Destroy and regenerate the UI.
+ if (mask & LLInventoryObserver::REBUILD)
+ {
+ handled = true;
+ if (model_item && view_item)
+ {
+ view_item->destroyView();
+ }
+ buildNewViews(item_id);
+ }
+
+ //////////////////////////////
+ // INTERNAL Operation
+ // This could be anything. For now, just refresh the item.
+ if (mask & LLInventoryObserver::INTERNAL)
+ {
+ if (view_item)
+ {
+ view_item->refresh();
+ }
+ }
// We don't typically care which of these masks the item is actually flagged with, since the masks
// may not be accurate (e.g. in the main inventory panel, I move an item from My Inventory into
@@ -359,6 +383,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
}
}
+ /* I don't think we need this code, but not positive -- Seraph
if (!handled)
{
// It's a small change that only requires a refresh.
@@ -366,6 +391,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
// since it is expensive on large inventories
mFolders->refresh();
}
+ */
}
// static