From c4577856ed913ba7070a6bd1ad8e91c454e7bd6c Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Mon, 8 Sep 2014 22:09:44 -0700
Subject: DD-104 : Use default folder icons for stock folders outside of the
 marketplace root

---
 indra/newview/llinventorybridge.cpp | 36 ++++++++++++++++++------------------
 indra/newview/llinventorybridge.h   |  3 ++-
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 0692d425fc..75883ac002 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -3211,36 +3211,36 @@ LLFolderType::EType LLFolderBridge::getPreferredType() const
 // Icons for folders are based on the preferred type
 LLUIImagePtr LLFolderBridge::getIcon() const
 {
-	LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
-	LLViewerInventoryCategory* cat = getCategory();
-	if (cat)
-	{
-		preferred_type = cat->getPreferredType();
-	}
-    if ((preferred_type == LLFolderType::FT_NONE) && (depth_nesting_in_marketplace(mUUID) == 2))
-    {
-        // We override the type when in the marketplace listings folder and only for version folder
-        preferred_type = LLFolderType::FT_MARKETPLACE_VERSION;
-    }
-	return getIcon(preferred_type);
+	return getFolderIcon(FALSE);
 }
 
-// static
-LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
+LLUIImagePtr LLFolderBridge::getIconOpen() const
 {
-	return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, FALSE));
+	return getFolderIcon(TRUE);
 }
 
-LLUIImagePtr LLFolderBridge::getIconOpen() const
+LLUIImagePtr LLFolderBridge::getFolderIcon(BOOL is_open) const
 {
 	LLFolderType::EType preferred_type = getPreferredType();
-    if ((preferred_type == LLFolderType::FT_NONE) && (depth_nesting_in_marketplace(mUUID) == 2))
+    S32 depth = depth_nesting_in_marketplace(mUUID);
+    if ((preferred_type == LLFolderType::FT_NONE) && (depth == 2))
     {
         // We override the type when in the marketplace listings folder and only for version folder
         preferred_type = LLFolderType::FT_MARKETPLACE_VERSION;
     }
-	return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, TRUE));
+    else if ((preferred_type == LLFolderType::FT_MARKETPLACE_STOCK) && (depth == -1))
+    {
+        // We override the type when a stock folder is outside of the marketplace listings root
+        // as we don't want to export that notion outside of marketplace
+        preferred_type = LLFolderType::FT_NONE;
+    }
+	return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, is_open));
+}
 
+// static : use by LLLinkFolderBridge to get the closed type icons
+LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
+{
+	return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, FALSE));
 }
 
 LLUIImagePtr LLFolderBridge::getIconOverlay() const
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 13215e5934..091aff71b1 100755
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -284,9 +284,9 @@ public:
 	virtual LLUIImagePtr getIcon() const;
 	virtual LLUIImagePtr getIconOpen() const;
 	virtual LLUIImagePtr getIconOverlay() const;
+	static LLUIImagePtr getIcon(LLFolderType::EType preferred_type);
 	virtual std::string getLabelSuffix() const;
 	virtual LLFontGL::StyleFlags getLabelStyle() const;
-	static LLUIImagePtr getIcon(LLFolderType::EType preferred_type);
 
 	virtual BOOL renameItem(const std::string& new_name);
 
@@ -362,6 +362,7 @@ private:
     void callback_pasteFromClipboard(const LLSD& notification, const LLSD& response);
     void perform_pasteFromClipboard();
     void gatherMessage(std::string& message, LLError::ELevel log_level);
+    LLUIImagePtr getFolderIcon(BOOL is_open) const;
 
 	bool							mCallingCards;
 	bool							mWearables;
-- 
cgit v1.2.3