From 68c8248fb9450cc9adb41f53f0d2f03d5fd4124e Mon Sep 17 00:00:00 2001
From: Jonathan Yap <none@none>
Date: Wed, 29 Jun 2011 10:28:06 -0400
Subject: STORM-1459 "Wearing Tab" - Add ability to copy displayed inventory
 names to clipboard

---
 doc/contributions.txt                              |  2 ++
 indra/newview/llpanelwearing.cpp                   | 26 ++++++++++++++++++++++
 indra/newview/llpanelwearing.h                     |  1 +
 .../skins/default/xui/en/panel_outfits_wearing.xml | 11 ++++++++-
 4 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/doc/contributions.txt b/doc/contributions.txt
index 256c39eb9e..b253a7662d 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -449,6 +449,7 @@ Jonathan Yap
 	STORM-1313
 	STORM-899
 	STORM-1273
+	STORM-1459
 Kage Pixel
 	VWR-11
 Ken March
@@ -690,6 +691,7 @@ Robin Cornelius
 	STORM-1019
 	STORM-1095
 	STORM-1128
+	STORM-1459
 	VWR-2488
 	VWR-9557
 	VWR-10579
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index 911a9e5dda..e0109675a6 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -38,6 +38,8 @@
 #include "llsidetray.h"
 #include "llviewermenu.h"
 #include "llwearableitemslist.h"
+#include "llsdserialize.h"
+#include "llclipboard.h"
 
 // Context menu and Gear menu helper.
 static void edit_outfit()
@@ -182,6 +184,7 @@ BOOL LLPanelWearing::postBuild()
 {
 	mCOFItemsList = getChild<LLWearableItemsList>("cof_items_list");
 	mCOFItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onWearableItemsListRightClick, this, _1, _2, _3));
+	childSetAction("copy_to_clipboard", boost::bind(&LLPanelWearing::copyToClipboard, this));
 
 	LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
 
@@ -280,4 +283,27 @@ void LLPanelWearing::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const
 	mCOFItemsList->getSelectedUUIDs(selected_uuids);
 }
 
+void LLPanelWearing::copyToClipboard()
+{
+	std::string text;
+	bool need_cr = false;
+	std::vector<LLSD> data;
+	mCOFItemsList->getValues(data);
+	for(std::vector<LLSD>::iterator iter = data.begin(); iter != data.end(); iter++)
+	{
+		LLSD uuid = (*iter);
+		LLViewerInventoryItem* item = gInventory.getItem(uuid);
+		if (!need_cr)
+		{
+			text += item->getName();
+			need_cr = true;
+		}
+		else
+		{
+			text += "\n" + item->getName();
+		}
+	}
+	gClipboard.copyFromString(utf8str_to_wstring(text));
+}
+
 // EOF
diff --git a/indra/newview/llpanelwearing.h b/indra/newview/llpanelwearing.h
index 157b2c4c5f..4c9f5ed079 100644
--- a/indra/newview/llpanelwearing.h
+++ b/indra/newview/llpanelwearing.h
@@ -66,6 +66,7 @@ public:
 
 private:
 	void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
+	void copyToClipboard();
 
 	LLInventoryCategoriesObserver* 	mCategoriesObserver;
 	LLWearableItemsList* 			mCOFItemsList;
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
index d85b778db2..eef499184c 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
@@ -42,6 +42,15 @@
          tool_tip="Show additional options"
          top="1"
          width="31" />
+        <button
+         follows="bottom|left|right"
+         height="25"
+         layout="topleft"
+         left_pad="1"
+         name="copy_to_clipboard"
+         label="Send to clipboard"
+         tool_tip="Send current outfit names to clipboard"
+         width="150" />
         <icon
          follows="bottom|left|right"
          height="25"
@@ -49,6 +58,6 @@
          layout="topleft"
          left_pad="1"
          name="dummy_icon"
-         width="274" />
+         width="123" />
     </panel>
 </panel>
-- 
cgit v1.2.3


From a6475e379e972776761a9d69b76fcbb392959a26 Mon Sep 17 00:00:00 2001
From: Jonathan Yap <none@none>
Date: Wed, 29 Jun 2011 15:12:21 -0400
Subject: STORM-1459 "Wearing Tab" - Add ability to copy displayed inventory
 names to clipboard Made changes with input from Oz & Vadim

---
 doc/contributions.txt                                |  1 +
 indra/newview/llpanelwearing.cpp                     | 20 +++++++++-----------
 indra/newview/llpanelwearing.h                       |  3 ++-
 .../skins/default/xui/en/menu_wearing_gear.xml       |  7 +++++++
 .../skins/default/xui/en/panel_outfits_wearing.xml   | 11 +----------
 5 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/doc/contributions.txt b/doc/contributions.txt
index b253a7662d..5114aa53dd 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -103,6 +103,7 @@ Ales Beaumont
 Alexandrea Fride
     STORM-255
 	STORM-960
+	STORM-1459
 Alissa Sabre
 	VWR-81
 	VWR-83
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index e0109675a6..c2f39524c4 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -60,6 +60,7 @@ public:
 
 		registrar.add("Gear.Edit", boost::bind(&edit_outfit));
 		registrar.add("Gear.TakeOff", boost::bind(&LLWearingGearMenu::onTakeOff, this));
+		registrar.add("Gear.Copy", boost::bind(&LLPanelWearing::copyToClipboard, mPanelWearing));
 
 		enable_registrar.add("Gear.OnEnable", boost::bind(&LLPanelWearing::isActionEnabled, mPanelWearing, _2));
 
@@ -184,7 +185,6 @@ BOOL LLPanelWearing::postBuild()
 {
 	mCOFItemsList = getChild<LLWearableItemsList>("cof_items_list");
 	mCOFItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onWearableItemsListRightClick, this, _1, _2, _3));
-	childSetAction("copy_to_clipboard", boost::bind(&LLPanelWearing::copyToClipboard, this));
 
 	LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
 
@@ -286,24 +286,22 @@ void LLPanelWearing::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const
 void LLPanelWearing::copyToClipboard()
 {
 	std::string text;
-	bool need_cr = false;
 	std::vector<LLSD> data;
 	mCOFItemsList->getValues(data);
-	for(std::vector<LLSD>::iterator iter = data.begin(); iter != data.end(); iter++)
+
+	for(std::vector<LLSD>::const_iterator iter = data.begin(); iter != data.end();)
 	{
 		LLSD uuid = (*iter);
 		LLViewerInventoryItem* item = gInventory.getItem(uuid);
-		if (!need_cr)
-		{
-			text += item->getName();
-			need_cr = true;
-		}
-		else
+
+		iter++;
+		if (item != NULL)
 		{
-			text += "\n" + item->getName();
+			// Append a CR to all but the last line
+			text += iter != data.end() ? item->getName() + "\n" : item->getName();
 		}
 	}
+
 	gClipboard.copyFromString(utf8str_to_wstring(text));
 }
-
 // EOF
diff --git a/indra/newview/llpanelwearing.h b/indra/newview/llpanelwearing.h
index 4c9f5ed079..9a212b3cca 100644
--- a/indra/newview/llpanelwearing.h
+++ b/indra/newview/llpanelwearing.h
@@ -60,13 +60,14 @@ public:
 
 	/*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
 
+	/*virtual*/ void copyToClipboard();
+
 	boost::signals2::connection setSelectionChangeCallback(commit_callback_t cb);
 
 	bool hasItemSelected();
 
 private:
 	void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
-	void copyToClipboard();
 
 	LLInventoryCategoriesObserver* 	mCategoriesObserver;
 	LLWearableItemsList* 			mCOFItemsList;
diff --git a/indra/newview/skins/default/xui/en/menu_wearing_gear.xml b/indra/newview/skins/default/xui/en/menu_wearing_gear.xml
index 0ac2c14253..0e858ccf10 100644
--- a/indra/newview/skins/default/xui/en/menu_wearing_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_wearing_gear.xml
@@ -20,4 +20,11 @@
          function="Gear.OnEnable"
          parameter="take_off" />
     </menu_item_call>
+    <menu_item_call
+     label="Copy outfit list to clipboard"
+     layout="topleft"
+     name="copy">
+        <on_click
+         function="Gear.Copy" />
+    </menu_item_call>
 </toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
index eef499184c..d85b778db2 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
@@ -42,15 +42,6 @@
          tool_tip="Show additional options"
          top="1"
          width="31" />
-        <button
-         follows="bottom|left|right"
-         height="25"
-         layout="topleft"
-         left_pad="1"
-         name="copy_to_clipboard"
-         label="Send to clipboard"
-         tool_tip="Send current outfit names to clipboard"
-         width="150" />
         <icon
          follows="bottom|left|right"
          height="25"
@@ -58,6 +49,6 @@
          layout="topleft"
          left_pad="1"
          name="dummy_icon"
-         width="123" />
+         width="274" />
     </panel>
 </panel>
-- 
cgit v1.2.3


From 845a92aceda812841f069c0f12a25cec20f4de01 Mon Sep 17 00:00:00 2001
From: Jonathan Yap <none@none>
Date: Thu, 30 Jun 2011 04:24:11 -0400
Subject: STORM-1459 Updated comment per Nicky's suggestion

---
 indra/newview/llpanelwearing.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index c2f39524c4..a56b7d6006 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -297,7 +297,7 @@ void LLPanelWearing::copyToClipboard()
 		iter++;
 		if (item != NULL)
 		{
-			// Append a CR to all but the last line
+			// Append a newline to all but the last line
 			text += iter != data.end() ? item->getName() + "\n" : item->getName();
 		}
 	}
-- 
cgit v1.2.3