From 2a031df763ab7ea0f17f263ef9a03f53fbfb1187 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Fri, 11 Apr 2014 11:55:57 -0700
Subject: [PATCH] DD-12, DD-19 : Add a button to create a new listing folder.
 Also added a validate button though it does nothing ATM

---
 .../newview/llfloatermarketplacelistings.cpp  | 11 +++++++++
 indra/newview/llfloatermarketplacelistings.h  |  1 +
 .../xui/en/panel_marketplace_listings.xml     | 24 +++++++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp
index 9bbe63de72a..dcf27baae7f 100755
--- a/indra/newview/llfloatermarketplacelistings.cpp
+++ b/indra/newview/llfloatermarketplacelistings.cpp
@@ -59,6 +59,7 @@ LLPanelMarketplaceListings::LLPanelMarketplaceListings()
 BOOL LLPanelMarketplaceListings::postBuild()
 {
 	mAllPanel = getChild<LLInventoryPanel>("All Items");
+	childSetAction("add_btn", boost::bind(&LLPanelMarketplaceListings::onAddButtonClicked, this));
 
 	// Set the sort order newest to oldest
 	LLInventoryPanel* panel = getChild<LLInventoryPanel>("All Items");
@@ -87,6 +88,16 @@ void LLPanelMarketplaceListings::draw()
 	LLPanel::draw();
 }
 
+void LLPanelMarketplaceListings::onAddButtonClicked()
+{
+	LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, true);
+	llassert(marketplacelistings_id.notNull());
+    LLFolderType::EType preferred_type = LLFolderType::lookup("category");
+    LLUUID category = gInventory.createNewCategory(marketplacelistings_id, preferred_type, LLStringUtil::null);
+    gInventory.notifyObservers();
+    mAllPanel->setSelectionByID(category, TRUE);
+}
+
 void LLPanelMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata)
 {
 	std::string chosen_item = userdata.asString();
diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h
index 0eddd636e8e..03c4fa6818d 100755
--- a/indra/newview/llfloatermarketplacelistings.h
+++ b/indra/newview/llfloatermarketplacelistings.h
@@ -54,6 +54,7 @@ class LLPanelMarketplaceListings : public LLPanel
     // UI callbacks
 	void onViewSortMenuItemClicked(const LLSD& userdata);
 	bool onViewSortMenuItemCheck(const LLSD& userdata);
+	void onAddButtonClicked();
     
     LLInventoryPanel* mAllPanel;
     LLInventoryFilter::ESortOrderType mSortOrder;
diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml
index 45e0fe04c07..3b48c2e48c2 100755
--- a/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml
+++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml
@@ -28,6 +28,30 @@
       image_selected="Toolbar_Middle_Selected"
       image_unselected="Toolbar_Middle_Off"
       menu_position="bottomleft"/>
+    <button
+      name="add_btn"
+      tool_tip="Create a new listing folder"
+      layout="topleft"
+      follows="top|left"
+      width="31"
+      height="25"
+      left_pad="2"
+      image_hover_unselected="Toolbar_Middle_Over"
+      image_overlay="Conv_toolbar_plus"
+      image_selected="Toolbar_Middle_Selected"
+      image_unselected="Toolbar_Middle_Off"/>
+    <button
+      name="audit_btn"
+      tool_tip="Validate your marketplace listings"
+      layout="topleft"
+      follows="top|left"
+      width="31"
+      height="25"
+      left_pad="2"
+      image_hover_unselected="Toolbar_Middle_Over"
+      image_overlay="Info"
+      image_selected="Toolbar_Middle_Selected"
+      image_unselected="Toolbar_Middle_Off"/>
   </panel>
   <panel
     name="tab_container_panel"
-- 
GitLab