1. simon_linden
  2. viewer-rabbit

Commits

leslie_linden  committed 08a7b4c

EXP-1799 FIX -- Replace and Add to Outfit options appear as grayed out in Inventory

* Refactored LLFolderBridge::buildContextMenu fetch to clear and rebuild basic
context menu options after the fetch rather than trying to merge the two.

  • Participants
  • Parent commits 4458a72
  • Branches default

Comments (0)

Files changed (2)

File indra/newview/llinventorybridge.cpp

View file
 			{
 				menu_item->setVisible(FALSE);
 			}
+
+			menu_item->setEnabled(FALSE);
 		}
 		else
 		{
 			{
 				items.push_back(std::string("Marketplace Separator"));
 
-				bool copyable = true;
-				LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID);
-				if (inv_item)
-				{
-					copyable = inv_item->getPermissions().allowCopyBy(gAgent.getID());
-				}
-
 				items.push_back(std::string("Merchant Copy"));
 				if (!canListOnMarketplaceNow())
 				{
 		return false;
 	}
 	
-	const LLUUID & outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
-	if (outbox_id.isNull())
-	{
-		return false;
-	}
-
 	LLViewerInventoryItem * item = model->getItem(mUUID);
 	if (item)
 	{
 		delete this;
 	}
 
-
 protected:
 	LLUUID mCatID;
 	bool mCopyItems;
 	LLFolderBridge* selfp = sSelf.get();
 	if (selfp)
 	{
-		selfp->folderOptionsMenu();
-	}
-}
-
-void LLFolderBridge::folderOptionsMenu()
-{
+		selfp->folderOptionsMenuAfterFetch();
+	}
+}
+
+void LLFolderBridge::folderOptionsMenuAfterFetch()
+{
+	const U32 flags = mContextMenuFlags;
+
+	mItems.clear();
+	mDisabledItems.clear();
+	mContextMenuFlags = 0x0;
+
+	LLMenuGL* menup = dynamic_cast<LLMenuGL*>(mMenu.get());
+	if (!menup) return;
+
+	// Reset the menu
+	{
+		const LLView::child_list_t *list = menup->getChildList();
+
+		LLView::child_list_t::const_iterator menu_itor;
+		for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor)
+		{
+			(*menu_itor)->setVisible(FALSE);
+			(*menu_itor)->pushVisible(TRUE);
+			(*menu_itor)->setEnabled(TRUE);
+		}
+	}
+
+	// Build basic menu back up
+	buildContextMenuBaseOptions(*menup, flags);
+
+	// Build folder specific options back up
 	LLInventoryModel* model = getInventoryModel();
 	if(!model) return;
 
 		}
 		mItems.push_back(std::string("Outfit Separator"));
 	}
-	LLMenuGL* menup = dynamic_cast<LLMenuGL*>(mMenu.get());
-	if (menup)
-	{
-		hide_context_entries(*menup, mItems, mDisabledItems);
-
-		// Reposition the menu, in case we're adding items to an existing menu.
-		menup->needsArrange();
-		menup->arrangeAndClear();
-	}
+
+	hide_context_entries(*menup, mItems, mDisabledItems);
+
+	// Reposition the menu, in case we're adding items to an existing menu.
+	menup->needsArrange();
+	menup->arrangeAndClear();
 }
 
 BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type)
 	return ((item_array.count() > 0) ? TRUE : FALSE );
 }
 
-// Flags unused
-void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
-{
-	mItems.clear();
-	mDisabledItems.clear();
-
-	lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
-
-//	menuentry_vec_t disabled_items;
+void LLFolderBridge::buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags)
+{
 	LLInventoryModel* model = getInventoryModel();
-	if(!model) return;
+	llassert(model != NULL);
+
 	const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
 	const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
 
 			mDisabledItems.push_back(std::string("Share"));
 		}
 	}
+}
+
+// Flags unused
+void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+	mItems.clear();
+	mDisabledItems.clear();
+	mContextMenuFlags = flags;
+
+	lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
+
+	LLInventoryModel* model = getInventoryModel();
+	if(!model) return;
+
+	buildContextMenuBaseOptions(menu, flags);
 
 	hide_context_entries(menu, mItems, mDisabledItems);
 

File indra/newview/llinventorybridge.h

View file
 				   const LLUUID& uuid) :
 		LLInvFVBridge(inventory, root, uuid),
 		mCallingCards(FALSE),
-		mWearables(FALSE)
+		mWearables(FALSE),
+		mContextMenuFlags(0x0)
 	{}
 		
 	BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg);
 	LLHandle<LLFolderBridge> getHandle() { mHandle.bind(this); return mHandle; }
 
 protected:
+	void buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags);
+
 	//--------------------------------------------------------------------
 	// Menu callbacks
 	//--------------------------------------------------------------------
 public:
 	static LLHandle<LLFolderBridge> sSelf;
 	static void staticFolderOptionsMenu();
-	void folderOptionsMenu();
+	void folderOptionsMenuAfterFetch();
 
 private:
 	BOOL				mCallingCards;
 	LLHandle<LLView>	mMenu;
 	menuentry_vec_t		mItems;
 	menuentry_vec_t		mDisabledItems;
+	U32					mContextMenuFlags;
 	LLRootHandle<LLFolderBridge> mHandle;
 };