Anonymous avatar Anonymous committed f2bef71

EXT-7639 FIXED (Make shop button open different URLs depending on what is selected in outfit editor)

- Fixed old market place URL to the new one in the settings.xml.
- Implemented the following feature: \"When Add More panel in focus selection inside it should supersede selection in accordions\". To achieve this:
-- LLPanelOutfitEdit::getCOFWearablesSelectionType() function was implemented.
-- LLPanelOutfitEdit::getAddMorePanelSelectionType() function was implemented.
-- LLPanelOutfitEdit::getWearableTypeByItemUUID(const LLUUID& item_uuid) function was implemented.
-- LLPanelOutfitEdit::onShopButtonClicked() was rewritten to use those functions.
- Fixed the problem with shop button and gender: now shop button for male leads to male links.

Reviewed by Vadim Savchuk and Neal Orman at https://codereview.productengine.com/secondlife/r/725/

Comments (0)

Files changed (3)

indra/newview/app_settings/settings.xml

       <key>Type</key>
       <string>String</string>
       <key>Value</key>
-      <string>https://www.xstreetsl.com/modules.php?name=Marketplace</string>
+      <string>http://marketplace.secondlife.com/</string>
     </map>
     <key>MarketplaceURL_objectFemale</key>
     <map>
       <key>Type</key>
       <string>String</string>
       <key>Value</key>
-      <string>https://www.xstreetsl.com/modules.php?name=Marketplace</string>
+      <string>http://marketplace.secondlife.com</string>
     </map>
     <key>MarketplaceURL_bodypartMale</key>
     <map>
       <key>Type</key>
       <string>String</string>
       <key>Value</key>
-      <string>https://www.xstreetsl.com/modules.php?name=Marketplace</string>
+      <string>http://marketplace.secondlife.com/</string>
     </map>
     <key>MarketplaceURL_glovesMale</key>
     <map>

indra/newview/llpaneloutfitedit.cpp

 #include "llsdutil.h"
 #include "llsidepanelappearance.h"
 #include "lltoggleablemenu.h"
+#include "llvoavatarself.h"
 #include "llwearablelist.h"
 #include "llwearableitemslist.h"
 #include "llwearabletype.h"
 {
 	static LLShopURLDispatcher url_resolver;
 
+	// will contain the resultant URL
 	std::string url;
+
+	if (isAgentAvatarValid())
+	{
+		// try to get wearable type from 'Add More' panel first (EXT-7639)
+		LLWearableType::EType type = getAddMorePanelSelectionType();
+
+		if (type == LLWearableType::WT_NONE)
+		{
+			type = getCOFWearablesSelectionType();
+		}
+
+		ESex sex = gAgentAvatarp->getSex();
+
+		// WT_INVALID comes for attachments
+		if (type != LLWearableType::WT_INVALID && type != LLWearableType::WT_NONE)
+		{
+			url = url_resolver.resolveURL(type, sex);
+		}
+
+		if (url.empty())
+		{
+			url = url_resolver.resolveURL(mCOFWearables->getExpandedAccordionAssetType(), sex);
+		}
+	}
+	else
+	{
+		llwarns << "Agent avatar is invalid" << llendl;
+
+		// the second argument is not important in this case: generic market place will be opened
+		url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE);
+	}
+
+	LLWeb::loadURLExternal(url);
+}
+
+LLWearableType::EType LLPanelOutfitEdit::getCOFWearablesSelectionType() const
+{
 	std::vector<LLPanel*> selected_items;
+	LLWearableType::EType type = LLWearableType::WT_NONE;
+
 	mCOFWearables->getSelectedItems(selected_items);
 
-	ESex sex = gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE;
-
 	if (selected_items.size() == 1)
 	{
-		LLWearableType::EType type = LLWearableType::WT_NONE;
 		LLPanel* item = selected_items.front();
 
 		// LLPanelDummyClothingListItem is lower then LLPanelInventoryListItemBase in hierarchy tree
 		{
 			type = real_item->getWearableType();
 		}
+	}
 
-		// WT_INVALID comes for attachments
-		if (type != LLWearableType::WT_INVALID)
+	return type;
+}
+
+LLWearableType::EType LLPanelOutfitEdit::getAddMorePanelSelectionType() const
+{
+	LLWearableType::EType type = LLWearableType::WT_NONE;
+
+	if (mAddWearablesPanel != NULL && mAddWearablesPanel->getVisible())
+	{
+		if (mInventoryItemsPanel != NULL && mInventoryItemsPanel->getVisible())
 		{
-			url = url_resolver.resolveURL(type, sex);
+			std::set<LLUUID> selected_uuids = mInventoryItemsPanel->getRootFolder()->getSelectionList();
+
+			if (selected_uuids.size() == 1)
+			{
+				type = getWearableTypeByItemUUID(*(selected_uuids.begin()));
+			}
+		}
+		else if (mWearableItemsList != NULL && mWearableItemsList->getVisible())
+		{
+			std::vector<LLUUID> selected_uuids;
+			mWearableItemsList->getSelectedUUIDs(selected_uuids);
+
+			if (selected_uuids.size() == 1)
+			{
+				type = getWearableTypeByItemUUID(selected_uuids.front());
+			}
 		}
 	}
 
-	if (url.empty())
-	{
-		url = url_resolver.resolveURL(mCOFWearables->getExpandedAccordionAssetType(), sex);
-	}
+	return type;
+}
 
-	LLWeb::loadURLExternal(url);
+LLWearableType::EType LLPanelOutfitEdit::getWearableTypeByItemUUID(const LLUUID& item_uuid) const
+{
+	LLViewerInventoryItem* item = gInventory.getLinkedItem(item_uuid);
+	return (item != NULL) ? item->getWearableType() : LLWearableType::WT_NONE;
 }
 
 void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void)

indra/newview/llpaneloutfitedit.h

 	void getCurrentItemUUID(LLUUID& selected_id);
 	void onCOFChanged();
 
+	LLWearableType::EType getCOFWearablesSelectionType() const;
+	LLWearableType::EType getAddMorePanelSelectionType() const;
+	LLWearableType::EType getWearableTypeByItemUUID(const LLUUID& item_uuid) const;
+
 	LLTextBox*			mCurrentOutfitName;
 	LLTextBox*			mStatus;
 	LLInventoryPanel*	mInventoryItemsPanel;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.