From efa73d4975afda19ee5255d5cca33fa96fc21eb4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 19 Jul 2012 20:38:07 -0700 Subject: CHUI-236 : WIP : Places panel works for My Inventory but still empty lists for Favorites Bar, My Landmarks and Library. --- indra/newview/llinventorymodel.cpp | 37 ++++++++++++++++++------------------- indra/newview/llinventorypanel.cpp | 25 +++++++++++-------------- indra/newview/llinventorypanel.h | 1 - 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 3250d60179..9b0d12b353 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -210,7 +210,7 @@ const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(cons if (!cat) break; const LLFolderType::EType folder_type = cat->getPreferredType(); if (folder_type != LLFolderType::FT_NONE && -// folder_type != LLFolderType::FT_ROOT_INVENTORY && + folder_type != LLFolderType::FT_ROOT_INVENTORY && !LLFolderType::lookupIsEnsembleType(folder_type)) { return cat; @@ -380,12 +380,11 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe LLUUID rv = LLUUID::null; const LLUUID &root_id = (find_in_library) ? gInventory.getLibraryRootFolderID() : gInventory.getRootFolderID(); -// if(LLFolderType::FT_ROOT_INVENTORY == preferred_type) -// { -// rv = root_id; -// } -// else if (root_id.notNull()) - if (root_id.notNull()) + if(LLFolderType::FT_ROOT_INVENTORY == preferred_type) + { + rv = root_id; + } + else if (root_id.notNull()) { cat_array_t* cats = NULL; cats = get_ptr_in_map(mParentChildCategoryTree, root_id); @@ -2027,11 +2026,11 @@ void LLInventoryModel::buildParentChildMap() { cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND)); } -// else if(LLFolderType::FT_ROOT_INVENTORY == pref) -// { + else if(LLFolderType::FT_ROOT_INVENTORY == pref) + { // it's the root -// cat->setParent(LLUUID::null); -// } + cat->setParent(LLUUID::null); + } else { // it's a protected folder. @@ -2161,14 +2160,14 @@ void LLInventoryModel::buildParentChildMap() if(category && category->getPreferredType() != LLFolderType::FT_ROOT_INVENTORY) continue; -// if ( category && 0 == LLStringUtil::compareInsensitive(name, category->getName()) ) -// { -// if(category->getUUID()!=mRootFolderID) -// { -// LLUUID& new_inv_root_folder_id = const_cast(mRootFolderID); -// new_inv_root_folder_id = category->getUUID(); -// } -// } + if ( category && 0 == LLStringUtil::compareInsensitive(name, category->getName()) ) + { + if(category->getUUID()!=mRootFolderID) + { + LLUUID& new_inv_root_folder_id = const_cast(mRootFolderID); + new_inv_root_folder_id = category->getUUID(); + } + } } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index ed370e9add..340f851ed8 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -193,6 +193,15 @@ void LLInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params) void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { + // Clear up the root view + // Note: This needs to be done *before* we build the new folder view + LLFolderViewItem* root_view = getItemByID(gInventory.getRootFolderID()); + if (root_view) + { + removeItemID(static_cast(root_view->getViewModelItem())->getUUID()); + root_view->destroyView(); + } + LLMemType mt(LLMemType::MTYPE_INVENTORY_POST_BUILD); mCommitCallbackRegistrar.pushScope(); // registered as a widget; need to push callback scope ourselves @@ -228,6 +237,7 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { initializeViews(); } + gIdleCallbacks.addFunction(onIdle, (void*)this); if (mSortOrderSetting != INHERIT_SORT_ORDER) @@ -595,7 +605,7 @@ void LLInventoryPanel::initializeViews() { if (!gInventory.isInventoryUsable()) return; - rebuildViewsFor(gInventory.getRootFolderID()); + buildNewViews(gInventory.getRootFolderID()); gIdleCallbacks.addFunction(idle, this); @@ -622,19 +632,6 @@ void LLInventoryPanel::initializeViews() } } -LLFolderViewItem* LLInventoryPanel::rebuildViewsFor(const LLUUID& id) -{ - // Destroy the old view for this ID so we can rebuild it. - LLFolderViewItem* old_view = getItemByID(id); - if (old_view) - { - old_view->destroyView(); - removeItemID(static_cast(old_view->getViewModelItem())->getUUID()); - } - - return buildNewViews(id); -} - LLFolderView * LLInventoryPanel::createFolderView(LLInvFVBridge * bridge, bool useLabelSuffix) { LLRect folder_rect(0, diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 465ccdd582..4fcc93b0c4 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -237,7 +237,6 @@ public: protected: // Builds the UI. Call this once the inventory is usable. void initializeViews(); - LLFolderViewItem* rebuildViewsFor(const LLUUID& id); // Given the id and the parent, build all of the folder views. virtual void buildFolderView(const LLInventoryPanel::Params& params); LLFolderViewItem* buildNewViews(const LLUUID& id); -- cgit v1.2.3