summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorypanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r--indra/newview/llinventorypanel.cpp145
1 files changed, 47 insertions, 98 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 97f90ac845..3a8b8bdf9e 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -38,55 +38,16 @@
// Seraph TODO: Remove unnecessary headers
-// library includes
#include "llagent.h"
#include "llagentwearables.h"
-#include "llcallingcard.h"
-#include "llfloaterreg.h"
-#include "llsdserialize.h"
-#include "llfiltereditor.h"
-#include "llspinctrl.h"
-#include "llui.h"
-#include "message.h"
-
-// newview includes
#include "llappearancemgr.h"
-#include "llappviewer.h"
-#include "llfirstuse.h"
-#include "llfloaterchat.h"
-#include "llfloatercustomize.h"
-#include "llfocusmgr.h"
-#include "llfolderview.h"
-#include "llgesturemgr.h"
-#include "lliconctrl.h"
+#include "llfloaterreg.h"
#include "llimview.h"
#include "llinventorybridge.h"
-#include "llinventoryclipboard.h"
-#include "llinventorymodel.h"
-#include "lllineeditor.h"
-#include "llmenugl.h"
-#include "llpreviewanim.h"
-#include "llpreviewgesture.h"
-#include "llpreviewnotecard.h"
-#include "llpreviewscript.h"
-#include "llpreviewsound.h"
-#include "llpreviewtexture.h"
-#include "llresmgr.h"
-#include "llscrollbar.h"
#include "llscrollcontainer.h"
-#include "llselectmgr.h"
-#include "lltabcontainer.h"
-#include "lltooldraganddrop.h"
-#include "lluictrlfactory.h"
#include "llviewerfoldertype.h"
-#include "llviewerinventory.h"
-#include "llviewermessage.h"
-#include "llviewerobjectlist.h"
-#include "llviewerregion.h"
-#include "llviewerwindow.h"
-#include "llvoavatarself.h"
-#include "llwearablelist.h"
#include "llimfloater.h"
+#include "llvoavatarself.h"
static LLDefaultChildRegistry::Register<LLInventoryPanel> r("inventory_panel");
@@ -303,7 +264,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
return;
}
- if(mask & LLInventoryObserver::LABEL)
+ if (mask & LLInventoryObserver::LABEL)
{
handled = true;
// label change - empty out the display name for each object
@@ -328,9 +289,15 @@ void LLInventoryPanel::modelChanged(U32 mask)
}
}
}
- if((mask & (LLInventoryObserver::STRUCTURE
- | LLInventoryObserver::ADD
- | LLInventoryObserver::REMOVE)) != 0)
+
+ // We don't really 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
+ // Landmarks; this is a STRUCTURE change for that panel but is an ADD change for the Landmarks
+ // panel). What's relevant is that the item and UI are probably out of sync and thus need to be
+ // resynchronized.
+ if (mask & (LLInventoryObserver::STRUCTURE |
+ LLInventoryObserver::ADD |
+ LLInventoryObserver::REMOVE))
{
handled = true;
// Record which folders are open by uuid.
@@ -347,74 +314,56 @@ void LLInventoryPanel::modelChanged(U32 mask)
LLInventoryObject* model_item = model->getObject(*id_it);
LLFolderViewItem* view_item = mFolders->getItemByID(*id_it);
- if (model_item)
+ // Item exists in memory but a UI element hasn't been created for it.
+ if (model_item && !view_item)
{
- if (!view_item)
+ // Add the UI element for this item.
+ buildNewViews(*id_it);
+ // Select any newly created object that has the auto rename at top of folder root set.
+ if(mFolders->getRoot()->needsAutoRename())
{
- // this object was just created, need to build a view for it
- if ((mask & LLInventoryObserver::ADD) != LLInventoryObserver::ADD)
- {
- llwarns << *id_it << " is in model but not in view, but ADD flag not set" << llendl;
- }
- buildNewViews(*id_it);
-
- // select any newly created object
- // that has the auto rename at top of folder
- // root set
- if(mFolders->getRoot()->needsAutoRename())
- {
- setSelection(*id_it, FALSE);
- }
+ setSelection(*id_it, FALSE);
}
- else
- {
- // this object was probably moved, check its parent
- if ((mask & LLInventoryObserver::STRUCTURE) != LLInventoryObserver::STRUCTURE)
- {
- llwarns << *id_it << " is in model and in view, but STRUCTURE flag not set" << " for model (Name :" << model_item->getName() << " )" << llendl;
- }
+ }
- LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID());
+ // This item already exists in both memory and UI. It was probably moved
+ // around in the panel's directory structure (i.e. reparented).
+ if (model_item && view_item)
+ {
+ LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID());
- // added check against NULL for cases when Inventory panel contains startFolder.
- // in this case parent is LLFolderView (LLInventoryPanel::mFolders) itself.
- // this check is a fix for bug EXT-1859.
- if (NULL != new_parent && view_item->getParentFolder() != new_parent)
+ // Item has been moved.
+ if (view_item->getParentFolder() != new_parent)
+ {
+ if (new_parent != NULL)
{
+ // Item is to be moved and we found its new parent in the panel's directory, so move the item's UI.
view_item->getParentFolder()->extractItem(view_item);
view_item->addToFolder(new_parent, mFolders);
}
-/*
- on the other side in case Inventory Panel has content of the any folder
- it is possible that item moved to some folder which is absent in current
- Panel. For ex. removing item (via moving to trash).
- In this case we need to check if new parent is other then inventory start folder
- and simply remove its View from the hierarchy.
- See details in EXT-2098.
-*/
- // So, let check if item was moved into folder out of this Inventory Panel.
- else if (mStartFolderID.notNull() && NULL == new_parent && model_item->getParentUUID() != mStartFolderID)
- {
- view_item->getParentFolder()->extractItem(view_item);
- }
- }
- }
- else
- {
- if (view_item)
- {
- if ((mask & LLInventoryObserver::REMOVE) != LLInventoryObserver::REMOVE)
+ else
{
- llwarns << *id_it << " is not in model but in view, but REMOVE flag not set" << llendl;
+ // Item is to be moved outside the panel's directory (e.g. moved to trash for a panel that
+ // doesn't include trash). Just remove the item's UI.
+ view_item->destroyView();
}
- // item in view but not model, need to delete view
- view_item->destroyView();
}
else
{
- llwarns << *id_it << "Item does not exist in either view or model, but notification triggered" << llendl;
+ // Hmm, we got an ADD/REMOVE/STRUCTURE notification for this item but there's nothing to be done to it.
+ llwarns << "Notification triggered for item that isn't changing. "
+ << "Operation: ( mask: " << mask << " panel name: " << mStartFolderString << " ) "
+ << "Item: [ Name:" << model_item->getName() << " UUID: " << *id_it << " ]" << llendl;
+
}
}
+
+ // This item has been removed from memory, but its associated UI element still exists.
+ if (!model_item && view_item)
+ {
+ // Remove the item's UI.
+ view_item->destroyView();
+ }
}
}
}
@@ -697,7 +646,7 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc
{
// Don't select objects in COF (e.g. to prevent refocus when items are worn).
const LLInventoryObject *obj = gInventory.getObject(obj_id);
- if (obj && obj->getParentUUID() == LLAppearanceManager::getCOF())
+ if (obj && obj->getParentUUID() == LLAppearanceManager::instance().getCOF())
{
return;
}