From 56a861138b451ab7f7c20c6c461a6243edca8069 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 19 Nov 2009 21:57:14 -0500 Subject: EXT-2675 : Folder that contains baseitems for COF doesn't load on first click EXT-2456 : Usability: Inventory > Clothing > context menu not intuitive RightClickFetchInventoryObserver now works correctly to update menu FetchInventoryDescendents now triggers notifyObservers properly Fixed up gInventory.notifyObservers logic --HG-- branch : avatar-pipeline --- indra/newview/llappviewer.cpp | 2 +- indra/newview/llinventorybridge.cpp | 5 +++++ indra/newview/llinventorymodel.cpp | 27 +++++++++++++++------------ indra/newview/llinventorymodel.h | 9 ++++++--- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index a5ca06ce30..af17286c9c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3534,7 +3534,7 @@ void LLAppViewer::idle() gEventNotifier.update(); gIdleCallbacks.callFunctions(); - gInventory.notifyObservers(); + gInventory.idleNotifyObservers(); } if (gDisconnected) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 578cf7bebc..c8540bdbd2 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -492,6 +492,7 @@ void hide_context_entries(LLMenuGL& menu, } else { + (*itor)->setVisible(TRUE); for (itor2 = disabled_entries.begin(); itor2 != disabled_entries.end(); ++itor2) { if (*itor2 == name) @@ -2359,6 +2360,10 @@ void LLFolderBridge::folderOptionsMenu() mItems.push_back(std::string("Remove From Outfit")); } hide_context_entries(*mMenu, mItems, disabled_items); + + // Reposition the menu, in case we're adding items to an existing menu. + mMenu->needsArrange(); + mMenu->arrangeAndClear(); } BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index fbaab385fe..9e37c5be38 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1118,9 +1118,16 @@ BOOL LLInventoryModel::containsObserver(LLInventoryObserver* observer) const return mObservers.find(observer) != mObservers.end(); } -// Call this method when it's time to update everyone on a new state, -// by default, the inventory model will not update observers -// automatically. +void LLInventoryModel::idleNotifyObservers() +{ + if (mModifyMask == LLInventoryObserver::NONE && (mChangedItemIDs.size() == 0)) + { + return; + } + notifyObservers(""); +} + +// Call this method when it's time to update everyone on a new state. // The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328] void LLInventoryModel::notifyObservers(const std::string service_name) { @@ -1133,13 +1140,6 @@ void LLInventoryModel::notifyObservers(const std::string service_name) return; } - if ((mModifyMask == LLInventoryObserver::NONE) && (service_name == "")) - { - mModifyMask = LLInventoryObserver::NONE; - mChangedItemIDs.clear(); - return; - } - mIsNotifyObservers = TRUE; for (observer_list_t::iterator iter = mObservers.begin(); iter != mObservers.end(); ) @@ -3308,8 +3308,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a UpdateInventoryItem for the wrong agent." - << llendl; + llwarns << "Got a UpdateInventoryItem for the wrong agent." << llendl; return; } LLUUID parent_id; @@ -3320,6 +3319,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) msg->getS32("AgentData", "Version", version); S32 descendents; msg->getS32("AgentData", "Descendents", descendents); + S32 i; S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); LLPointer tcategory = new LLViewerInventoryCategory(owner_id); @@ -3349,6 +3349,9 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) { cat->setVersion(version); cat->setDescendentCount(descendents); + // Get this UUID on the changed list so that whatever's listening for it + // will get triggered. + gInventory.addChangedMask(LLInventoryObserver::INTERNAL, cat->getUUID()); } gInventory.notifyObservers(); } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index da12dbdf7f..50f54cb842 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -252,9 +252,12 @@ public: // multiple trash can bug. const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder = true, bool find_in_library = false); - // Call this method when it's time to update everyone on a new - // state, by default, the inventory model will not update - // observers automatically. + // This gets called by the idle loop. It only updates if new + // state is detected. Call notifyObservers() manually to update + // regardless of whether state change has been indicated. + void idleNotifyObservers(); + + // Call this method to explicitly update everyone on a new state. // The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328] void notifyObservers(const std::string service_name=""); -- cgit v1.2.3