From 50fad31f09b394b409df710bdabd66341ae2135c Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 14 May 2010 17:31:56 -0400
Subject: [PATCH] EXT-7353 FIXED short cuts (links) to textures should show up
 in the texture picker

Links in general will now show up for all filtered inventory views of their associated types.
---
 indra/newview/llinventorybridge.cpp | 14 +-------------
 indra/newview/llinventoryfilter.h   |  7 ++++++-
 indra/newview/llinventorymodel.h    |  2 +-
 indra/newview/llinventorypanel.cpp  |  5 +++++
 indra/newview/llinventorypanel.h    |  3 ++-
 indra/newview/llviewerinventory.cpp | 14 ++++++++++++++
 indra/newview/llviewerinventory.h   |  1 +
 7 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 973257b19c7..b9b4fa8b031 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -143,7 +143,6 @@ const std::string& LLInvFVBridge::getDisplayName() const
 // Folders have full perms
 PermissionMask LLInvFVBridge::getPermissionMask() const
 {
-
 	return PERM_ALL;
 }
 
@@ -1219,18 +1218,7 @@ PermissionMask LLItemBridge::getPermissionMask() const
 {
 	LLViewerInventoryItem* item = getItem();
 	PermissionMask perm_mask = 0;
-	if(item)
-	{
-		BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
-		BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
-		BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
-															gAgent.getID());
-
-		if (copy) perm_mask |= PERM_COPY;
-		if (mod)  perm_mask |= PERM_MODIFY;
-		if (xfer) perm_mask |= PERM_TRANSFER;
-
-	}
+	if (item) perm_mask = item->getPermissionMask();
 	return perm_mask;
 }
 
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index 2376ba5d226..3ef51baefca 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -98,11 +98,15 @@ class LLInventoryFilter
 	void 				setHoursAgo(U32 hours);
 	U32 				getHoursAgo() const;
 
+	void 				setIncludeLinks(BOOL include_links);
+	BOOL				getIncludeLinks() const;
+
 	// +-------------------------------------------------------------------+
 	// + Execution And Results
 	// +-------------------------------------------------------------------+
 	BOOL 				check(const LLFolderViewItem* item);
-	BOOL 				checkAgainstFilterType(const LLFolderViewItem* item);
+	BOOL 				checkAgainstFilterType(const LLFolderViewItem* item) const;
+	BOOL 				checkAgainstPermissions(const LLFolderViewItem* item) const;
 	std::string::size_type getStringMatchOffset() const;
 
 	// +-------------------------------------------------------------------+
@@ -172,6 +176,7 @@ class LLInventoryFilter
 		U32				mHoursAgo;
 		EFolderShow		mShowFolderState;
 		PermissionMask	mPermissions;
+		BOOL			mIncludeLinks;
 	};
 
 	U32						mOrder;
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 5f5d4d61186..1f7bd50328a 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -256,7 +256,7 @@ class LLInventoryModel
 	//    updateCategory() method to actually modify values.
 	LLViewerInventoryCategory* getCategory(const LLUUID& id) const;
 
-	// Get the inventoryID that this item points to, else just return item_id.
+	// Get the inventoryID or item that this item points to, else just return object_id
 	const LLUUID& getLinkedItemID(const LLUUID& object_id) const;
 private:
 	mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups	
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 000bcdd265d..4766c1c2278 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -248,6 +248,11 @@ void LLInventoryPanel::setHoursAgo(U32 hours)
 	getFilter()->setHoursAgo(hours);
 }
 
+void LLInventoryPanel::setIncludeLinks(BOOL include_links)
+{
+	getFilter()->setIncludeLinks(include_links);
+}
+
 void LLInventoryPanel::setShowFolderState(LLInventoryFilter::EFolderShow show)
 {
 	getFilter()->setShowFolderState(show);
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 160a3d6f23b..4373cedf66f 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -141,7 +141,8 @@ class LLInventoryPanel : public LLPanel
 	void setSinceLogoff(BOOL sl);
 	void setHoursAgo(U32 hours);
 	BOOL getSinceLogoff();
-	
+	void setIncludeLinks(BOOL include_links);
+
 	void setShowFolderState(LLInventoryFilter::EFolderShow show);
 	LLInventoryFilter::EFolderShow getShowFolderState();
 	void setAllowMultiSelect(BOOL allow) { mFolderRoot->setAllowMultiSelect(allow); }
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 49748c59e8d..ac70be029a2 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1653,6 +1653,20 @@ bool LLViewerInventoryItem::checkPermissionsSet(PermissionMask mask) const
 	return ((curr_mask & mask) == mask);
 }
 
+PermissionMask LLViewerInventoryItem::getPermissionMask() const
+{
+	const LLPermissions& permissions = getPermissions();
+
+	BOOL copy = permissions.allowCopyBy(gAgent.getID());
+	BOOL mod = permissions.allowModifyBy(gAgent.getID());
+	BOOL xfer = permissions.allowOperationBy(PERM_TRANSFER, gAgent.getID());
+	PermissionMask perm_mask = 0;
+	if (copy) perm_mask |= PERM_COPY;
+	if (mod)  perm_mask |= PERM_MODIFY;
+	if (xfer) perm_mask |= PERM_TRANSFER;
+	return perm_mask;
+}
+
 //----------
 
 void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const std::string& first_name, const std::string& last_name)
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index f0dc7bcb675..8ab7c9710d4 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -159,6 +159,7 @@ class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::tr
 	
 	// Checks the items permissions (for owner, group, or everyone) and returns true if all mask bits are set.
 	bool checkPermissionsSet(PermissionMask mask) const;
+	PermissionMask getPermissionMask() const;
 
 	// callback
 	void onCallingCardNameLookup(const LLUUID& id, const std::string& first_name, const std::string& last_name);
-- 
GitLab