diff options
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 164e72e621..498a29728c 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -433,11 +433,10 @@ void LLInventoryPanel::initializeViews() { mStartFolderID = (preferred_type != LLFolderType::FT_NONE ? gInventory.findCategoryUUIDForType(preferred_type) : LLUUID::null); } - llinfos << this << " Generating views for start folder " << mStartFolderString << llendl; rebuildViewsFor(mStartFolderID); mViewsInitialized = true; - defaultOpenInventory(); + openStartFolderOrMyInventory(); } void LLInventoryPanel::rebuildViewsFor(const LLUUID& id) @@ -491,13 +490,14 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) if (new_listener) { - LLFolderViewFolder::Params p; - p.name = new_listener->getDisplayName(); - p.icon = new_listener->getIcon(); - p.root = mFolders; - p.listener = new_listener; - p.tool_tip = p.name; - LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(p); + LLFolderViewFolder::Params params; + params.name = new_listener->getDisplayName(); + params.icon = new_listener->getIcon(); + params.icon_open = new_listener->getOpenIcon(); + params.root = mFolders; + params.listener = new_listener; + params.tool_tip = params.name; + LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(params); folderp->setItemSortOrder(mFolders->getSortOrder()); itemp = folderp; @@ -523,12 +523,13 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) if (new_listener) { LLFolderViewItem::Params params; - params.name(new_listener->getDisplayName()); - params.icon(new_listener->getIcon()); - params.creation_date(new_listener->getCreationDate()); - params.root(mFolders); - params.listener(new_listener); - params.rect(LLRect (0, 0, 0, 0)); + params.name = new_listener->getDisplayName(); + params.icon = new_listener->getIcon(); + params.icon_open = new_listener->getOpenIcon(); + params.creation_date = new_listener->getCreationDate(); + params.root = mFolders; + params.listener = new_listener; + params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; itemp = LLUICtrlFactory::create<LLFolderViewItem> (params); } @@ -575,7 +576,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) } // bit of a hack to make sure the inventory is open. -void LLInventoryPanel::defaultOpenInventory() +void LLInventoryPanel::openStartFolderOrMyInventory() { if (mStartFolderString != "") { @@ -583,13 +584,17 @@ void LLInventoryPanel::defaultOpenInventory() } else { - // Get the first child (it should be "My Inventory") and - // open it up by name (just to make sure the first child is actually a folder). - LLView* first_child = mFolders->getFirstChild(); - if (first_child) + // Find My Inventory folder and open it up by name + for (LLView *child = mFolders->getFirstChild(); child; child = mFolders->findNextSibling(child)) { - const std::string& first_child_name = first_child->getName(); - mFolders->openFolder(first_child_name); + LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child); + if (fchild && fchild->getListener() && + (fchild->getListener()->getUUID() == gInventory.getRootFolderID())) + { + const std::string& child_name = child->getName(); + mFolders->openFolder(child_name); + break; + } } } } |