diff options
Diffstat (limited to 'indra/newview/llfloaterinventory.cpp')
-rw-r--r-- | indra/newview/llfloaterinventory.cpp | 77 |
1 files changed, 32 insertions, 45 deletions
diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp index a33a605f50..4596ae7739 100644 --- a/indra/newview/llfloaterinventory.cpp +++ b/indra/newview/llfloaterinventory.cpp @@ -1174,7 +1174,6 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) mHasInventoryConnection(false), mStartFolderString(p.start_folder) , mBuildDefaultHierarchy(true) -, mRootInventoryItemUUID(LLUUID::null) , mInvFVBridgeBuilder(NULL) { mInvFVBridgeBuilder = &INVENTORY_BRIDGE_BUILDER; @@ -1241,7 +1240,19 @@ BOOL LLInventoryPanel::postBuild() // determine the root folder, if any, so inventory contents show just the children // of that folder (i.e. not including the folder itself). const LLAssetType::EType preferred_type = LLAssetType::lookupHumanReadable(mStartFolderString); - mStartFolderID = (preferred_type != LLAssetType::AT_NONE ? gInventory.findCategoryUUIDForType(preferred_type) : LLUUID::null); + + if ("inventory" == mStartFolderString) + { + mStartFolderID = gInventory.getRootFolderID(); + } + else if ("library" == mStartFolderString) + { + mStartFolderID = gInventory.getLibraryRootFolderID(); + } + else + { + mStartFolderID = (preferred_type != LLAssetType::AT_NONE ? gInventory.findCategoryUUIDForType(preferred_type) : LLUUID::null); + } // build view of inventory if we need default full hierarchy and inventory ready, otherwise wait for modelChanged() callback if (mBuildDefaultHierarchy && mInventory->isInventoryUsable() && !mHasInventoryConnection) @@ -1462,24 +1473,6 @@ void LLInventoryPanel::modelChanged(U32 mask) } } -void LLInventoryPanel::setInvFVBridgeBuilder(const LLInventoryFVBridgeBuilder* bridge_builder) -{ - if (NULL == bridge_builder) - { - llwarns << "NULL is passed as Inventory Bridge Builder. Default will be used." << llendl; - } - else - { - mInvFVBridgeBuilder = bridge_builder; - } - - if (mInventory->isInventoryUsable() && !mHasInventoryConnection) - { - rebuildViewsFor(mRootInventoryItemUUID); - mHasInventoryConnection = true; - } -} - void LLInventoryPanel::rebuildViewsFor(const LLUUID& id) { @@ -1508,14 +1501,28 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) objectp = gInventory.getObject(id); if (objectp) { + const LLUUID &parent_id = objectp->getParentUUID(); + // If this item's parent is the starting folder, then just add it to the top level (recall that + // the starting folder isn't actually represented in the view, parent_folder would be NULL in + // this case otherwise). + LLFolderViewFolder* parent_folder = (parent_id == mStartFolderID ? + mFolders : (LLFolderViewFolder*)mFolders->getItemByID(parent_id)); + + // This item exists outside the inventory's hierarchy, so don't add it. + if (!parent_folder) + { + return; + } + if (objectp->getType() <= LLAssetType::AT_NONE || objectp->getType() >= LLAssetType::AT_COUNT) { - llwarns << "LLInventoryPanel::buildNewViews called with objectp->mType == " - << ((S32) objectp->getType()) - << " (shouldn't happen)" << llendl; + llwarns << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : " << + ((S32) objectp->getType()) << llendl; + return; } - else if (objectp->getType() == LLAssetType::AT_CATEGORY && + + if (objectp->getType() == LLAssetType::AT_CATEGORY && objectp->getActualType() != LLAssetType::AT_LINK_FOLDER) { LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(objectp->getType(), @@ -1563,27 +1570,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) if (itemp) { - - const LLUUID &parent_id = objectp->getParentUUID(); - LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolders->getItemByID(parent_id); - - // If this item's parent is the starting folder, then just add it to the top level (recall that - // the starting folder isn't actually represented in the view, parent_folder would be NULL in - // this case otherwise). - if (parent_id == mStartFolderID) - { - parent_folder = mFolders; - } - - if (parent_folder) - { - itemp->addToFolder(parent_folder, mFolders); - } - else - { - llwarns << "Couldn't find parent folder for child " << itemp->getLabel() << llendl; - delete itemp; - } + itemp->addToFolder(parent_folder, mFolders); } } } |