From e11d1c1d2b437b7b6d8ba0d0514f050b5d60b221 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 23 Nov 2009 18:10:37 -0500
Subject: [PATCH] EXT-2705 : Remove (dont' just grey out) right-click context
 menu options for Links that aren't necessary

--HG--
branch : avatar-pipeline
---
 indra/newview/llfolderview.cpp      |  8 ++--
 indra/newview/llinventorybridge.cpp | 62 ++++++++++++++---------------
 2 files changed, 34 insertions(+), 36 deletions(-)

diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 3138b5b26fe..ab49739d585 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -39,6 +39,7 @@
 #include "llinventoryclipboard.h" // *TODO: remove this once hack below gone.
 #include "llinventoryfilter.h"
 #include "llinventoryfunctions.h"
+#include "llinventorypanel.h"
 #include "llfoldertype.h"
 #include "llfloaterinventory.h"// hacked in for the bonus context menu items.
 #include "llkeyboard.h"
@@ -2015,9 +2016,10 @@ static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory");
 // Main idle routine
 void LLFolderView::doIdle()
 {
-	// Don't do anything until the inventory is usable and loaded up.
-	// Seraph: Change this to calling mParentPanel->isViewsInitialized
-	if (!gInventory.isInventoryUsable())
+	// If this is associated with the user's inventory, don't do anything
+	// until that inventory is loaded up.
+	const LLInventoryPanel *inventory_panel = dynamic_cast<LLInventoryPanel*>(mParentPanel);
+	if (inventory_panel && !inventory_panel->getIsViewsInitialized())
 	{
 		return;
 	}
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index db079de593d..50dbe8af965 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -509,28 +509,39 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
 										std::vector<std::string> &items,
 										std::vector<std::string> &disabled_items, U32 flags)
 {
-	items.push_back(std::string("Rename"));
-	if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0)
-	{
-		disabled_items.push_back(std::string("Rename"));
-	}
-
-	if (show_asset_id)
+	const LLInventoryObject *obj = getInventoryObject();
+	if (obj && obj->getIsLinkType())
 	{
-		items.push_back(std::string("Copy Asset UUID"));
-		if ( (! ( isItemPermissive() || gAgent.isGodlike() ) )
-			  || (flags & FIRST_SELECTED_ITEM) == 0)
+		items.push_back(std::string("Find Original"));
+		if (LLAssetType::lookupIsLinkType(obj->getType()))
 		{
-			disabled_items.push_back(std::string("Copy Asset UUID"));
+			disabled_items.push_back(std::string("Find Original"));
 		}
 	}
-
-	items.push_back(std::string("Copy Separator"));
-
-	items.push_back(std::string("Copy"));
-	if (!isItemCopyable())
+	else
 	{
-		disabled_items.push_back(std::string("Copy"));
+		items.push_back(std::string("Rename"));
+		if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0)
+		{
+			disabled_items.push_back(std::string("Rename"));
+		}
+		
+		if (show_asset_id)
+		{
+			items.push_back(std::string("Copy Asset UUID"));
+			if ( (! ( isItemPermissive() || gAgent.isGodlike() ) )
+				 || (flags & FIRST_SELECTED_ITEM) == 0)
+			{
+				disabled_items.push_back(std::string("Copy Asset UUID"));
+			}
+		}
+		items.push_back(std::string("Copy Separator"));
+		
+		items.push_back(std::string("Copy"));
+		if (!isItemCopyable())
+		{
+			disabled_items.push_back(std::string("Copy"));
+		}
 	}
 
 	items.push_back(std::string("Paste"));
@@ -3707,11 +3718,6 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		LLInventoryItem* item = getItem();
-		if (item && item->getIsLinkType())
-		{
-			items.push_back(std::string("Find Original"));
-		}
 		items.push_back(std::string("Open"));
 		items.push_back(std::string("Properties"));
 
@@ -4031,14 +4037,9 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		LLInventoryItem* item = getItem();
-		if (item && item->getIsLinkType())
-		{
-			items.push_back(std::string("Find Original"));
-		}
-
 		items.push_back(std::string("Properties"));
 
+		LLInventoryItem *item = getItem();
 		getClipboardEntries(true, items, disabled_items, flags);
 
 		LLObjectBridge::sContextMenuItemID = mUUID;
@@ -4469,11 +4470,6 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 			items.push_back(std::string("Open"));
 		}
 
-		if (item && item->getIsLinkType())
-		{
-			items.push_back(std::string("Find Original"));
-		}
-
 		items.push_back(std::string("Properties"));
 
 		getClipboardEntries(true, items, disabled_items, flags);
-- 
GitLab