diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index ee1d69682953727296b1071fba2ce7cacd54b2d1..e5b8edf9c398ddbff4b299d528251f819e3f1218 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -2,25 +2,31 @@
  * @file llapp.h
  * @brief Declaration of the LLApp class.
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -60,10 +66,6 @@ class LLChildInfo
 };
 #endif
 
-namespace google_breakpad {
-	class ExceptionHandler; // See exception_handler.h
-}
-
 class LL_COMMON_API LLApp : public LLOptionInterface
 {
 	friend class LLErrorThread;
@@ -225,20 +227,8 @@ class LL_COMMON_API LLApp : public LLOptionInterface
 	void setupErrorHandling();
 
 	void setErrorHandler(LLAppErrorHandler handler);
-	static void runErrorHandler(); // run shortly after we detect an error, ran in the relatively robust context of the LLErrorThread - preferred.
+	void setSyncErrorHandler(LLAppErrorHandler handler);
 	//@}
-	
-	// the maximum length of the minidump filename returned by getMiniDumpFilename()
-	static const U32 MAX_MINDUMP_PATH_LENGTH = 256;
-
-	// change the directory where Breakpad minidump files are written to
-	void setMiniDumpDir(const std::string &path);
-
-	// Return the Google Breakpad minidump filename after a crash.
-	char *getMiniDumpFilename() { return minidump_path; }
-
-	// Write out a Google Breakpad minidump file.
-	void writeMiniDump();
 
 #if !LL_WINDOWS
 	//
@@ -296,14 +286,15 @@ class LL_COMMON_API LLApp : public LLOptionInterface
 private:
 	void startErrorThread();
 	
-	// Contains the filename of the minidump file after a crash.
-	char minidump_path[MAX_MINDUMP_PATH_LENGTH];
+	static void runErrorHandler(); // run shortly after we detect an error, ran in the relatively robust context of the LLErrorThread - preferred.
+	static void runSyncErrorHandler(); // run IMMEDIATELY when we get an error, ran in the context of the faulting thread.
 
 	// *NOTE: On Windows, we need a routine to reset the structured
 	// exception handler when some evil driver has taken it over for
 	// their own purposes
 	typedef int(*signal_handler_func)(int signum);
 	static LLAppErrorHandler sErrorHandler;
+	static LLAppErrorHandler sSyncErrorHandler;
 
 	// Default application threads
 	LLErrorThread* mThreadErrorp;		// Waits for app to go to status ERROR, then runs the error callback
@@ -324,8 +315,6 @@ class LL_COMMON_API LLApp : public LLOptionInterface
 private:
 	// the static application instance if it was created.
 	static LLApp* sApplication;
-	
-	google_breakpad::ExceptionHandler * mExceptionHandler;
 
 
 #if !LL_WINDOWS
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index eb610f625a31d7d14086a5c5bc5d220cc7309205..1c664e093b78ed35970968afb3242a6fd5c8e6da 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -2,25 +2,31 @@
  * @file llassettype.cpp
  * @brief Implementatino of LLAssetType functionality.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -71,23 +77,23 @@ LLAssetDictionary::LLAssetDictionary()
 {
 	//       												   DESCRIPTION			TYPE NAME	HUMAN NAME			CAN LINK?   CAN FETCH?  CAN KNOW?	
 	//      												  |--------------------|-----------|-------------------|-----------|-----------|---------|
-	addEntry(LLAssetType::AT_TEXTURE, 			new AssetEntry("TEXTURE",			"texture",	"texture",			true,		false,		true));
-	addEntry(LLAssetType::AT_SOUND, 			new AssetEntry("SOUND",				"sound",	"sound",			true,		true,		true));
-	addEntry(LLAssetType::AT_CALLINGCARD, 		new AssetEntry("CALLINGCARD",		"callcard",	"calling card",		true,		false,		false));
-	addEntry(LLAssetType::AT_LANDMARK, 			new AssetEntry("LANDMARK",			"landmark",	"landmark",			true,		true,		true));
-	addEntry(LLAssetType::AT_SCRIPT, 			new AssetEntry("SCRIPT",			"script",	"legacy script",	true,		false,		false));
+	addEntry(LLAssetType::AT_TEXTURE, 			new AssetEntry("TEXTURE",			"texture",	"texture",			false,		false,		true));
+	addEntry(LLAssetType::AT_SOUND, 			new AssetEntry("SOUND",				"sound",	"sound",			false,		true,		true));
+	addEntry(LLAssetType::AT_CALLINGCARD, 		new AssetEntry("CALLINGCARD",		"callcard",	"calling card",		false,		false,		false));
+	addEntry(LLAssetType::AT_LANDMARK, 			new AssetEntry("LANDMARK",			"landmark",	"landmark",			false,		true,		true));
+	addEntry(LLAssetType::AT_SCRIPT, 			new AssetEntry("SCRIPT",			"script",	"legacy script",	false,		false,		false));
 	addEntry(LLAssetType::AT_CLOTHING, 			new AssetEntry("CLOTHING",			"clothing",	"clothing",			true,		true,		true));
 	addEntry(LLAssetType::AT_OBJECT, 			new AssetEntry("OBJECT",			"object",	"object",			true,		false,		false));
-	addEntry(LLAssetType::AT_NOTECARD, 			new AssetEntry("NOTECARD",			"notecard",	"note card",		true,		false,		true));
+	addEntry(LLAssetType::AT_NOTECARD, 			new AssetEntry("NOTECARD",			"notecard",	"note card",		false,		false,		true));
 	addEntry(LLAssetType::AT_CATEGORY, 			new AssetEntry("CATEGORY",			"category",	"folder",			true,		false,		false));
-	addEntry(LLAssetType::AT_LSL_TEXT, 			new AssetEntry("LSL_TEXT",			"lsltext",	"lsl2 script",		true,		false,		false));
-	addEntry(LLAssetType::AT_LSL_BYTECODE, 		new AssetEntry("LSL_BYTECODE",		"lslbyte",	"lsl bytecode",		true,		false,		false));
-	addEntry(LLAssetType::AT_TEXTURE_TGA, 		new AssetEntry("TEXTURE_TGA",		"txtr_tga",	"tga texture",		true,		false,		false));
+	addEntry(LLAssetType::AT_LSL_TEXT, 			new AssetEntry("LSL_TEXT",			"lsltext",	"lsl2 script",		false,		false,		false));
+	addEntry(LLAssetType::AT_LSL_BYTECODE, 		new AssetEntry("LSL_BYTECODE",		"lslbyte",	"lsl bytecode",		false,		false,		false));
+	addEntry(LLAssetType::AT_TEXTURE_TGA, 		new AssetEntry("TEXTURE_TGA",		"txtr_tga",	"tga texture",		false,		false,		false));
 	addEntry(LLAssetType::AT_BODYPART, 			new AssetEntry("BODYPART",			"bodypart",	"body part",		true,		true,		true));
-	addEntry(LLAssetType::AT_SOUND_WAV, 		new AssetEntry("SOUND_WAV",			"snd_wav",	"sound",			true,		false,		false));
-	addEntry(LLAssetType::AT_IMAGE_TGA, 		new AssetEntry("IMAGE_TGA",			"img_tga",	"targa image",		true,		false,		false));
-	addEntry(LLAssetType::AT_IMAGE_JPEG, 		new AssetEntry("IMAGE_JPEG",		"jpeg",		"jpeg image",		true,		false,		false));
-	addEntry(LLAssetType::AT_ANIMATION, 		new AssetEntry("ANIMATION",			"animatn",	"animation",		true,		true,		true));
+	addEntry(LLAssetType::AT_SOUND_WAV, 		new AssetEntry("SOUND_WAV",			"snd_wav",	"sound",			false,		false,		false));
+	addEntry(LLAssetType::AT_IMAGE_TGA, 		new AssetEntry("IMAGE_TGA",			"img_tga",	"targa image",		false,		false,		false));
+	addEntry(LLAssetType::AT_IMAGE_JPEG, 		new AssetEntry("IMAGE_JPEG",		"jpeg",		"jpeg image",		false,		false,		false));
+	addEntry(LLAssetType::AT_ANIMATION, 		new AssetEntry("ANIMATION",			"animatn",	"animation",		false,		true,		true));
 	addEntry(LLAssetType::AT_GESTURE, 			new AssetEntry("GESTURE",			"gesture",	"gesture",			true,		true,		true));
 	addEntry(LLAssetType::AT_SIMSTATE, 			new AssetEntry("SIMSTATE",			"simstate",	"simstate",			false,		false,		false));
 
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index c5ff2364ccc4e97ddba02e6c207fbfadb91c2779..2c2dc27aaa47806d6ccd7e56e05c218a084e4276 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -2,25 +2,31 @@
  * @file llassettype.h
  * @brief Declaration of LLAssetType.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 33b55d843cabf4cfc3513d660c7545afcb7d37f2..b5a73ec1d13e37f33a0c415bef9187e0dd2061ff 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -2,25 +2,31 @@
  * @file llstring.cpp
  * @brief String utility functions and the std::string class.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -627,14 +633,14 @@ namespace snprintf_hack
 	}
 }
 
-std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page)
+std::string ll_convert_wide_to_string(const wchar_t* in)
 {
 	std::string out;
 	if(in)
 	{
 		int len_in = wcslen(in);
 		int len_out = WideCharToMultiByte(
-			code_page,
+			CP_ACP,
 			0,
 			in,
 			len_in,
@@ -649,7 +655,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page)
 		if(pout)
 		{
 			WideCharToMultiByte(
-				code_page,
+				CP_ACP,
 				0,
 				in,
 				len_in,
@@ -663,38 +669,6 @@ std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page)
 	}
 	return out;
 }
-
-wchar_t* ll_convert_string_to_wide(const std::string& in, unsigned int code_page)
-{
-	// From review:
-	// We can preallocate a wide char buffer that is the same length (in wchar_t elements) as the utf8 input,
-	// plus one for a null terminator, and be guaranteed to not overflow.
-
-	//	Normally, I'd call that sort of thing premature optimization,
-	// but we *are* seeing string operations taking a bunch of time, especially when constructing widgets.
-//	int output_str_len = MultiByteToWideChar(code_page, 0, in.c_str(), in.length(), NULL, 0);
-
-	// reserve place to NULL terminator
-	int output_str_len = in.length();
-	wchar_t* w_out = new wchar_t[output_str_len + 1];
-
-	memset(w_out, 0, output_str_len + 1);
-	int real_output_str_len = MultiByteToWideChar (code_page, 0, in.c_str(), in.length(), w_out, output_str_len);
-
-	//looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858.
-	w_out[real_output_str_len] = 0;
-
-	return w_out;
-}
-
-std::string ll_convert_string_to_utf8_string(const std::string& in)
-{
-	wchar_t* w_mesg = ll_convert_string_to_wide(in, CP_ACP);
-	std::string out_utf8(ll_convert_wide_to_string(w_mesg, CP_UTF8));
-	delete[] w_mesg;
-
-	return out_utf8;
-}
 #endif // LL_WINDOWS
 
 long LLStringOps::sPacificTimeOffset = 0;
@@ -702,17 +676,6 @@ long LLStringOps::sLocalTimeOffset = 0;
 bool LLStringOps::sPacificDaylightTime = 0;
 std::map<std::string, std::string> LLStringOps::datetimeToCodes;
 
-std::vector<std::string> LLStringOps::sWeekDayList;
-std::vector<std::string> LLStringOps::sWeekDayShortList;
-std::vector<std::string> LLStringOps::sMonthList;
-std::vector<std::string> LLStringOps::sMonthShortList;
-
-
-std::string LLStringOps::sDayFormat;
-std::string LLStringOps::sAM;
-std::string LLStringOps::sPM;
-
-
 S32	LLStringOps::collate(const llwchar* a, const llwchar* b)
 { 
 	#if LL_WINDOWS
@@ -752,7 +715,6 @@ void LLStringOps::setupDatetimeInfo (bool daylight)
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
@@ -762,50 +724,6 @@ void LLStringOps::setupDatetimeInfo (bool daylight)
 	datetimeToCodes["timezone"]	= "%Z";		// PST
 }
 
-void tokenizeStringToArray(const std::string& data, std::vector<std::string>& output)
-{
-	output.clear();
-	size_t length = data.size();
-	
-	// tokenize it and put it in the array
-	std::string cur_word;
-	for(size_t i = 0; i < length; ++i)
-	{
-		if(data[i] == ':')
-		{
-			output.push_back(cur_word);
-			cur_word.clear();
-		}
-		else
-		{
-			cur_word.append(1, data[i]);
-		}
-	}
-	output.push_back(cur_word);
-}
-
-void LLStringOps::setupWeekDaysNames(const std::string& data)
-{
-	tokenizeStringToArray(data,sWeekDayList);
-}
-void LLStringOps::setupWeekDaysShortNames(const std::string& data)
-{
-	tokenizeStringToArray(data,sWeekDayShortList);
-}
-void LLStringOps::setupMonthNames(const std::string& data)
-{
-	tokenizeStringToArray(data,sMonthList);
-}
-void LLStringOps::setupMonthShortNames(const std::string& data)
-{
-	tokenizeStringToArray(data,sMonthShortList);
-}
-void LLStringOps::setupDayFormat(const std::string& data)
-{
-	sDayFormat = data;
-}
-
-
 std::string LLStringOps::getDatetimeCode (std::string key)
 {
 	std::map<std::string, std::string>::iterator iter;
@@ -901,10 +819,6 @@ namespace LLStringFn
 
 ////////////////////////////////////////////////////////////
 
-// Forward specialization of LLStringUtil::format before use in LLStringUtil::formatDatetime.
-template<>
-S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions);
-
 //static
 template<> 
 void LLStringUtil::getTokens(const std::string& instr, std::vector<std::string >& tokens, const std::string& delims)
@@ -1021,14 +935,7 @@ void LLStringUtil::formatNumber(std::string& numStr, std::string decimals)
 	convertToS32 (decimals, intDecimals);
 	if (!sLocale.empty())
 	{
-		// std::locale() throws if the locale is unknown! (EXT-7926)
-		try
-		{
-			strStream.imbue(std::locale(sLocale.c_str()));
-		} catch (const std::exception &)
-		{
-			LL_WARNS_ONCE("Locale") << "Cannot set locale to " << sLocale << LL_ENDL;
-		}
+		strStream.imbue (std::locale(sLocale.c_str()));
 	}
 
 	if (!intDecimals)
@@ -1091,58 +998,7 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token,
 		}
 		return true;
 	}
-
-	//EXT-7013
-	//few codes are not suppotred by strtime function (example - weekdays for Japanise)
-	//so use predefined ones
-	
-	//if sWeekDayList is not empty than current locale doesn't support
-        //weekday name.
-	time_t loc_seconds = (time_t) secFromEpoch;
-	if(LLStringOps::sWeekDayList.size() == 7 && code == "%A")
-	{
-		struct tm * gmt = gmtime (&loc_seconds);
-		replacement = LLStringOps::sWeekDayList[gmt->tm_wday];
-	}
-	else if(LLStringOps::sWeekDayShortList.size() == 7 && code == "%a")
-	{
-		struct tm * gmt = gmtime (&loc_seconds);
-		replacement = LLStringOps::sWeekDayShortList[gmt->tm_wday];
-	}
-	else if(LLStringOps::sMonthList.size() == 12 && code == "%B")
-	{
-		struct tm * gmt = gmtime (&loc_seconds);
-		replacement = LLStringOps::sWeekDayList[gmt->tm_mon];
-	}
-	else if( !LLStringOps::sDayFormat.empty() && code == "%d" )
-	{
-		struct tm * gmt = gmtime (&loc_seconds);
-		LLStringUtil::format_map_t args;
-		args["[MDAY]"] = llformat ("%d", gmt->tm_mday);
-		replacement = LLStringOps::sDayFormat;
-		LLStringUtil::format(replacement, args);
-	}
-	else if (code == "%-d")
-	{
-		struct tm * gmt = gmtime (&loc_seconds);
-		replacement = llformat ("%d", gmt->tm_mday); // day of the month without leading zero
-	}
-	else if( !LLStringOps::sAM.empty() && !LLStringOps::sPM.empty() && code == "%p" )
-	{
-		struct tm * gmt = gmtime (&loc_seconds);
-		if(gmt->tm_hour<12)
-		{
-			replacement = LLStringOps::sAM;
-		}
-		else
-		{
-			replacement = LLStringOps::sPM;
-		}
-	}
-	else
-	{
-		replacement = datetime.toHTTPDateString(code);
-	}
+	replacement = datetime.toHTTPDateString(code);
 
 	// *HACK: delete leading zero from hour string in case 'hour12' (code = %I) time format
 	// to show time without leading zero, e.g. 08:16 -> 8:16 (EXT-2738).
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 88fecb57bf7f9158abb115746bbc569f99e5cf32..96588b29b94d04158bd4636cbfc3d37a87474795 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -2,25 +2,31 @@
  * @file llstring.h
  * @brief String utility functions and std::string class.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -148,19 +154,9 @@ class LL_COMMON_API LLStringOps
 	static long sPacificTimeOffset;
 	static long sLocalTimeOffset;
 	static bool sPacificDaylightTime;
-
 	static std::map<std::string, std::string> datetimeToCodes;
 
 public:
-	static std::vector<std::string> sWeekDayList;
-	static std::vector<std::string> sWeekDayShortList;
-	static std::vector<std::string> sMonthList;
-	static std::vector<std::string> sMonthShortList;
-	static std::string sDayFormat;
-
-	static std::string sAM;
-	static std::string sPM;
-
 	static char toUpper(char elem) { return toupper((unsigned char)elem); }
 	static llwchar toUpper(llwchar elem) { return towupper(elem); }
 	
@@ -189,14 +185,6 @@ class LL_COMMON_API LLStringOps
 	static S32	collate(const llwchar* a, const llwchar* b);
 
 	static void setupDatetimeInfo(bool pacific_daylight_time);
-
-	static void setupWeekDaysNames(const std::string& data);
-	static void setupWeekDaysShortNames(const std::string& data);
-	static void setupMonthNames(const std::string& data);
-	static void setupMonthShortNames(const std::string& data);
-	static void setupDayFormat(const std::string& data);
-
-
 	static long getPacificTimeOffset(void) { return sPacificTimeOffset;}
 	static long getLocalTimeOffset(void) { return sLocalTimeOffset;}
 	// Is the Pacific time zone (aka server time zone)
@@ -243,7 +231,7 @@ class LLStringUtilBase
 	/////////////////////////////////////////////////////////////////////////////////////////
 	// Static Utility functions that operate on std::strings
 
-	static const std::basic_string<T> null;
+	static std::basic_string<T> null;
 	
 	typedef std::map<LLFormatMapString, LLFormatMapString> format_map_t;
 	LL_COMMON_API static void getTokens(const std::basic_string<T>& instr, std::vector<std::basic_string<T> >& tokens, const std::basic_string<T>& delims);
@@ -365,7 +353,7 @@ class LLStringUtilBase
 	LL_COMMON_API static size_type getSubstitution(const std::basic_string<T>& instr, size_type& start, std::vector<std::basic_string<T> >& tokens);
 };
 
-template<class T> const std::basic_string<T> LLStringUtilBase<T>::null;
+template<class T> std::basic_string<T> LLStringUtilBase<T>::null;
 template<class T> std::string LLStringUtilBase<T>::sLocale;
 
 typedef LLStringUtilBase<char> LLStringUtil;
@@ -558,20 +546,7 @@ using snprintf_hack::snprintf;
  *
  * This replaces the unsafe W2A macro from ATL.
  */
-LL_COMMON_API std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page);
-
-/**
- * Converts a string to wide string.
- *
- * It will allocate memory for result string with "new []". Don't forget to release it with "delete []".
- */
-LL_COMMON_API wchar_t* ll_convert_string_to_wide(const std::string& in, unsigned int code_page);
-
-/**
- * Converts incoming string into urf8 string
- *
- */
-LL_COMMON_API std::string ll_convert_string_to_utf8_string(const std::string& in);
+LL_COMMON_API std::string ll_convert_wide_to_string(const wchar_t* in);
 
 //@}
 #endif // LL_WINDOWS
diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index b39ea0c6f2c40e23e08b783680792227bebaeed2..9d4f3a98f04668a41a7940353097322c9115191d 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -4,25 +4,31 @@
  * @date 2006-02-08
  * @brief Implementation of the LLURI class.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -225,8 +231,7 @@ static BOOL isDefault(const std::string& scheme, U16 port)
 void LLURI::parseAuthorityAndPathUsingOpaque()
 {
 	if (mScheme == "http" || mScheme == "https" ||
-		mScheme == "ftp" || mScheme == "secondlife" || 
-		mScheme == "x-grid-location-info")
+		mScheme == "ftp" || mScheme == "secondlife" )
 	{
 		if (mEscapedOpaque.substr(0,2) != "//")
 		{
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index 5d452ac4e44c03675e37ff2d681f1c741280dc79..bcbae06ec564e968c68a40718d00b6fcbe9eca7b 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file lluuid.cpp
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -27,12 +33,9 @@
 
 // We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
 #if LL_WINDOWS
-#undef WIN32_LEAN_AND_MEAN
-#include <winsock2.h>
-#include <windows.h>
-// ugh, this is ugly.  We need to straighten out our linking for this library
-#pragma comment(lib, "IPHLPAPI.lib")
-#include <iphlpapi.h>
+#	undef WIN32_LEAN_AND_MEAN
+#	include <winsock2.h>
+#	include <windows.h>
 #endif
 
 #include "lldefs.h"
@@ -449,8 +452,7 @@ static void get_random_bytes(void *buf, int nbytes)
 	return;	
 }
 
-#if	LL_WINDOWS
-
+#if LL_WINDOWS
 typedef struct _ASTAT_
 {
 	ADAPTER_STATUS adapt;
@@ -458,44 +460,58 @@ typedef struct _ASTAT_
 }ASTAT, * PASTAT;
 
 // static
-S32	LLUUID::getNodeID(unsigned char	*node_id)
-{
-	ASTAT Adapter;
-	NCB Ncb;
-	UCHAR uRetCode;
-	LANA_ENUM   lenum;
-	int      i;
-	int retval = 0;
-
-	memset( &Ncb, 0, sizeof(Ncb) );
-	Ncb.ncb_command = NCBENUM;
-	Ncb.ncb_buffer = (UCHAR *)&lenum;
-	Ncb.ncb_length = sizeof(lenum);
-	uRetCode = Netbios( &Ncb );
-
-	for(i=0; i < lenum.length ;i++)
-	{
-		memset( &Ncb, 0, sizeof(Ncb) );
-		Ncb.ncb_command = NCBRESET;
-		Ncb.ncb_lana_num = lenum.lana[i];
-
-		uRetCode = Netbios( &Ncb );
-
-		memset( &Ncb, 0, sizeof (Ncb) );
-		Ncb.ncb_command = NCBASTAT;
-		Ncb.ncb_lana_num = lenum.lana[i];
-
-		strcpy( (char *)Ncb.ncb_callname,  "*              " );		/* Flawfinder: ignore */
-		Ncb.ncb_buffer = (unsigned char *)&Adapter;
-		Ncb.ncb_length = sizeof(Adapter);
-
-		uRetCode = Netbios( &Ncb );
-		if ( uRetCode == 0 )
-		{
+S32 LLUUID::getNodeID(unsigned char * node_id)
+{
+	  ASTAT Adapter;
+      NCB Ncb;
+      UCHAR uRetCode;
+      LANA_ENUM   lenum;
+      int      i;
+	  int retval = 0;
+
+      memset( &Ncb, 0, sizeof(Ncb) );
+      Ncb.ncb_command = NCBENUM;
+      Ncb.ncb_buffer = (UCHAR *)&lenum;
+      Ncb.ncb_length = sizeof(lenum);
+      uRetCode = Netbios( &Ncb );
+ //     printf( "The NCBENUM return code is: 0x%x \n", uRetCode );
+
+      for(i=0; i < lenum.length ;i++)
+      {
+          memset( &Ncb, 0, sizeof(Ncb) );
+          Ncb.ncb_command = NCBRESET;
+          Ncb.ncb_lana_num = lenum.lana[i];
+
+          uRetCode = Netbios( &Ncb );
+ //         printf( "The NCBRESET on LANA %d return code is: 0x%x \n",
+ //                 lenum.lana[i], uRetCode );
+
+          memset( &Ncb, 0, sizeof (Ncb) );
+          Ncb.ncb_command = NCBASTAT;
+          Ncb.ncb_lana_num = lenum.lana[i];
+
+          strcpy( (char *)Ncb.ncb_callname,  "*              " );		/* Flawfinder: ignore */
+          Ncb.ncb_buffer = (unsigned char *)&Adapter;
+          Ncb.ncb_length = sizeof(Adapter);
+
+          uRetCode = Netbios( &Ncb );
+//          printf( "The NCBASTAT on LANA %d return code is: 0x%x \n",
+//                 lenum.lana[i], uRetCode );
+          if ( uRetCode == 0 )
+          {
+//            printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n",
+//	 			  lenum.lana[i],
+//                  Adapter.adapt.adapter_address[0],
+//                  Adapter.adapt.adapter_address[1],
+//                  Adapter.adapt.adapter_address[2],
+//                  Adapter.adapt.adapter_address[3],
+//                  Adapter.adapt.adapter_address[4],
+//                  Adapter.adapt.adapter_address[5] );
 			memcpy(node_id,Adapter.adapt.adapter_address,6);		/* Flawfinder: ignore */
 			retval = 1;
-		}
-	}
+
+          }
+	  }
 	return retval;
 }
 
diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h
index 726be4a82da6697aa62186e8fd79f405a44dc379..3a0d66e4a5d953ab59f44d5645b4f6cd97fdcad0 100644
--- a/indra/llcommon/lluuid.h
+++ b/indra/llcommon/lluuid.h
@@ -1,25 +1,31 @@
 /** 
  * @file lluuid.h
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h
index 2c2c81927222ea689e73fb048df3cb386b9e905f..e3663544db71565ff43c30ebfc78db26fb22f9d4 100644
--- a/indra/llcommon/llversionserver.h
+++ b/indra/llcommon/llversionserver.h
@@ -2,35 +2,41 @@
  * @file llversionserver.h
  * @brief
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #ifndef LL_LLVERSIONSERVER_H
 #define LL_LLVERSIONSERVER_H
 
-const S32 LL_VERSION_MAJOR = 2;
-const S32 LL_VERSION_MINOR = 1;
+const S32 LL_VERSION_MAJOR = 1;
+const S32 LL_VERSION_MINOR = 31;
 const S32 LL_VERSION_PATCH = 0;
-const S32 LL_VERSION_BUILD = 0;
+const S32 LL_VERSION_BUILD = 203110;
 
 const char * const LL_CHANNEL = "Second Life Server";
 
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index 92d9e1204a218562f45b6e18bc77adae7dc427d8..3ab4257fabe90f4e5d0dd31aead6095d308c3197 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -2,25 +2,31 @@
  * @file llversionviewer.h
  * @brief
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -28,9 +34,9 @@
 #define LL_LLVERSIONVIEWER_H
 
 const S32 LL_VERSION_MAJOR = 2;
-const S32 LL_VERSION_MINOR = 1;
-const S32 LL_VERSION_PATCH = 2;
-const S32 LL_VERSION_BUILD = 0;
+const S32 LL_VERSION_MINOR = 0;
+const S32 LL_VERSION_PATCH = 0;
+const S32 LL_VERSION_BUILD = 203110;
 
 const char * const LL_CHANNEL = "Second Life Developer";
 
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index be0ab9fcb7e82941562ea176cd5ae2b9f3720d0c..0874f574c55e025c86d45bb9a59f1d7c150e9208 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -2,25 +2,31 @@
  * @file llimage.cpp
  * @brief Base class for images.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -162,8 +168,8 @@ U8* LLImageBase::allocateData(S32 size)
 		}
 		else
 		{
-			llerrs << "LLImageBase::allocateData: bad size: " << size << llendl;
-		}
+		llerrs << "LLImageBase::allocateData: bad size: " << size << llendl;
+	}
 	}
 	if (!mData || size != mDataSize)
 	{
@@ -261,6 +267,10 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
 {
 	mMemType = LLMemType::MTYPE_IMAGERAW;
 	//llassert( S32(width) * S32(height) * S32(components) <= MAX_IMAGE_DATA_SIZE );
+	if(S32(width) * S32(height) * S32(components) > MAX_IMAGE_DATA_SIZE)
+	{
+		llwarns << "over size: width: " << (S32)width << " height: " << (S32)height << " components: " << (S32)components << llendl ;
+	}
 	allocateDataSize(width, height, components);
 	++sRawImageCount;
 }
@@ -1328,7 +1338,7 @@ LLImageFormatted::LLImageFormatted(S8 codec)
 	  mCodec(codec),
 	  mDecoding(0),
 	  mDecoded(0),
-	  mDiscardLevel(-1)
+	  mDiscardLevel(0)
 {
 	mMemType = LLMemType::MTYPE_IMAGEFORMATTED;
 }
@@ -1547,7 +1557,6 @@ void LLImageFormatted::appendData(U8 *data, S32 size)
 			S32 newsize = cursize + size;
 			reallocateData(newsize);
 			memcpy(getData() + cursize, data, size);
-			delete[] data;
 		}
 	}
 }
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index bca7e915fac8d9f469f6566b46540ba0fbf1f351..10444e7f89d9bd580508db6fd75b3fb3a7937581 100644
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -2,25 +2,31 @@
  * @file llimage.h
  * @brief Object for managing images and their textures.
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt
index 6b2b61f88353727c667be8711474ac1bc29c9491..a563db901a84eeaf95e19da77ff032899a3c8e71 100644
--- a/indra/llinventory/CMakeLists.txt
+++ b/indra/llinventory/CMakeLists.txt
@@ -59,16 +59,16 @@ list(APPEND llinventory_SOURCE_FILES ${llinventory_HEADER_FILES})
 add_library (llinventory ${llinventory_SOURCE_FILES})
 
 
-if(LL_TESTS)
-  #add unit tests
-  INCLUDE(LLAddBuildTest)
-  SET(llinventory_TEST_SOURCE_FILES
-      # no real unit tests yet!
-      )
-  LL_ADD_PROJECT_UNIT_TESTS(llinventory "${llinventory_TEST_SOURCE_FILES}")
 
-  #set(TEST_DEBUG on)
-  set(test_libs llinventory ${LLMESSAGE_LIBRARIES} ${LLVFS_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
-  LL_ADD_INTEGRATION_TEST(inventorymisc "" "${test_libs}")
-  LL_ADD_INTEGRATION_TEST(llparcel "" "${test_libs}")
-endif(LL_TESTS)
+#add unit tests
+INCLUDE(LLAddBuildTest)
+SET(llinventory_TEST_SOURCE_FILES
+  # no real unit tests yet!
+  )
+LL_ADD_PROJECT_UNIT_TESTS(llinventory "${llinventory_TEST_SOURCE_FILES}")
+
+#set(TEST_DEBUG on)
+set(test_libs llinventory ${LLMESSAGE_LIBRARIES} ${LLVFS_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
+LL_ADD_INTEGRATION_TEST(inventorymisc "" "${test_libs}")
+LL_ADD_INTEGRATION_TEST(llparcel "" "${test_libs}")
+
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index bda76eac806620636f721fe77e1f2f3a00f56ef6..2c767a4857592ca7810ab0c2681e6dedbb270908 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -2,25 +2,31 @@
  * @file llinventory.cpp
  * @brief Implementation of the inventory system.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -79,7 +85,10 @@ LLInventoryObject::LLInventoryObject(const LLUUID& uuid,
 	mType(type),
 	mName(name)
 {
-	correctInventoryName(mName);
+	LLStringUtil::replaceNonstandardASCII(mName, ' ');
+	LLStringUtil::replaceChar(mName, '|', ' ');
+	LLStringUtil::trim(mName);
+	LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN);
 }
 
 LLInventoryObject::LLInventoryObject() :
@@ -146,8 +155,12 @@ void LLInventoryObject::setUUID(const LLUUID& new_uuid)
 void LLInventoryObject::rename(const std::string& n)
 {
 	std::string new_name(n);
-	correctInventoryName(new_name);
-	if( !new_name.empty() && new_name != mName )
+	LLStringUtil::replaceNonstandardASCII(new_name, ' ');
+	LLStringUtil::replaceChar(new_name, '|', ' ');
+	LLStringUtil::trim(new_name);
+	LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN);
+
+	if( new_name != mName )
 	{
 		mName = new_name;
 	}
@@ -208,7 +221,10 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
 				" %254s %254[^|]",
 				keyword, valuestr);
 			mName.assign(valuestr);
-			correctInventoryName(mName);
+			LLStringUtil::replaceNonstandardASCII(mName, ' ');
+			LLStringUtil::replaceChar(mName, '|', ' ');
+			LLStringUtil::trim(mName);
+			LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN);
 		}
 		else
 		{
@@ -268,15 +284,6 @@ void LLInventoryObject::updateServer(BOOL) const
 	llwarns << "LLInventoryObject::updateServer() called.  Doesn't do anything." << llendl;
 }
 
-inline
-void LLInventoryObject::correctInventoryName(std::string& name)
-{
-	LLStringUtil::replaceNonstandardASCII(name, ' ');
-	LLStringUtil::replaceChar(name, '|', ' ');
-	LLStringUtil::trim(name);
-	LLStringUtil::truncate(name, DB_INV_ITEM_NAME_STR_LEN);
-}
-
 
 ///----------------------------------------------------------------------------
 /// Class LLInventoryItem
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index a5cfe59bda347b615f674c351b6050cc362bf2af..b083e305b10f777f4fcd6ffee8d5fdd385e933db 100644
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -2,25 +2,31 @@
  * @file llinventory.h
  * @brief LLInventoryItem and LLInventoryCategory class declaration.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -86,13 +92,9 @@ class LLInventoryObject : public LLRefCount
 	void setParent(const LLUUID& new_parent);
 	void setType(LLAssetType::EType type);
 
-private:
-	// in place correction for inventory name string
-	void correctInventoryName(std::string& name);
-
 	//--------------------------------------------------------------------
 	// File Support
-	//   Implemented here so that a minimal information set can be transmitted
+	//   Implemented here so that a minimal information set can be transmitted 
 	//   between simulator and viewer.
 	//--------------------------------------------------------------------
 public:
diff --git a/indra/llinventory/llinventorydefines.cpp b/indra/llinventory/llinventorydefines.cpp
index 575331a2636c4d8b89c69a40147734755ec75056..a9610d4d4baf776fb6545851699d9d5f6bc7bba5 100644
--- a/indra/llinventory/llinventorydefines.cpp
+++ b/indra/llinventory/llinventorydefines.cpp
@@ -2,25 +2,31 @@
  * @file llinventorydefines.cpp
  * @brief Implementation of the inventory defines.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llinventory/llinventorydefines.h b/indra/llinventory/llinventorydefines.h
index 3881fb1fd72d22d9c1e8ff9b18b36b8f5d4c556f..ccf1a356dec1beba64560c561db41e64cb2fc2a8 100644
--- a/indra/llinventory/llinventorydefines.h
+++ b/indra/llinventory/llinventorydefines.h
@@ -2,25 +2,31 @@
  * @file llinventorydefines.h
  * @brief LLInventoryDefines
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -83,7 +89,7 @@ class LLInventoryItemFlags
 
 		II_FLAGS_WEARABLES_MASK = 0xff,
 			// Wearables use the low order byte of flags to store the
-			// LLWearableType::EType enumeration found in newview/llwearable.h
+			// EWearableType enumeration found in newview/llwearable.h
 
 		II_FLAGS_PERM_OVERWRITE_MASK = 				(II_FLAGS_OBJECT_SLAM_PERM |
 													 II_FLAGS_OBJECT_SLAM_SALE |
diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h
index d9777a73f265c53d061f0d1411dac5b63cbf5d3d..20da95400225f11f073a9e85965e742f71e3a73f 100644
--- a/indra/llinventory/llinventorytype.h
+++ b/indra/llinventory/llinventorytype.h
@@ -2,25 +2,31 @@
  * @file llinventorytype.h
  * @brief Inventory item type, more specific than an asset type.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index ede624141d4c6cbe5dbed7a7e2c7f2578f2e4247..b08cb28218f96d39372f15ca926d79c3dff1663e 100644
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -2,25 +2,31 @@
  * @file llparcel.cpp
  * @brief A land parcel.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index ae301af9f5ecc41ca4aa36db5d971be2f5864309..4ee9d9b40feec22c90ed1764017e331d3ecfa001 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -1,25 +1,31 @@
 /** 
  * @file llparcel.h
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp
index 5a67035ed15fff56a9d42742c26c74dee8b36f4f..00e77d20e9d03673eccf1384009276edd3063974 100644
--- a/indra/llmessage/llares.cpp
+++ b/indra/llmessage/llares.cpp
@@ -4,25 +4,31 @@
  * @date 2007-08-15
  * @brief Wrapper for asynchronous DNS lookups.
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -102,8 +108,7 @@ LLAres::LLAres() :
     mInitSuccess(false),
     mListener(new LLAresListener(this))
 {
-	if (ares_library_init( ARES_LIB_INIT_ALL ) != ARES_SUCCESS ||
-		ares_init(&chan_) != ARES_SUCCESS)
+	if (ares_init(&chan_) != ARES_SUCCESS)
 	{
 		llwarns << "Could not succesfully initialize ares!" << llendl;
 		return;
@@ -115,7 +120,6 @@ LLAres::LLAres() :
 LLAres::~LLAres()
 {
 	ares_destroy(chan_);
-	ares_library_cleanup();
 }
 
 void LLAres::cancel()
@@ -469,7 +473,7 @@ bool LLAres::process(U64 timeout)
 		ll_init_apr();
 	}
 
-	ares_socket_t socks[ARES_GETSOCK_MAXNUM];
+	int socks[ARES_GETSOCK_MAXNUM];
 	apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM];
 	apr_int32_t nsds = 0;	
 	int nactive = 0;
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index b26d412e9fa688b80f4c2eda69549f9fba579989..02523467e839be212ed8760b7dd4add619aaf968 100644
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -2,25 +2,31 @@
  * @file llassetstorage.cpp
  * @brief Implementation of the base asset storage system.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -277,30 +283,28 @@ LLEstateAssetRequest::~LLEstateAssetRequest()
 // TODO: rework tempfile handling?
 
 
-LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host)
+LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host)
 {
-	_init(msg, xfer, vfs, static_vfs, upstream_host);
+	_init(msg, xfer, vfs, upstream_host);
 }
 
 
 LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
-							   LLVFS *vfs, LLVFS *static_vfs)
+							   LLVFS *vfs)
 {
-	_init(msg, xfer, vfs, static_vfs, LLHost::invalid);
+	_init(msg, xfer, vfs, LLHost::invalid);
 }
 
 
 void LLAssetStorage::_init(LLMessageSystem *msg,
 						   LLXferManager *xfer,
 						   LLVFS *vfs,
-						   LLVFS *static_vfs,
 						   const LLHost &upstream_host)
 {
 	mShutDown = FALSE;
 	mMessageSys = msg;
 	mXferManager = xfer;
 	mVFS = vfs;
-	mStaticVFS = static_vfs;
 
 	setUpstream(upstream_host);
 	msg->setHandlerFuncFast(_PREHASH_AssetUploadComplete, processUploadComplete, (void **)this);
@@ -392,33 +396,7 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
 
 BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type)
 {
-	return mStaticVFS->getExists(uuid, type) || mVFS->getExists(uuid, type);
-}
-
-bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type,
-													  LLGetAssetCallback callback, void *user_data)
-{
-	BOOL exists = mStaticVFS->getExists(uuid, type);
-	if (exists)
-	{
-		LLVFile file(mStaticVFS, uuid, type);
-		U32 size = file.getSize();
-		if (size > 0)
-		{
-			// we've already got the file
-			if (callback)
-			{
-				callback(mStaticVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
-			}
-			return true;
-		}
-		else
-		{
-			llwarns << "Asset vfile " << uuid << ":" << type
-					<< " found in static cache with bad size " << file.getSize() << ", ignoring" << llendl;
-		}
-	}
-	return false;
+	return mVFS->getExists(uuid, type);
 }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -426,7 +404,7 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
 ///////////////////////////////////////////////////////////////////////////
 
 // IW - uuid is passed by value to avoid side effects, please don't re-add &    
-void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority)
+void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void *user_data, BOOL is_priority)
 {
 	lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
 
@@ -434,7 +412,6 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
 
 	if (mShutDown)
 	{
-		llinfos << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl;
 		return; // don't get the asset or do any callbacks, we are shutting down
 	}
 		
@@ -448,30 +425,11 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
 		return;
 	}
 
-	// Try static VFS first.
-	if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data))
-	{
-		llinfos << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl;
-		return;
-	}
-
 	BOOL exists = mVFS->getExists(uuid, type);
 	LLVFile file(mVFS, uuid, type);
 	U32 size = exists ? file.getSize() : 0;
 	
-	if (size > 0)
-	{
-		// we've already got the file
-		// theoretically, partial files w/o a pending request shouldn't happen
-		// unless there's a weird error
-		if (callback)
-		{
-			callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
-		}
-
-		llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
-	}
-	else
+	if (size < 1)
 	{
 		if (exists)
 		{
@@ -510,7 +468,18 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
 		// This can be overridden by subclasses
 		_queueDataRequest(uuid, type, callback, user_data, duplicate, is_priority);	
 	}
+	else
+	{
+		// we've already got the file
+		// theoretically, partial files w/o a pending request shouldn't happen
+		// unless there's a weird error
+		llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
 
+		if (callback)
+		{
+			callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
+		}
+	}
 }
 
 void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType atype,
@@ -653,27 +622,11 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
 		return;
 	}
 
-	// Try static VFS first.
-	if (findInStaticVFSAndInvokeCallback(asset_id,atype,callback,user_data))
-	{
-		return;
-	}
-	
 	BOOL exists = mVFS->getExists(asset_id, atype);
 	LLVFile file(mVFS, asset_id, atype);
 	U32 size = exists ? file.getSize() : 0;
 
-	if (size > 0)
-	{
-		// we've already got the file
-		// theoretically, partial files w/o a pending request shouldn't happen
-		// unless there's a weird error
-		if (callback)
-		{
-			callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
-		}
-	}
-	else
+	if (size < 1)
 	{
 		if (exists)
 		{
@@ -724,6 +677,16 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
 			}
 		}
 	}
+	else
+	{
+		// we've already got the file
+		// theoretically, partial files w/o a pending request shouldn't happen
+		// unless there's a weird error
+		if (callback)
+		{
+			callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
+		}
+	}
 }
 
 void LLAssetStorage::downloadEstateAssetCompleteCallback(
@@ -790,12 +753,6 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
 
 	if(asset_id.notNull())
 	{
-		// Try static VFS first.
-		if (findInStaticVFSAndInvokeCallback( asset_id, atype, callback, user_data))
-		{
-			return;
-		}
-
 		exists = mVFS->getExists(asset_id, atype);
 		LLVFile file(mVFS, asset_id, atype);
 		size = exists ? file.getSize() : 0;
@@ -807,17 +764,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
 
 	}
 
-	if (size > 0)
-	{
-		// we've already got the file
-		// theoretically, partial files w/o a pending request shouldn't happen
-		// unless there's a weird error
-		if (callback)
-		{
-			callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
-		}
-	}
-	else
+	if (size < 1)
 	{
 		// See whether we should talk to the object's originating sim,
 		// or the upstream provider.
@@ -866,6 +813,16 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
 			}
 		}
 	}
+	else
+	{
+		// we've already got the file
+		// theoretically, partial files w/o a pending request shouldn't happen
+		// unless there's a weird error
+		if (callback)
+		{
+			callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
+		}
+	}
 }
 
 
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index a485fa016085eaf050ebf110067c6ac3317cc65f..024e17a7779a487ef8e9022e3ec5cda7104a4327 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -4,25 +4,31 @@
  * @date 2006-10-15
  * @brief Implementation of wrapper around libcurl.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -83,6 +89,10 @@ S32 gCurlMultiCount = 0;
 std::vector<LLMutex*> LLCurl::sSSLMutex;
 std::string LLCurl::sCAPath;
 std::string LLCurl::sCAFile;
+// Verify SSL certificates by default (matches libcurl default). The ability
+// to alter this flag is only to allow us to suppress verification if it's
+// broken for some reason.
+bool LLCurl::sSSLVerify = true;
 
 //static
 void LLCurl::setCAPath(const std::string& path)
@@ -96,6 +106,18 @@ void LLCurl::setCAFile(const std::string& file)
 	sCAFile = file;
 }
 
+//static
+void LLCurl::setSSLVerify(bool verify)
+{
+	sSSLVerify = verify;
+}
+
+//static
+bool LLCurl::getSSLVerify()
+{
+	return sSSLVerify;
+}
+
 //static
 std::string LLCurl::getVersionString()
 {
@@ -358,7 +380,7 @@ U32 LLCurl::Easy::report(CURLcode code)
 		responseCode = 499;
 		responseReason = strerror(code) + " : " + mErrorBuffer;
 	}
-
+		
 	if (mResponder)
 	{	
 		mResponder->completedRaw(responseCode, responseReason, mChannels, mOutput);
@@ -456,17 +478,11 @@ void LLCurl::Easy::prepRequest(const std::string& url,
 	setopt(CURLOPT_HEADERFUNCTION, (void*)&curlHeaderCallback);
 	setopt(CURLOPT_HEADERDATA, (void*)this);
 
-	// Allow up to five redirects
-	if(responder && responder->followRedir())
-	{
-		setopt(CURLOPT_FOLLOWLOCATION, 1);
-		setopt(CURLOPT_MAXREDIRS, MAX_REDIRECTS);
-	}
-
 	setErrorBuffer();
 	setCA();
 
-	setopt(CURLOPT_SSL_VERIFYPEER, true);
+	setopt(CURLOPT_SSL_VERIFYPEER, LLCurl::getSSLVerify());
+	setopt(CURLOPT_SSL_VERIFYHOST, LLCurl::getSSLVerify()? 2 : 0);
 	setopt(CURLOPT_TIMEOUT, CURL_REQUEST_TIMEOUT);
 
 	setoptString(CURLOPT_URL, url);
@@ -896,15 +912,6 @@ void LLCurlEasyRequest::setReadCallback(curl_read_callback callback, void* userd
 	}
 }
 
-void LLCurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata)
-{
-	if (mEasy)
-	{
-		mEasy->setopt(CURLOPT_SSL_CTX_FUNCTION, (void*)callback);
-		mEasy->setopt(CURLOPT_SSL_CTX_DATA, userdata);
-	}
-}
-
 void LLCurlEasyRequest::slist_append(const char* str)
 {
 	if (mEasy)
@@ -1054,5 +1061,3 @@ void LLCurl::cleanupClass()
 #endif
 	curl_global_cleanup();
 }
-
-const unsigned int LLCurl::MAX_REDIRECTS = 5;
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index 64dadd6640c48ad5fb724d0a74935c9b41e69d22..caf02cccd90bc6c70ab4f755485b6b355bb2986d 100644
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -4,25 +4,31 @@
  * @date 2006-10-15
  * @brief A wrapper around libcurl.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
  
@@ -117,11 +123,6 @@ class LLCurl
 			// Used internally to set the url for debugging later.
 			void setURL(const std::string& url);
 
-			virtual bool followRedir() 
-			{
-				return false;
-			}
-
 	public: /* but not really -- don't touch this */
 		U32 mReferenceCount;
 
@@ -156,6 +157,16 @@ class LLCurl
 	 */
 	static const std::string& getCAPath() { return sCAPath; }
 
+	/**
+	 * @ brief Set flag controlling whether to verify HTTPS certs.
+	 */
+	static void setSSLVerify(bool verify);
+
+	/**
+	 * @ brief Get flag controlling whether to verify HTTPS certs.
+	 */
+	static bool getSSLVerify();
+
 	/**
 	 * @ brief Initialize LLCurl class
 	 */
@@ -181,7 +192,7 @@ class LLCurl
 private:
 	static std::string sCAPath;
 	static std::string sCAFile;
-	static const unsigned int MAX_REDIRECTS;
+	static bool sSSLVerify;
 };
 
 namespace boost
@@ -229,7 +240,6 @@ class LLCurlEasyRequest
 	void setHeaderCallback(curl_header_callback callback, void* userdata);
 	void setWriteCallback(curl_write_callback callback, void* userdata);
 	void setReadCallback(curl_read_callback callback, void* userdata);
-	void setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata);
 	void slist_append(const char* str);
 	void sendRequest(const std::string& url);
 	void requestComplete();
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 47b86bd53dc8a66cf830d197fa8305dc68f61102..dd56e18caf8fbe26e60b61d0167cdcc3d20ee12b 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -2,30 +2,36 @@
  * @file llhttpclient.cpp
  * @brief Implementation of classes for making HTTP requests.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "linden_common.h"
-#include <openssl/x509_vfy.h>
+
 #include "llhttpclient.h"
 
 #include "llassetstorage.h"
@@ -40,10 +46,7 @@
 #include "message.h"
 #include <curl/curl.h>
 
-
 const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
-LLURLRequest::SSLCertVerifyCallback LLHTTPClient::mCertVerifyCallback = NULL;
-
 ////////////////////////////////////////////////////////////////////////////
 
 // Responder class moved to LLCurl
@@ -76,10 +79,8 @@ namespace
 		{
 			if (mResponder.get())
 			{
-				// Allow clients to parse headers before we attempt to parse
-				// the body and provide completed/result/error calls.
-				mResponder->completedHeader(mStatus, mReason, mHeaderOutput);
 				mResponder->completedRaw(mStatus, mReason, channels, buffer);
+				mResponder->completedHeader(mStatus, mReason, mHeaderOutput);
 			}
 		}
 		virtual void header(const std::string& header, const std::string& value)
@@ -193,7 +194,6 @@ namespace
 			fileBuffer = new U8 [fileSize];
             vfile.read(fileBuffer, fileSize);
             ostream.write((char*)fileBuffer, fileSize);
-			delete [] fileBuffer;
 			eos = true;
 			return STATUS_DONE;
 		}
@@ -206,19 +206,13 @@ namespace
 	LLPumpIO* theClientPump = NULL;
 }
 
-void LLHTTPClient::setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback)
-{
-	LLHTTPClient::mCertVerifyCallback = callback;
-}
-
 static void request(
 	const std::string& url,
 	LLURLRequest::ERequestAction method,
 	Injector* body_injector,
 	LLCurl::ResponderPtr responder,
 	const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
-	const LLSD& headers = LLSD()
-    )
+	const LLSD& headers = LLSD())
 {
 	if (!LLHTTPClient::hasPump())
 	{
@@ -228,7 +222,7 @@ static void request(
 	LLPumpIO::chain_t chain;
 
 	LLURLRequest* req = new LLURLRequest(method, url);
-	req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
+	req->checkRootCertificate(LLCurl::getSSLVerify());
 
 	
 	lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " "
@@ -423,6 +417,7 @@ static LLSD blocking_request(
 	std::string body_str;
 	
 	// other request method checks root cert first, we skip?
+	//req->checkRootCertificate(true);
 	
 	// * Set curl handle options
 	curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1);	// don't use SIGALRM for timeouts
diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h
index a7236ba16994200052aa4d1a5736ba12ff478be6..3d0646e5fe9b53b436f5fc9c7166ca47845b767d 100644
--- a/indra/llmessage/llhttpclient.h
+++ b/indra/llmessage/llhttpclient.h
@@ -2,25 +2,31 @@
  * @file llhttpclient.h
  * @brief Declaration of classes for making HTTP client requests.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -34,8 +40,7 @@
 #include <string>
 
 #include <boost/intrusive_ptr.hpp>
-#include <openssl/x509_vfy.h>
-#include "llurlrequest.h"
+
 #include "llassettype.h"
 #include "llcurl.h"
 #include "lliopipe.h"
@@ -56,7 +61,6 @@ class LLHTTPClient
 	typedef LLCurl::Responder Responder;
 	typedef LLCurl::ResponderPtr ResponderPtr;
 
-	
 	/** @name non-blocking API */
 	//@{
 	static void head(
@@ -151,12 +155,7 @@ class LLHTTPClient
 	static void setPump(LLPumpIO& pump);
 		///< must be called before any of the above calls are made
 	static bool hasPump();
-
-	static void setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback);
-	static  LLURLRequest::SSLCertVerifyCallback getCertVerifyCallback() { return mCertVerifyCallback; }
-
-protected:
-	static LLURLRequest::SSLCertVerifyCallback mCertVerifyCallback;
+		///< for testing
 };
 
 #endif // LL_LLHTTPCLIENT_H
diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp
index 7e57841580bc0466dcefc61ce0e2b9375edd2c67..43f7c07e9480e4dcaf6bd82fd1a52d1db6e77087 100644
--- a/indra/llmessage/lltransfersourceasset.cpp
+++ b/indra/llmessage/lltransfersourceasset.cpp
@@ -2,25 +2,31 @@
  * @file lltransfersourceasset.cpp
  * @brief Transfer system for sending an asset.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llmessage/lltransfersourceasset.h b/indra/llmessage/lltransfersourceasset.h
index 3abda83cf8dd189ac5869ab240ea8eb542d296be..861659565436da6acf805e8bbfe89cbfe256a9bc 100644
--- a/indra/llmessage/lltransfersourceasset.h
+++ b/indra/llmessage/lltransfersourceasset.h
@@ -2,25 +2,31 @@
  * @file lltransfersourceasset.h
  * @brief Transfer system for sending an asset.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index 8adb3cda19a4639cecd2968adefbc448e41e3b95..4e7ceff9843ffcc0d16b6c7795d0cbcb1bb09a5f 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -4,25 +4,31 @@
  * @date 2005-04-28
  * @brief Implementation of the URLRequest class and related classes.
  *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ * 
+ * Copyright (c) 2005-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -30,8 +36,7 @@
 #include "llurlrequest.h"
 
 #include <algorithm>
-#include <openssl/x509_vfy.h>
-#include <openssl/ssl.h>
+
 #include "llcurl.h"
 #include "llioutil.h"
 #include "llmemtype.h"
@@ -51,8 +56,6 @@ const std::string CONTEXT_TRANSFERED_BYTES("transfered_bytes");
 
 static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user);
 
-
-
 /**
  * class LLURLRequestDetail
  */
@@ -69,7 +72,6 @@ class LLURLRequestDetail
 	U32 mBodyLimit;
 	S32 mByteAccumulator;
 	bool mIsBodyLimitSet;
-	LLURLRequest::SSLCertVerifyCallback mSSLVerifyCallback;
 };
 
 LLURLRequestDetail::LLURLRequestDetail() :
@@ -78,8 +80,7 @@ LLURLRequestDetail::LLURLRequestDetail() :
 	mLastRead(NULL),
 	mBodyLimit(0),
 	mByteAccumulator(0),
-	mIsBodyLimitSet(false),
-    mSSLVerifyCallback(NULL)
+	mIsBodyLimitSet(false)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
 	mCurlRequest = new LLCurlEasyRequest();
@@ -93,36 +94,6 @@ LLURLRequestDetail::~LLURLRequestDetail()
 	mLastRead = NULL;
 }
 
-void LLURLRequest::setSSLVerifyCallback(SSLCertVerifyCallback callback, void *param)
-{
-	mDetail->mSSLVerifyCallback = callback;
-	mDetail->mCurlRequest->setSSLCtxCallback(LLURLRequest::_sslCtxCallback, (void *)this);
-	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, true);
-	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, 2);	
-}
-
-
-// _sslCtxFunction
-// Callback function called when an SSL Context is created via CURL
-// used to configure the context for custom cert validation
-
-CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
-{	
-	LLURLRequest *req = (LLURLRequest *)param;
-	if(req == NULL || req->mDetail->mSSLVerifyCallback == NULL)
-	{
-		SSL_CTX_set_cert_verify_callback((SSL_CTX *)sslctx, NULL, NULL);
-		return CURLE_OK;
-	}
-	SSL_CTX * ctx = (SSL_CTX *) sslctx;
-	// disable any default verification for server certs
-	SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
-	// set the verification callback.
-	SSL_CTX_set_cert_verify_callback(ctx, req->mDetail->mSSLVerifyCallback, (void *)req);
-	// the calls are void
-	return CURLE_OK;
-	
-}
 
 /**
  * class LLURLRequest
@@ -177,11 +148,6 @@ void LLURLRequest::setURL(const std::string& url)
 	mDetail->mURL = url;
 }
 
-std::string LLURLRequest::getURL() const
-{
-	return mDetail->mURL;
-}
-
 void LLURLRequest::addHeader(const char* header)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
@@ -194,6 +160,13 @@ void LLURLRequest::setBodyLimit(U32 size)
 	mDetail->mIsBodyLimitSet = true;
 }
 
+void LLURLRequest::checkRootCertificate(bool check)
+{
+	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, (check? TRUE : FALSE));
+	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, (check? 2 : 0));
+	mDetail->mCurlRequest->setoptString(CURLOPT_ENCODING, "");
+}
+
 void LLURLRequest::setCallback(LLURLRequestComplete* callback)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h
index dad245f154b29736dc8202596dea0ce78eb93f11..cb3c46644062cbb26530cc4fbc4e13c90a99309e 100644
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -4,25 +4,31 @@
  * @date 2005-04-21
  * @brief Declaration of url based requests on pipes.
  *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ * 
+ * Copyright (c) 2005-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -38,8 +44,6 @@
 #include "lliopipe.h"
 #include "llchainio.h"
 #include "llerror.h"
-#include <openssl/x509_vfy.h>
-#include "llcurl.h"
 
 
 extern const std::string CONTEXT_REQUEST;
@@ -68,8 +72,6 @@ class LLURLRequest : public LLIOPipe
 {
 	LOG_CLASS(LLURLRequest);
 public:
-
-	typedef int (* SSLCertVerifyCallback)(X509_STORE_CTX *ctx, void *param);
 	/** 
 	 * @brief This enumeration is for specifying the type of request.
 	 */
@@ -123,7 +125,7 @@ class LLURLRequest : public LLIOPipe
 	 * 
 	 */
 	void setURL(const std::string& url);
-	std::string getURL() const;
+
 	/** 
 	 * @brief Add a header to the http post.
 	 *
@@ -141,9 +143,8 @@ class LLURLRequest : public LLIOPipe
 	 * Set whether request will check that remote server
 	 * certificates are signed by a known root CA when using HTTPS.
 	 */
-	void setSSLVerifyCallback(SSLCertVerifyCallback callback, void * param);
+	void checkRootCertificate(bool check);
 
-	
 	/**
 	 * @brief Return at most size bytes of body.
 	 *
@@ -188,7 +189,6 @@ class LLURLRequest : public LLIOPipe
 	 * @brief Give this pipe a chance to handle a generated error
 	 */
 	virtual EStatus handleError(EStatus status, LLPumpIO* pump);
-
 	
 protected:
 	/** 
@@ -217,8 +217,6 @@ class LLURLRequest : public LLIOPipe
 	 S32 mRequestTransferedBytes;
 	 S32 mResponseTransferedBytes;
 
-	static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param);
-	
 private:
 	/** 
 	 * @brief Initialize the object. Called during construction.
@@ -366,6 +364,62 @@ class LLURLRequestComplete : public LLIOPipe
 };
 
 
+/** 
+ * @class LLURLRequestClientFactory
+ * @brief Template class to build url request based client chains 
+ *
+ * This class eases construction of a basic sd rpc client. Here is an
+ * example of it's use:
+ * <code>
+ *  class LLUsefulService : public LLService { ... }<br>
+ *  LLService::registerCreator(<br>
+ *    "useful",<br>
+ *    LLService::creator_t(new LLURLRequestClientFactory<LLUsefulService>))<br>
+ * </code>
+ *
+ * This class should work, but I never got around to using/testing it.
+ *
+ */
+#if 0
+template<class Client>
+class LLURLRequestClientFactory : public LLChainIOFactory
+{
+public:
+	LLURLRequestClientFactory(LLURLRequest::ERequestAction action) {}
+	LLURLRequestClientFactory(
+		LLURLRequest::ERequestAction action,
+		const std::string& fixed_url) :
+		mAction(action),
+		mURL(fixed_url)
+	{
+	}
+	virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
+	{
+		lldebugs << "LLURLRequestClientFactory::build" << llendl;
+		LLIOPipe::ptr_t service(new Client);
+		chain.push_back(service);
+		LLURLRequest* http(new LLURLRequest(mAction));
+		LLIOPipe::ptr_t http_pipe(http);
+		// *FIX: how do we know the content type?
+		//http->addHeader("Content-Type: text/llsd");
+		if(mURL.empty())
+		{
+			chain.push_back(LLIOPipe::ptr_t(new LLContextURLExtractor(http)));
+		}
+		else
+		{
+			http->setURL(mURL);
+		}
+		chain.push_back(http_pipe);
+		chain.push_back(service);
+		return true;
+	}
+
+protected:
+	LLURLRequest::ERequestAction mAction;
+	std::string mURL;
+};
+#endif
 
 /**
  * External constants
diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp
index eb1e366149e2bceaeb4ad75bde396ccd554bc201..a118e21ffbb261b7d19ef01a04bf15a6417296e3 100644
--- a/indra/llmessage/message_prehash.cpp
+++ b/indra/llmessage/message_prehash.cpp
@@ -2,25 +2,31 @@
  * @file message_prehash.cpp
  * @brief file of prehashed variables
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt
index fdd510b389404727c33285bdad45cb56285c8915..441becbae00c5683b4770750fa1805ccf5a71abc 100644
--- a/indra/llplugin/CMakeLists.txt
+++ b/indra/llplugin/CMakeLists.txt
@@ -57,21 +57,18 @@ add_library (llplugin ${llplugin_SOURCE_FILES})
 
 add_subdirectory(slplugin)
 
-if (LL_TESTS)
-  # Add tests
-  include(LLAddBuildTest)
+# Add tests
+include(LLAddBuildTest)
+# UNIT TESTS
+SET(llplugin_TEST_SOURCE_FILES
+  llplugincookiestore.cpp
+  )
 
-  # UNIT TESTS
-  SET(llplugin_TEST_SOURCE_FILES
-      llplugincookiestore.cpp
-      )
+# llplugincookiestore has a dependency on curl, so we need to link the curl library into the test.
+set_source_files_properties(
+  llplugincookiestore.cpp
+  PROPERTIES
+    LL_TEST_ADDITIONAL_LIBRARIES "${CURL_LIBRARIES}"
+  )
 
-  # llplugincookiestore has a dependency on curl, so we need to link the curl library into the test.
-  set_source_files_properties(
-      llplugincookiestore.cpp
-      PROPERTIES
-      LL_TEST_ADDITIONAL_LIBRARIES "${CURL_LIBRARIES}"
-      )
-
-  LL_ADD_PROJECT_UNIT_TESTS(llplugin "${llplugin_TEST_SOURCE_FILES}")
-endif (LL_TESTS)
+LL_ADD_PROJECT_UNIT_TESTS(llplugin "${llplugin_TEST_SOURCE_FILES}")
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 9ce9ee2101dbd701b64664fb170949bdc5ad9b87..e09b511a6e475ace147d16ea9e3e6343a0e42cf9 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -3,25 +3,30 @@
  * @brief LLPluginClassMedia handles a plugin which knows about the "media" message class.
  *
  * @cond
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ *
+ * Copyright (c) 2008, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  * @endcond
  */
@@ -52,15 +57,11 @@ LLPluginClassMedia::LLPluginClassMedia(LLPluginClassMediaOwner *owner)
 	mOwner = owner;
 	mPlugin = NULL;
 	reset();
-
-	//debug use
-	mDeleteOK = true ;
 }
 
 
 LLPluginClassMedia::~LLPluginClassMedia()
 {
-	llassert_always(mDeleteOK) ;
 	reset();
 }
 
@@ -159,7 +160,7 @@ void LLPluginClassMedia::idle(void)
 		mPlugin->idle();
 	}
 	
-	if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == NULL) || (mPlugin->isBlocked()))
+	if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == NULL))
 	{
 		// Can't process a size change at this time
 	}
@@ -436,12 +437,6 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int
 {
 	if(type == MOUSE_EVENT_MOVE)
 	{
-		if(!mPlugin || !mPlugin->isRunning() || mPlugin->isBlocked())
-		{
-			// Don't queue up mouse move events that can't be delivered.
-			return;
-		}
-
 		if((x == mLastMouseX) && (y == mLastMouseY))
 		{
 			// Don't spam unnecessary mouse move events.
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index ee53f3a4da30bbb3215638b7a1bfc63e95ea10de..8c7b00f45b0284f3ec39ade63666f9d87ef5f7bf 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -3,25 +3,30 @@
  * @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class.
  *
  * @cond
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ *
+ * Copyright (c) 2008, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  * @endcond
  */
@@ -368,14 +373,6 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
 	F64				mCurrentRate;
 	F64				mLoadedDuration;
 	
-//--------------------------------------
-	//debug use only
-	//
-private:
-	bool  mDeleteOK ;
-public:
-	void setDeleteOK(bool flag) { mDeleteOK = flag ;}
-//--------------------------------------
 };
 
 #endif // LL_LLPLUGINCLASSMEDIA_H
diff --git a/indra/llplugin/llpluginclassmediaowner.h b/indra/llplugin/llpluginclassmediaowner.h
index b48a5ca4ac856bfbfc56fe1d825bf4be4bee99f1..5669b81fd1f15ff2b3797f2a8a2e844cef6207aa 100644
--- a/indra/llplugin/llpluginclassmediaowner.h
+++ b/indra/llplugin/llpluginclassmediaowner.h
@@ -3,25 +3,30 @@
  * @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class.
  *
  * @cond
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ *
+ * Copyright (c) 2008, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  * @endcond
  */
diff --git a/indra/llplugin/llplugincookiestore.cpp b/indra/llplugin/llplugincookiestore.cpp
index 82017ab3fae3d09008130442253c12ff2083715b..85b1e70d7870d99827e163e1bee2d0b467b74a4d 100644
--- a/indra/llplugin/llplugincookiestore.cpp
+++ b/indra/llplugin/llplugincookiestore.cpp
@@ -3,25 +3,30 @@
  * @brief LLPluginCookieStore provides central storage for http cookies used by plugins
  *
  * @cond
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  * @endcond
  */
@@ -94,7 +99,7 @@ bool LLPluginCookieStore::Cookie::parse(const std::string &host)
 	std::string::size_type cookie_end = mCookie.size();
 	std::string::size_type field_start = 0;
 
-	LL_DEBUGS("CookieStoreParse") << "parsing cookie: " << mCookie << LL_ENDL;
+	lldebugs << "parsing cookie: " << mCookie << llendl;
 	while(field_start < cookie_end)
 	{
 		// Finding the start of the next field requires honoring special quoting rules
@@ -162,10 +167,10 @@ bool LLPluginCookieStore::Cookie::parse(const std::string &host)
 			++value_end;
 		}
 
-		LL_DEBUGS("CookieStoreParse") 
+		lldebugs 
 			<< "    field name: \"" << mCookie.substr(name_start, name_end - name_start) 
 			<< "\", value: \"" << mCookie.substr(value_start, value_end - value_start) << "\""
-			<< LL_ENDL;
+			<< llendl;
 				
 		// See whether this field is one we know
 		if(first_field)
@@ -190,13 +195,13 @@ bool LLPluginCookieStore::Cookie::parse(const std::string &host)
 #if 1
 				time_t date = curl_getdate(date_string.c_str(), NULL );
 				mDate.secondsSinceEpoch((F64)date);
-				LL_DEBUGS("CookieStoreParse") << "        expire date parsed to: " << mDate.asRFC1123() << LL_ENDL;
+				lldebugs << "        expire date parsed to: " << mDate.asRFC1123() << llendl;
 #else
 				// This doesn't work (rfc1123-format dates cause it to fail)
 				if(!mDate.fromString(date_string))
 				{
 					// Date failed to parse.
-					LL_WARNS("CookieStoreParse") << "failed to parse cookie's expire date: " << date << LL_ENDL;
+					llwarns << "failed to parse cookie's expire date: " << date << llendl;
 					return false;
 				}
 #endif
@@ -227,14 +232,9 @@ bool LLPluginCookieStore::Cookie::parse(const std::string &host)
 			{
 				// We don't care about the value of this field (yet)
 			}
-			else if(matchName(name_start, name_end, "httponly"))
-			{
-				// We don't care about the value of this field (yet)
-			}
 			else
 			{
 				// An unknown field is a parse failure
-				LL_WARNS("CookieStoreParse") << "unexpected field name: " << mCookie.substr(name_start, name_end - name_start) << LL_ENDL;
 				return false;
 			}
 			
@@ -270,7 +270,7 @@ bool LLPluginCookieStore::Cookie::parse(const std::string &host)
 		mCookie += host;
 		mDomainEnd = mCookie.size();
 		
-		LL_DEBUGS("CookieStoreParse") << "added domain (" << mDomainStart << " to " << mDomainEnd << "), new cookie is: " << mCookie << LL_ENDL;
+		lldebugs << "added domain (" << mDomainStart << " to " << mDomainEnd << "), new cookie is: " << mCookie << llendl;
 	}
 
 	// If the cookie doesn't have a path, add "/".
@@ -288,7 +288,7 @@ bool LLPluginCookieStore::Cookie::parse(const std::string &host)
 		mCookie += "/";
 		mPathEnd = mCookie.size();
 		
-		LL_DEBUGS("CookieStoreParse") << "added path (" << mPathStart << " to " << mPathEnd << "), new cookie is: " << mCookie << LL_ENDL;
+		lldebugs << "added path (" << mPathStart << " to " << mPathEnd << "), new cookie is: " << mCookie << llendl;
 	}
 	
 	
@@ -566,7 +566,7 @@ void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_t
 	Cookie *cookie = Cookie::createFromString(s, cookie_start, cookie_end, host);
 	if(cookie)
 	{
-		LL_DEBUGS("CookieStoreUpdate") << "setting cookie: " << cookie->getCookie() << LL_ENDL;
+		lldebugs << "setting cookie: " << cookie->getCookie() << llendl;
 		
 		// Create a key for this cookie
 		std::string key = cookie->getKey();
@@ -579,7 +579,7 @@ void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_t
 			{
 				// If we're marking cookies as changed, we should keep it anyway since we'll need to send it out with deltas.
 				cookie->setDead(true);
-				LL_DEBUGS("CookieStoreUpdate") << "    marking dead" << LL_ENDL;
+				lldebugs << "    marking dead" << llendl;
 			}
 			else
 			{
@@ -590,7 +590,7 @@ void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_t
 				delete cookie;
 				cookie = NULL;
 
-				LL_DEBUGS("CookieStoreUpdate") << "    removing" << LL_ENDL;
+				lldebugs << "    removing" << llendl;
 			}
 		}
 		
@@ -607,7 +607,7 @@ void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_t
 					delete cookie;
 					cookie = NULL;
 
-					LL_DEBUGS("CookieStoreUpdate") << "    unchanged" << LL_ENDL;
+					lldebugs << "    unchanged" << llendl;
 				}
 				else
 				{
@@ -619,7 +619,7 @@ void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_t
 					if(mark_changed)
 						mHasChangedCookies = true;
 
-					LL_DEBUGS("CookieStoreUpdate") << "    replacing" << LL_ENDL;
+					lldebugs << "    replacing" << llendl;
 				}
 			}
 			else
@@ -631,15 +631,10 @@ void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_t
 				if(mark_changed)
 					mHasChangedCookies = true;
 
-				LL_DEBUGS("CookieStoreUpdate") << "    adding" << LL_ENDL;
+				lldebugs << "    adding" << llendl;
 			}
 		}
 	}
-	else
-	{
-		LL_WARNS("CookieStoreUpdate") << "failed to parse cookie: " << s.substr(cookie_start, cookie_end - cookie_start) << LL_ENDL;
-	}
-
 }
 
 void LLPluginCookieStore::clearCookies()
diff --git a/indra/llplugin/llplugincookiestore.h b/indra/llplugin/llplugincookiestore.h
index 91289d38a539f242b47596fb64fbbe2c3edbcc30..a93f0c14f0d72529c72452d990c9be35cebb5d66 100644
--- a/indra/llplugin/llplugincookiestore.h
+++ b/indra/llplugin/llplugincookiestore.h
@@ -3,25 +3,30 @@
  * @brief LLPluginCookieStore provides central storage for http cookies used by plugins
  *
  * @cond
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  * @endcond
  */
diff --git a/indra/llplugin/tests/llplugincookiestore_test.cpp b/indra/llplugin/tests/llplugincookiestore_test.cpp
index cc8663285fffd1916b915bab78e6cc6b455ebe50..020d9c1977361957c37030ac6d3a4b92718027b1 100644
--- a/indra/llplugin/tests/llplugincookiestore_test.cpp
+++ b/indra/llplugin/tests/llplugincookiestore_test.cpp
@@ -3,25 +3,30 @@
  * @brief Unit tests for LLPluginCookieStore.
  *
  * @cond
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  * @endcond
  */
@@ -122,7 +127,7 @@ namespace tut
 		// Valid, distinct cookies:
 		
 		std::string cookie01 = "cookieA=value; domain=example.com; path=/";
-		std::string cookie02 = "cookieB=value; Domain=example.com; Path=/; Max-Age=10; Secure; Version=1; Comment=foo!; HTTPOnly"; // cookie with every supported field, in different cases.
+		std::string cookie02 = "cookieB=value; domain=example.com; path=/"; // different name
 		std::string cookie03 = "cookieA=value; domain=foo.example.com; path=/"; // different domain
 		std::string cookie04 = "cookieA=value; domain=example.com; path=/bar/"; // different path
 		std::string cookie05 = "cookieC; domain=example.com; path=/"; // empty value
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index f9ffaaa6462cd8a106c68f661853ff8e972da6dd..cdcf780d2e08d058e19f284b645e4ca006fa0117 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -2,25 +2,31 @@
  * @file llaccordionctrl.cpp
  * @brief Accordion panel  implementation
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 #include "linden_common.h"
@@ -59,14 +65,8 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
  , mFitParent(params.fit_parent)
  , mAutoScrolling( false )
  , mAutoScrollRate( 0.f )
- , mSelectedTab( NULL )
- , mTabComparator( NULL )
- , mNoVisibleTabsHelpText(NULL)
- , mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString())
 {
-	initNoTabsWidget(params.no_matched_tabs_text);
-
-	mSingleExpansion = params.single_expansion;
+  mSingleExpansion = params.single_expansion;
 	if(mFitParent && !mSingleExpansion)
 	{
 		llinfos << "fit_parent works best when combined with single_expansion" << llendl;
@@ -76,11 +76,7 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
 LLAccordionCtrl::LLAccordionCtrl() : LLPanel()
  , mAutoScrolling( false )
  , mAutoScrollRate( 0.f )
- , mSelectedTab( NULL )
- , mNoVisibleTabsHelpText(NULL)
 {
-	initNoTabsWidget(LLTextBox::Params());
-
 	mSingleExpansion = false;
 	mFitParent = false;
 	LLUICtrlFactory::getInstance()->buildPanel(this, "accordion_parent.xml");	
@@ -170,8 +166,6 @@ BOOL LLAccordionCtrl::postBuild()
 		}
 	}
 
-	updateNoTabsHelpTextVisibility();
-
 	return TRUE;
 }
 
@@ -191,15 +185,8 @@ void LLAccordionCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
 	rcLocal.mRight = rcLocal.mLeft + width;
 	rcLocal.mTop = rcLocal.mBottom + height;
 
-	// get textbox a chance to reshape its content
-	mNoVisibleTabsHelpText->reshape(width, height, called_from_parent);
-
 	setRect(rcLocal);
 
-	// assume that help text is always fit accordion.
-	// necessary text paddings can be set via h_pad and v_pad
-	mNoVisibleTabsHelpText->setRect(getLocalRect());
-
 	arrange();
 }
 
@@ -342,63 +329,12 @@ void LLAccordionCtrl::addCollapsibleCtrl(LLView* view)
 	LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view);
 	if(!accordion_tab)
 		return;
-	if(std::find(beginChild(), endChild(), accordion_tab) == endChild())
+	if(std::find(getChildList()->begin(),getChildList()->end(),accordion_tab) == getChildList()->end())
 		addChild(accordion_tab);
 	mAccordionTabs.push_back(accordion_tab);
-
+	
 	accordion_tab->setDropDownStateChangedCallback( boost::bind(&LLAccordionCtrl::onCollapseCtrlCloseOpen, this, mAccordionTabs.size() - 1) );
-	arrange();	
-}
-
-void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view)
-{
-	LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view);
-	if(!accordion_tab)
-		return;
-
-	if(std::find(beginChild(), endChild(), accordion_tab) != endChild())
-		removeChild(accordion_tab);
-
-	for (std::vector<LLAccordionCtrlTab*>::iterator iter = mAccordionTabs.begin();
-			iter != mAccordionTabs.end(); ++iter)
-	{
-		if (accordion_tab == (*iter))
-		{
-			mAccordionTabs.erase(iter);
-			break;
-		}
-	}
-
-	// if removed is selected - reset selection
-	if (mSelectedTab == view)
-	{
-		mSelectedTab = NULL;
-	}
-}
 
-void	LLAccordionCtrl::initNoTabsWidget(const LLTextBox::Params& tb_params)
-{
-	LLTextBox::Params tp = tb_params;
-	tp.rect(getLocalRect());
-	mNoMatchedTabsOrigString = tp.initial_value().asString();
-	mNoVisibleTabsHelpText = LLUICtrlFactory::create<LLTextBox>(tp, this);
-}
-
-void	LLAccordionCtrl::updateNoTabsHelpTextVisibility()
-{
-	bool visible_exists = false;
-	std::vector<LLAccordionCtrlTab*>::const_iterator it = mAccordionTabs.begin();
-	const std::vector<LLAccordionCtrlTab*>::const_iterator it_end = mAccordionTabs.end();
-	for (; it != it_end; ++it)
-	{
-		if ((*it)->getVisible())
-		{
-			visible_exists = true;
-			break;
-		}
-	}
-
-	mNoVisibleTabsHelpText->setVisible(!visible_exists);
 }
 
 void	LLAccordionCtrl::arrangeSinge()
@@ -524,8 +460,6 @@ void	LLAccordionCtrl::arrangeMultiple()
 
 void LLAccordionCtrl::arrange()
 {
-	updateNoTabsHelpTextVisibility();
-
 	if( mAccordionTabs.size() == 0)
 	{
 		//We do not arrange if we do not have what should be arranged
@@ -544,8 +478,6 @@ void LLAccordionCtrl::arrange()
 		
 		S32 panel_height = getRect().getHeight() - 2*BORDER_MARGIN;
 
-		if (accordion_tab->getFitParent())
-			panel_height = accordion_tab->getRect().getHeight();
 		ctrlSetLeftTopAndSize(accordion_tab,panel_rect.mLeft,panel_top,panel_width,panel_height);
 		
 		show_hide_scrollbar(getRect().getWidth(),getRect().getHeight());
@@ -716,60 +648,19 @@ S32	LLAccordionCtrl::notifyParent(const LLSD& info)
 				LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
 				if(accordion_tab->hasFocus() && i>0)
 				{
-					bool prev_visible_tab_found = false;
 					while(i>0)
 					{
 						if(mAccordionTabs[--i]->getVisible())
-						{
-							prev_visible_tab_found = true;
 							break;
-						}
-					}
-
-					if (prev_visible_tab_found)
-					{
-						accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
-						accordion_tab->notify(LLSD().with("action","select_last"));
-						return 1;
 					}
-					break;
-				}
-			}
-			return 0;
-		}
-		else if(str_action == "select_current")
-		{
-			for(size_t i=0;i<mAccordionTabs.size();++i)
-			{
-				// Set selection to the currently focused tab.
-				if(mAccordionTabs[i]->hasFocus())
-				{
-					if (mAccordionTabs[i] != mSelectedTab)
-					{
-						if (mSelectedTab)
-						{
-							mSelectedTab->setSelected(false);
-						}
-						mSelectedTab = mAccordionTabs[i];
-						mSelectedTab->setSelected(true);
-					}
-
+					
+					accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
+					accordion_tab->notify(LLSD().with("action","select_last"));
 					return 1;
 				}
 			}
 			return 0;
 		}
-		else if(str_action == "deselect_current")
-		{
-			// Reset selection to the currently selected tab.
-			if (mSelectedTab)
-			{
-				mSelectedTab->setSelected(false);
-				mSelectedTab = NULL;
-				return 1;
-			}
-			return 0;
-		}
 	}
 	else if (info.has("scrollToShowRect"))
 	{
@@ -794,20 +685,6 @@ S32	LLAccordionCtrl::notifyParent(const LLSD& info)
 		}
 		return 1;
 	}
-	else if (info.has("child_visibility_change"))
-	{
-		BOOL new_visibility = info["child_visibility_change"];
-		if (new_visibility)
-		{
-			// there is at least one visible tab
-			mNoVisibleTabsHelpText->setVisible(FALSE);
-		}
-		else
-		{
-			// it could be the latest visible tab, check all of them
-			updateNoTabsHelpTextVisibility();
-		}
-	}
 	return LLPanel::notifyParent(info);
 }
 void	LLAccordionCtrl::reset		()
@@ -816,71 +693,6 @@ void	LLAccordionCtrl::reset		()
 		mScrollbar->setDocPos(0);
 }
 
-void LLAccordionCtrl::expandDefaultTab()
-{
-	if (mAccordionTabs.size() > 0)
-	{
-		LLAccordionCtrlTab* tab = mAccordionTabs.front();
-
-		if (!tab->getDisplayChildren())
-		{
-			tab->setDisplayChildren(true);
-		}
-
-		for (size_t i = 1; i < mAccordionTabs.size(); ++i)
-		{
-			tab = mAccordionTabs[i];
-
-			if (tab->getDisplayChildren())
-			{
-				tab->setDisplayChildren(false);
-			}
-		}
-
-		arrange();
-	}
-}
-
-void LLAccordionCtrl::sort()
-{
-	if (!mTabComparator)
-	{
-		llwarns << "No comparator specified for sorting accordion tabs." << llendl;
-		return;
-	}
-
-	std::sort(mAccordionTabs.begin(), mAccordionTabs.end(), LLComparatorAdaptor(*mTabComparator));
-	arrange();
-}
-
-void	LLAccordionCtrl::setFilterSubString(const std::string& filter_string)
-{
-	LLStringUtil::format_map_t args;
-	args["[SEARCH_TERM]"] = LLURI::escape(filter_string);
-	std::string text = filter_string.empty() ? mNoVisibleTabsOrigString : mNoMatchedTabsOrigString;
-	LLStringUtil::format(text, args);
-
-	mNoVisibleTabsHelpText->setValue(text);
-}
-
-const LLAccordionCtrlTab* LLAccordionCtrl::getExpandedTab() const
-{
-	typedef std::vector<LLAccordionCtrlTab*>::const_iterator tabs_const_iterator;
-
-	const LLAccordionCtrlTab* result = 0;
-
-	for (tabs_const_iterator i = mAccordionTabs.begin(); i != mAccordionTabs.end(); ++i)
-	{
-		if ((*i)->isExpanded())
-		{
-			result = *i;
-			break;
-		}
-	}
-
-	return result;
-}
-
 S32 LLAccordionCtrl::calcExpandedTabHeight(S32 tab_index /* = 0 */, S32 available_height /* = 0 */)
 {
 	if(tab_index < 0)
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 4e0537f5924be719b18a467e00b04cd977283e38..0959722aa695971f2654c3397e6b8681487ac463 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -2,44 +2,48 @@
  * @file LLAccordionCtrlTab.cpp
  * @brief Collapsible control implementation
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "linden_common.h"
 
+#include "lluictrl.h"
+#include "llscrollbar.h"
 #include "llaccordionctrltab.h"
-#include "llaccordionctrl.h"
-
 #include "lllocalcliprect.h"
-#include "llscrollbar.h"
+
 #include "lltextbox.h"
-#include "lltextutil.h"
-#include "lluictrl.h"
 
 static const std::string DD_BUTTON_NAME = "dd_button";
 static const std::string DD_TEXTBOX_NAME = "dd_textbox";
 static const std::string DD_HEADER_NAME = "dd_header";
 
-static const S32 HEADER_HEIGHT = 23;
+static const S32 HEADER_HEIGHT = 20;
 static const S32 HEADER_IMAGE_LEFT_OFFSET = 5;
 static const S32 HEADER_TEXT_LEFT_OFFSET = 30;
 static const F32 AUTO_OPEN_TIME = 1.f;
@@ -68,14 +72,7 @@ class LLAccordionCtrlTab::LLAccordionCtrlTabHeader : public LLUICtrl
 
 	virtual BOOL postBuild();
 
-	std::string getTitle();
-	void	setTitle(const std::string& title, const std::string& hl);
-
-	void	setTitleFontStyle(std::string style);
-
-	void	setTitleColor(LLUIColor);
-
-	void	setSelected(bool is_selected) { mIsSelected = is_selected; }
+	void	setTitle(const std::string& title);
 
 	virtual void onMouseEnter(S32 x, S32 y, MASK mask);
 	virtual void onMouseLeave(S32 x, S32 y, MASK mask);
@@ -101,13 +98,9 @@ class LLAccordionCtrlTab::LLAccordionCtrlTabHeader : public LLUICtrl
 	LLPointer<LLUIImage> mImageHeaderPressed;
 	LLPointer<LLUIImage> mImageHeaderFocused;
 
-	// style saved when applying it in setTitleFontStyle
-	LLStyle::Params			mStyleParams;
-
 	LLUIColor mHeaderBGColor;
 
 	bool mNeedsHighlight;
-	bool mIsSelected;
 
 	LLFrameTimer mAutoOpenTimer;
 };
@@ -120,8 +113,7 @@ LLAccordionCtrlTab::LLAccordionCtrlTabHeader::LLAccordionCtrlTabHeader(
 	const LLAccordionCtrlTabHeader::Params& p)
 : LLUICtrl(p)
 , mHeaderBGColor(p.header_bg_color())
-, mNeedsHighlight(false)
-, mIsSelected(false),
+,mNeedsHighlight(false),
 	mImageCollapsed(p.header_collapse_img),
 	mImageCollapsedPressed(p.header_collapse_img_pressed),
 	mImageExpanded(p.header_expand_img),
@@ -154,47 +146,10 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild()
 	return TRUE;
 }
 
-std::string LLAccordionCtrlTab::LLAccordionCtrlTabHeader::getTitle()
-{
-	if(mHeaderTextbox)
-	{
-		return mHeaderTextbox->getText();
-	}
-	else
-	{
-		return LLStringUtil::null;
-	}
-}
-
-void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title, const std::string& hl)
+void	LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title)
 {
 	if(mHeaderTextbox)
-	{
-		LLTextUtil::textboxSetHighlightedVal(
-			mHeaderTextbox,
-			mStyleParams,
-			title,
-			hl);
-	}
-}
-
-void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitleFontStyle(std::string style)
-{
-	if (mHeaderTextbox)
-	{
-		std::string text = mHeaderTextbox->getText();
-		mStyleParams.font(mHeaderTextbox->getDefaultFont());
-		mStyleParams.font.style(style);
-		mHeaderTextbox->setText(text, mStyleParams);
-	}
-}
-
-void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitleColor(LLUIColor color)
-{
-	if(mHeaderTextbox)
-	{
-		mHeaderTextbox->setColor(color);
-	}
+		mHeaderTextbox->setText(title);
 }
 
 void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw()
@@ -212,7 +167,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw()
 	// Only show green "focus" background image if the accordion is open,
 	// because the user's mental model of focus is that it goes away after
 	// the accordion is closed.
-	if (getParent()->hasFocus() || mIsSelected
+	if (getParent()->hasFocus()
 		/*&& !(collapsible && !expanded)*/ // WHY??
 		)
 	{
@@ -254,15 +209,6 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height
 	LLRect textboxRect(HEADER_TEXT_LEFT_OFFSET,(height+header_height)/2 ,width,(height-header_height)/2);
 	mHeaderTextbox->reshape(textboxRect.getWidth(), textboxRect.getHeight());
 	mHeaderTextbox->setRect(textboxRect);
-
-	if (mHeaderTextbox->getTextPixelWidth() > mHeaderTextbox->getRect().getWidth())
-	{
-		setToolTip(mHeaderTextbox->getText());
-	}
-	else
-	{
-		setToolTip(LLStringUtil::null);
-	}
 }
 
 void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::onMouseEnter(S32 x, S32 y, MASK mask)
@@ -335,7 +281,6 @@ LLAccordionCtrlTab::Params::Params()
 	,header_image_focused("header_image_focused")
 	,header_text_color("header_text_color")
 	,fit_panel("fit_panel",true)
-	,selection_enabled("selection_enabled", false)
 {
 	mouse_opaque(false);
 }
@@ -366,13 +311,6 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p)
 	mHeader = LLUICtrlFactory::create<LLAccordionCtrlTabHeader>(headerParams);
 	addChild(mHeader, 1);
 
-	LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLAccordionCtrlTab::selectOnFocusReceived, this));
-
-	if (!p.selection_enabled)
-	{
-		LLFocusableElement::setFocusLostCallback(boost::bind(&LLAccordionCtrlTab::deselectOnFocusLost, this));
-	}
-
 	reshape(100, 200,FALSE);
 }
 
@@ -441,13 +379,6 @@ void LLAccordionCtrlTab::changeOpenClose(bool is_open)
 	}
 }
 
-void LLAccordionCtrlTab::handleVisibilityChange(BOOL new_visibility)
-{
-	LLUICtrl::handleVisibilityChange(new_visibility);
-
-	notifyParent(LLSD().with("child_visibility_change", new_visibility));
-}
-
 BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask)
 {
 	if(mCollapsible && mHeaderVisible && mCanOpenClose)
@@ -494,9 +425,6 @@ bool LLAccordionCtrlTab::addChild(LLView* child, S32 tab_group)
 			setDisplayChildren(getDisplayChildren());	
 	}
 
-	if (!mContainerPanel)
-		mContainerPanel = findContainerView();
-
 	return res;
 }
 
@@ -505,74 +433,6 @@ void LLAccordionCtrlTab::setAccordionView(LLView* panel)
 	addChild(panel,0);
 }
 
-std::string LLAccordionCtrlTab::getTitle() const
-{
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
-	{
-		return header->getTitle();
-	}
-	else
-	{
-		return LLStringUtil::null;
-	}
-}
-
-void LLAccordionCtrlTab::setTitle(const std::string& title, const std::string& hl)
-{
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
-	{
-		header->setTitle(title, hl);
-	}
-}
-
-void LLAccordionCtrlTab::setTitleFontStyle(std::string style)
-{
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
-	{
-		header->setTitleFontStyle(style);
-	}
-}
-
-void LLAccordionCtrlTab::setTitleColor(LLUIColor color)
-{
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
-	{
-		header->setTitleColor(color);
-	}
-}
-
-boost::signals2::connection LLAccordionCtrlTab::setFocusReceivedCallback(const focus_signal_t::slot_type& cb)
-{
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
-	{
-		return header->setFocusReceivedCallback(cb);
-	}
-	return boost::signals2::connection();
-}
-
-boost::signals2::connection LLAccordionCtrlTab::setFocusLostCallback(const focus_signal_t::slot_type& cb)
-{
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
-	{
-		return header->setFocusLostCallback(cb);
-	}
-	return boost::signals2::connection();
-}
-
-void LLAccordionCtrlTab::setSelected(bool is_selected)
-{
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
-	{
-		header->setSelected(is_selected);
-	}
-}
 
 LLView*	LLAccordionCtrlTab::findContainerView()
 {
@@ -589,20 +449,6 @@ LLView*	LLAccordionCtrlTab::findContainerView()
 	return NULL;
 }
 
-void LLAccordionCtrlTab::selectOnFocusReceived()
-{
-	if (getParent()) // A parent may not be set if tabs are added dynamically.
-		getParent()->notifyParent(LLSD().with("action", "select_current"));
-}
-
-void LLAccordionCtrlTab::deselectOnFocusLost()
-{
-	if(getParent()) // A parent may not be set if tabs are added dynamically.
-	{
-		getParent()->notifyParent(LLSD().with("action", "deselect_current"));
-	}
-
-}
 
 S32 LLAccordionCtrlTab::getHeaderHeight()
 {
@@ -704,9 +550,8 @@ S32	LLAccordionCtrlTab::notifyParent(const LLSD& info)
 				setRect(panel_rect);
 			}
 			
-			//LLAccordionCtrl should rearrange accordion tab if one of accordion change its size
-			if (getParent()) // A parent may not be set if tabs are added dynamically.
-				getParent()->notifyParent(info);
+			//LLAccordionCtrl should rearrange accodion tab if one of accordion change its size
+			getParent()->notifyParent(info);
 			return 1;
 		}
 		else if(str_action == "select_prev") 
@@ -715,27 +560,6 @@ S32	LLAccordionCtrlTab::notifyParent(const LLSD& info)
 			return 1;
 		}
 	}
-	else if (info.has("scrollToShowRect"))
-	{
-		LLAccordionCtrl* parent = dynamic_cast<LLAccordionCtrl*>(getParent());
-		if (parent && parent->getFitParent())
-		{
-			//	EXT-8285 ('No attachments worn' text appears at the bottom of blank 'Attachments' accordion)
-			//	The problem was in passing message "scrollToShowRect" IN LLAccordionCtrlTab::notifyParent
-			//	FROM child LLScrollContainer TO parent LLAccordionCtrl with "it_parent" set to true.
-
-			//	It is wrong notification for parent accordion which leads to recursive call of adjustContainerPanel
-			//	As the result of recursive call of adjustContainerPanel we got LLAccordionCtrlTab
-			//	that reshaped and re-sized with different rectangles.
-
-			//	LLAccordionCtrl has own scrollContainer and LLAccordionCtrlTab has own scrollContainer
-			//	both should handle own scroll container's event.
-			//	So, if parent accordion "fit_parent" accordion tab should handle its scroll container events itself.
-
-			return 1;
-		}
-	}
-
 	return LLUICtrl::notifyParent(info);
 }
 
@@ -824,7 +648,6 @@ void LLAccordionCtrlTab::showAndFocusHeader()
 {
 	LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);	
 	header->setFocus(true);
-	header->setSelected(true);
 
 	LLRect screen_rc;
 	LLRect selected_rc = header->getRect();
@@ -1037,28 +860,5 @@ void LLAccordionCtrlTab::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top,
 	panel->reshape( width, height, 1);
 	panel->setRect(panel_rect);
 }
-BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask)
-{
-	//header may be not the first child but we need to process it first
-	if(y >= (getRect().getHeight() - HEADER_HEIGHT - HEADER_HEIGHT/2) )
-	{
-		//inside tab header
-		//fix for EXT-6619
-		mHeader->handleToolTip(x, y, mask);
-		return TRUE;
-	}
-	return LLUICtrl::handleToolTip(x, y, mask);
-}
-BOOL LLAccordionCtrlTab::handleScrollWheel		( S32 x, S32 y, S32 clicks )
-{
-	if( LLUICtrl::handleScrollWheel(x,y,clicks))
-	{
-		return TRUE;
-	}
-	if( mScrollbar && mScrollbar->getVisible() && mScrollbar->handleScrollWheel( 0, 0, clicks ) )
-	{
-		return TRUE;
-	}
-	return FALSE;
-}
+
 
diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h
index 8ae91ad6517d9b3fed41d9df4a83953ca5ab8498..4b8b22405ea2fc3e4e6326e6ee51508b162478a3 100644
--- a/indra/llui/llaccordionctrltab.h
+++ b/indra/llui/llaccordionctrltab.h
@@ -2,25 +2,31 @@
  * @file LLAccordionCtrlTab.h
  * @brief Collapsible box control implementation
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -31,7 +37,6 @@
 #include "llrect.h"
 #include "lluictrl.h"
 #include "lluicolor.h"
-#include "llstyle.h"
 
 class LLUICtrlFactory;
 class LLUIImage;
@@ -83,8 +88,6 @@ class LLAccordionCtrlTab : public LLUICtrl
 
 		Optional<bool>			fit_panel;
 
-		Optional<bool>			selection_enabled;
-
 		Optional<S32>			padding_left;
 		Optional<S32>			padding_right;
 		Optional<S32>			padding_top;
@@ -110,22 +113,6 @@ class LLAccordionCtrlTab : public LLUICtrl
 	void		setAccordionView(LLView* panel);
 	LLView*		getAccordionView() { return mContainerPanel; };
 
-	std::string getTitle() const;
-
-	// Set text and highlight substring in LLAccordionCtrlTabHeader
-	void setTitle(const std::string& title, const std::string& hl = LLStringUtil::null);
-
-	// Set text font style in LLAccordionCtrlTabHeader
-	void setTitleFontStyle(std::string style);
-
-	// Set text color in LLAccordionCtrlTabHeader
-	void setTitleColor(LLUIColor color);
-
-	boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb);
-	boost::signals2::connection setFocusLostCallback(const focus_signal_t::slot_type& cb);
-
-	void setSelected(bool is_selected);
-
 	bool getCollapsible() {return mCollapsible;};
 
 	void setCollapsible(bool collapsible) {mCollapsible = collapsible;};
@@ -155,24 +142,15 @@ class LLAccordionCtrlTab : public LLUICtrl
 	// Call reshape after changing size
 	virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 
-	/**
-	 * Raises notifyParent event with "child_visibility_change" = new_visibility
-	 */
-	void handleVisibilityChange(BOOL new_visibility);
-
 	// Changes expand/collapse state and triggers expand/collapse callbacks
 	virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
 
 	virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
 	virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
 
-	virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
-	virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks );
-
-
 	virtual bool addChild(LLView* child, S32 tab_group);
 
-	bool isExpanded() const { return mDisplayChildren; }
+	bool isExpanded() { return mDisplayChildren; }
 
 	S32 getHeaderHeight();
 
@@ -193,7 +171,6 @@ class LLAccordionCtrlTab : public LLUICtrl
 	void showAndFocusHeader();
 
 	void setFitPanel( bool fit ) { mFitPanel = true; }
-	bool getFitParent() const { return mFitPanel; }
 
 protected:
 	void adjustContainerPanel	(const LLRect& child_rect);
@@ -212,10 +189,6 @@ class LLAccordionCtrlTab : public LLUICtrl
 	void drawChild(const LLRect& root_rect,LLView* child);
 
 	LLView* findContainerView	();
-
-	void selectOnFocusReceived();
-	void deselectOnFocusLost();
-
 private:
 
 	class LLAccordionCtrlTabHeader;
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index ac5651e4b62ed42a307184dcbc2081dcdf6e4965..33c6a8b6aca10ba1c9de9dec50857635bfc17906 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -1,27 +1,32 @@
-
 /** 
  * @file llbutton.cpp
  * @brief LLButton base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -123,7 +128,6 @@ LLButton::LLButton(const LLButton::Params& p)
 	mImageSelected(p.image_selected),
 	mImageDisabled(p.image_disabled),
 	mImageDisabledSelected(p.image_disabled_selected),
-	mImageFlash(p.image_flash),
 	mImagePressed(p.image_pressed),
 	mImagePressedSelected(p.image_pressed_selected),
 	mImageHoverSelected(p.image_hover_selected),
@@ -631,24 +635,14 @@ void LLButton::draw()
 
 	if (mFlashing)
 	{
-		// if button should flash and we have icon for flashing, use it as image for button
-		if(flash && mImageFlash)
-		{
-			// setting flash to false to avoid its further influence on glow
-			flash = false;
-			imagep = mImageFlash;
-		}
-		// else use usual flashing via flash_color
+		LLColor4 flash_color = mFlashBgColor.get();
+		use_glow_effect = TRUE;
+		glow_type = LLRender::BT_ALPHA; // blend the glow
+
+		if (mNeedsHighlight) // highlighted AND flashing
+			glow_color = (glow_color*0.5f + flash_color*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity
 		else
-		{
-			LLColor4 flash_color = mFlashBgColor.get();
-			use_glow_effect = TRUE;
-			glow_type = LLRender::BT_ALPHA; // blend the glow
-			if (mNeedsHighlight) // highlighted AND flashing
-				glow_color = (glow_color*0.5f + flash_color*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity
-			else
-				glow_color = flash_color;
-		}
+			glow_color = flash_color;
 	}
 
 	if (mNeedsHighlight && !imagep)
@@ -1009,11 +1003,6 @@ void LLButton::setImageDisabledSelected(LLPointer<LLUIImage> image)
 	mFadeWhenDisabled = TRUE;
 }
 
-void LLButton::setImagePressed(LLPointer<LLUIImage> image)
-{
-	mImagePressed = image;
-}
-
 void LLButton::setImageHoverSelected(LLPointer<LLUIImage> image)
 {
 	mImageHoverSelected = image;
@@ -1024,11 +1013,6 @@ void LLButton::setImageHoverUnselected(LLPointer<LLUIImage> image)
 	mImageHoverUnselected = image;
 }
 
-void LLButton::setImageFlash(LLPointer<LLUIImage> image)
-{
-	mImageFlash = image;
-}
-
 void LLButton::setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment, const LLColor4& color)
 {
 	if (image_name.empty())
@@ -1157,10 +1141,3 @@ void LLButton::resetMouseDownTimer()
 	mMouseDownTimer.stop();
 	mMouseDownTimer.reset();
 }
-
-
-BOOL LLButton::handleDoubleClick(S32 x, S32 y, MASK mask)
-{
-	// just treat a double click as a second click
-	return handleMouseDown(x, y, mask);
-}
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 910bab9a97f2bcd268ed3bcb4a225e212d2a610f..cc107c972d8651ef2689f12dd306fabd53b3dcc9 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -2,25 +2,31 @@
  * @file llcombobox.cpp
  * @brief LLComboBox base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp
index 9ad7c01bd5109f6871d4ea31690d441e9c2e2cbd..9d4e2fa495fea2ab6e735856963da252246306a3 100644
--- a/indra/llui/lldraghandle.cpp
+++ b/indra/llui/lldraghandle.cpp
@@ -2,25 +2,31 @@
  * @file lldraghandle.cpp
  * @brief LLDragHandle base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -243,7 +249,7 @@ void LLDragHandleTop::reshapeTitleBox()
 	}
 	const LLFontGL* font = LLFontGL::getFontSansSerif();
 	S32 title_width = getRect().getWidth();
-	title_width -= LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth();
+	title_width -= 2 * LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth();
 	S32 title_height = llround(font->getLineHeight());
 	LLRect title_rect;
 	title_rect.setLeftTopAndSize( 
diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h
index 7c56475e751f081cd254ecb39d2f7835142c37e6..825bc9303e218d545414aa8b6859e199a109b4b9 100644
--- a/indra/llui/lldraghandle.h
+++ b/indra/llui/lldraghandle.h
@@ -2,25 +2,31 @@
  * @file lldraghandle.h
  * @brief LLDragHandle base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llui/lleditmenuhandler.cpp b/indra/llui/lleditmenuhandler.cpp
index d48237e3771be9e1761f41c2882d9c47889b0f6c..245bce76f5e1df23fc62c18bfbb42b9f997d2397 100644
--- a/indra/llui/lleditmenuhandler.cpp
+++ b/indra/llui/lleditmenuhandler.cpp
@@ -2,25 +2,31 @@
 * @file lleditmenuhandler.cpp
 * @authors Aaron Yonas, James Cook
 *
-* $LicenseInfo:firstyear=2006&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2006&license=viewergpl$
+* 
+* Copyright (c) 2006-2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 
diff --git a/indra/llui/lleditmenuhandler.h b/indra/llui/lleditmenuhandler.h
index 0932f094ef95eeb6c0028c151e46c417e7e0b72a..d72283cd9946eb8cf058d839dc1579739d0a088c 100644
--- a/indra/llui/lleditmenuhandler.h
+++ b/indra/llui/lleditmenuhandler.h
@@ -2,25 +2,31 @@
 * @file lleditmenuhandler.h
 * @authors Aaron Yonas, James Cook
 *
-* $LicenseInfo:firstyear=2006&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2006&license=viewergpl$
+* 
+* Copyright (c) 2006-2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index b28399a36b6acb62e9dbddd7f807ce8894568852..35f5a6bbb9364780f6a912fb1ac75b7a361cabed 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -1,26 +1,32 @@
 /** 
  * @file llflatlistview.cpp
- * @brief LLFlatListView base class and extension to support messages for several cases of an empty list.
+ * @brief LLFlatListView base class
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -44,21 +50,14 @@ LLFlatListView::Params::Params()
 	allow_select("allow_select"),
 	multi_select("multi_select"),
 	keep_one_selected("keep_one_selected"),
-	keep_selection_visible_on_reshape("keep_selection_visible_on_reshape",false),
 	no_items_text("no_items_text")
 {};
 
 void LLFlatListView::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
 {
-	S32 delta = height - getRect().getHeight();
 	LLScrollContainer::reshape(width, height, called_from_parent);
 	setItemsNoScrollWidth(width);
 	rearrangeItems();
-	
-	if(delta!= 0 && mKeepSelectionVisibleOnReshape)
-	{
-		ensureSelectedVisible();
-	}
 }
 
 const LLRect& LLFlatListView::getItemsRect() const
@@ -87,9 +86,6 @@ bool LLFlatListView::addItem(LLPanel * item, const LLSD& value /*= LLUUID::null*
 		mItemsPanel->addChild(item);
 		break;
 	default:
-		LL_WARNS("") << "Unsupported position." << LL_ENDL;
-		delete new_pair;
-		return false;
 		break;
 	}
 	
@@ -154,7 +150,7 @@ bool LLFlatListView::insertItemAfter(LLPanel* after_item, LLPanel* item_to_add,
 }
 
 
-bool LLFlatListView::removeItem(LLPanel* item, bool rearrange)
+bool LLFlatListView::removeItem(LLPanel* item)
 {
 	if (!item) return false;
 	if (item->getParent() != mItemsPanel) return false;
@@ -162,22 +158,22 @@ bool LLFlatListView::removeItem(LLPanel* item, bool rearrange)
 	item_pair_t* item_pair = getItemPair(item);
 	if (!item_pair) return false;
 
-	return removeItemPair(item_pair, rearrange);
+	return removeItemPair(item_pair);
 }
 
-bool LLFlatListView::removeItemByValue(const LLSD& value, bool rearrange)
+bool LLFlatListView::removeItemByValue(const LLSD& value)
 {
 	if (value.isUndefined()) return false;
 	
 	item_pair_t* item_pair = getItemPair(value);
 	if (!item_pair) return false;
 
-	return removeItemPair(item_pair, rearrange);
+	return removeItemPair(item_pair);
 }
 
-bool LLFlatListView::removeItemByUUID(const LLUUID& uuid, bool rearrange)
+bool LLFlatListView::removeItemByUUID(const LLUUID& uuid)
 {
-	return removeItemByValue(LLSD(uuid), rearrange);
+	return removeItemByValue(LLSD(uuid));
 }
 
 LLPanel* LLFlatListView::getItemByValue(const LLSD& value) const
@@ -301,32 +297,8 @@ void LLFlatListView::setNoItemsCommentText(const std::string& comment_text)
 	mNoItemsCommentTextbox->setValue(comment_text);
 }
 
-U32 LLFlatListView::size(const bool only_visible_items) const
-{
-	if (only_visible_items)
-	{
-		U32 size = 0;
-		for (pairs_const_iterator_t
-				 iter = mItemPairs.begin(),
-				 iter_end = mItemPairs.end();
-			 iter != iter_end; ++iter)
-		{
-			if ((*iter)->first->getVisible())
-				++size;
-		}
-		return size;
-	}
-	else
-	{
-		return mItemPairs.size();
-	}
-}
-
 void LLFlatListView::clear()
 {
-	// This will clear mSelectedItemPairs, calling all appropriate callbacks.
-	resetSelection();
-	
 	// do not use LLView::deleteAllChildren to avoid removing nonvisible items. drag-n-drop for ex.
 	for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it)
 	{
@@ -335,6 +307,7 @@ void LLFlatListView::clear()
 		delete *it;
 	}
 	mItemPairs.clear();
+	mSelectedItemPairs.clear();
 
 	// also set items panel height to zero. Reshape it to allow reshaping of non-item children
 	LLRect rc = mItemsPanel->getRect();
@@ -385,8 +358,6 @@ LLFlatListView::LLFlatListView(const LLFlatListView::Params& p)
   , mCommitOnSelectionChange(false)
   , mPrevNotifyParentRect(LLRect())
   , mNoItemsCommentTextbox(NULL)
-  , mIsConsecutiveSelection(false)
-  , mKeepSelectionVisibleOnReshape(p.keep_selection_visible_on_reshape)
 {
 	mBorderThickness = getBorderWidth();
 
@@ -455,7 +426,7 @@ void LLFlatListView::rearrangeItems()
 {
 	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
 
-	setNoItemsCommentVisible(0==size());
+	setNoItemsCommentVisible(mItemPairs.empty());
 
 	if (mItemPairs.empty()) return;
 
@@ -533,80 +504,7 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
 
 	//*TODO find a better place for that enforcing stuff
 	if (mKeepOneItemSelected && numSelected() == 1 && !select_item) return;
-
-	if ( (mask & MASK_SHIFT) && !(mask & MASK_CONTROL)
-		 && mMultipleSelection && !mSelectedItemPairs.empty() )
-	{
-		item_pair_t* last_selected_pair = mSelectedItemPairs.back();
-
-		// If item_pair is already selected - do nothing
-		if (last_selected_pair == item_pair)
-			return;
-
-		bool grab_items = false;
-		bool reverse = false;
-		pairs_list_t pairs_to_select;
-
-		// Pick out items from list between last selected and current clicked item_pair.
-		for (pairs_iterator_t
-				 iter = mItemPairs.begin(),
-				 iter_end = mItemPairs.end();
-			 iter != iter_end; ++iter)
-		{
-			item_pair_t* cur = *iter;
-			if (cur == last_selected_pair || cur == item_pair)
-			{
-				// We've got reverse selection if last grabed item isn't a new selection.
-				reverse = grab_items && (cur != item_pair);
-				grab_items = !grab_items;
-				// Skip last selected and current clicked item pairs.
-				continue;
-			}
-			if (!cur->first->getVisible())
-			{
-				// Skip invisible item pairs.
-				continue;
-			}
-			if (grab_items)
-			{
-				pairs_to_select.push_back(cur);
-			}
-		}
-
-		if (reverse)
-		{
-			pairs_to_select.reverse();
-		}
-
-		pairs_to_select.push_back(item_pair);
-
-		for (pairs_iterator_t
-				 iter = pairs_to_select.begin(),
-				 iter_end = pairs_to_select.end();
-			 iter != iter_end; ++iter)
-		{
-			item_pair_t* pair_to_select = *iter;
-			if (isSelected(pair_to_select))
-			{
-				// Item was already selected but there is a need to keep order from last selected pair to new selection.
-				// Do it here to prevent extra mCommitOnSelectionChange in selectItemPair().
-				mSelectedItemPairs.remove(pair_to_select);
-				mSelectedItemPairs.push_back(pair_to_select);
-			}
-			else
-			{
-				selectItemPair(pair_to_select, true);
-			}
-		}
-
-		if (!select_item)
-		{
-			// Update last selected item border.
-			mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1));
-		}
-		return;
-	}
-
+	
 	if (!(mask & MASK_CONTROL) || !mMultipleSelection) resetSelection();
 	selectItemPair(item_pair, select_item);
 }
@@ -769,8 +667,6 @@ bool LLFlatListView::selectItemPair(item_pair_t* item_pair, bool select)
 
 	// Stretch selected item rect to ensure it won't be clipped
 	mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1));
-	// By default mark it as not consecutive selection
-	mIsConsecutiveSelection = false;
 
 	return true;
 }
@@ -787,44 +683,14 @@ LLRect LLFlatListView::getLastSelectedItemRect()
 
 void LLFlatListView::selectFirstItem	()
 {
-	// No items - no actions!
-	if (0 == size()) return;
-
-	// Select first visible item
-	for (pairs_iterator_t
-			 iter = mItemPairs.begin(),
-			 iter_end = mItemPairs.end();
-		 iter != iter_end; ++iter)
-	{
-		// skip invisible items
-		if ( (*iter)->first->getVisible() )
-		{
-			selectItemPair(*iter, true);
-			ensureSelectedVisible();
-			break;
-		}
-	}
+	selectItemPair(mItemPairs.front(), true);
+	ensureSelectedVisible();
 }
 
 void LLFlatListView::selectLastItem		()
 {
-	// No items - no actions!
-	if (0 == size()) return;
-
-	// Select last visible item
-	for (pairs_list_t::reverse_iterator
-			 r_iter = mItemPairs.rbegin(),
-			 r_iter_end = mItemPairs.rend();
-		 r_iter != r_iter_end; ++r_iter)
-	{
-		// skip invisible items
-		if ( (*r_iter)->first->getVisible() )
-		{
-			selectItemPair(*r_iter, true);
-			ensureSelectedVisible();
-			break;
-		}
-	}
+	selectItemPair(mItemPairs.back(), true);
+	ensureSelectedVisible();
 }
 
 void LLFlatListView::ensureSelectedVisible()
@@ -842,25 +708,14 @@ void LLFlatListView::ensureSelectedVisible()
 bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selection)
 {
 	// No items - no actions!
-	if ( 0 == size() )
+	if ( !mItemPairs.size() )
 		return false;
 
-	if (!mIsConsecutiveSelection)
-	{
-		// Leave only one item selected if list has not consecutive selection
-		if (mSelectedItemPairs.size() && !reset_selection)
-		{
-			item_pair_t* cur_sel_pair = mSelectedItemPairs.back();
-			resetSelection();
-			selectItemPair (cur_sel_pair, true);
-		}
-	}
-
+	
+	item_pair_t* to_sel_pair = NULL;
+	item_pair_t* cur_sel_pair = NULL;
 	if ( mSelectedItemPairs.size() )
 	{
-		item_pair_t* to_sel_pair = NULL;
-		item_pair_t* cur_sel_pair = NULL;
-
 		// Take the last selected pair
 		cur_sel_pair = mSelectedItemPairs.back();
 		// Bases on given direction choose next item to select
@@ -894,46 +749,42 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti
 				}
 			}
 		}
-
-		if ( to_sel_pair )
-		{
-			bool select = true;
-			if ( reset_selection )
-			{
-				// Reset current selection if we were asked about it
-				resetSelection();
-			}
-			else
-			{
-				// If item already selected and no reset request than we should deselect last selected item.
-				select = (mSelectedItemPairs.end() == std::find(mSelectedItemPairs.begin(), mSelectedItemPairs.end(), to_sel_pair));
-			}
-			// Select/Deselect next item
-			selectItemPair(select ? to_sel_pair : cur_sel_pair, select);
-			// Mark it as consecutive selection
-			mIsConsecutiveSelection = true;
-			return true;
-		}
 	}
 	else
 	{
 		// If there weren't selected items then choose the first one bases on given direction
+		cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front();
 		// Force selection to first item
-		if (is_up_direction)
-			selectLastItem();
+		to_sel_pair = cur_sel_pair;
+	}
+
+
+	if ( to_sel_pair )
+	{
+		bool select = true;
+
+		if ( reset_selection )
+		{
+			// Reset current selection if we were asked about it
+			resetSelection();
+		}
 		else
-			selectFirstItem();
-		// Mark it as consecutive selection
-		mIsConsecutiveSelection = true;
+		{
+			// If item already selected and no reset request than we should deselect last selected item.
+			select = (mSelectedItemPairs.end() == std::find(mSelectedItemPairs.begin(), mSelectedItemPairs.end(), to_sel_pair));
+		}
+
+		// Select/Deselect next item
+		selectItemPair(select ? to_sel_pair : cur_sel_pair, select);
+
 		return true;
 	}
-
 	return false;
 }
 
 BOOL LLFlatListView::canSelectAll() const
 {
-	return 0 != size() && mAllowSelection && mMultipleSelection;
+	return !mItemPairs.empty() && mAllowSelection && mMultipleSelection;
 }
 
 void LLFlatListView::selectAll()
@@ -969,12 +820,11 @@ bool LLFlatListView::isSelected(item_pair_t* item_pair) const
 	return std::find(mSelectedItemPairs.begin(), it_end, item_pair) != it_end;
 }
 
-bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
+bool LLFlatListView::removeItemPair(item_pair_t* item_pair)
 {
 	llassert(item_pair);
 
 	bool deleted = false;
-	bool selection_changed = false;
 	for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it)
 	{
 		item_pair_t* _item_pair = *it;
@@ -994,7 +844,6 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
 		if (selected_item_pair == item_pair)
 		{
 			it = mSelectedItemPairs.erase(it);
-			selection_changed = true;
 			break;
 		}
 	}
@@ -1003,16 +852,8 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
 	item_pair->first->die();
 	delete item_pair;
 
-	if (rearrange)
-	{
 	rearrangeItems();
 	notifyParentItemsRectChanged();
-	}
-
-	if (selection_changed && mCommitOnSelectionChange)
-	{
-		onCommit();
-	}
 
 	return true;
 }
@@ -1057,7 +898,25 @@ void LLFlatListView::setNoItemsCommentVisible(bool visible) const
 {
 	if (mNoItemsCommentTextbox)
 	{
-		mSelectedItemsBorder->setVisible(!visible);
+		if (visible)
+		{
+/*
+// *NOTE: MA 2010-02-04
+// Deprecated after params of the comment text box were moved into widget (flat_list_view.xml)
+// can be removed later if nothing happened.
+			// We have to update child rect here because of issues with rect after reshaping while creating LLTextbox
+			// It is possible to have invalid LLRect if Flat List is in LLAccordionTab
+			LLRect comment_rect = getLocalRect();
+
+			// To see comment correctly (EXT - 3244) in mNoItemsCommentTextbox we must get border width
+			// of LLFlatListView (@see getBorderWidth()) and stretch mNoItemsCommentTextbox to this width
+			// But getBorderWidth() returns 0 if LLFlatListView not visible. So we have to get border width
+			// from 'scroll_border'
+			LLViewBorder* scroll_border = getChild<LLViewBorder>("scroll border");
+			comment_rect.stretch(-scroll_border->getBorderWidth());
+			mNoItemsCommentTextbox->setRect(comment_rect);
+*/
+		}
 		mNoItemsCommentTextbox->setVisible(visible);
 	}
 }
@@ -1087,10 +946,7 @@ void LLFlatListView::getValues(std::vector<LLSD>& values) const
 // virtual
 void LLFlatListView::onFocusReceived()
 {
-	if (size())
-	{
 	mSelectedItemsBorder->setVisible(TRUE);
-	}
 	gEditMenuHandler = this;
 }
 // virtual
@@ -1205,112 +1061,4 @@ void LLFlatListView::detachItems(std::vector<LLPanel*>& detached_items)
 	}
 }
 
-
-/************************************************************************/
-/*             LLFlatListViewEx implementation                          */
-/************************************************************************/
-LLFlatListViewEx::Params::Params()
-: no_items_msg("no_items_msg")
-, no_filtered_items_msg("no_filtered_items_msg")
-{
-
-}
-
-LLFlatListViewEx::LLFlatListViewEx(const Params& p)
-:	LLFlatListView(p)
-, mNoFilteredItemsMsg(p.no_filtered_items_msg)
-, mNoItemsMsg(p.no_items_msg)
-, mForceShowingUnmatchedItems(false)
-, mHasMatchedItems(false)
-{
-
-}
-
-void LLFlatListViewEx::updateNoItemsMessage(const std::string& filter_string)
-{
-	bool items_filtered = !filter_string.empty();
-	if (items_filtered)
-	{
-		// items were filtered
-		LLStringUtil::format_map_t args;
-		args["[SEARCH_TERM]"] = LLURI::escape(filter_string);
-		std::string text = mNoFilteredItemsMsg;
-		LLStringUtil::format(text, args);
-		setNoItemsCommentText(text);
-	}
-	else
-	{
-		// list does not contain any items at all
-		setNoItemsCommentText(mNoItemsMsg);
-	}
-
-}
-
-bool LLFlatListViewEx::getForceShowingUnmatchedItems()
-{
-	return mForceShowingUnmatchedItems;
-}
-
-void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show)
-{
-	mForceShowingUnmatchedItems = show;
-}
-
-void LLFlatListViewEx::setFilterSubString(const std::string& filter_str)
-{
-	if (0 != LLStringUtil::compareInsensitive(filter_str, mFilterSubString))
-	{
-		mFilterSubString = filter_str;
-		updateNoItemsMessage(mFilterSubString);
-		filterItems();
-	}
-}
-
-void LLFlatListViewEx::filterItems()
-{
-	typedef std::vector <LLPanel*> item_panel_list_t;
-
-	std::string cur_filter = mFilterSubString;
-	LLStringUtil::toUpper(cur_filter);
-
-	LLSD action;
-	action.with("match_filter", cur_filter);
-
-	item_panel_list_t items;
-	getItems(items);
-
-	mHasMatchedItems = false;
-	for (item_panel_list_t::iterator
-			 iter = items.begin(),
-			 iter_end = items.end();
-		 iter != iter_end; ++iter)
-	{
-		LLPanel* pItem = (*iter);
-		// 0 signifies that filter is matched,
-		// i.e. we don't hide items that don't support 'match_filter' action, separators etc.
-		if (0 == pItem->notify(action))
-		{
-			mHasMatchedItems = true;
-			pItem->setVisible(true);
-		}
-		else
-		{
-			// TODO: implement (re)storing of current selection.
-			if(!mForceShowingUnmatchedItems)
-			{
-				selectItem(pItem, false);
-			}
-			pItem->setVisible(mForceShowingUnmatchedItems);
-		}
-	}
-
-	sort();
-	notifyParentItemsRectChanged();
-}
-
-bool LLFlatListViewEx::hasMatchedItems()
-{
-	return mHasMatchedItems;
-}
-
 //EOF
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index afd0176d987c144f65aa65edc295e2e7c59e4ddd..e3c07e811faab6adbb94eac1c0e4de9f8661a745 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -1,26 +1,32 @@
 /** 
  * @file llflatlistview.h
- * @brief LLFlatListView base class and extension to support messages for several cases of an empty list.
+ * @brief LLFlatListView base class
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -54,7 +60,6 @@
  */
 class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
 {
-	LOG_CLASS(LLFlatListView);
 public:
 
 	/**
@@ -100,9 +105,6 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
 		/** don't allow to deselect all selected items (for mouse events on items only) */
 		Optional<bool> keep_one_selected;
 
-		/** try to keep selection visible after reshape */
-		Optional<bool> keep_selection_visible_on_reshape;
-
 		/** padding between items */
 		Optional<U32> item_pad; 
 
@@ -112,9 +114,6 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
 		Params();
 	};
 	
-	// disable traversal when finding widget to hand focus off to
-	/*virtual*/ BOOL canFocusChildren() const { return FALSE; }
-
 	/**
 	 * Connects callback to signal called when Return key is pressed.
 	 */
@@ -147,19 +146,19 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
 	 * Remove specified item
 	 * @return true if the item was removed, false otherwise 
 	 */
-	virtual bool removeItem(LLPanel* item, bool rearrange = true);
+	virtual bool removeItem(LLPanel* item);
 
 	/** 
 	 * Remove an item specified by value
 	 * @return true if the item was removed, false otherwise 
 	 */
-	virtual bool removeItemByValue(const LLSD& value, bool rearrange = true);
+	virtual bool removeItemByValue(const LLSD& value);
 
 	/** 
 	 * Remove an item specified by uuid
 	 * @return true if the item was removed, false otherwise 
 	 */
-	virtual bool removeItemByUUID(const LLUUID& uuid, bool rearrange = true);
+	virtual bool removeItemByUUID(const LLUUID& uuid);
 
 	/** 
 	 * Get an item by value 
@@ -260,14 +259,14 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
 	void setAllowSelection(bool can_select) { mAllowSelection = can_select; }
 
 	/** Sets flag whether onCommit should be fired if selection was changed */
-	// FIXME: this should really be a separate signal, since "Commit" implies explicit user action, and selection changes can happen more indirectly.
 	void setCommitOnSelectionChange(bool b)		{ mCommitOnSelectionChange = b; }
 
 	/** Get number of selected items in the list */
 	U32 numSelected() const {return mSelectedItemPairs.size(); }
 
-	/** Get number of (visible) items in the list */
-	U32 size(const bool only_visible_items = true) const;
+	/** Get number of items in the list */
+	U32 size() const { return mItemPairs.size(); }
+
 
 	/** Removes all items from the list */
 	virtual void clear();
@@ -348,7 +347,7 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
 
 	virtual bool isSelected(item_pair_t* item_pair) const;
 
-	virtual bool removeItemPair(item_pair_t* item_pair, bool rearrange);
+	virtual bool removeItemPair(item_pair_t* item_pair);
 
 	/**
 	 * Notify parent about changed size of internal controls with "size_changes" action
@@ -412,10 +411,6 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
 
 	bool mKeepOneItemSelected;
 
-	bool mIsConsecutiveSelection;
-
-	bool mKeepSelectionVisibleOnReshape;
-
 	/** All pairs of the list */
 	pairs_list_t mItemPairs;
 
@@ -435,84 +430,4 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
 	commit_signal_t	mOnReturnSignal;
 };
 
-/**
- * Extends LLFlatListView functionality to show different messages when there are no items in the
- * list depend on whether they are filtered or not.
- *
- * Class provides one message per case of empty list.
- * It also provides protected updateNoItemsMessage() method to be called each time when derived list
- * is changed to update base mNoItemsCommentTextbox value.
- *
- * It is implemented to avoid duplication of this functionality in concrete implementations of the
- * lists. It is intended to be used as a base class for lists which should support two different
- * messages for empty state. Can be improved to support more than two messages via state-to-message map.
- */
-class LLFlatListViewEx : public LLFlatListView
-{
-	LOG_CLASS(LLFlatListViewEx);
-public:
-	struct Params : public LLInitParam::Block<Params, LLFlatListView::Params>
-	{
-		/**
-		 * Contains a message for empty list when it does not contain any items at all.
-		 */
-		Optional<std::string>	no_items_msg;
-
-		/**
-		 * Contains a message for empty list when its items are removed by filtering.
-		 */
-		Optional<std::string>	no_filtered_items_msg;
-		Params();
-	};
-
-	// *WORKAROUND: two methods to overload appropriate Params due to localization issue:
-	// no_items_msg & no_filtered_items_msg attributes are not defined as translatable in VLT. See EXT-5931
-	void setNoItemsMsg(const std::string& msg) { mNoItemsMsg = msg; }
-	void setNoFilteredItemsMsg(const std::string& msg) { mNoFilteredItemsMsg = msg; }
-
-	bool getForceShowingUnmatchedItems();
-
-	void setForceShowingUnmatchedItems(bool show);
-
-	/**
-	 * Sets up new filter string and filters the list.
-	 */
-	void setFilterSubString(const std::string& filter_str);
-	
-	/**
-	 * Filters the list, rearranges and notifies parent about shape changes.
-	 * Derived classes may want to overload rearrangeItems() to exclude repeated separators after filtration.
-	 */
-	void filterItems();
-
-	/**
-	 * Returns true if last call of filterItems() found at least one matching item
-	 */
-	bool hasMatchedItems();
-
-protected:
-	LLFlatListViewEx(const Params& p);
-
-	/**
-	 * Applies a message for empty list depend on passed argument.
-	 *
-	 * @param filter_string - if is not empty, message for filtered items will be set, otherwise for
-	 * completely empty list. Value of filter string will be passed as search_term in SLURL.
-	 */
-	void updateNoItemsMessage(const std::string& filter_string);
-
-private:
-	std::string mNoFilteredItemsMsg;
-	std::string mNoItemsMsg;
-	std::string	mFilterSubString;
-	/**
-	 * Show list items that don't match current filter
-	 */
-	bool mForceShowingUnmatchedItems;
-	/**
-	 * True if last call of filterItems() found at least one matching item
-	 */
-	bool mHasMatchedItems;
-};
-
 #endif
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 3cfb2c5d4a3bd9c4580d6402e9c4cc0eac56cbf1..e672252a5071acdc05304fb1d7205fb8b1e9e4b4 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2,25 +2,31 @@
  * @file llfloater.cpp
  * @brief LLFloater base class
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -163,7 +169,6 @@ LLFloater::Params::Params()
 	save_rect("save_rect", false),
 	save_visibility("save_visibility", false),
 	can_dock("can_dock", false),
-	open_centered("open_centered", false),
 	header_height("header_height", 0),
 	legacy_header_height("legacy_header_height", 0),
 	close_image("close_image"),
@@ -324,7 +329,6 @@ void LLFloater::addDragHandle()
 		addChild(mDragHandle);
 	}
 	layoutDragHandle();
-	applyTitle();
 }
 
 void LLFloater::layoutDragHandle()
@@ -341,8 +345,9 @@ void LLFloater::layoutDragHandle()
 	{
 		rect = getLocalRect();
 	}
-	mDragHandle->setShape(rect);
+	mDragHandle->setRect(rect);
 	updateTitleButtons();
+	applyTitle();
 }
 
 void LLFloater::addResizeCtrls()
@@ -445,14 +450,6 @@ void LLFloater::enableResizeCtrls(bool enable)
 	}
 }
 
-void LLFloater::destroy()
-{
-	// LLFloaterReg should be synchronized with "dead" floater to avoid returning dead instance before
-	// it was deleted via LLMortician::updateClass(). See EXT-8458.
-	LLFloaterReg::removeInstance(mInstanceName, mKey);
-	die();
-}
-
 // virtual
 LLFloater::~LLFloater()
 {
@@ -566,7 +563,6 @@ void LLFloater::handleVisibilityChange ( BOOL new_visibility )
 
 void LLFloater::openFloater(const LLSD& key)
 {
-	llinfos << "Opening floater " << getName() << llendl;
 	mKey = key; // in case we need to open ourselves again
 	
 	if (getSoundFlags() != SILENT 
@@ -607,7 +603,6 @@ void LLFloater::openFloater(const LLSD& key)
 
 void LLFloater::closeFloater(bool app_quitting)
 {
-	llinfos << "Closing floater " << getName() << llendl;
 	if (app_quitting)
 	{
 		LLFloater::sQuitting = true;
@@ -766,13 +761,6 @@ void    LLFloater::applySavedVariables()
 
 void LLFloater::applyRectControl()
 {
-	// first, center on screen if requested	
-	if (mOpenCentered)
-	{
-		center();
-	}
-
-	// override center if we have saved rect control
 	if (mRectControl.size() > 1)
 	{
 		const LLRect& rect = LLUI::sSettingGroups["floater"]->getRect(mRectControl);
@@ -812,11 +800,6 @@ void LLFloater::applyTitle()
 	{
 		mDragHandle->setTitle ( mTitle );
 	}
-
-	if (getHost())
-	{
-		getHost()->updateFloaterTitle(this);	
-	}
 }
 
 std::string LLFloater::getCurrentTitle() const
@@ -1803,16 +1786,13 @@ void LLFloater::updateTitleButtons()
 					llround((F32)floater_close_box_size * mButtonScale));
 			}
 
-			// first time here, init 'buttons_rect'
-			if(1 == button_count)
+			if(!buttons_rect.isValid())
 			{
 				buttons_rect = btn_rect;
 			}
 			else
 			{
-				// if mDragOnLeft=true then buttons are on top-left side vertically aligned
-				// title is not displayed in this case, calculating 'buttons_rect' for future use
-				mDragOnLeft ? buttons_rect.mBottom -= btn_rect.mBottom : 
+				mDragOnLeft ? buttons_rect.mRight + btn_rect.mRight : 
 					buttons_rect.mLeft = btn_rect.mLeft;
 			}
 			mButtons[i]->setRect(btn_rect);
@@ -2526,7 +2506,7 @@ LLFloater *LLFloaterView::getBackmost() const
 
 void LLFloaterView::syncFloaterTabOrder()
 {
-	// look for a visible modal dialog, starting from first
+	// look for a visible modal dialog, starting from first (should be only one)
 	LLModalDialog* modal_dialog = NULL;
 	for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
 	{
@@ -2726,7 +2706,6 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
 	mLegacyHeaderHeight = p.legacy_header_height;
 	mSingleInstance = p.single_instance;
 	mAutoTile = p.auto_tile;
-	mOpenCentered = p.open_centered;
 
 	if (p.save_rect)
 	{
@@ -2756,10 +2735,10 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
 
 LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
 
-bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node)
+bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node)
 {
 	Params params(LLUICtrlFactory::getDefaultParams<LLFloater>());
-	LLXUIParser::instance().readXUI(node, params, filename); // *TODO: Error checking
+	LLXUIParser::instance().readXUI(node, params); // *TODO: Error checking
 
 	if (output_node)
 	{
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 2deae29607c115f997ee816fdef48a8066d46c4b..403723d9d8d1f074c56b7245908278ae4112fa4f 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -2,25 +2,31 @@
  * @file llfloater.h
  * @brief LLFloater base class
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -104,8 +110,7 @@ friend class LLMultiFloater;
 								save_rect,
 								save_visibility,
 								save_dock_state,
-								can_dock,
-								open_centered;
+								can_dock;
 		Optional<S32>			header_height,
 								legacy_header_height; // HACK see initFromXML()
 
@@ -143,7 +148,7 @@ friend class LLMultiFloater;
 	static void setupParamsForExport(Params& p, LLView* parent);
 
 	void initFromParams(const LLFloater::Params& p);
-	bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL);
+	bool initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
 
 	/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
 	/*virtual*/ BOOL canSnapTo(const LLView* other_view);
@@ -302,7 +307,7 @@ friend class LLMultiFloater;
 	BOOL			getAutoFocus() const { return mAutoFocus; }
 	LLDragHandle*	getDragHandle() const { return mDragHandle; }
 
-	void			destroy(); // Don't call this directly.  You probably want to call closeFloater()
+	void			destroy() { die(); } // Don't call this directly.  You probably want to call closeFloater()
 
 	virtual	void	onClickCloseBtn();
 
@@ -368,7 +373,6 @@ friend class LLMultiFloater;
 	BOOL			mCanClose;
 	BOOL			mDragOnLeft;
 	BOOL			mResizable;
-	bool			mOpenCentered;
 	
 	S32				mMinWidth;
 	S32				mMinHeight;
@@ -428,15 +432,11 @@ friend class LLMultiFloater;
 
 class LLFloaterView : public LLUICtrl
 {
-public:
-	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>{};
-
 protected:
 	LLFloaterView (const Params& p);
 	friend class LLUICtrlFactory;
 
 public:
-
 	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 	void reshapeFloater(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical);
 
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 2759167d047bb266ea9f278be160c6932d13bb30..843f72d8e40bc02fcada552ef536f13853463913 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -2,25 +2,31 @@
  * @file lllineeditor.cpp
  * @brief LLLineEditor base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -371,10 +377,7 @@ void LLLineEditor::setText(const LLStringExplicit &new_text)
 	setCursor(llmin((S32)mText.length(), getCursor()));
 
 	// Set current history line to end of history.
-	if(mLineHistory.end() != mLineHistory.begin())
-	{
-		mCurrentHistoryLine = mLineHistory.end() - 1;
-	}
+	mCurrentHistoryLine = mLineHistory.end() - 1;
 
 	mPrevText = mText;
 }
@@ -1437,7 +1440,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
 
 BOOL LLLineEditor::canDoDelete() const
 {
-	return ( !mReadOnly && mText.length() > 0 && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
+	return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
 }
 
 void LLLineEditor::doDelete()
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 76d018771281041ccf959857d674e7158373cf6c..9489e723e320a9b225505dcf12ff7dcee06e9774 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -11,25 +11,31 @@
  *		Pre-validation (limit which keys can be used)
  *		Optional line history so previous entries can be recalled by CTRL UP/DOWN
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index c53361038126443932dab821a31f3b17387ca396..e0e86ae228f90593dea75e65230549568b740ee9 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -2,25 +2,31 @@
  * @file llmenugl.cpp
  * @brief LLMenuItemGL base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+  *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -133,7 +139,6 @@ LLMenuItemGL::Params::Params()
 :	shortcut("shortcut"),
 	jump_key("jump_key", KEY_NONE),
 	use_mac_ctrl("use_mac_ctrl", false),
-	allow_key_repeat("allow_key_repeat", false),
 	rect("rect"),
 	left("left"),
 	top("top"),
@@ -155,7 +160,7 @@ LLMenuItemGL::Params::Params()
 LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p)
 :	LLUICtrl(p),
 	mJumpKey(p.jump_key),
-	mAllowKeyRepeat(p.allow_key_repeat),
+	mAllowKeyRepeat(FALSE),
 	mHighlight( FALSE ),
 	mGotHover( FALSE ),
 	mBriefItem( FALSE ),
@@ -211,12 +216,6 @@ void LLMenuItemGL::setValue(const LLSD& value)
 	setLabel(value.asString());
 }
 
-//virtual
-LLSD LLMenuItemGL::getValue() const
-{
-	return getLabel();
-}
-
 //virtual
 BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask)
 {
@@ -922,15 +921,6 @@ void LLMenuItemCheckGL::setValue(const LLSD& value)
 	}
 }
 
-//virtual
-LLSD LLMenuItemCheckGL::getValue() const
-{
-	// Get our boolean value from the view model.
-	// If we don't override this method then the implementation from
-	// LLMenuItemGL will return a string. (EXT-8501)
-	return LLUICtrl::getValue();
-}
-
 // called to rebuild the draw label
 void LLMenuItemCheckGL::buildDrawLabel( void )
 {
@@ -3430,12 +3420,6 @@ BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent)
 			
 	if (pMenu)
 	{
-		//eat TAB key - EXT-7000
-		if (key == KEY_TAB && mask == MASK_NONE)
-		{
-			return TRUE;
-		}
-
 		//handle ESCAPE and RETURN key
 		handled = LLPanel::handleKey(key, mask, called_from_parent);
 		if (!handled)
@@ -3742,14 +3726,10 @@ void LLContextMenuBranch::buildDrawLabel( void )
 
 void	LLContextMenuBranch::showSubMenu()
 {
-	LLMenuItemGL* menu_item = mBranch->getParentMenuItem();
-	if (menu_item != NULL && menu_item->getVisible())
-	{
-		S32 center_x;
-		S32 center_y;
-		localPointToScreen(getRect().getWidth(), getRect().getHeight() , &center_x, &center_y);
-		mBranch->show(center_x, center_y);
-	}
+	S32 center_x;
+	S32 center_y;
+	localPointToScreen(getRect().getWidth(), getRect().getHeight() , &center_x, &center_y);
+	mBranch->show(	center_x, center_y);
 }
 
 // onCommit() - do the primary funcationality of the menu item.
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index eb0d0bcb1f4a68dab960bba66c0bb0ad36f2cf8b..6f0f83d4b9e041e085d6ea1aeac85e40e3443751 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -2,25 +2,31 @@
  * @file llmenugl.h
  * @brief Declaration of the opengl based menu system.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -55,8 +61,7 @@ class LLMenuItemGL : public LLUICtrl
 	{
 		Optional<std::string>	shortcut;
 		Optional<KEY>			jump_key;
-		Optional<bool>			use_mac_ctrl,
-								allow_key_repeat;
+		Optional<bool>			use_mac_ctrl;
 
 		Ignored					rect,
 								left,
@@ -89,7 +94,6 @@ class LLMenuItemGL : public LLUICtrl
 
 	// LLUICtrl overrides
 	/*virtual*/ void setValue(const LLSD& value);
-	/*virtual*/ LLSD getValue() const;
 
 	virtual BOOL handleAcceleratorKey(KEY key, MASK mask);
 
@@ -316,7 +320,6 @@ class LLMenuItemCheckGL
 	virtual void onCommit( void );
 	
 	virtual void setValue(const LLSD& value);
-	virtual LLSD getValue() const;
 
 	// called to rebuild the draw label
 	virtual void buildDrawLabel( void );
diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp
index f3a48835b1ecb8cc282871145d5a26178f0a6adc..3aea648562d5bb2126b0c85cdd19c8b490b6ae91 100644
--- a/indra/llui/llmultifloater.cpp
+++ b/indra/llui/llmultifloater.cpp
@@ -2,25 +2,31 @@
  * @file llmultifloater.cpp
  * @brief LLFloater that hosts other floaters
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -232,16 +238,6 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater,
 	moveResizeHandlesToFront();
 }
 
-void LLMultiFloater::updateFloaterTitle(LLFloater* floaterp)
-{
-	S32 index = mTabContainer->getIndexForPanel(floaterp);
-	if (index != -1)
-	{
-		mTabContainer->setPanelTitle(index, floaterp->getShortTitle());
-	}
-}
-
-
 /**
 	BOOL selectFloater(LLFloater* floaterp)
 
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 99d540a9de779bba7279d4ae6673bfd644c05478..65ef53443b3f629ed15acad5926444505ceeef03 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -2,25 +2,31 @@
 * @file llnotifications.cpp
 * @brief Non-UI queue manager for keeping a prioritized list of notifications
 *
-* $LicenseInfo:firstyear=2008&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2008&license=viewergpl$
+* 
+* Copyright (c) 2008-2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 
@@ -28,7 +34,6 @@
 
 #include "llnotifications.h"
 
-#include "llinstantmessage.h"
 #include "llxmlnode.h"
 #include "lluictrl.h"
 #include "lluictrlfactory.h"
@@ -36,7 +41,6 @@
 #include "llsdserialize.h"
 #include "lltrans.h"
 #include "llnotificationslistener.h"
-#include "llstring.h"
 
 #include <algorithm>
 #include <boost/regex.hpp>
@@ -44,38 +48,122 @@
 
 const std::string NOTIFICATION_PERSIST_VERSION = "0.93";
 
-// Local channel for persistent notifications
-// Stores only persistent notifications.
-// Class users can use connectChanged() to process persistent notifications
-// (see LLNotificationStorage for example).
-class LLPersistentNotificationChannel : public LLNotificationChannel
+// local channel for notification history
+class LLNotificationHistoryChannel : public LLNotificationChannel
 {
-	LOG_CLASS(LLPersistentNotificationChannel);
+	LOG_CLASS(LLNotificationHistoryChannel);
 public:
-	LLPersistentNotificationChannel() :
-		LLNotificationChannel("Persistent", "Visible", &notificationFilter, LLNotificationComparators::orderByUUID())
+	LLNotificationHistoryChannel(const std::string& filename) : 
+		LLNotificationChannel("History", "Visible", &historyFilter, LLNotificationComparators::orderByUUID()),
+		mFileName(filename)
 	{
+		connectChanged(boost::bind(&LLNotificationHistoryChannel::historyHandler, this, _1));
+		loadPersistentNotifications();
 	}
 
 private:
+	bool historyHandler(const LLSD& payload)
+	{
+		// we ignore "load" messages, but rewrite the persistence file on any other
+		std::string sigtype = payload["sigtype"];
+		if (sigtype != "load")
+		{
+			savePersistentNotifications();
+		}
+		return false;
+	}
+
+	// The history channel gets all notifications except those that have been cancelled
+	static bool historyFilter(LLNotificationPtr pNotification)
+	{
+		return !pNotification->isCancelled();
+	}
+
+	void savePersistentNotifications()
+	{
+		/* NOTE: As of 2009-11-09 the reload of notifications on startup does not
+		work, and has not worked for months.  Skip saving notifications until the
+		read can be fixed, because this hits the disk once per notification and
+		causes log spam.  James
+
+		llinfos << "Saving open notifications to " << mFileName << llendl;
+
+		llofstream notify_file(mFileName.c_str());
+		if (!notify_file.is_open()) 
+		{
+			llwarns << "Failed to open " << mFileName << llendl;
+			return;
+		}
 
-	// The channel gets all persistent notifications except those that have been canceled
-	static bool notificationFilter(LLNotificationPtr pNotification)
+		LLSD output;
+		output["version"] = NOTIFICATION_PERSIST_VERSION;
+		LLSD& data = output["data"];
+
+		for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
+		{
+			if (!LLNotifications::instance().templateExists((*it)->getName())) continue;
+
+			// only store notifications flagged as persisting
+			LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate((*it)->getName());
+			if (!templatep->mPersist) continue;
+
+			data.append((*it)->asLLSD());
+		}
+
+		LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+		formatter->format(output, notify_file, LLSDFormatter::OPTIONS_PRETTY);
+		*/
+	}
+
+	void loadPersistentNotifications()
 	{
-		bool handle_notification = false;
+		llinfos << "Loading open notifications from " << mFileName << llendl;
 
-		handle_notification = pNotification->isPersistent()
-			&& !pNotification->isCancelled();
+		llifstream notify_file(mFileName.c_str());
+		if (!notify_file.is_open()) 
+		{
+			llwarns << "Failed to open " << mFileName << llendl;
+			return;
+		}
+
+		LLSD input;
+		LLPointer<LLSDParser> parser = new LLSDXMLParser();
+		if (parser->parse(notify_file, input, LLSDSerialize::SIZE_UNLIMITED) < 0)
+		{
+			llwarns << "Failed to parse open notifications" << llendl;
+			return;
+		}
 
-		return handle_notification;
+		if (input.isUndefined()) return;
+		std::string version = input["version"];
+		if (version != NOTIFICATION_PERSIST_VERSION)
+		{
+			llwarns << "Bad open notifications version: " << version << llendl;
+			return;
+		}
+		LLSD& data = input["data"];
+		if (data.isUndefined()) return;
+
+		LLNotifications& instance = LLNotifications::instance();
+		for (LLSD::array_const_iterator notification_it = data.beginArray();
+			notification_it != data.endArray();
+			++notification_it)
+		{
+			instance.add(LLNotificationPtr(new LLNotification(*notification_it)));
+		}
 	}
 
+	//virtual
 	void onDelete(LLNotificationPtr pNotification)
 	{
-		// we want to keep deleted notifications in our log, otherwise some 
-		// notifications will be lost on exit.
+		// we want to keep deleted notifications in our log
 		mItems.insert(pNotification);
+		
+		return;
 	}
+	
+private:
+	std::string mFileName;
 };
 
 bool filterIgnoredNotifications(LLNotificationPtr notification)
@@ -329,10 +417,6 @@ LLNotification::LLNotification(const LLNotification::Params& p) :
 
 		mTemporaryResponder = true;
 	}
-	else if(p.functor.responder.isChosen())
-	{
-		mResponder = p.functor.responder;
-	}
 
 	if(p.responder.isProvided())
 	{
@@ -369,7 +453,6 @@ LLNotification::LLNotification(const LLSD& sd) :
 LLSD LLNotification::asLLSD()
 {
 	LLSD output;
-	output["id"] = mId;
 	output["name"] = mTemplatep->mName;
 	output["form"] = getForm()->asLLSD();
 	output["substitutions"] = mSubstitutions;
@@ -379,12 +462,6 @@ LLSD LLNotification::asLLSD()
 	output["priority"] = (S32)mPriority;
 	output["responseFunctor"] = mResponseFunctorName;
 	output["reusable"] = mIsReusable;
-
-	if(mResponder)
-	{
-		output["responder"] = mResponder->asLLSD();
-	}
-
 	return output;
 }
 
@@ -494,20 +571,12 @@ void LLNotification::respond(const LLSD& response)
 	// *TODO may remove mRespondedTo and use mResponce.isDefined() in isRespondedTo()
 	mRespondedTo = true;
 	mResponse = response;
-
-	if(mResponder)
-	{
-		mResponder->handleRespond(asLLSD(), response);
-	}
-	else
-	{
-		// look up the functor
-		LLNotificationFunctorRegistry::ResponseFunctor functor =
-			LLNotificationFunctorRegistry::instance().getFunctor(mResponseFunctorName);
-		// and then call it
-		functor(asLLSD(), response);
-	}
-
+	// look up the functor
+	LLNotificationFunctorRegistry::ResponseFunctor functor = 
+		LLNotificationFunctorRegistry::instance().getFunctor(mResponseFunctorName);
+	// and then call it
+	functor(asLLSD(), response);
+	
 	if (mTemporaryResponder && !isReusable())
 	{
 		LLNotificationFunctorRegistry::instance().unregisterFunctor(mResponseFunctorName);
@@ -552,9 +621,19 @@ void LLNotification::setResponseFunctor(const LLNotificationFunctorRegistry::Res
 	LLNotificationFunctorRegistry::instance().registerFunctor(mResponseFunctorName, cb);
 }
 
-void LLNotification::setResponseFunctor(const LLNotificationResponderPtr& responder)
+bool LLNotification::payloadContainsAll(const std::vector<std::string>& required_fields) const
 {
-	mResponder = responder;
+	for(std::vector<std::string>::const_iterator required_fields_it = required_fields.begin(); 
+		required_fields_it != required_fields.end();
+		required_fields_it++)
+	{
+		std::string required_field_name = *required_fields_it;
+		if( ! getPayload().has(required_field_name))
+		{
+			return false; // a required field was not found
+		}
+	}
+	return true; // all required fields were found
 }
 
 bool LLNotification::isEquivalentTo(LLNotificationPtr that) const
@@ -565,22 +644,11 @@ bool LLNotification::isEquivalentTo(LLNotificationPtr that) const
 	}
 	if (this->mTemplatep->mUnique)
 	{
-		const LLSD& these_substitutions = this->getSubstitutions();
-		const LLSD& those_substitutions = that->getSubstitutions();
-
 		// highlander bit sez there can only be one of these
-		for (std::vector<std::string>::const_iterator it = mTemplatep->mUniqueContext.begin(), end_it = mTemplatep->mUniqueContext.end();
-			it != end_it;
-			++it)
-		{
-			if (these_substitutions.get(*it).asString() != those_substitutions.get(*it).asString())
-			{
-				return false;
-			}
-		}
-		return true;
+		return
+			this->payloadContainsAll(that->mTemplatep->mUniqueContext) &&
+			that->payloadContainsAll(this->mTemplatep->mUniqueContext);
 	}
-
 	return false; 
 }
 
@@ -1048,9 +1116,12 @@ void LLNotifications::createDefaultChannels()
 	LLNotificationChannel::buildChannel("Visible", "Ignore",
 		&LLNotificationFilters::includeEverything);
 
-	// create special persistent notification channel
+	// create special history channel
+	//std::string notifications_log_file = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml" );
+	// use ^^^ when done debugging notifications serialization
+	std::string notifications_log_file = gDirUtilp->getExpandedFilename ( LL_PATH_USER_SETTINGS, "open_notifications.xml" );
 	// this isn't a leak, don't worry about the empty "new"
-	new LLPersistentNotificationChannel();
+	new LLNotificationHistoryChannel(notifications_log_file);
 
 	// connect action methods to these channels
 	LLNotifications::instance().getChannel("Expiration")->
@@ -1484,14 +1555,7 @@ std::ostream& operator<<(std::ostream& s, const LLNotification& notification)
 void LLPostponedNotification::onCachedNameReceived(const LLUUID& id, const std::string& first,
 		const std::string& last, bool is_group)
 {
-	mName = first + " " + last;
-
-	LLStringUtil::trim(mName);
-	if (mName.empty())
-	{
-		llwarns << "Empty name received for Id: " << id << llendl;
-		mName = SYSTEM_FROM;
-	}
+	gCacheName->getFullName(id, mName);
 	modifyNotificationParams();
 	LLNotifications::instance().add(mParams);
 	cleanup();
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 2cc8803f10172bbac85c88e86e8ef467b77e052d..1799ca65b7ac4eb9f62d6103b60e996ab122402f 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -3,25 +3,31 @@
 * @brief Non-UI manager and support for keeping a prioritized list of notifications
 * @author Q (with assistance from Richard and Coco)
 *
-* $LicenseInfo:firstyear=2008&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2008&license=viewergpl$
+* 
+* Copyright (c) 2008-2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 
@@ -110,23 +116,8 @@ typedef enum e_notification_priority
 	NOTIFICATION_PRIORITY_CRITICAL
 } ENotificationPriority;
 
-class LLNotificationResponderInterface
-{
-public:
-	LLNotificationResponderInterface(){};
-	virtual ~LLNotificationResponderInterface(){};
-
-	virtual void handleRespond(const LLSD& notification, const LLSD& response) = 0;
-
-	virtual LLSD asLLSD() = 0;
-
-	virtual void fromLLSD(const LLSD& params) = 0;
-};
-
 typedef boost::function<void (const LLSD&, const LLSD&)> LLNotificationResponder;
 
-typedef boost::shared_ptr<LLNotificationResponderInterface> LLNotificationResponderPtr;
-
 typedef LLFunctorRegistry<LLNotificationResponder> LLNotificationFunctorRegistry;
 typedef LLFunctorRegistration<LLNotificationResponder> LLNotificationFunctorRegistration;
 
@@ -312,12 +303,10 @@ friend class LLNotifications;
 		{
 			Alternative<std::string>										name;
 			Alternative<LLNotificationFunctorRegistry::ResponseFunctor>	function;
-			Alternative<LLNotificationResponderPtr>						responder;
 
 			Functor()
 			:	name("functor_name"),
-				function("functor"),
-				responder("responder")
+				function("functor")
 			{}
 		};
 		Optional<Functor>						functor;
@@ -347,8 +336,6 @@ friend class LLNotifications;
 		}
 	};
 
-	LLNotificationResponderPtr getResponderPtr() { return mResponder; }
-
 private:
 	
 	LLUUID mId;
@@ -362,13 +349,12 @@ friend class LLNotifications;
 	bool mIgnored;
 	ENotificationPriority mPriority;
 	LLNotificationFormPtr mForm;
-	void* mResponderObj; // TODO - refactor/remove this field
+	void* mResponderObj;
 	bool mIsReusable;
-	LLNotificationResponderPtr mResponder;
-
+	
 	// a reference to the template
 	LLNotificationTemplatePtr mTemplatep;
-
+	
 	/*
 	 We want to be able to store and reload notifications so that they can survive
 	 a shutdown/restart of the client. So we can't simply pass in callbacks;
@@ -396,6 +382,8 @@ friend class LLNotifications;
 
 	void cancel();
 
+	bool payloadContainsAll(const std::vector<std::string>& required_fields) const;
+
 public:
 
 	// constructor from a saved notification
@@ -405,8 +393,6 @@ friend class LLNotifications;
 
 	void setResponseFunctor(const LLNotificationFunctorRegistry::ResponseFunctor& cb);
 
-	void setResponseFunctor(const LLNotificationResponderPtr& responder);
-
 	typedef enum e_response_template_type
 	{
 		WITHOUT_DEFAULT_BUTTON,
@@ -473,12 +459,7 @@ friend class LLNotifications;
 	{
 		return mTemplatep->mName;
 	}
-
-	bool isPersistent() const
-	{
-		return mTemplatep->mPersist;
-	}
-
+	
 	const LLUUID& id() const
 	{
 		return mId;
diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp
index 9b65c2b79d9dc3376d2823fb9587ec1e3c139f39..b7840d1b59f906aaac8d8128ef122c27d9fa547d 100644
--- a/indra/llui/llscrollingpanellist.cpp
+++ b/indra/llui/llscrollingpanellist.cpp
@@ -2,25 +2,31 @@
  * @file llscrollingpanellist.cpp
  * @brief 
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h
index 8f569c2a582106f7e812f0a9f0610d95d3e031f0..5f1996159b3990d241cfc15a9f6066abafc4c326 100644
--- a/indra/llui/llscrollingpanellist.h
+++ b/indra/llui/llscrollingpanellist.h
@@ -1,25 +1,31 @@
 /** 
  * @file llscrollingpanellist.h
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 3f4ab0fbc80da246a3d0c8b4eca2067f79124529..db0f2bd6e2b3d0ed2582cb58a6ff2b6098b26183 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -3,25 +3,31 @@
  * @brief Scroll lists are composed of rows (items), each of which 
  * contains columns (cells).
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -276,8 +282,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
 	text_p.border_visible(false);
 	text_p.rect(mItemListRect);
 	text_p.follows.flags(FOLLOWS_ALL);
-	// word wrap was added accroding to the EXT-6841
-	text_p.wrap(true);
 	addChild(LLUICtrlFactory::create<LLTextBox>(text_p));
 }
 
@@ -2943,6 +2947,7 @@ BOOL LLScrollListCtrl::operateOnAll(EOperation op)
 //virtual 
 void LLScrollListCtrl::setFocus(BOOL b)
 {
+	mSearchString.clear();
 	// for tabbing into pristine scroll lists (Finder)
 	if (!getFirstSelected())
 	{
@@ -2987,9 +2992,6 @@ void LLScrollListCtrl::onFocusLost()
 	{
 		gFocusMgr.setMouseCapture(NULL);
 	}
-
-	mSearchString.clear();
-
 	LLUICtrl::onFocusLost();
 }
 
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index 30618866af8292f6ce5b2a565de3128ccff75daa..1f0ef585dba171b3f0097272f4b98ea934cc380e 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -4,25 +4,31 @@
  * in UI code.  LLScrollListCell, LLScrollListItem, etc. are utility
  * classes.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index b95596fa70a6f4efeffb6dcde7fefd7befef4d92..e08026eaf4024766889896a7b96ec02dc91af77a 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -3,25 +3,31 @@
  * @author Martin Reddy
  * @brief The base class of text box/editor, providing Url handling support
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -34,7 +40,6 @@
 #include "llscrollcontainer.h"
 #include "llstl.h"
 #include "lltextparser.h"
-#include "lltextutil.h"
 #include "lltooltip.h"
 #include "lluictrl.h"
 #include "llurlaction.h"
@@ -60,10 +65,7 @@ bool LLTextBase::compare_segment_end::operator()(const LLTextSegmentPtr& a, cons
 	{
 		return a->getStart() < b->getStart();
 	}
-	else
-	{
-		return a->getEnd() < b->getEnd();
-	}
+	return a->getEnd() < b->getEnd();
 }
 
 
@@ -150,7 +152,6 @@ LLTextBase::Params::Params()
 	bg_writeable_color("bg_writeable_color"),
 	bg_focus_color("bg_focus_color"),
 	allow_scroll("allow_scroll", true),
-	plain_text("plain_text",false),
 	track_end("track_end", false),
 	read_only("read_only", false),
 	v_pad("v_pad", 0),
@@ -171,7 +172,7 @@ LLTextBase::Params::Params()
 
 LLTextBase::LLTextBase(const LLTextBase::Params &p) 
 :	LLUICtrl(p, LLTextViewModelPtr(new LLTextViewModel)),
-	mURLClickSignal(NULL),
+	mURLClickSignal(),
 	mMaxTextByteLength( p.max_text_length ),
 	mDefaultFont(p.font),
 	mFontShadow(p.font_shadow),
@@ -191,7 +192,6 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
 	mHPad(p.h_pad),
 	mVPad(p.v_pad),
 	mHAlign(p.font_halign),
-	mVAlign(p.font_valign),
 	mLineSpacingMult(p.line_spacing.multiple),
 	mLineSpacingPixels(p.line_spacing.pixels),
 	mClipPartial(p.clip_partial && !p.allow_scroll),
@@ -200,14 +200,12 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
 	mSelectionStart( 0 ),
 	mSelectionEnd( 0 ),
 	mIsSelecting( FALSE ),
-	mPlainText ( p.plain_text ),
 	mWordWrap(p.wrap),
 	mUseEllipses( p.use_ellipses ),
 	mParseHTML(p.allow_html),
 	mParseHighlights(p.parse_highlights),
 	mBGVisible(p.bg_visible),
-	mScroller(NULL),
-	mStyleDirty(true)
+	mScroller(NULL)
 {
 	if(p.allow_scroll)
 	{
@@ -246,8 +244,9 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
 
 LLTextBase::~LLTextBase()
 {
+	// Menu, like any other LLUICtrl, is deleted by its parent - gMenuHolder
+
 	mSegments.clear();
-	delete mURLClickSignal;
 }
 
 void LLTextBase::initFromParams(const LLTextBase::Params& p)
@@ -293,18 +292,13 @@ bool LLTextBase::truncate()
 	return did_truncate;
 }
 
-const LLStyle::Params& LLTextBase::getDefaultStyleParams()
+LLStyle::Params LLTextBase::getDefaultStyleParams()
 {
-	if (mStyleDirty)
-	{
-		  mDefaultStyle
-				  .color(LLUIColor(&mFgColor))
-				  .readonly_color(LLUIColor(&mReadOnlyFgColor))
-				  .font(mDefaultFont)
-				  .drop_shadow(mFontShadow);
-		  mStyleDirty = false;
-	}
-	return mDefaultStyle;
+	return LLStyle::Params()
+		.color(LLUIColor(&mFgColor))
+		.readonly_color(LLUIColor(&mReadOnlyFgColor))
+		.font(mDefaultFont)
+		.drop_shadow(mFontShadow);
 }
 
 void LLTextBase::onValueChange(S32 start, S32 end)
@@ -486,9 +480,9 @@ void LLTextBase::drawCursor()
 					text_color = mFgColor.get();
 					fontp = mDefaultFont;
 				}
-				fontp->render(text, mCursorPos, cursor_rect, 
+				fontp->render(text, mCursorPos, cursor_rect.mLeft, cursor_rect.mTop, 
 					LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], alpha),
-					LLFontGL::LEFT, mVAlign,
+					LLFontGL::LEFT, LLFontGL::TOP,
 					LLFontGL::NORMAL,
 					LLFontGL::NO_SHADOW,
 					1);
@@ -863,12 +857,11 @@ BOOL LLTextBase::handleMouseUp(S32 x, S32 y, MASK mask)
 	if (cur_segment && cur_segment->handleMouseUp(x, y, mask))
 	{
 		// Did we just click on a link?
-		if (mURLClickSignal
-			&& cur_segment->getStyle()
+		if (cur_segment->getStyle()
 		    && cur_segment->getStyle()->isLink())
 		{
 			// *TODO: send URL here?
-			(*mURLClickSignal)(this, LLSD() );
+			mURLClickSignal(this, LLSD() );
 		}
 		return TRUE;
 	}
@@ -969,19 +962,18 @@ void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
 	if (width != getRect().getWidth() || height != getRect().getHeight())
 	{
-		bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false;
-
+		//EXT-4288
+		//to keep consistance scrolling behaviour 
+		//when scrolling from top and from bottom...
+		bool is_scrolled_to_end = (mScroller!=NULL) && scrolledToEnd();
+		
 		LLUICtrl::reshape( width, height, called_from_parent );
-
-		if (mScroller && scrolled_to_bottom && mTrackEnd)
+	
+		if (is_scrolled_to_end)
 		{
-			// keep bottom of text buffer visible
-			// do this here as well as in reflow to handle case
-			// where shrinking from top, which causes buffer to temporarily 
-			// not be scrolled to the bottom, since the scroll index
-			// specified the _top_ of the visible document region
-			mScroller->goToBottom();
-		}
+			deselect();
+			endOfDoc();
+		}		
 
 		// do this first after reshape, because other things depend on
 		// up-to-date mVisibleTextRect
@@ -1042,14 +1034,12 @@ void LLTextBase::draw()
 void LLTextBase::setColor( const LLColor4& c )
 {
 	mFgColor = c;
-	mStyleDirty = true;
 }
 
 //virtual 
 void LLTextBase::setReadOnlyColor(const LLColor4 &c)
 {
 	mReadOnlyFgColor = c;
-	mStyleDirty = true;
 }
 
 //virtual
@@ -1110,7 +1100,7 @@ S32 LLTextBase::getLeftOffset(S32 width)
 	case LLFontGL::LEFT:
 		return mHPad;
 	case LLFontGL::HCENTER:
-		return mHPad + llmax(0, (mVisibleTextRect.getWidth() - width - mHPad) / 2);
+		return mHPad + (mVisibleTextRect.getWidth() - width - mHPad) / 2;
 	case LLFontGL::RIGHT:
 		return mVisibleTextRect.getWidth() - width;
 	default:
@@ -1126,48 +1116,8 @@ void LLTextBase::reflow()
 
 	updateSegments();
 
-	if (mReflowIndex == S32_MAX)
-	{
-		return;
-	}
-
-	bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false;
-
-	LLRect cursor_rect = getLocalRectFromDocIndex(mCursorPos);
-	bool follow_selection = getLocalRect().overlaps(cursor_rect); // cursor is (potentially) visible
-
-	// store in top-left relative coordinates to avoid issues with horizontal scrollbar appearing and disappearing
-	cursor_rect.mTop = mVisibleTextRect.mTop - cursor_rect.mTop;
-	cursor_rect.mBottom = mVisibleTextRect.mTop - cursor_rect.mBottom;
-
-	S32 first_line = getFirstVisibleLine();
-
-	// if scroll anchor not on first line, update it to first character of first line
-	if (!mLineInfoList.empty()
-		&&	(mScrollIndex <  mLineInfoList[first_line].mDocIndexStart
-			||	mScrollIndex >= mLineInfoList[first_line].mDocIndexEnd))
-	{
-		mScrollIndex = mLineInfoList[first_line].mDocIndexStart;
-	}
-	LLRect first_char_rect = getLocalRectFromDocIndex(mScrollIndex);
-	// store in top-left relative coordinates to avoid issues with horizontal scrollbar appearing and disappearing
-	first_char_rect.mTop = mVisibleTextRect.mTop - first_char_rect.mTop;
-	first_char_rect.mBottom = mVisibleTextRect.mTop - first_char_rect.mBottom;
-
-	S32 reflow_count = 0;
 	while(mReflowIndex < S32_MAX)
 	{
-		// we can get into an infinite loop if the document height does not monotonically increase
-		// with decreasing width (embedded ui elements with alternate layouts).  In that case, 
-		// we want to stop reflowing after 2 iterations.  We use 2, since we need to handle the case
-		// of introducing a vertical scrollbar causing a reflow with less width.  We should also always
-		// use an even number of iterations to avoid user visible oscillation of the layout
-		if(++reflow_count > 2)
-		{
-			lldebugs << "Breaking out of reflow due to possible infinite loop in " << getName() << llendl;
-			break;
-		}
-	
 		S32 start_index = mReflowIndex;
 		mReflowIndex = S32_MAX;
 
@@ -1175,6 +1125,25 @@ void LLTextBase::reflow()
 		// to force inlined widgets with follows set to shrink
 		mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight());
 
+		bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false;
+
+		LLRect old_cursor_rect = getLocalRectFromDocIndex(mCursorPos);
+		bool follow_selection = mVisibleTextRect.overlaps(old_cursor_rect); // cursor is visible
+		old_cursor_rect.translate(-mVisibleTextRect.mLeft, -mVisibleTextRect.mBottom);
+
+		S32 first_line = getFirstVisibleLine();
+
+		// if scroll anchor not on first line, update it to first character of first line
+		if (!mLineInfoList.empty()
+			&&	(mScrollIndex <  mLineInfoList[first_line].mDocIndexStart
+				||	mScrollIndex >= mLineInfoList[first_line].mDocIndexEnd))
+		{
+			mScrollIndex = mLineInfoList[first_line].mDocIndexStart;
+		}
+		LLRect first_char_rect = getLocalRectFromDocIndex(mScrollIndex);
+		// subtract off effect of horizontal scrollbar from local position of first char
+		first_char_rect.translate(-mVisibleTextRect.mLeft, -mVisibleTextRect.mBottom);
+
 		S32 cur_top = 0;
 
 		segment_set_t::iterator seg_iter = mSegments.begin();
@@ -1216,6 +1185,11 @@ void LLTextBase::reflow()
 			// grow line height as necessary based on reported height of this segment
 			line_height = llmax(line_height, segment_height);
 			remaining_pixels -= segment_width;
+			if (remaining_pixels < 0)
+			{
+				// getNumChars() and getDimensions() should return consistent results
+				remaining_pixels = 0;
+			}
 
 			seg_offset += character_count;
 
@@ -1290,42 +1264,32 @@ void LLTextBase::reflow()
 			segmentp->updateLayout(*this);
 
 		}
-	}
 
-	// apply scroll constraints after reflowing text
-	if (!hasMouseCapture() && mScroller)
-	{
-		if (scrolled_to_bottom && mTrackEnd)
-		{
-			// keep bottom of text buffer visible
-			endOfDoc();
-		}
-		else if (hasSelection() && follow_selection)
+		// apply scroll constraints after reflowing text
+		if (!hasMouseCapture() && mScroller)
 		{
-			// keep cursor in same vertical position on screen when selecting text
-			LLRect new_cursor_rect_doc = getDocRectFromDocIndex(mCursorPos);
-			LLRect old_cursor_rect = cursor_rect;
-			old_cursor_rect.mTop = mVisibleTextRect.mTop - cursor_rect.mTop;
-			old_cursor_rect.mBottom = mVisibleTextRect.mTop - cursor_rect.mBottom;
-
-			mScroller->scrollToShowRect(new_cursor_rect_doc, old_cursor_rect);
+			if (scrolled_to_bottom && mTrackEnd)
+			{
+				// keep bottom of text buffer visible
+				endOfDoc();
+			}
+			else if (hasSelection() && follow_selection)
+			{
+				// keep cursor in same vertical position on screen when selecting text
+				LLRect new_cursor_rect_doc = getDocRectFromDocIndex(mCursorPos);
+				mScroller->scrollToShowRect(new_cursor_rect_doc, old_cursor_rect);
+			}
+			else
+			{
+				// keep first line of text visible
+				LLRect new_first_char_rect = getDocRectFromDocIndex(mScrollIndex);
+				mScroller->scrollToShowRect(new_first_char_rect, first_char_rect);
+			}
 		}
-		else
-		{
-			// keep first line of text visible
-			LLRect new_first_char_rect = getDocRectFromDocIndex(mScrollIndex);
 
-			// pass in desired rect in the coordinate frame of the document viewport
-			LLRect old_first_char_rect = first_char_rect;
-			old_first_char_rect.mTop = mVisibleTextRect.mTop - first_char_rect.mTop;
-			old_first_char_rect.mBottom = mVisibleTextRect.mTop - first_char_rect.mBottom;
-
-			mScroller->scrollToShowRect(new_first_char_rect, old_first_char_rect);
-		}
+		// reset desired x cursor position
+		updateCursorXPos();
 	}
-
-	// reset desired x cursor position
-	updateCursorXPos();
 }
 
 LLRect LLTextBase::getTextBoundingRect()
@@ -1493,22 +1457,12 @@ void LLTextBase::getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg
 
 LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index)
 {
-	if (index > getLength()) { return mSegments.end(); }
-
-	// when there are no segments, we return the end iterator, which must be checked by caller
-	if (mSegments.size() <= 1) { return mSegments.begin(); }
-
 	segment_set_t::iterator it = mSegments.upper_bound(new LLIndexSegment(index));
 	return it;
 }
 
 LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 index) const
 {
-	if (index > getLength()) { return mSegments.end(); }
-
-	// when there are no segments, we return the end iterator, which must be checked by caller
-	if (mSegments.size() <= 1) { return mSegments.begin(); }
-
 	LLTextBase::segment_set_t::const_iterator it =  mSegments.upper_bound(new LLIndexSegment(index));
 	return it;
 }
@@ -1553,7 +1507,6 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
 	registrar.add("Url.OpenExternal", boost::bind(&LLUrlAction::openURLExternal, url));
 	registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url));
 	registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url));
-	registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url));
 	registrar.add("Url.ShowOnMap", boost::bind(&LLUrlAction::showLocationOnMap, url));
 	registrar.add("Url.CopyLabel", boost::bind(&LLUrlAction::copyLabelToClipboard, url));
 	registrar.add("Url.CopyUrl", boost::bind(&LLUrlAction::copyURLToClipboard, url));
@@ -1597,7 +1550,7 @@ std::string LLTextBase::getText() const
 	return getViewModel()->getValue().asString();
 }
 
-void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params)
+void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params)
 {
 	LLStyle::Params style_params(input_params);
 	style_params.fillFrom(getDefaultStyleParams());
@@ -1633,20 +1586,34 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
 					part = (S32)LLTextParser::MIDDLE;
 				}
 				std::string subtext=text.substr(0,start);
-				appendAndHighlightText(subtext, part, style_params); 
+				appendAndHighlightText(subtext, prepend_newline, part, style_params); 
+				prepend_newline = false;
 			}
 
-			// inserts an avatar icon preceding the Url if appropriate
-			LLTextUtil::processUrlMatch(&match,this);
+			// output an optional icon before the Url
+			if (! match.getIcon().empty())
+			{
+				LLUIImagePtr image = LLUI::getUIImage(match.getIcon());
+				if (image)
+				{
+					LLStyle::Params icon;
+					icon.image = image;
+					// Text will be replaced during rendering with the icon,
+					// but string cannot be empty or the segment won't be
+					// added (or drawn).
+					appendAndHighlightText(" ", prepend_newline, part, icon);
+					prepend_newline = false;
+				}
+			}
 
 			// output the styled Url (unless we've been asked to suppress hyperlinking)
 			if (match.isLinkDisabled())
 			{
-				appendAndHighlightText(match.getLabel(), part, style_params);
+				appendAndHighlightText(match.getLabel(), prepend_newline, part, style_params);
 			}
 			else
 			{
-				appendAndHighlightText(match.getLabel(), part, link_params);
+				appendAndHighlightText(match.getLabel(), prepend_newline, part, link_params);
 
 				// set the tooltip for the Url label
 				if (! match.getTooltip().empty())
@@ -1659,6 +1626,8 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
 						}
 				}
 			}
+			prepend_newline = false;
+
 			// move on to the rest of the text after the Url
 			if (end < (S32)text.length()) 
 			{
@@ -1671,66 +1640,25 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
 				break;
 			}
 		}
-		if (part != (S32)LLTextParser::WHOLE) 
-			part=(S32)LLTextParser::END;
-		if (end < (S32)text.length()) 
-			appendAndHighlightText(text, part, style_params);		
+		if (part != (S32)LLTextParser::WHOLE) part=(S32)LLTextParser::END;
+		if (end < (S32)text.length()) appendAndHighlightText(text, prepend_newline, part, style_params);		
 	}
 	else
 	{
-		appendAndHighlightText(new_text, part, style_params);
+		appendAndHighlightText(new_text, prepend_newline, part, style_params);
 	}
 }
 
-void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params)
-{
-	if (new_text.empty()) 
-		return;
-
-	if(prepend_newline)
-		appendLineBreakSegment(input_params);
-	appendTextImpl(new_text,input_params);
-}
-
 void LLTextBase::needsReflow(S32 index)
 {
 	lldebugs << "reflow on object " << (void*)this << " index = " << mReflowIndex << ", new index = " << index << llendl;
 	mReflowIndex = llmin(mReflowIndex, index);
 }
 
-void LLTextBase::appendLineBreakSegment(const LLStyle::Params& style_params)
+void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& style_params)
 {
-	segment_vec_t segments;
-	LLStyleConstSP sp(new LLStyle(style_params));
-	segments.push_back(new LLLineBreakTextSegment(sp, getLength()));
+	if (new_text.empty()) return;                                                                                 
 
-	insertStringNoUndo(getLength(), utf8str_to_wstring("\n"), &segments);
-}
-
-void LLTextBase::appendImageSegment(const LLStyle::Params& style_params)
-{
-	if(getPlainText())
-	{
-		return;
-	}
-	segment_vec_t segments;
-	LLStyleConstSP sp(new LLStyle(style_params));
-	segments.push_back(new LLImageTextSegment(sp, getLength(),*this));
-
-	insertStringNoUndo(getLength(), utf8str_to_wstring(" "), &segments);
-}
-
-void LLTextBase::appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo)
-{
-	segment_vec_t segments;
-	LLWString widget_wide_text = utf8str_to_wstring(text);
-	segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + widget_wide_text.size()));
-
-	insertStringNoUndo(getLength(), widget_wide_text, &segments);
-}
-
-void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params)
-{
 	// Save old state
 	S32 selection_start = mSelectionStart;
 	S32 selection_end = mSelectionEnd;
@@ -1743,11 +1671,13 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig
 
 	setCursorPos(old_length);
 
-	if (mParseHighlights)
+	LLTextParser* highlight = LLTextParser::getInstance();
+	
+	if (mParseHighlights && highlight)
 	{
 		LLStyle::Params highlight_params(style_params);
 
-		LLSD pieces = LLTextParser::instance().parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part);
+		LLSD pieces = highlight->parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part);
 		for (S32 i = 0; i < pieces.size(); i++)
 		{
 			LLSD color_llsd = pieces[i]["color"];
@@ -1756,8 +1686,14 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig
 			highlight_params.color = lcolor;
 
 			LLWString wide_text;
-			wide_text = utf8str_to_wstring(pieces[i]["text"].asString());
-
+			if (prepend_newline && (i == 0 || pieces.size() <= 1 )) 
+			{
+				wide_text = utf8str_to_wstring(std::string("\n") + pieces[i]["text"].asString());
+			}
+			else
+			{
+				wide_text = utf8str_to_wstring(pieces[i]["text"].asString());
+			}
 			S32 cur_length = getLength();
 			LLStyleConstSP sp(new LLStyle(highlight_params));
 			LLTextSegmentPtr segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + wide_text.size(), *this);
@@ -1769,7 +1705,17 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig
 	else
 	{
 		LLWString wide_text;
-		wide_text = utf8str_to_wstring(new_text);
+
+		// Add carriage return if not first line
+		if (getLength() != 0
+			&& prepend_newline)
+		{
+			wide_text = utf8str_to_wstring(std::string("\n") + new_text);
+		}
+		else
+		{
+			wide_text = utf8str_to_wstring(new_text);
+		}
 
 		segment_vec_t segments;
 		S32 segment_start = old_length;
@@ -1797,29 +1743,11 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig
 	{
 		setCursorPos(cursor_pos);
 	}
-}
-
-void LLTextBase::appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params)
-{
-	if (new_text.empty()) return; 
 
-	std::string::size_type start = 0;
-	std::string::size_type pos = new_text.find("\n",start);
-	
-	while(pos!=-1)
-	{
-		if(pos!=start)
-		{
-			std::string str = std::string(new_text,start,pos-start);
-			appendAndHighlightTextImpl(str,highlight_part, style_params);
-		}
-		appendLineBreakSegment(style_params);
-		start = pos+1;
-		pos = new_text.find("\n",start);
-	}
-
-	std::string str = std::string(new_text,start,new_text.length()-start);
-	appendAndHighlightTextImpl(str,highlight_part, style_params);
+	//if( !allow_undo )
+	//{
+	//	blockUndo();
+	//}
 }
 
 
@@ -1887,7 +1815,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round,
 {
 	// Figure out which line we're nearest to.
 	LLRect visible_region = getVisibleDocumentRect();
-	
+
 	// binary search for line that starts before local_y
 	line_list_t::const_iterator line_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), local_y - mVisibleTextRect.mBottom + visible_region.mBottom, compare_bottom());
 
@@ -1897,7 +1825,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round,
 	}
 	
 	S32 pos = getLength();
-	S32 start_x = mVisibleTextRect.mLeft + line_iter->mRect.mLeft - visible_region.mLeft;
+	S32 start_x = mVisibleTextRect.mLeft + line_iter->mRect.mLeft;
 
 	segment_set_t::iterator line_seg_iter;
 	S32 line_seg_offset;
@@ -1912,19 +1840,14 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round,
 		S32 text_width, text_height;
 		bool newline = segmentp->getDimensions(line_seg_offset, segment_line_length, text_width, text_height);
 
-		if(newline)
-		{
-			pos = segment_line_start + segmentp->getOffset(local_x - start_x, line_seg_offset, segment_line_length, round);
-			break;
-		}
-
 		// if we've reached a line of text *below* the mouse cursor, doc index is first character on that line
 		if (hit_past_end_of_line && local_y - mVisibleTextRect.mBottom + visible_region.mBottom > line_iter->mRect.mTop)
 		{
 			pos = segment_line_start;
 			break;
 		}
-		if (local_x < start_x + text_width)			// cursor to left of right edge of text
+		if (local_x < start_x + text_width			// cursor to left of right edge of text
+			|| newline)								// or this line ends with a newline, set doc pos to newline char
 		{
 			// Figure out which character we're nearest to.
 			S32 offset;
@@ -1948,13 +1871,13 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round,
 			pos = segment_line_start + offset;
 			break;
 		}
-		else if (hit_past_end_of_line && segmentp->getEnd() > line_iter->mDocIndexEnd - 1)	
+		else if (hit_past_end_of_line && segmentp->getEnd() >= line_iter->mDocIndexEnd - 1)	
 		{
-			// segment wraps to next line, so just set doc pos to the end of the line
- 			// segment wraps to next line, so just set doc pos to start of next line (represented by mDocIndexEnd)
- 			pos = llmin(getLength(), line_iter->mDocIndexEnd);
+			// segment wraps to next line, so just set doc pos to start of next line (represented by mDocIndexEnd)
+			pos = llmin(getLength(), line_iter->mDocIndexEnd);
 			break;
 		}
+
 		start_x += text_width;
 	}
 
@@ -2023,18 +1946,11 @@ LLRect LLTextBase::getDocRectFromDocIndex(S32 pos) const
 
 LLRect LLTextBase::getLocalRectFromDocIndex(S32 pos) const
 {
-	LLRect content_window_rect = mScroller ? mScroller->getContentWindowRect() : getLocalRect();
-	if (mBorderVisible)
-	{
-		content_window_rect.stretch(-1);
-	}
-
 	LLRect local_rect;
-
 	if (mLineInfoList.empty()) 
 	{ 
 		// return default height rect in upper left
-		local_rect = content_window_rect;
+		local_rect = mVisibleTextRect;
 		local_rect.mBottom = local_rect.mTop - (S32)(mDefaultFont->getLineHeight());
 		return local_rect;
 	}
@@ -2045,8 +1961,8 @@ LLRect LLTextBase::getLocalRectFromDocIndex(S32 pos) const
 	// compensate for scrolled, inset view of doc
 	LLRect scrolled_view_rect = getVisibleDocumentRect();
 	local_rect = doc_rect;
-	local_rect.translate(content_window_rect.mLeft - scrolled_view_rect.mLeft, 
-						content_window_rect.mBottom - scrolled_view_rect.mBottom);
+	local_rect.translate(mVisibleTextRect.mLeft - scrolled_view_rect.mLeft, 
+						mVisibleTextRect.mBottom - scrolled_view_rect.mBottom);
 
 	return local_rect;
 }
@@ -2277,12 +2193,6 @@ void LLTextBase::updateRects()
 		? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight)
 		: mVisibleTextRect.getWidth();
 
-	if (!mScroller)
-	{
-		// push doc rect to top of text widget
-		doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop);
-	}
-
 	mDocumentView->setShape(doc_rect);
 
 	//update mVisibleTextRect *after* mDocumentView has been resized
@@ -2346,15 +2256,6 @@ LLRect LLTextBase::getVisibleDocumentRect() const
 	}
 }
 
-boost::signals2::connection LLTextBase::setURLClickedCallback(const commit_signal_t::slot_type& cb)
-{
-	if (!mURLClickSignal)
-	{
-		mURLClickSignal = new commit_signal_t();
-	}
-	return mURLClickSignal->connect(cb);
-}
-
 //
 // LLTextSegment
 //
@@ -2433,6 +2334,25 @@ F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selec
 {
 	if( end - start > 0 )
 	{
+		if ( mStyle->isImage() && (start >= 0) && (end <= mEnd - mStart))
+		{
+			// ...for images, only render the image, not the underlying text,
+			// which is only a placeholder space
+			LLColor4 color = LLColor4::white % mEditor.getDrawContext().mAlpha;
+			LLUIImagePtr image = mStyle->getImage();
+			S32 style_image_height = image->getHeight();
+			S32 style_image_width = image->getWidth();
+			// Text is drawn from the top of the draw_rect downward
+			S32 text_center = draw_rect.mTop - (mFontHeight / 2);
+			// Align image to center of text
+			S32 image_bottom = text_center - (style_image_height / 2);
+			image->draw(draw_rect.mLeft, image_bottom, 
+				style_image_width, style_image_height, color);
+			
+			const S32 IMAGE_HPAD = 3;
+			return draw_rect.mLeft + style_image_width + IMAGE_HPAD;
+		}
+
 		return drawClippedSegment( getStart() + start, getStart() + end, selection_start, selection_end, draw_rect);
 	}
 	return draw_rect.mLeft;
@@ -2445,6 +2365,11 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
 
 	const LLWString &text = mEditor.getWText();
 
+	if ( text[seg_end-1] == '\n' )
+	{
+		--seg_end;
+	}
+
 	F32 right_x = rect.mLeft;
 	if (!mStyle->isVisible())
 	{
@@ -2462,12 +2387,12 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
 		S32 end = llmin( selection_start, seg_end );
 		S32 length =  end - start;
 		font->render(text, start, 
-			     rect, 
+			     rect.mLeft, rect.mTop, 
 			     color, 
-			     LLFontGL::LEFT, mEditor.mVAlign, 
+			     LLFontGL::LEFT, LLFontGL::TOP, 
 			     LLFontGL::NORMAL, 
 			     mStyle->getShadowType(), 
-			     length,
+			     length, rect.getWidth(), 
 			     &right_x, 
 			     mEditor.getUseEllipses());
 	}
@@ -2481,12 +2406,12 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
 		S32 length = end - start;
 
 		font->render(text, start, 
-			     rect,
+			     rect.mLeft, rect.mTop,
 			     LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ),
-			     LLFontGL::LEFT, mEditor.mVAlign, 
+			     LLFontGL::LEFT, LLFontGL::TOP, 
 			     LLFontGL::NORMAL, 
 			     LLFontGL::NO_SHADOW, 
-			     length,
+			     length, rect.getWidth(), 
 			     &right_x, 
 			     mEditor.getUseEllipses());
 	}
@@ -2498,12 +2423,12 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
 		S32 end = seg_end;
 		S32 length = end - start;
 		font->render(text, start, 
-			     rect, 
+			     rect.mLeft, rect.mTop, 
 			     color, 
-			     LLFontGL::LEFT, mEditor.mVAlign, 
+			     LLFontGL::LEFT, LLFontGL::TOP, 
 			     LLFontGL::NORMAL, 
 			     mStyle->getShadowType(), 
-			     length,
+			     length, rect.getWidth(), 
 			     &right_x, 
 			     mEditor.getUseEllipses());
 	}
@@ -2603,14 +2528,33 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt
 {
 	height = 0;
 	width = 0;
+	bool force_newline = false;
 	if (num_chars > 0)
 	{
 		height = mFontHeight;
 		const LLWString &text = mEditor.getWText();
 		// if last character is a newline, then return true, forcing line break
-		width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
+		llwchar last_char = text[mStart + first_char + num_chars - 1];
+		if (last_char == '\n')
+		{
+			force_newline = true;
+			// don't count newline in font width
+			width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars - 1);
+		}
+		else
+		{
+			width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
+		}
 	}
-	return false;
+
+	LLUIImagePtr image = mStyle->getImage();
+	if( image.notNull())
+	{
+		width += image->getWidth();
+		height = llmax(height, image->getHeight());
+	}
+
+	return force_newline;
 }
 
 S32	LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const
@@ -2633,7 +2577,15 @@ S32	LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin
 		num_pixels = llmax(0, num_pixels - image->getWidth());
 	}
 
-	S32 last_char = mEnd;
+	// search for newline and if found, truncate there
+	S32 last_char = mStart + segment_offset;
+	for (; last_char != mEnd; ++last_char)
+	{
+		if (text[last_char] == '\n') 
+		{
+			break;
+		}
+	}
 
 	// set max characters to length of segment, or to first newline
 	max_chars = llmin(max_chars, last_char - (mStart + segment_offset));
@@ -2661,7 +2613,8 @@ S32	LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin
 	S32 last_char_in_run = mStart + segment_offset + num_chars;
 	// check length first to avoid indexing off end of string
 	if (last_char_in_run < mEnd 
-		&& (last_char_in_run >= mEditor.getLength() ))
+		&& (last_char_in_run >= mEditor.getLength() 
+			|| text[last_char_in_run] == '\n'))
 	{
 		num_chars++;
 	}
@@ -2756,93 +2709,3 @@ void LLInlineViewSegment::linkToDocument(LLTextBase* editor)
 {
 	editor->addDocumentChild(mView);
 }
-
-LLLineBreakTextSegment::LLLineBreakTextSegment(S32 pos):LLTextSegment(pos,pos+1)
-{
-	LLStyleSP s( new LLStyle(LLStyle::Params().visible(true)));
-
-	mFontHeight = llceil(s->getFont()->getLineHeight());
-}
-LLLineBreakTextSegment::LLLineBreakTextSegment(LLStyleConstSP style,S32 pos):LLTextSegment(pos,pos+1)
-{
-	mFontHeight = llceil(style->getFont()->getLineHeight());
-}
-LLLineBreakTextSegment::~LLLineBreakTextSegment()
-{
-}
-bool LLLineBreakTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
-{
-	width = 0;
-	height = mFontHeight;
-
-	return true;
-}
-S32	LLLineBreakTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const
-{
-	return 1;
-}
-F32	LLLineBreakTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect)
-{
-	return  draw_rect.mLeft;
-}
-
-LLImageTextSegment::LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor)
-:	LLTextSegment(pos,pos+1),
-	mStyle( style ),
-	mEditor(editor)
-{
-}
-
-LLImageTextSegment::~LLImageTextSegment()
-{
-}
-
-static const S32 IMAGE_HPAD = 3;
-
-bool LLImageTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
-{
-	width = 0;
-	height = llceil(mStyle->getFont()->getLineHeight());;
-
-	LLUIImagePtr image = mStyle->getImage();
-	if( num_chars>0 && image.notNull())
-	{
-		width += image->getWidth() + IMAGE_HPAD;
-		height = llmax(height, image->getHeight() + IMAGE_HPAD );
-	}
-	return false;
-}
-
-S32	 LLImageTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const
-{
-	LLUIImagePtr image = mStyle->getImage();
-	S32 image_width = image->getWidth();
-	if(line_offset == 0 || num_pixels>image_width + IMAGE_HPAD)
-	{
-		return 1;
-	}
-	return 0;
-}
-
-F32	LLImageTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect)
-{
-	if ( (start >= 0) && (end <= mEnd - mStart))
-	{
-		LLColor4 color = LLColor4::white % mEditor.getDrawContext().mAlpha;
-		LLUIImagePtr image = mStyle->getImage();
-		S32 style_image_height = image->getHeight();
-		S32 style_image_width = image->getWidth();
-		// Text is drawn from the top of the draw_rect downward
-		
-		S32 text_center = draw_rect.mTop - (draw_rect.getHeight() / 2);
-		// Align image to center of draw rect
-		S32 image_bottom = text_center - (style_image_height / 2);
-		image->draw(draw_rect.mLeft, image_bottom, 
-			style_image_width, style_image_height, color);
-		
-		const S32 IMAGE_HPAD = 3;
-		return draw_rect.mLeft + style_image_width + IMAGE_HPAD;
-	}
-	return 0.0;
-}
-
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 86ab8f357dd204f8abc8ff5ee57074e0bf104d7c..8ed0680df9a16818c138051bf1b5be892a5908e2 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -3,25 +3,31 @@
  * @author Martin Reddy
  * @brief The base class of text box/editor, providing Url handling support
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -41,170 +47,8 @@
 #include <boost/signals2.hpp>
 
 class LLContextMenu;
-class LLUrlMatch;
-
-///
-/// A text segment is used to specify a subsection of a text string
-/// that should be formatted differently, such as a hyperlink. It
-/// includes a start/end offset from the start of the string, a
-/// style to render with, an optional tooltip, etc.
-///
-class LLTextSegment : public LLRefCount, public LLMouseHandler
-{
-public:
-	LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){};
-	virtual ~LLTextSegment();
-
-	virtual bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	virtual S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
-	virtual S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	virtual void				updateLayout(const class LLTextBase& editor);
-	virtual F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-	virtual bool				canEdit() const;
-	virtual void				unlinkFromDocument(class LLTextBase* editor);
-	virtual void				linkToDocument(class LLTextBase* editor);
-
-	virtual const LLColor4&		getColor() const;
-	//virtual void 				setColor(const LLColor4 &color);
-	virtual LLStyleConstSP		getStyle() const;
-	virtual void 				setStyle(LLStyleConstSP style);
-	virtual void				setToken( LLKeywordToken* token );
-	virtual LLKeywordToken*		getToken() const;
-	virtual void				setToolTip(const std::string& tooltip);
-	virtual void				dump() const;
-
-	// LLMouseHandler interface
-	/*virtual*/ BOOL			handleMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleMouseUp(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleMiddleMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleMiddleMouseUp(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleRightMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleRightMouseUp(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleDoubleClick(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleHover(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL			handleScrollWheel(S32 x, S32 y, S32 clicks);
-	/*virtual*/ BOOL			handleToolTip(S32 x, S32 y, MASK mask);
-	/*virtual*/ std::string		getName() const;
-	/*virtual*/ void			onMouseCaptureLost();
-	/*virtual*/ void			screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
-	/*virtual*/ void			localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
-	/*virtual*/ BOOL			hasMouseCapture();
-
-	S32							getStart() const 					{ return mStart; }
-	void						setStart(S32 start)					{ mStart = start; }
-	S32							getEnd() const						{ return mEnd; }
-	void						setEnd( S32 end )					{ mEnd = end; }
-
-protected:
-	S32				mStart;
-	S32				mEnd;
-};
-
-class LLNormalTextSegment : public LLTextSegment
-{
-public:
-	LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor );
-	LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE);
-	~LLNormalTextSegment();
-
-	/*virtual*/ bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	/*virtual*/ S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
-	/*virtual*/ S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	/*virtual*/ F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-	/*virtual*/ bool				canEdit() const { return true; }
-	/*virtual*/ const LLColor4&		getColor() const					{ return mStyle->getColor(); }
-	/*virtual*/ LLStyleConstSP		getStyle() const					{ return mStyle; }
-	/*virtual*/ void 				setStyle(LLStyleConstSP style)	{ mStyle = style; }
-	/*virtual*/ void				setToken( LLKeywordToken* token )	{ mToken = token; }
-	/*virtual*/ LLKeywordToken*		getToken() const					{ return mToken; }
-	/*virtual*/ BOOL				getToolTip( std::string& msg ) const;
-	/*virtual*/ void				setToolTip(const std::string& tooltip);
-	/*virtual*/ void				dump() const;
-
-	/*virtual*/ BOOL				handleHover(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL				handleRightMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL				handleMouseDown(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL				handleMouseUp(S32 x, S32 y, MASK mask);
-	/*virtual*/ BOOL				handleToolTip(S32 x, S32 y, MASK mask);
-
-protected:
-	F32					drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRect rect);
-
-protected:
-	class LLTextBase&	mEditor;
-	LLStyleConstSP		mStyle;
-	S32					mFontHeight;
-	LLKeywordToken* 	mToken;
-	std::string     	mTooltip;
-	boost::signals2::connection mImageLoadedConnection;
-};
-
-class LLIndexSegment : public LLTextSegment
-{
-public:
-	LLIndexSegment(S32 pos) : LLTextSegment(pos, pos) {}
-};
-
-class LLInlineViewSegment : public LLTextSegment
-{
-public:
-	struct Params : public LLInitParam::Block<Params>
-	{
-		Mandatory<LLView*>		view;
-		Optional<bool>			force_newline;
-		Optional<S32>			left_pad,
-								right_pad,
-								bottom_pad,
-								top_pad;
-	};
-
-	LLInlineViewSegment(const Params& p, S32 start, S32 end);
-	~LLInlineViewSegment();
-	/*virtual*/ bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	/*virtual*/ S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	/*virtual*/ void		updateLayout(const class LLTextBase& editor);
-	/*virtual*/ F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-	/*virtual*/ bool		canEdit() const { return false; }
-	/*virtual*/ void		unlinkFromDocument(class LLTextBase* editor);
-	/*virtual*/ void		linkToDocument(class LLTextBase* editor);
-
-private:
-	S32 mLeftPad;
-	S32 mRightPad;
-	S32 mTopPad;
-	S32 mBottomPad;
-	LLView* mView;
-	bool	mForceNewLine;
-};
-
-class LLLineBreakTextSegment : public LLTextSegment
-{
-public:
-
-	LLLineBreakTextSegment(LLStyleConstSP style,S32 pos);
-	LLLineBreakTextSegment(S32 pos);
-	~LLLineBreakTextSegment();
-	bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-
-private:
-	S32			mFontHeight;
-};
-
-class LLImageTextSegment : public LLTextSegment
-{
-public:
-	LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor);
-	~LLImageTextSegment();
-	bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
-	S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
-	F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
-
-private:
-	class LLTextBase&	mEditor;
-	LLStyleConstSP	mStyle;
-};
+class LLTextSegment;
+class LLNormalTextSegment;
 
 typedef LLPointer<LLTextSegment> LLTextSegmentPtr;
 
@@ -242,7 +86,6 @@ class LLTextBase
 								track_end,
 								read_only,
 								allow_scroll,
-								plain_text,
 								wrap,
 								use_ellipses,
 								allow_html,
@@ -334,9 +177,6 @@ class LLTextBase
 	void					setReadOnly(bool read_only) { mReadOnly = read_only; }
 	bool					getReadOnly() { return mReadOnly; }
 
-	void					setPlainText(bool value) { mPlainText = value;}
-	bool					getPlainText() const { return mPlainText; }
-
 	// cursor manipulation
 	bool					setCursor(S32 row, S32 column);
 	bool					setCursorPos(S32 cursor_pos, bool keep_cursor_offset = false);
@@ -352,10 +192,9 @@ class LLTextBase
 
 	const LLFontGL*			getDefaultFont() const					{ return mDefaultFont; }
 
-	virtual void			appendLineBreakSegment(const LLStyle::Params& style_params);
-	virtual void			appendImageSegment(const LLStyle::Params& style_params);
-	virtual void			appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
-	boost::signals2::connection setURLClickedCallback(const commit_signal_t::slot_type& cb);
+public:
+	// Fired when a URL link is clicked
+	commit_signal_t mURLClickSignal;
 
 protected:
 	// helper structs
@@ -435,7 +274,7 @@ class LLTextBase
 	S32								insertStringNoUndo(S32 pos, const LLWString &wstr, segment_vec_t* segments = NULL); // returns num of chars actually inserted
 	S32 							removeStringNoUndo(S32 pos, S32 length);
 	S32								overwriteCharNoUndo(S32 pos, llwchar wc);
-	void							appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& stylep);
+	void							appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& stylep);
 
 
 	// manage segments 
@@ -448,7 +287,7 @@ class LLTextBase
 	void							createDefaultSegment();
 	virtual void					updateSegments();
 	void							insertSegment(LLTextSegmentPtr segment_to_insert);
-	const LLStyle::Params&			getDefaultStyleParams();
+	LLStyle::Params					getDefaultStyleParams();
 
 	//  manage lines
 	S32								getLineStart( S32 line ) const;
@@ -476,10 +315,6 @@ class LLTextBase
 	void							updateRects();
 	void							needsScroll() { mScrollNeeded = TRUE; }
 	void							replaceUrlLabel(const std::string &url, const std::string &label);
-	
-	void							appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params = LLStyle::Params());
-	void							appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params);
-	
 
 protected:
 	// text segmentation and flow
@@ -488,12 +323,6 @@ class LLTextBase
 	LLRect						mVisibleTextRect;			// The rect in which text is drawn.  Excludes borders.
 	LLRect						mTextBoundingRect;
 
-	// default text style
-	LLStyle::Params				mDefaultStyle;
-	bool						mStyleDirty;
-	const LLFontGL* const		mDefaultFont;		// font that is used when none specified, can only be set by constructor
-	const LLFontGL::ShadowType	mFontShadow;		// shadow style, can only be set by constructor
-
 	// colors
 	LLUIColor					mCursorColor;
 	LLUIColor					mFgColor;
@@ -517,9 +346,10 @@ class LLTextBase
 	S32							mHPad;				// padding on left of text
 	S32							mVPad;				// padding above text
 	LLFontGL::HAlign			mHAlign;
-	LLFontGL::VAlign			mVAlign;
 	F32							mLineSpacingMult;	// multiple of line height used as space for a single line of text (e.g. 1.5 to get 50% padding)
 	S32							mLineSpacingPixels;	// padding between lines
+	const LLFontGL*				mDefaultFont;		// font that is used when none specified
+	LLFontGL::ShadowType		mFontShadow;
 	bool						mBorderVisible;
 	bool                		mParseHTML;			// make URLs interactive
 	bool						mParseHighlights;	// highlight user-defined keywords
@@ -529,7 +359,6 @@ class LLTextBase
 	bool						mReadOnly;
 	bool						mBGVisible;			// render background?
 	bool						mClipPartial;		// false if we show lines that are partially inside bounding rect
-	bool						mPlainText;			// didn't use Image or Icon segments
 	S32							mMaxTextByteLength;	// Maximum length mText is allowed to be in bytes
 
 	// support widgets
@@ -542,9 +371,141 @@ class LLTextBase
 	bool						mScrollNeeded;		// need to change scroll region because of change to cursor position
 	S32							mScrollIndex;		// index of first character to keep visible in scroll region
 
-	// Fired when a URL link is clicked
-	commit_signal_t*			mURLClickSignal;
+};
+
+///
+/// A text segment is used to specify a subsection of a text string
+/// that should be formatted differently, such as a hyperlink. It
+/// includes a start/end offset from the start of the string, a
+/// style to render with, an optional tooltip, etc.
+///
+class LLTextSegment : public LLRefCount, public LLMouseHandler
+{
+public:
+	LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){};
+	virtual ~LLTextSegment();
+
+	virtual bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+	virtual S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
+	virtual S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
+	virtual void				updateLayout(const class LLTextBase& editor);
+	virtual F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
+	virtual bool				canEdit() const;
+	virtual void				unlinkFromDocument(class LLTextBase* editor);
+	virtual void				linkToDocument(class LLTextBase* editor);
+
+	virtual const LLColor4&		getColor() const;
+	//virtual void 				setColor(const LLColor4 &color);
+	virtual LLStyleConstSP		getStyle() const;
+	virtual void 				setStyle(LLStyleConstSP style);
+	virtual void				setToken( LLKeywordToken* token );
+	virtual LLKeywordToken*		getToken() const;
+	virtual void				setToolTip(const std::string& tooltip);
+	virtual void				dump() const;
+
+	// LLMouseHandler interface
+	/*virtual*/ BOOL			handleMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleMouseUp(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleMiddleMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleMiddleMouseUp(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleRightMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleRightMouseUp(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleDoubleClick(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleHover(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL			handleScrollWheel(S32 x, S32 y, S32 clicks);
+	/*virtual*/ BOOL			handleToolTip(S32 x, S32 y, MASK mask);
+	/*virtual*/ std::string		getName() const;
+	/*virtual*/ void			onMouseCaptureLost();
+	/*virtual*/ void			screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
+	/*virtual*/ void			localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
+	/*virtual*/ BOOL			hasMouseCapture();
+
+	S32							getStart() const 					{ return mStart; }
+	void						setStart(S32 start)					{ mStart = start; }
+	S32							getEnd() const						{ return mEnd; }
+	void						setEnd( S32 end )					{ mEnd = end; }
+
+protected:
+	S32				mStart;
+	S32				mEnd;
+};
+
+class LLNormalTextSegment : public LLTextSegment
+{
+public:
+	LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor );
+	LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE);
+	~LLNormalTextSegment();
 
+	/*virtual*/ bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+	/*virtual*/ S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
+	/*virtual*/ S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
+	/*virtual*/ F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
+	/*virtual*/ bool				canEdit() const { return true; }
+	/*virtual*/ const LLColor4&		getColor() const					{ return mStyle->getColor(); }
+	/*virtual*/ LLStyleConstSP		getStyle() const					{ return mStyle; }
+	/*virtual*/ void 				setStyle(LLStyleConstSP style)	{ mStyle = style; }
+	/*virtual*/ void				setToken( LLKeywordToken* token )	{ mToken = token; }
+	/*virtual*/ LLKeywordToken*		getToken() const					{ return mToken; }
+	/*virtual*/ BOOL				getToolTip( std::string& msg ) const;
+	/*virtual*/ void				setToolTip(const std::string& tooltip);
+	/*virtual*/ void				dump() const;
+
+	/*virtual*/ BOOL				handleHover(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL				handleRightMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL				handleMouseDown(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL				handleMouseUp(S32 x, S32 y, MASK mask);
+	/*virtual*/ BOOL				handleToolTip(S32 x, S32 y, MASK mask);
+
+protected:
+	F32					drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRect rect);
+
+protected:
+	class LLTextBase&	mEditor;
+	LLStyleConstSP		mStyle;
+	S32					mFontHeight;
+	LLKeywordToken* 	mToken;
+	std::string     	mTooltip;
+	boost::signals2::connection mImageLoadedConnection;
 };
 
+class LLIndexSegment : public LLTextSegment
+{
+public:
+	LLIndexSegment(S32 pos) : LLTextSegment(pos, pos) {}
+};
+
+class LLInlineViewSegment : public LLTextSegment
+{
+public:
+	struct Params : public LLInitParam::Block<Params>
+	{
+		Mandatory<LLView*>		view;
+		Optional<bool>			force_newline;
+		Optional<S32>			left_pad,
+								right_pad,
+								bottom_pad,
+								top_pad;
+	};
+
+	LLInlineViewSegment(const Params& p, S32 start, S32 end);
+	~LLInlineViewSegment();
+	/*virtual*/ bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+	/*virtual*/ S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
+	/*virtual*/ void		updateLayout(const class LLTextBase& editor);
+	/*virtual*/ F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
+	/*virtual*/ bool		canEdit() const { return false; }
+	/*virtual*/ void		unlinkFromDocument(class LLTextBase* editor);
+	/*virtual*/ void		linkToDocument(class LLTextBase* editor);
+
+private:
+	S32 mLeftPad;
+	S32 mRightPad;
+	S32 mTopPad;
+	S32 mBottomPad;
+	LLView* mView;
+	bool	mForceNewLine;
+};
+
+
 #endif
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index e09df60704105b98082cf8ca3a8de84582bf6ff4..a1cae4bb988fe24a57ec30c1d2c43fd2a6789ccc 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file lltexteditor.cpp
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -258,6 +264,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
 	mContextMenu(NULL),
 	mShowContextMenu(p.show_context_menu)
 {
+	mDefaultFont = p.font;
+
 	mSourceID.generate();
 
 	//FIXME: use image?
@@ -705,8 +713,7 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	{
 		setFocus(TRUE);
 	}
-	// Prefer editor menu if it has selection. See EXT-6806.
-	if (hasSelection() || !LLTextBase::handleRightMouseDown(x, y, mask))
+	if (!LLTextBase::handleRightMouseDown(x, y, mask))
 	{
 		if(getShowContextMenu())
 		{
@@ -1075,28 +1082,6 @@ void LLTextEditor::addChar(llwchar wc)
 
 	setCursorPos(mCursorPos + addChar( mCursorPos, wc ));
 }
-void LLTextEditor::addLineBreakChar()
-{
-	if( !getEnabled() )
-	{
-		return;
-	}
-	if( hasSelection() )
-	{
-		deleteSelection(TRUE);
-	}
-	else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
-	{
-		removeChar(mCursorPos);
-	}
-
-	LLStyleConstSP sp(new LLStyle(LLStyle::Params()));
-	LLTextSegmentPtr segment = new LLLineBreakTextSegment(sp, mCursorPos);
-
-	S32 pos = execute(new TextCmdAddChar(mCursorPos, FALSE, '\n', segment));
-	
-	setCursorPos(mCursorPos + pos);
-}
 
 
 BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
@@ -1418,27 +1403,7 @@ void LLTextEditor::pasteHelper(bool is_primary)
 	}
 
 	// Insert the new text into the existing text.
-
-	//paste text with linebreaks.
-	std::basic_string<llwchar>::size_type start = 0;
-	std::basic_string<llwchar>::size_type pos = clean_string.find('\n',start);
-	
-	while(pos!=-1)
-	{
-		if(pos!=start)
-		{
-			std::basic_string<llwchar> str = std::basic_string<llwchar>(clean_string,start,pos-start);
-			setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr()));
-		}
-		addLineBreakChar();
-		
-		start = pos+1;
-		pos = clean_string.find('\n',start);
-	}
-
-	std::basic_string<llwchar> str = std::basic_string<llwchar>(clean_string,start,clean_string.length()-start);
-	setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr()));
-
+	setCursorPos(mCursorPos + insert(mCursorPos, clean_string, FALSE, LLTextSegmentPtr()));
 	deselect();
 
 	onKeyStroke();
@@ -2203,10 +2168,7 @@ void LLTextEditor::autoIndent()
 	}
 
 	// Insert that number of spaces on the new line
-
-	//appendLineBreakSegment(LLStyle::Params());//addChar( '\n' );
-	addLineBreakChar();
-
+	addChar( '\n' );
 	for( i = 0; i < space_count; i++ )
 	{
 		addChar( ' ' );
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 58ecefdccbd4ee9798bc6b24ce873ea26fa9b00e..9b3ab9414ce5a588f959cab897bc9e618ef1fed6 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -2,25 +2,31 @@
  * @file lltexteditor.h
  * @brief LLTextEditor base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -234,7 +240,6 @@ class LLTextEditor :
 	// Undoable operations
 	void			addChar(llwchar c); // at mCursorPos
 	S32				addChar(S32 pos, llwchar wc);
-	void			addLineBreakChar();
 	S32				overwriteChar(S32 pos, llwchar wc);
 	void			removeChar();
 	S32 			removeChar(S32 pos);
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 03223b45f775f4b25a3a80021eef565e629394c0..f9a4ed7285dd65336db550a02862d4578c9f7534 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -2,25 +2,31 @@
  * @file llui.cpp
  * @brief UI implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -50,7 +56,6 @@
 #include "llfloaterreg.h"
 #include "llmenugl.h"
 #include "llmenubutton.h"
-#include "llloadingindicator.h"
 #include "llwindow.h"
 
 // for registration
@@ -89,9 +94,7 @@ std::list<std::string> gUntranslated;
 static LLDefaultChildRegistry::Register<LLFilterEditor> register_filter_editor("filter_editor");
 static LLDefaultChildRegistry::Register<LLFlyoutButton> register_flyout_button("flyout_button");
 static LLDefaultChildRegistry::Register<LLSearchEditor> register_search_editor("search_editor");
-
-// register other widgets which otherwise may not be linked in
-static LLDefaultChildRegistry::Register<LLLoadingIndicator> register_loading_indicator("loading_indicator");
+static LLDefaultChildRegistry::Register<LLMenuButton> register_menu_button("menu_button");
 
 
 //
@@ -1745,33 +1748,6 @@ std::string LLUI::getLanguage()
 	return language;
 }
 
-struct SubDir : public LLInitParam::Block<SubDir>
-{
-	Mandatory<std::string> value;
-
-	SubDir()
-	:	value("value")
-	{}
-};
-
-struct Directory : public LLInitParam::Block<Directory>
-{
-	Multiple<SubDir, AtLeast<1> > subdirs;
-
-	Directory()
-	:	subdirs("subdir")
-	{}
-};
-
-struct Paths : public LLInitParam::Block<Paths>
-{
-	Multiple<Directory, AtLeast<1> > directories;
-
-	Paths()
-	:	directories("directory")
-	{}
-};
-
 //static
 void LLUI::setupPaths()
 {
@@ -1779,36 +1755,21 @@ void LLUI::setupPaths()
 
 	LLXMLNodePtr root;
 	BOOL success  = LLXMLNode::parseFile(filename, root, NULL);
-	Paths paths;
-	LLXUIParser::instance().readXUI(root, paths, filename);
-
 	sXUIPaths.clear();
 	
-	if (success && paths.validateBlock())
+	if (success)
 	{
 		LLStringUtil::format_map_t path_args;
 		path_args["[LANGUAGE]"] = LLUI::getLanguage();
 		
-		for (LLInitParam::ParamIterator<Directory>::const_iterator it = paths.directories().begin(), 
-				end_it = paths.directories().end();
-			it != end_it;
-			++it)
+		for (LLXMLNodePtr path = root->getFirstChild(); path.notNull(); path = path->getNextSibling())
 		{
-			std::string path_val_ui;
-			for (LLInitParam::ParamIterator<SubDir>::const_iterator subdir_it = it->subdirs().begin(),
-					subdir_end_it = it->subdirs().end();
-				subdir_it != subdir_end_it;)
-			{
-				path_val_ui += subdir_it->value();
-				if (++subdir_it != subdir_end_it)
-					path_val_ui += gDirUtilp->getDirDelimiter();
-			}
+			std::string path_val_ui(path->getValue());
 			LLStringUtil::format(path_val_ui, path_args);
 			if (std::find(sXUIPaths.begin(), sXUIPaths.end(), path_val_ui) == sXUIPaths.end())
 			{
 				sXUIPaths.push_back(path_val_ui);
 			}
-
 		}
 	}
 	else // parsing failed
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index afec2e9c263977457678f98fe3515645baef45f5..c18262ef76b6c63dbf88105cb4abfad730c648d9 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -2,25 +2,31 @@
  * @file llui.h
  * @brief GL function declarations and other general static UI services.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index a34ede439af18f4953a43e0a2b4ab29caf9eddd4..736de651da3a5720ba81ea6bc3f259c5ce6ba5ff 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -3,25 +3,31 @@
  * @author Martin Reddy
  * @brief Describes the Url types that can be registered in LLUrlRegistry
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -35,9 +41,6 @@
 #include "lltrans.h"
 #include "lluicolortable.h"
 
-#define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))"
-
-
 LLUrlEntryBase::LLUrlEntryBase() :
 	mColor(LLUIColorTable::instance().getColor("HTMLLinkColor")),
 	mDisabledLink(false)
@@ -300,11 +303,10 @@ std::string LLUrlEntrySLURL::getLocation(const std::string &url) const
 //
 // LLUrlEntryAgent Describes a Second Life agent Url, e.g.,
 // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
-// x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
 //
 LLUrlEntryAgent::LLUrlEntryAgent()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/agent/[\\da-f-]+/\\w+",
+	mPattern = boost::regex("secondlife:///app/agent/[\\da-f-]+/\\w+",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_agent.xml";
 	mIcon = "Generic_Person";
@@ -320,11 +322,6 @@ void LLUrlEntryAgent::onAgentNameReceived(const LLUUID& id,
 	callObservers(id.asString(), first + " " + last);
 }
 
-LLUUID	LLUrlEntryAgent::getID(const std::string &string) const
-{
-	return LLUUID(getIDStringFromUrl(string));
-}
-
 std::string LLUrlEntryAgent::getTooltip(const std::string &string) const
 {
 	// return a tooltip corresponding to the URL type instead of the generic one
@@ -421,11 +418,10 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
 // LLUrlEntryGroup Describes a Second Life group Url, e.g.,
 // secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about
 // secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect
-// x-grid-location-info://lincoln.lindenlab.com/app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect
 //
 LLUrlEntryGroup::LLUrlEntryGroup()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/group/[\\da-f-]+/\\w+",
+	mPattern = boost::regex("secondlife:///app/group/[\\da-f-]+/\\w+",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_group.xml";
 	mIcon = "Generic_Group";
@@ -433,8 +429,6 @@ LLUrlEntryGroup::LLUrlEntryGroup()
 	mColor = LLUIColorTable::instance().getColor("GroupLinkColor");
 }
 
-
-
 void LLUrlEntryGroup::onGroupNameReceived(const LLUUID& id,
 										  const std::string& first,
 										  const std::string& last,
@@ -444,12 +438,6 @@ void LLUrlEntryGroup::onGroupNameReceived(const LLUUID& id,
 	callObservers(id.asString(), first);
 }
 
-LLUUID	LLUrlEntryGroup::getID(const std::string &string) const
-{
-	return LLUUID(getIDStringFromUrl(string));
-}
-
-
 std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
 {
 	if (!gCacheName)
@@ -494,8 +482,7 @@ LLUrlEntryInventory::LLUrlEntryInventory()
 	//*TODO: add supporting of inventory item names with whitespaces
 	//this pattern cann't parse for example 
 	//secondlife:///app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select?name=name with spaces&param2=value
-	//x-grid-location-info://lincoln.lindenlab.com/app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select?name=name with spaces&param2=value
-	mPattern = boost::regex(APP_HEADER_REGEX "/inventory/[\\da-f-]+/\\w+\\S*",
+	mPattern = boost::regex("secondlife:///app/inventory/[\\da-f-]+/\\w+\\S*",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_inventory.xml";
 }
@@ -538,11 +525,10 @@ std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const
 ///
 /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g.,
 /// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
-/// x-grid-location-info://lincoln.lindenlab.com/app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
 ///
 LLUrlEntryParcel::LLUrlEntryParcel()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/parcel/[\\da-f-]+/about",
+	mPattern = boost::regex("secondlife:///app/parcel/[\\da-f-]+/about",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_parcel.xml";
 	mTooltip = LLTrans::getString("TooltipParcelUrl");
@@ -558,7 +544,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC
 //
 LLUrlEntryPlace::LLUrlEntryPlace()
 {
-	mPattern = boost::regex("((x-grid-location-info://[-\\w\\.]+/region/)|(secondlife://))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
+	mPattern = boost::regex("secondlife://\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_slurl.xml";
 	mTooltip = LLTrans::getString("TooltipSLURL");
@@ -603,11 +589,10 @@ std::string LLUrlEntryPlace::getLocation(const std::string &url) const
 //
 // LLUrlEntryTeleport Describes a Second Life teleport Url, e.g.,
 // secondlife:///app/teleport/Ahern/50/50/50/
-// x-grid-location-info://lincoln.lindenlab.com/app/teleport/Ahern/50/50/50/
 //
 LLUrlEntryTeleport::LLUrlEntryTeleport()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/teleport/\\S+(/\\d+)?(/\\d+)?(/\\d+)?/?\\S*",
+	mPattern = boost::regex("secondlife:///app/teleport/\\S+(/\\d+)?(/\\d+)?(/\\d+)?/?\\S*",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_teleport.xml";
 	mTooltip = LLTrans::getString("TooltipTeleportUrl");
@@ -625,12 +610,7 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe
 	LLURI uri(url);
 	LLSD path_array = uri.pathArray();
 	S32 path_parts = path_array.size();
-	std::string host = uri.hostName();
-	std::string label = LLTrans::getString("SLurlLabelTeleport");
-	if (!host.empty())
-	{
-		label += " " + host;
-	}
+	const std::string label = LLTrans::getString("SLurlLabelTeleport");
 	if (path_parts == 6)
 	{
 		// handle teleport url with (X,Y,Z) coordinates
@@ -729,7 +709,7 @@ std::string LLUrlEntrySLLabel::getTooltip(const std::string &string) const
 //
 LLUrlEntryWorldMap::LLUrlEntryWorldMap()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/worldmap/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*",
+	mPattern = boost::regex("secondlife:///app/worldmap/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_map.xml";
 	mTooltip = LLTrans::getString("TooltipMapUrl");
@@ -785,35 +765,3 @@ std::string LLUrlEntryNoLink::getLabel(const std::string &url, const LLUrlLabelC
 {
 	return getUrl(url);
 }
-
-//
-// LLUrlEntryIcon describes an icon with <icon>...</icon> tags
-//
-LLUrlEntryIcon::LLUrlEntryIcon()
-{
-	mPattern = boost::regex("<icon\\s*>\\s*([^<]*)?\\s*</icon\\s*>",
-							boost::regex::perl|boost::regex::icase);
-	mDisabledLink = true;
-}
-
-std::string LLUrlEntryIcon::getUrl(const std::string &url) const
-{
-	return LLStringUtil::null;
-}
-
-std::string LLUrlEntryIcon::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
-{
-	return LLStringUtil::null;
-}
-
-std::string LLUrlEntryIcon::getIcon(const std::string &url)
-{
-	// Grep icon info between <icon>...</icon> tags
-	// matches[1] contains the icon name/path
-	boost::match_results<std::string::const_iterator> matches;
-	mIcon = (boost::regex_match(url, matches, mPattern) && matches[1].matched)
-		? matches[1]
-		: LLStringUtil::null;
-	LLStringUtil::trim(mIcon);
-	return mIcon;
-}
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index d868e01aa686d59c8423d4bc6b2ec73d9e5587ec..29575d752ced36fca7fa35713084028004b41d1d 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -3,25 +3,31 @@
  * @author Martin Reddy
  * @brief Describes the Url types that can be registered in LLUrlRegistry
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -71,7 +77,7 @@ class LLUrlEntryBase
 	virtual std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb) { return url; }
 
 	/// Return an icon that can be displayed next to Urls of this type
-	virtual std::string getIcon(const std::string &url) { return mIcon; }
+	std::string getIcon() const { return mIcon; }
 
 	/// Return the color to render the displayed text
 	LLUIColor getColor() const { return mColor; }
@@ -88,8 +94,6 @@ class LLUrlEntryBase
 	/// is this a match for a URL that should not be hyperlinked?
 	bool isLinkDisabled() const { return mDisabledLink; }
 
-	virtual LLUUID	getID(const std::string &string) const { return LLUUID::null; }
-
 protected:
 	std::string getIDStringFromUrl(const std::string &url) const;
 	std::string escapeUrl(const std::string &url) const;
@@ -166,7 +170,6 @@ class LLUrlEntryAgent : public LLUrlEntryBase
 	LLUrlEntryAgent();
 	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
 	/*virtual*/ std::string getTooltip(const std::string &string) const;
-	/*virtual*/ LLUUID	getID(const std::string &string) const;
 private:
 	void onAgentNameReceived(const LLUUID& id, const std::string& first,
 							 const std::string& last, BOOL is_group);
@@ -181,7 +184,6 @@ class LLUrlEntryGroup : public LLUrlEntryBase
 public:
 	LLUrlEntryGroup();
 	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
-	/*virtual*/ LLUUID	getID(const std::string &string) const;
 private:
 	void onGroupNameReceived(const LLUUID& id, const std::string& first,
 							 const std::string& last, BOOL is_group);
@@ -294,17 +296,4 @@ class LLUrlEntryNoLink : public LLUrlEntryBase
 	/*virtual*/ std::string getUrl(const std::string &string) const;
 };
 
-///
-/// LLUrlEntryIcon describes an icon with <icon>...</icon> tags
-///
-class LLUrlEntryIcon : public LLUrlEntryBase
-{
-public:
-	LLUrlEntryIcon();
-	/*virtual*/ std::string getUrl(const std::string &string) const;
-	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
-	/*virtual*/ std::string getIcon(const std::string &url);
-};
-
-
 #endif
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 1c103a628b4152baa7157c57377e7c5e3a67b2bf..0a70aa586a2cc40135232a4d9e992f27c3829ffe 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -3,25 +3,31 @@
  * @author Martin Reddy
  * @brief Contains a set of Url types that can be matched in a string
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -39,7 +45,6 @@ LLUrlRegistry::LLUrlRegistry()
 {
 	// Urls are matched in the order that they were registered
 	registerUrl(new LLUrlEntryNoLink());
-	registerUrl(new LLUrlEntryIcon());
 	registerUrl(new LLUrlEntrySLURL());
 	registerUrl(new LLUrlEntryHTTP());
 	registerUrl(new LLUrlEntryHTTPLabel());
@@ -130,8 +135,7 @@ static bool stringHasUrl(const std::string &text)
 			text.find(".net") != std::string::npos ||
 			text.find(".edu") != std::string::npos ||
 			text.find(".org") != std::string::npos ||
-			text.find("<nolink>") != std::string::npos ||
-			text.find("<icon") != std::string::npos);
+			text.find("<nolink>") != std::string::npos);
 }
 
 bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb)
@@ -173,12 +177,11 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
 						match_entry->getUrl(url),
 						match_entry->getLabel(url, cb),
 						match_entry->getTooltip(url),
-						match_entry->getIcon(url),
+						match_entry->getIcon(),
 						match_entry->getColor(),
 						match_entry->getMenuName(),
 						match_entry->getLocation(url),
-						match_entry->isLinkDisabled(),
-						match_entry->getID(url));
+						match_entry->isLinkDisabled());
 		return true;
 	}
 
@@ -212,8 +215,7 @@ bool LLUrlRegistry::findUrl(const LLWString &text, LLUrlMatch &match, const LLUr
 						match.getColor(),
 						match.getMenuName(),
 						match.getLocation(),
-						match.isLinkDisabled(),
-						match.getID());
+						match.isLinkDisabled());
 		return true;
 	}
 	return false;
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index 95affe4460ff65b10bc153c66e5a472a6bbd3a62..cbb303a059254f864257b81fba4ab0f8e9d670c4 100644
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -3,25 +3,20 @@
  * @author Martin Reddy
  * @brief Unit tests for LLUrlEntry objects
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of
+ * this source code is governed by the Linden Lab Source Code Disclosure
+ * Agreement ("Agreement") previously entered between you and Linden
+ * Lab. By accessing, using, copying, modifying or distributing this
+ * software, you acknowledge that you have been informed of your
+ * obligations under the Agreement and agree to abide by those obligations.
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -291,13 +286,6 @@ namespace tut
 				  "XXX secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar",
 				  "secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar");
 
-		testRegex("Standalone Agent Url ", url,
-				  "x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
-
-		testRegex("Standalone Agent Url Multicase with Text", url,
-				  "M x-grid-location-info://lincoln.lindenlab.com/app/AGENT/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about M",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/AGENT/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
 	}
 
 	template<> template<>
@@ -327,15 +315,6 @@ namespace tut
 		testRegex("Group Url multicase", url,
 				  "XXX secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About XXX",
 				  "secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About");
-		
-		testRegex("Standalone Group Url ", url,
-				  "x-grid-location-info://lincoln.lindenlab.com/app/group/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/group/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
-		
-		testRegex("Standalone Group Url Multicase ith Text", url,
-				  "M x-grid-location-info://lincoln.lindenlab.com/app/GROUP/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about M",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/GROUP/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
-		
 	}
 
 	template<> template<>
@@ -382,11 +361,7 @@ namespace tut
 		// DEV-35459: SLURLs and teleport Links not parsed properly
 		testRegex("SLURL with quote", url,
 				  "XXX secondlife://A'ksha%20Oasis/41/166/701 XXX",
-			          "secondlife://A%27ksha%20Oasis/41/166/701");
-		
-		testRegex("Standalone All Hands (50,50) [2] with text", url,
-				  "XXX x-grid-location-info://lincoln.lindenlab.com/region/All%20Hands/50/50/50 XXX",
-				  "x-grid-location-info://lincoln.lindenlab.com/region/All%20Hands/50/50/50");		
+				  "secondlife://A%27ksha%20Oasis/41/166/701");
 	}
 
 	template<> template<>
@@ -486,10 +461,6 @@ namespace tut
 		testRegex("Teleport url with quote", url,
 				  "XXX secondlife:///app/teleport/A'ksha%20Oasis/41/166/701 XXX",
 				  "secondlife:///app/teleport/A%27ksha%20Oasis/41/166/701");
-		
-		testRegex("Standalone All Hands", url,
-				  "XXX x-grid-location-info://lincoln.lindenlab.com/app/teleport/All%20Hands/50/50/50 XXX",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/teleport/All%20Hands/50/50/50");		
 	}
 
 	template<> template<>
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index 938fb008c9900c8497accdb976c570a5ee34d64e..da4abde451f203a3204464323d119febdc4abbd3 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -2,25 +2,31 @@
  * @file lldir.cpp
  * @brief implementation of directory utilities base class
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -85,16 +91,15 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask)
 	S32 result;
 	while (getNextFileInDir(dirname, mask, filename, FALSE))
 	{
-		fullpath = dirname;
-		fullpath += getDirDelimiter();
-		fullpath += filename;
-
-		if(LLFile::isdir(fullpath))
+		if ((filename == ".") || (filename == ".."))
 		{
 			// skipping directory traversal filenames
 			count++;
 			continue;
 		}
+		fullpath = dirname;
+		fullpath += getDirDelimiter();
+		fullpath += filename;
 
 		S32 retry_count = 0;
 		while (retry_count < 5)
@@ -454,6 +459,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
 	}
 
 	//llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl;
+
 	return expanded_filename;
 }
 
@@ -559,23 +565,27 @@ std::string LLDir::getForbiddenFileChars()
 	return "\\/:*?\"<>|";
 }
 
-void LLDir::setLindenUserDir(const std::string &username)
+void LLDir::setLindenUserDir(const std::string &first, const std::string &last)
 {
-	// if the username isn't set, that's bad
-	if (!username.empty())
+	// if both first and last aren't set, that's bad.
+	if (!first.empty() && !last.empty())
 	{
 		// some platforms have case-sensitive filesystems, so be
 		// utterly consistent with our firstname/lastname case.
-		std::string userlower(username);
-		LLStringUtil::toLower(userlower);
-		LLStringUtil::replaceChar(userlower, ' ', '_');
+		std::string firstlower(first);
+		LLStringUtil::toLower(firstlower);
+		std::string lastlower(last);
+		LLStringUtil::toLower(lastlower);
 		mLindenUserDir = getOSUserAppDir();
 		mLindenUserDir += mDirDelimiter;
-		mLindenUserDir += userlower;
+		mLindenUserDir += firstlower;
+		mLindenUserDir += "_";
+		mLindenUserDir += lastlower;
+		llinfos << "Got name for LLDir::setLindenUserDir(first='" << first << "', last='" << last << "')" << llendl;
 	}
 	else
 	{
-		llerrs << "NULL name for LLDir::setLindenUserDir" << llendl;
+		llerrs << "Invalid name for LLDir::setLindenUserDir(first='" << first << "', last='" << last << "')" << llendl;
 	}
 
 	dumpCurrentDirectories();	
@@ -593,25 +603,27 @@ void LLDir::setChatLogsDir(const std::string &path)
 	}
 }
 
-void LLDir::setPerAccountChatLogsDir(const std::string &username)
+void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string &last)
 {
 	// if both first and last aren't set, assume we're grabbing the cached dir
-	if (!username.empty())
+	if (!first.empty() && !last.empty())
 	{
 		// some platforms have case-sensitive filesystems, so be
 		// utterly consistent with our firstname/lastname case.
-		std::string userlower(username);
-		LLStringUtil::toLower(userlower);
-		LLStringUtil::replaceChar(userlower, ' ', '_');
+		std::string firstlower(first);
+		LLStringUtil::toLower(firstlower);
+		std::string lastlower(last);
+		LLStringUtil::toLower(lastlower);
 		mPerAccountChatLogsDir = getChatLogsDir();
 		mPerAccountChatLogsDir += mDirDelimiter;
-		mPerAccountChatLogsDir += userlower;
+		mPerAccountChatLogsDir += firstlower;
+		mPerAccountChatLogsDir += "_";
+		mPerAccountChatLogsDir += lastlower;
 	}
 	else
 	{
-		llerrs << "NULL name for LLDir::setPerAccountChatLogsDir" << llendl;
+		llwarns << "Invalid name for LLDir::setPerAccountChatLogsDir" << llendl;
 	}
-	
 }
 
 void LLDir::setSkinFolder(const std::string &skin_folder)
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index 4f63c04aabefa6876ad8846417ff97fc873c603f..9067d75bacad7a978d085edf0898ea7ab312b385 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -2,25 +2,31 @@
  * @file lldir.h
  * @brief Definition of directory utilities class
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -131,8 +137,8 @@ class LLDir
 	static std::string getForbiddenFileChars();
 
 	virtual void setChatLogsDir(const std::string &path);		// Set the chat logs dir to this user's dir
-	virtual void setPerAccountChatLogsDir(const std::string &username);		// Set the per user chat log directory.
-	virtual void setLindenUserDir(const std::string &username);		// Set the linden user dir to this user's dir
+	virtual void setPerAccountChatLogsDir(const std::string &first, const std::string &last);		// Set the per user chat log directory.
+	virtual void setLindenUserDir(const std::string &first, const std::string &last);		// Set the linden user dir to this user's dir
 	virtual void setSkinFolder(const std::string &skin_folder);
 	virtual bool setCacheDir(const std::string &path);
 
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index e8a86a188072c90f6563f47681d266a4e9eea196..52132c38d36bd21b20edfb06a29f634e8aee542e 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -2,25 +2,31 @@
  * @file llwindow.h
  * @brief Basic graphical window class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index affd7276cceca1ebb83c9aff24fa3ba32c774ec0..7026a3f7a634602e35bcd8f0c3006b3a09bcc492 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -2,25 +2,31 @@
  * @file llwindowmacosx.cpp
  * @brief Platform-dependent implementation of llwindow
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 6dc093b4be0e31a622b08e3993e1b143af1170a9..5ac74bb00456551c5260e14e880c190b09323084 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -2,25 +2,31 @@
  * @file llwindowmacosx.h
  * @brief Mac implementation of LLWindow class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index b65287715c555b6e3f2082c041d8fb669134af98..399d284402a8d9daef5c05a687ccbbb657485e76 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -3,25 +3,31 @@
  * @brief SDL implementation of LLWindow class
  * @author This module has many fathers, and it shows.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index fa544b16cef171ff8b6097c5db880a6a6ff9da6c..8e65a2f3245c39990fb65054ce193d65184baf8d 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -2,25 +2,31 @@
  * @file llwindowsdl.h
  * @brief SDL implementation of LLWindow class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 87075c7318ebbe4f9651dcea309a26bb1874aada..95c1980dd6902e127887eea2522fb354fa84791d 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -2,25 +2,31 @@
  * @file llwindowwin32.cpp
  * @brief Platform-dependent implementation of llwindow
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -1538,14 +1544,16 @@ void LLWindowWin32::initCursors()
 	mCursor[ UI_CURSOR_TOOLZOOMIN ] = LoadCursor(module, TEXT("TOOLZOOMIN"));
 	mCursor[ UI_CURSOR_TOOLPICKOBJECT3 ] = LoadCursor(module, TEXT("TOOLPICKOBJECT3"));
 	mCursor[ UI_CURSOR_PIPETTE ] = LoadCursor(module, TEXT("TOOLPIPETTE"));
-	mCursor[ UI_CURSOR_TOOLSIT ]	= LoadCursor(module, TEXT("TOOLSIT"));
-	mCursor[ UI_CURSOR_TOOLBUY ]	= LoadCursor(module, TEXT("TOOLBUY"));
-	mCursor[ UI_CURSOR_TOOLOPEN ]	= LoadCursor(module, TEXT("TOOLOPEN"));
 
 	// Color cursors
-	mCursor[ UI_CURSOR_TOOLPLAY ]		= loadColorCursor(TEXT("TOOLPLAY"));
-	mCursor[ UI_CURSOR_TOOLPAUSE ]		= loadColorCursor(TEXT("TOOLPAUSE"));
-	mCursor[ UI_CURSOR_TOOLMEDIAOPEN ]	= loadColorCursor(TEXT("TOOLMEDIAOPEN"));
+	gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "res", "toolbuy.cur");
+
+	mCursor[UI_CURSOR_TOOLSIT] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + "res" + gDirUtilp->getDirDelimiter() + "toolsit.cur").c_str());
+	mCursor[UI_CURSOR_TOOLBUY] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + "res" + gDirUtilp->getDirDelimiter() + "toolbuy.cur").c_str());
+	mCursor[UI_CURSOR_TOOLOPEN] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + "res" + gDirUtilp->getDirDelimiter() + "toolopen.cur").c_str());
+	mCursor[UI_CURSOR_TOOLPLAY] = loadColorCursor(TEXT("TOOLPLAY"));
+	mCursor[UI_CURSOR_TOOLPAUSE] = loadColorCursor(TEXT("TOOLPAUSE"));
+	mCursor[UI_CURSOR_TOOLMEDIAOPEN] = loadColorCursor(TEXT("TOOLMEDIAOPEN"));
 
 	// Note: custom cursors that are not found make LoadCursor() return NULL.
 	for( S32 i = 0; i < UI_CURSOR_COUNT; i++ )
@@ -2871,16 +2879,8 @@ void LLSplashScreenWin32::updateImpl(const std::string& mesg)
 {
 	if (!mWindow) return;
 
-	int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), mesg.length(), NULL, 0);
-	if( output_str_len>1024 )
-		return;
-
-	WCHAR w_mesg[1025];//big enought to keep null terminatos
-
-	MultiByteToWideChar (CP_UTF8, 0, mesg.c_str(), mesg.length(), w_mesg, output_str_len);
-
-	//looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858
-	w_mesg[output_str_len] = 0;
+	WCHAR w_mesg[1024];
+	mbstowcs(w_mesg, mesg.c_str(), 1024);
 
 	SendDlgItemMessage(mWindow,
 		666,		// HACK: text id
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 387e4cbdb65a8767ecf8ddf220b4438669ff6111..d4a3446515ef09b8fc34f9f01b16a5c017606666 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -2,25 +2,31 @@
  * @file llwindowwin32.h
  * @brief Windows implementation of LLWindow class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp
index d79e9f8bde496797dd3a2a6de2073d2b90df9fae..8de54aeda54ba7ce8cf0ebbc1da793faf77a3d6c 100644
--- a/indra/lscript/lscript_execute/lscript_execute.cpp
+++ b/indra/lscript/lscript_execute/lscript_execute.cpp
@@ -2,25 +2,31 @@
  * @file lscript_execute.cpp
  * @brief classes to execute bytecode
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index 047146f8f3a96be7379a33831d924f08cafc3486..436e077e9b65c695035a334bf3c104859485d8de 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -3,25 +3,30 @@
  * @brief Webkit plugin for LLMedia API plugin system
  *
  * @cond
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ *
+ * Copyright (c) 2008, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  * @endcond
  */
@@ -41,15 +46,13 @@
 // set to 1 if you're using the version of llqtwebkit that's QPixmap-ified
 #if LL_LINUX
 # define LL_QTWEBKIT_USES_PIXMAPS 0
-extern "C" {
-# include <glib.h>
-# include <glib-object.h>
-}
 #else
 # define LL_QTWEBKIT_USES_PIXMAPS 0
 #endif // LL_LINUX
 
-# include "volume_catcher.h"
+#if LL_LINUX
+# include "linux_volume_catcher.h"
+#endif // LL_LINUX
 
 #if LL_WINDOWS
 # include <direct.h>
@@ -59,7 +62,7 @@ extern "C" {
 #endif
 
 #if LL_WINDOWS
-	// *NOTE:Mani - This captures the module handle for the dll. This is used below
+	// *NOTE:Mani - This captures the module handle fo rthe dll. This is used below
 	// to get the path to this dll for webkit initialization.
 	// I don't know how/if this can be done with apr...
 	namespace {	HMODULE gModuleHandle;};
@@ -116,7 +119,9 @@ class MediaPluginWebKit :
 	F32 mBackgroundG;
 	F32 mBackgroundB;
 	
-	VolumeCatcher mVolumeCatcher;
+#if LL_LINUX
+	LinuxVolumeCatcher mLinuxVolumeCatcher;
+#endif // LL_LINUX
 
 	void setInitState(int state)
 	{
@@ -128,19 +133,11 @@ class MediaPluginWebKit :
 	//
 	void update(int milliseconds)
 	{
-#if LL_QTLINUX_DOESNT_HAVE_GLIB
-		// pump glib generously, as Linux browser plugins are on the
-		// glib main loop, even if the browser itself isn't - ugh
-		// This is NOT NEEDED if Qt itself was built with glib
-		// mainloop integration.
-		GMainContext *mainc = g_main_context_default();
-		while(g_main_context_iteration(mainc, FALSE));
-#endif // LL_QTLINUX_DOESNT_HAVE_GLIB
-
-		// pump qt
 		LLQtWebKit::getInstance()->pump( milliseconds );
 		
-		mVolumeCatcher.pump();
+#if LL_LINUX
+		mLinuxVolumeCatcher.pump();
+#endif // LL_LINUX
 
 		checkEditState();
 		
@@ -209,14 +206,6 @@ class MediaPluginWebKit :
 		}
 		std::string application_dir = std::string( cwd );
 
-#if LL_LINUX
-		// take care to initialize glib properly, because some
-		// versions of Qt don't, and we indirectly need it for (some
-		// versions of) Flash to not crash the browser.
-		if (!g_thread_supported ()) g_thread_init (NULL);
-		g_type_init();
-#endif
-
 #if LL_DARWIN
 		// When running under the Xcode debugger, there's a setting called "Break on Debugger()/DebugStr()" which defaults to being turned on.
 		// This causes the environment variable USERBREAK to be set to 1, which causes these legacy calls to break into the debugger.
@@ -314,14 +303,11 @@ class MediaPluginWebKit :
 		// append details to agent string
 		LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent );
 
-		// Set up window open behavior
-		LLQtWebKit::getInstance()->setWindowOpenBehavior(mBrowserWindowId, LLQtWebKit::WOB_SIMULATE_BLANK_HREF_CLICK);
-		
 #if !LL_QTWEBKIT_USES_PIXMAPS
 		// don't flip bitmap
 		LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true );
 #endif // !LL_QTWEBKIT_USES_PIXMAPS
-
+		
 		// set background color
 		// convert background color channels from [0.0, 1.0] to [0, 255];
 		LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, int(mBackgroundR * 255.0f), int(mBackgroundG * 255.0f), int(mBackgroundB * 255.0f) );
@@ -1153,7 +1139,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 
 void MediaPluginWebKit::setVolume(F32 volume)
 {
-	mVolumeCatcher.setVolume(volume);
+#if LL_LINUX
+	mLinuxVolumeCatcher.setVolume(volume);
+#endif // LL_LINUX
 }
 
 int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data)
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 1ee7586d5f3955a0017d6282bce01402fa8245f3..47fde08a9de671c2a511d154b2f26f6def00808a 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -7,7 +7,6 @@ include(Boost)
 include(BuildVersion)
 include(DBusGlib)
 include(DirectX)
-include(OpenSSL)
 include(DragDrop)
 include(ELFIO)
 include(FMOD)
@@ -91,7 +90,6 @@ set(viewer_SOURCE_FILES
     llbottomtray.cpp
     llbox.cpp
     llbreadcrumbview.cpp
-    llbuycurrencyhtml.cpp
     llcallbacklist.cpp
     llcallfloater.cpp
     llcallingcard.cpp
@@ -106,7 +104,6 @@ set(viewer_SOURCE_FILES
     llclassifiedinfo.cpp
     llclassifiedstatsresponder.cpp
     llcloud.cpp
-    llcofwearables.cpp
     llcolorswatch.cpp
     llcommanddispatcherlistener.cpp
     llcommandhandler.cpp
@@ -145,10 +142,10 @@ set(viewer_SOURCE_FILES
     llfavoritesbar.cpp
     llfeaturemanager.cpp
     llfilepicker.cpp
-    llfilteredwearablelist.cpp
     llfirstuse.cpp
     llflexibleobject.cpp
     llfloaterabout.cpp
+    llfloateractivespeakers.cpp
     llfloateranimpreview.cpp
     llfloaterauction.cpp
     llfloateravatarpicker.cpp
@@ -160,10 +157,10 @@ set(viewer_SOURCE_FILES
     llfloaterbuy.cpp
     llfloaterbuycontents.cpp
     llfloaterbuycurrency.cpp
-    llfloaterbuycurrencyhtml.cpp
     llfloaterbuyland.cpp
     llfloatercamera.cpp
     llfloatercolorpicker.cpp
+    llfloatercustomize.cpp
     llfloaterdaycycle.cpp
     llfloaterenvsettings.cpp
     llfloaterevent.cpp
@@ -215,7 +212,6 @@ set(viewer_SOURCE_FILES
     llfloaterurldisplay.cpp
     llfloaterurlentry.cpp
     llfloatervoicedevicesettings.cpp
-    llfloatervoiceeffect.cpp
     llfloaterwater.cpp
     llfloaterwhitelistentry.cpp
     llfloaterwindlight.cpp
@@ -226,7 +222,6 @@ set(viewer_SOURCE_FILES
     llfollowcam.cpp
     llfriendcard.cpp
     llgesturemgr.cpp
-    llgiveinventory.cpp
     llglsandbox.cpp
     llgroupactions.cpp
     llgroupiconctrl.cpp
@@ -258,9 +253,6 @@ set(viewer_SOURCE_FILES
     llinventoryclipboard.cpp
     llinventoryfilter.cpp
     llinventoryfunctions.cpp
-    llinventoryicon.cpp
-    llinventoryitemslist.cpp
-    llinventorylistitem.cpp
     llinventorymodel.cpp
     llinventorymodelbackgroundfetch.cpp
     llinventoryobserver.cpp
@@ -269,7 +261,6 @@ set(viewer_SOURCE_FILES
     lllandmarkactions.cpp
     lllandmarklist.cpp
     lllistbrowser.cpp
-    lllistcontextmenu.cpp
     lllistview.cpp
     lllocaltextureobject.cpp
     lllocationhistory.cpp
@@ -277,7 +268,6 @@ set(viewer_SOURCE_FILES
     lllogchat.cpp
     llloginhandler.cpp
     lllogininstance.cpp
-    llmachineid.cpp
     llmanip.cpp
     llmaniprotate.cpp
     llmanipscale.cpp
@@ -305,10 +295,7 @@ set(viewer_SOURCE_FILES
     llnotificationmanager.cpp
     llnotificationofferhandler.cpp
     llnotificationscripthandler.cpp
-    llnotificationstorage.cpp
     llnotificationtiphandler.cpp
-    lloutfitslist.cpp
-    lloutfitobserver.cpp
     lloutputmonitorctrl.cpp
     llpanelavatar.cpp
     llpanelavatartag.cpp
@@ -317,7 +304,6 @@ set(viewer_SOURCE_FILES
     llpanelcontents.cpp
     llpaneleditwearable.cpp
     llpanelface.cpp
-    llpanelgenerictip.cpp
     llpanelgroup.cpp
     llpanelgroupgeneral.cpp
     llpanelgroupinvite.cpp
@@ -341,7 +327,6 @@ set(viewer_SOURCE_FILES
     llpanelnearbymedia.cpp
     llpanelobject.cpp
     llpanelobjectinventory.cpp
-    llpanelonlinestatus.cpp
     llpaneloutfitedit.cpp
     llpaneloutfitsinventory.cpp
     llpanelpeople.cpp
@@ -358,12 +343,8 @@ set(viewer_SOURCE_FILES
     llpanelprofile.cpp
     llpanelprofileview.cpp
     llpanelteleporthistory.cpp
-    llpaneltiptoast.cpp
-    llpanelvoiceeffect.cpp
-    llpaneltopinfobar.cpp
     llpanelvolume.cpp
     llpanelvolumepulldown.cpp
-    llpanelwearing.cpp
     llparcelselection.cpp
     llparticipantlist.cpp
     llpatchvertexarray.cpp
@@ -385,14 +366,11 @@ set(viewer_SOURCE_FILES
     llregionposition.cpp
     llremoteparcelrequest.cpp
     llsavedsettingsglue.cpp
-    llsaveoutfitcombobtn.cpp
     llscreenchannel.cpp
     llscriptfloater.cpp
     llscrollingpanelparam.cpp
     llsearchcombobox.cpp
     llsearchhistory.cpp
-    llsecapi.cpp
-    llsechandler_basic.cpp
     llselectmgr.cpp
     llsidepanelappearance.cpp
     llsidepanelinventory.cpp
@@ -432,6 +410,7 @@ set(viewer_SOURCE_FILES
     lltexturestats.cpp
     lltexturestatsuploader.cpp
     lltextureview.cpp
+    lltextutil.cpp
     lltoast.cpp
     lltoastalertpanel.cpp
     lltoastgroupnotifypanel.cpp
@@ -466,13 +445,13 @@ set(viewer_SOURCE_FILES
     llurldispatcherlistener.cpp
     llurlhistory.cpp
     llurllineeditorctrl.cpp
+    llurlsimstring.cpp
     llurlwhitelist.cpp
     llvectorperfoptions.cpp
     llversioninfo.cpp
     llviewchildren.cpp
     llviewerassetstorage.cpp
     llviewerassettype.cpp
-    llviewerattachmenu.cpp
     llvieweraudio.cpp
     llviewercamera.cpp
     llviewerchat.cpp
@@ -534,7 +513,6 @@ set(viewer_SOURCE_FILES
     llvoicechannel.cpp
     llvoiceclient.cpp
     llvoicevisualizer.cpp
-    llvoicevivox.cpp
     llvoinventorylistener.cpp
     llvopartgroup.cpp
     llvosky.cpp
@@ -548,9 +526,8 @@ set(viewer_SOURCE_FILES
     llwaterparammanager.cpp
     llwaterparamset.cpp
     llwearable.cpp
-    llwearableitemslist.cpp
+    llwearabledictionary.cpp
     llwearablelist.cpp
-    llwearabletype.cpp
     llweb.cpp
     llwind.cpp
     llwlanimator.cpp
@@ -615,7 +592,6 @@ set(viewer_HEADER_FILES
     llbottomtray.h
     llbox.h
     llbreadcrumbview.h
-    llbuycurrencyhtml.h
     llcallbacklist.h
     llcallfloater.h
     llcallingcard.h
@@ -631,7 +607,6 @@ set(viewer_HEADER_FILES
     llclassifiedinfo.h
     llclassifiedstatsresponder.h
     llcloud.h
-    llcofwearables.h
     llcolorswatch.h
     llcommanddispatcherlistener.h
     llcommandhandler.h
@@ -671,10 +646,10 @@ set(viewer_HEADER_FILES
     llfavoritesbar.h
     llfeaturemanager.h
     llfilepicker.h
-    llfilteredwearablelist.h
     llfirstuse.h
     llflexibleobject.h
     llfloaterabout.h
+    llfloateractivespeakers.h
     llfloateranimpreview.h
     llfloaterauction.h
     llfloateravatarpicker.h
@@ -686,10 +661,10 @@ set(viewer_HEADER_FILES
     llfloaterbuy.h
     llfloaterbuycontents.h
     llfloaterbuycurrency.h
-    llfloaterbuycurrencyhtml.h
     llfloaterbuyland.h
     llfloatercamera.h
     llfloatercolorpicker.h
+    llfloatercustomize.h
     llfloaterdaycycle.h
     llfloaterenvsettings.h
     llfloaterevent.h
@@ -741,7 +716,6 @@ set(viewer_HEADER_FILES
     llfloaterurldisplay.h
     llfloaterurlentry.h
     llfloatervoicedevicesettings.h
-    llfloatervoiceeffect.h
     llfloaterwater.h
     llfloaterwhitelistentry.h
     llfloaterwindlight.h
@@ -753,7 +727,6 @@ set(viewer_HEADER_FILES
     llfollowcam.h
     llfriendcard.h
     llgesturemgr.h
-    llgiveinventory.h
     llgroupactions.h
     llgroupiconctrl.h
     llgrouplist.h
@@ -783,9 +756,6 @@ set(viewer_HEADER_FILES
     llinventoryclipboard.h
     llinventoryfilter.h
     llinventoryfunctions.h
-    llinventoryicon.h
-    llinventoryitemslist.h
-    llinventorylistitem.h
     llinventorymodel.h
     llinventorymodelbackgroundfetch.h
     llinventoryobserver.h
@@ -795,7 +765,6 @@ set(viewer_HEADER_FILES
     lllandmarklist.h
     lllightconstants.h
     lllistbrowser.h
-    lllistcontextmenu.h
     lllistview.h
     lllocaltextureobject.h
     lllocationhistory.h
@@ -803,7 +772,6 @@ set(viewer_HEADER_FILES
     lllogchat.h
     llloginhandler.h
     lllogininstance.h
-    llmachineid.h
     llmanip.h
     llmaniprotate.h
     llmanipscale.h
@@ -827,11 +795,7 @@ set(viewer_HEADER_FILES
     llnetmap.h
     llnotificationhandler.h
     llnotificationmanager.h
-    llnotificationstorage.h
-    lloutfitslist.h
-    lloutfitobserver.h
     lloutputmonitorctrl.h
-    llpanelappearancetab.h
     llpanelavatar.h
     llpanelavatartag.h
     llpanelblockedlist.h
@@ -839,7 +803,6 @@ set(viewer_HEADER_FILES
     llpanelcontents.h
     llpaneleditwearable.h
     llpanelface.h
-    llpanelgenerictip.h
     llpanelgroup.h
     llpanelgroupgeneral.h
     llpanelgroupinvite.h
@@ -863,7 +826,6 @@ set(viewer_HEADER_FILES
     llpanelnearbymedia.h
     llpanelobject.h
     llpanelobjectinventory.h
-    llpanelonlinestatus.h
     llpaneloutfitedit.h
     llpaneloutfitsinventory.h
     llpanelpeople.h
@@ -880,12 +842,8 @@ set(viewer_HEADER_FILES
     llpanelprofile.h
     llpanelprofileview.h
     llpanelteleporthistory.h
-    llpaneltiptoast.h
-    llpanelvoiceeffect.h
-    llpaneltopinfobar.h
     llpanelvolume.h
     llpanelvolumepulldown.h
-    llpanelwearing.h
     llparcelselection.h
     llparticipantlist.h
     llpatchvertexarray.h
@@ -909,14 +867,11 @@ set(viewer_HEADER_FILES
     llresourcedata.h
     llrootview.h
     llsavedsettingsglue.h
-    llsaveoutfitcombobtn.h
     llscreenchannel.h
     llscriptfloater.h
     llscrollingpanelparam.h
     llsearchcombobox.h
     llsearchhistory.h
-    llsecapi.h
-    llsechandler_basic.h
     llselectmgr.h
     llsidepanelappearance.h
     llsidepanelinventory.h
@@ -957,6 +912,7 @@ set(viewer_HEADER_FILES
     lltexturestats.h
     lltexturestatsuploader.h
     lltextureview.h
+    lltextutil.h
     lltoast.h
     lltoastalertpanel.h
     lltoastgroupnotifypanel.h
@@ -992,13 +948,13 @@ set(viewer_HEADER_FILES
     llurldispatcherlistener.h
     llurlhistory.h
     llurllineeditorctrl.h
+    llurlsimstring.h
     llurlwhitelist.h
     llvectorperfoptions.h
     llversioninfo.h
     llviewchildren.h
     llviewerassetstorage.h
     llviewerassettype.h
-    llviewerattachmenu.h
     llvieweraudio.h
     llviewercamera.h
     llviewerchat.h
@@ -1057,7 +1013,6 @@ set(viewer_HEADER_FILES
     llvoicechannel.h
     llvoiceclient.h
     llvoicevisualizer.h
-    llvoicevivox.h
     llvoinventorylistener.h
     llvopartgroup.h
     llvosky.h
@@ -1072,11 +1027,11 @@ set(viewer_HEADER_FILES
     llwaterparammanager.h
     llwaterparamset.h
     llwearable.h
-    llwearableitemslist.h
+    llwearabledictionary.h
     llwearablelist.h
-    llwearabletype.h
     llweb.h
     llwind.h
+    llwindebug.h
     llwlanimator.h
     llwldaycycle.h
     llwlparammanager.h
@@ -1207,9 +1162,6 @@ if (WINDOWS)
         res/toolpickobject2.cur
         res/toolpickobject3.cur
         res/toolpipette.cur
-        res/toolbuy.cur
-        res/toolopen.cur
-        res/toolsit.cur
         )
 
     set_source_files_properties(${viewer_RESOURCE_FILES}
@@ -1321,6 +1273,8 @@ set(viewer_APPSETTINGS_FILES
     ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg
     )
 
+use_prebuilt_binary(artwork-common)
+
 source_group("App Settings" FILES ${viewer_APPSETTINGS_FILES})
 
 set_source_files_properties(${viewer_APPSETTINGS_FILES}
@@ -1431,7 +1385,7 @@ if (WINDOWS)
 
     # If adding a file to viewer_manifest.py in the WindowsManifest.construct() method, be sure to add the dependency
     # here.
-    # *NOTE:Mani - This is a crappy hack to have important dependencies for the viewer_manifest copy action
+    # *NOTE:Mani - This is a crappy hack to have important dependecies for the viewer_manifest copy action
     # be met. I'm looking forward to a source-code split-up project next year that will address this kind of thing.
     # In the meantime, if you have any ideas on how to easily maintain one list, either here or in viewer_manifest.py
     # and have the build deps get tracked *please* tell me about it.
@@ -1449,10 +1403,10 @@ if (WINDOWS)
         ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll
         ${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
         )
-     endif(USE_GOOGLE_PERFTOOLS)
- 
+    endif(USE_GOOGLE_PERFTOOLS)
+  
 
-    set(COPY_INPUT_DEPENDENCIES
+    set(COPY_INPUT_DEPENDECIES
       # The following commented dependencies are determined at variably at build time. Can't do this here.
       #${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libtcmalloc_minimal.dll => None ... Skipping libtcmalloc_minimal.dll
       ${CMAKE_SOURCE_DIR}/../etc/message.xml
@@ -1486,6 +1440,8 @@ if (WINDOWS)
       ${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt
       ${CMAKE_CURRENT_SOURCE_DIR}/dbghelp.dll
       ${CMAKE_CURRENT_SOURCE_DIR}/fmod.dll
+      ${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}/media_plugin_quicktime.dll
+      ${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}/media_plugin_webkit.dll
       ${ARCH_PREBUILT_DIRS_RELEASE}/libeay32.dll
       ${ARCH_PREBUILT_DIRS_RELEASE}/qtcore4.dll
       ${ARCH_PREBUILT_DIRS_RELEASE}/qtgui4.dll
@@ -1525,7 +1481,6 @@ if (WINDOWS)
       SLPlugin
       media_plugin_quicktime
       media_plugin_webkit
-      winmm_shim
       windows-crash-logger
       windows-updater
       )
@@ -1547,7 +1502,7 @@ if (WINDOWS)
       DEPENDS 
         ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
         stage_third_party_libs
-        ${COPY_INPUT_DEPENDENCIES}
+        ${COPY_INPUT_DEPENDECIES}
       COMMENT "Performing viewer_manifest copy"
       )
     
@@ -1566,6 +1521,8 @@ if (WINDOWS)
         
     add_dependencies(${VIEWER_BINARY_NAME} 
       SLPlugin 
+      media_plugin_quicktime 
+      media_plugin_webkit
       windows-updater 
       windows-crash-logger
       )
@@ -1615,10 +1572,7 @@ if (WINDOWS)
           --login_channel=${VIEWER_LOGIN_CHANNEL}
           --source=${CMAKE_CURRENT_SOURCE_DIR}
           --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/touched.bat
-        DEPENDS 
-            ${VIEWER_BINARY_NAME} 
-            ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
-            ${COPY_INPUT_DEPENDENCIES}
+        DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
         )
 
       add_custom_target(package ALL DEPENDS 
@@ -1667,8 +1621,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}
     ${WINDOWS_LIBRARIES}
     ${XMLRPCEPI_LIBRARIES}
     ${ELFIO_LIBRARIES}
-    ${OPENSSL_LIBRARIES}
-    ${CRYPTO_LIBRARIES}
     ${LLLOGIN_LIBRARIES}
     ${GOOGLE_PERFTOOLS_LIBRARIES}
     )
@@ -1704,35 +1656,12 @@ if (LINUX)
 
   add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_gstreamer010 media_plugin_webkit)
 
-  if (PACKAGE)
+  if (NOT INSTALL)
     add_custom_target(package ALL DEPENDS ${product}.tar.bz2)
     add_dependencies(package linux-crash-logger-target)
     add_dependencies(package linux-updater-target)
     check_message_template(package)
-  endif (PACKAGE)
-
-  add_custom_command(
-    OUTPUT  ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched
-    COMMAND ${PYTHON_EXECUTABLE}
-    ARGS
-      ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
-      --arch=${ARCH}
-      --actions=copy
-      --artwork=${ARTWORK_DIR}
-      --build=${CMAKE_CURRENT_BINARY_DIR}
-      --buildtype=${CMAKE_BUILD_TYPE}
-      --configuration=${CMAKE_CFG_INTDIR}
-      --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged
-      --grid=${GRID}
-      --source=${CMAKE_CURRENT_SOURCE_DIR}
-    DEPENDS 
-      ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
-      ${COPY_INPUT_DEPENDENCIES}
-    COMMENT "Performing viewer_manifest copy"
-    )
-    
-  add_custom_target(copy_l_viewer_manifest ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched) 
-  add_dependencies(copy_l_viewer_manifest "${VIEWER_BINARY_NAME}" linux-crash-logger-target linux-updater-target)
+  endif (NOT INSTALL)
 endif (LINUX)
 
 if (DARWIN)
@@ -1767,30 +1696,52 @@ if (DARWIN)
     DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
     )
 
-  add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_quicktime media_plugin_webkit mac-updater mac-crash-logger)
+  add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_quicktime media_plugin_webkit)
 
   if (PACKAGE)
       add_custom_target(package ALL DEPENDS ${VIEWER_BINARY_NAME}) 
       check_message_template(package)
+      add_dependencies(package mac-updater mac-crash-logger)
 
       add_custom_command(
         TARGET package POST_BUILD
         COMMAND ${PYTHON_EXECUTABLE}
         ARGS
           ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
-          --artwork=${ARTWORK_DIR}
-          --build=${CMAKE_CURRENT_BINARY_DIR}
+          --grid=${GRID}
           --buildtype=${CMAKE_BUILD_TYPE}
-          --channel=${VIEWER_CHANNEL}
           --configuration=${CMAKE_CFG_INTDIR}
+          --channel=${VIEWER_CHANNEL}
+          --login_channel=${VIEWER_LOGIN_CHANNEL}
+          --source=${CMAKE_CURRENT_SOURCE_DIR}
+          --artwork=${ARTWORK_DIR}
+          --build=${CMAKE_CURRENT_BINARY_DIR}
           --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app
+          --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched
+        DEPENDS
+          ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+      )
+
+
+      add_custom_command(
+        TARGET package POST_BUILD
+        COMMAND ${PYTHON_EXECUTABLE}
+        ARGS
+          ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
           --grid=${GRID}
+          --buildtype=${CMAKE_BUILD_TYPE}
+          --configuration=${CMAKE_CFG_INTDIR}
+          --channel=${VIEWER_CHANNEL}
           --login_channel=${VIEWER_LOGIN_CHANNEL}
           --source=${CMAKE_CURRENT_SOURCE_DIR}
+          --artwork=${ARTWORK_DIR}
+          --build=${CMAKE_CURRENT_BINARY_DIR}
+          --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app
           --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched
         DEPENDS
           ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
       )
+
   endif (PACKAGE)
 endif (DARWIN)
 
@@ -1798,45 +1749,6 @@ if (INSTALL)
   include(${CMAKE_CURRENT_SOURCE_DIR}/ViewerInstall.cmake)
 endif (INSTALL)
 
-if (PACKAGE)
-  if (WINDOWS)
-    set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
-    set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-windows.tar.bz2")
-    set(VIEWER_EXE_GLOBS "${VIEWER_BINARY_NAME}${CMAKE_EXECUTABLE_SUFFIX} slplugin.exe")
-    set(VIEWER_LIB_GLOB "*${CMAKE_SHARED_MODULE_SUFFIX}")
-    set(VIEWER_COPY_MANIFEST copy_w_viewer_manifest)
-  endif (WINDOWS)
-  if (DARWIN)
-    set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app")
-    set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-darwin.tar.bz2")
-    set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin")
-    set(VIEWER_LIB_GLOB "*.dylib")
-  endif (DARWIN)
-  if (LINUX)
-    set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/packaged")
-    set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-linux.tar.bz2")
-    set(VIEWER_EXE_GLOBS "do-not-directly-run-secondlife-bin SLPlugin")
-    set(VIEWER_LIB_GLOB "*${CMAKE_SHARED_MODULE_SUFFIX}*")
-    set(VIEWER_COPY_MANIFEST copy_l_viewer_manifest)
-  endif (LINUX)
-
-  add_custom_command(OUTPUT "${VIEWER_SYMBOL_FILE}"
-    COMMAND "${PYTHON_EXECUTABLE}"
-    ARGS
-      "${CMAKE_CURRENT_SOURCE_DIR}/generate_breakpad_symbols.py"
-      "${VIEWER_DIST_DIR}"
-      "${VIEWER_EXE_GLOBS}"
-      "${VIEWER_LIB_GLOB}"
-      "${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/bin/dump_syms"
-      "${VIEWER_SYMBOL_FILE}"
-    DEPENDS generate_breakpad_symbols.py
-    VERBATIM
-  )
-  add_custom_target(generate_breakpad_symbols ALL DEPENDS "${VIEWER_SYMBOL_FILE}")
-  add_dependencies(generate_breakpad_symbols "${VIEWER_BINARY_NAME}" "${VIEWER_COPY_MANIFEST}")
-  add_dependencies(package generate_breakpad_symbols)
-endif (PACKAGE)
-
 if (LL_TESTS)
   # To add a viewer unit test, just add the test .cpp file below
   # This creates a separate test project per file listed.
@@ -1885,43 +1797,6 @@ if (LL_TESTS)
     "${CMAKE_SOURCE_DIR}/llmessage/tests/test_llsdmessage_peer.py"
     )
 
-  set(test_libs 
-    ${LLMESSAGE_LIBRARIES} 
-    ${WINDOWS_LIBRARIES} 
-    ${LLVFS_LIBRARIES}
-    ${LLMATH_LIBRARIES}
-    ${LLCOMMON_LIBRARIES} 
-    ${GOOGLEMOCK_LIBRARIES}
-    ${OPENSSL_LIBRARIES}
-    ${CRYPTO_LIBRARIES}
-  )
-
-    LL_ADD_INTEGRATION_TEST(llsechandler_basic
-    llsechandler_basic.cpp
-    "${test_libs}"
-    )
-
-  LL_ADD_INTEGRATION_TEST(llsecapi
-     llsecapi.cpp
-    "${test_libs}"
-    )
-
-  set(llslurl_test_sources
-      llslurl.cpp
-      llviewernetwork.cpp
-  )
-
-
-  LL_ADD_INTEGRATION_TEST(llslurl
-     "${llslurl_test_sources}"
-    "${test_libs}"
-    )
-
-  LL_ADD_INTEGRATION_TEST(llviewernetwork
-     llviewernetwork.cpp
-    "${test_libs}"
-    )
-
   #ADD_VIEWER_BUILD_TEST(llmemoryview viewer)
   #ADD_VIEWER_BUILD_TEST(llagentaccess viewer)
   #ADD_VIEWER_BUILD_TEST(llworldmap viewer)
@@ -1929,7 +1804,6 @@ if (LL_TESTS)
   #ADD_VIEWER_BUILD_TEST(lltextureinfo viewer)
   #ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer)
   #ADD_VIEWER_BUILD_TEST(lltexturestatsuploader viewer)
-
 endif (LL_TESTS)
 
 
diff --git a/indra/newview/English.lproj/InfoPlist.strings b/indra/newview/English.lproj/InfoPlist.strings
index 4bf67b1367be7b90ee80a892dc5f5bf204d5eb8b..02c3dfc6e0c16d31b7079ce4cccbfa585f9e7dbc 100644
--- a/indra/newview/English.lproj/InfoPlist.strings
+++ b/indra/newview/English.lproj/InfoPlist.strings
@@ -2,6 +2,6 @@
 
 CFBundleName = "Second Life";
 
-CFBundleShortVersionString = "Second Life version 2.1.1.0";
-CFBundleGetInfoString = "Second Life version 2.1.1.0, Copyright 2004-2010 Linden Research, Inc.";
+CFBundleShortVersionString = "Second Life version 2.0.0.203110";
+CFBundleGetInfoString = "Second Life version 2.0.0.203110, Copyright 2004-2009 Linden Research, Inc.";
 
diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist
index 3cda7467dd0e51591e9a69a4dfd0493eeb5b66db..4cb01a0f338759a56d18093eadfb9a75691592b3 100644
--- a/indra/newview/Info-SecondLife.plist
+++ b/indra/newview/Info-SecondLife.plist
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
 	<key>CFBundleDevelopmentRegion</key>
@@ -18,33 +18,6 @@
 	<string>APPL</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
-	<key>CFBundleDocumentTypes</key>
-	<array>
-		<dict>
-			<key>CFBundleTypeExtensions</key>
-			<array>
-				<string>slurl</string>
-			</array>
-			<key>CFBundleTypeIconFile</key>
-			<string>seconlife</string>
-			<key>CFBundleTypeMIMETypes</key>
-			<array>
-				<string>application/x-grid-location-info</string>
-			</array>
-			<key>CFBundleTypeName</key>
-			<string>Secondlife SLURL</string>
-			<key>CFBundleTypeOSTypes</key>
-			<array>
-				<string>SLRL</string>
-			</array>
-			<key>CFBundleTypeRole</key>
-			<string>Viewer</string>
-			<key>LSTypeIsPackage</key>
-			<true/>
-			<key>NSDocumentClass</key>
-			<string>SecondLifeSLURL</string>
-		</dict>
-	</array>
 	<key>CFBundleURLTypes</key>
 	<array>
 		<dict>
@@ -53,14 +26,13 @@
 			<key>CFBundleURLSchemes</key>
 			<array>
 				<string>secondlife</string>
-				<string>x-grid-location-info</string>
 			</array>
 			<key>LSIsAppleDefaultForScheme</key>
 			<true/>
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>2.1.1.0</string>
+	<string>2.0.0.203110</string>
 	<key>CSResourcesFileMapped</key>
 	<true/>
 </dict>
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index 937c4e4c6a02e8bb764527a8e2ea407c6f3b7631..d7bb64ce8a7787b39abc4bf24ebfc954571cdfdb 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -25,7 +25,6 @@
 							<string>AppCache</string>
 							<string>Window</string>
 							<string>RenderInit</string>
-							<string>MediaAuth</string>
 						</array>
 				</map>
 				<map>
@@ -41,8 +40,6 @@
 						</array>
 					<key>tags</key>
 						<array>
-							<!-- sample entry for debugging a specific item	-->
-<!--						<string>Voice</string>							-->
 						</array>
 				</map>
 			</array>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 810b2d9a1dfe06a4e98d367e6b401e94ba79660e..8b66cce8a3e8e71bb4552c8e4c7689d062257b95 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1,28 +1,16 @@
 <?xml version="1.0" ?>
 <llsd>
 <map>
-	<key>CrashHostUrl</key>
-    <map>
-      <key>Comment</key>
-      <string>A URL pointing to a crash report handler; overrides cluster negotiation to locate crash handler.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string />
-    </map>
     <key>AFKTimeout</key>
     <map>
       <key>Comment</key>
-      <string>Time before automatically setting AFK (away from keyboard) mode (seconds, 0=never). 
-        Valid values are: 0, 120, 300, 600, 1800</string>
+      <string>Time before automatically setting AFK (away from keyboard) mode (seconds, 0=never)</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>S32</string>
       <key>Value</key>
-      <real>300</real>
+      <real>0</real>
     </map>
     <key>AdvanceSnapshot</key>
     <map>
@@ -585,29 +573,6 @@
       <key>Value</key>
       <integer>2</integer>
     </map>
-    <key>AvatarBakedTextureUploadTimeout</key>
-    <map>
-      <key>Comment</key>
-      <string>Specifes the maximum time in seconds to wait before sending your baked textures for avatar appearance.  Set to 0 to disable and wait until all baked textures are at highest resolution.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>U32</string>
-      <key>Value</key>
-      <integer>60</integer>
-    </map>
-    <key>AvatarBakedLocalTextureUpdateTimeout</key>
-    <map>
-      <key>Comment</key>
-      <string>Specifes the maximum time in seconds to wait before updating your appearance during appearance mode.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>U32</string>
-      <key>Value</key>
-      <integer>10</integer>
-    </map>
-
     <key>AvatarSex</key>
     <map>
       <key>Comment</key>
@@ -655,18 +620,7 @@
     <key>BlockAvatarAppearanceMessages</key>
         <map>
         <key>Comment</key>
-            <string>Ignores appearance messages (for simulating Ruth)</string>
-        <key>Persist</key>
-            <integer>1</integer>
-        <key>Type</key>
-            <string>Boolean</string>
-        <key>Value</key>
-            <integer>0</integer>
-        </map>
-    <key>BlockSomeAvatarAppearanceVisualParams</key>
-        <map>
-        <key>Comment</key>
-            <string>Drop around 50% of VisualParam occurances in appearance messages (for simulating Ruth)</string>
+            <string>Ignore's appearance messages (for simulating Ruth)</string>
         <key>Persist</key>
             <integer>1</integer>
         <key>Type</key>
@@ -1310,17 +1264,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>CertStore</key>
-    <map>
-      <key>Comment</key>
-      <string>Specifies the Certificate Store for certificate trust verification</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>default</string>
-    </map>
     <key>ChatBarStealsFocus</key>
     <map>
       <key>Comment</key>
@@ -1642,17 +1585,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>ChatBarCustomWidth</key>
-    <map>
-      <key>Comment</key>
-      <string>Stores customized width of chat bar.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
     <key>CreateToolCopyCenters</key>
     <map>
       <key>Comment</key>
@@ -1708,17 +1640,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>CurrentGrid</key>
-    <map>
-      <key>Comment</key>
-      <string>Currently Selected Grid</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string></string>
-    </map>
     <key>CustomServer</key>
     <map>
       <key>Comment</key>
@@ -1730,17 +1651,6 @@
       <key>Value</key>
       <string />
     </map>
-	<key>DebugAvatarRezTime</key>
-	<map>
-		<key>Comment</key>
-		<string>Display times for avatars to resolve.</string>
-		<key>Persist</key>
-		<integer>1</integer>
-		<key>Type</key>
-		<string>Boolean</string>
-		<key>Value</key>
-		<integer>0</integer>
-	</map>
     <key>DebugBeaconLineWidth</key>
     <map>
       <key>Comment</key>
@@ -2456,29 +2366,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-	<key>DefaultFemaleAvatar</key>
-	<map>
-	  <key>Comment</key>
-	  <string>Default Female Avatar</string>
-	  <key>Persist</key>
-	  <integer>1</integer>
-	  <key>Type</key>
-	  <string>String</string>
-	  <key>Value</key>
-	  <string>Female Shape &amp; Outfit</string>
-	</map>
-	<key>DefaultMaleAvatar</key>
-	<map>
-	  <key>Comment</key>
-	  <string>Default Male Avatar</string>
-	  <key>Persist</key>
-	  <integer>1</integer>
-	  <key>Type</key>
-	  <string>String</string>
-	  <key>Value</key>
-	  <string>Male Shape &amp; Outfit</string>
-	</map>
-
     <key>DefaultObjectTexture</key>
     <map>
       <key>Comment</key>
@@ -2732,17 +2619,6 @@
       <key>Value</key>
       <integer>4</integer>
     </map>
-    <key>DumpVFSCaches</key>
-    <map>
-      <key>Comment</key>
-      <string>Dump VFS caches on startup.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
     <key>DynamicCameraStrength</key>
     <map>
       <key>Comment</key>
@@ -2852,17 +2728,6 @@
         <string>Boolean</string>
         <key>Value</key>
         <integer>0</integer>
-    </map>
-	<key>FeatureManagerHTTPTable</key>
-      <map>
-        <key>Comment</key>
-        <string>Base directory for HTTP feature/gpu table fetches</string>
-        <key>Persist</key>
-        <integer>1</integer>
-        <key>Type</key>
-        <string>String</string>
-        <key>Value</key>
-        <string>http://viewer-settings.secondlife.com</string>
     </map>
     <key>FPSLogFrequency</key>
     <map>
@@ -3321,17 +3186,6 @@
       <key>Value</key>
       <real>1.0</real>
     </map>
-    <key>FlycamBuildModeScale</key>
-    <map>
-      <key>Comment</key>
-      <string>Scale factor to apply to flycam movements when in build mode.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>F32</string>
-      <key>Value</key>
-      <real>1.0</real>
-    </map>
     <key>FlycamFeathering</key>
     <map>
       <key>Comment</key>
@@ -3579,17 +3433,6 @@
       <key>Value</key>
       <real>9.0</real>
     </map>
-    <key>ForceAssetFail</key>
-    <map>
-      <key>Comment</key>
-      <string>Force wearable fetches to fail for this asset type.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>U32</string>
-      <key>Value</key>
-      <integer>255</integer>
-    </map>
     <key>ForceShowGrid</key>
     <map>
       <key>Comment</key>
@@ -3632,7 +3475,7 @@
       <key>Type</key>
       <string>F32</string>
       <key>Value</key>
-      <real>3</real>
+      <real>1.33329999447</real>
     </map>
     <key>FullScreenAutoDetectAspectRatio</key>
     <map>
@@ -3643,18 +3486,29 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
-    <key>GesturesMarketplaceURL</key>
+    <key>FullScreenHeight</key>
     <map>
       <key>Comment</key>
-      <string>URL to the Gestures Marketplace</string>
+      <string>Fullscreen resolution in height</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>String</string>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>768</integer>
+    </map>
+    <key>FullScreenWidth</key>
+    <map>
+      <key>Comment</key>
+      <string>Fullscreen resolution in width</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
       <key>Value</key>
-      <string>https://www.xstreetsl.com/modules.php?name=Marketplace&amp;CategoryID=233</string>
+      <integer>1024</integer>
     </map>
     <key>GridCrossSections</key>
     <map>
@@ -3885,7 +3739,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>0</integer>
     </map>
     <key>InBandwidth</key>
     <map>
@@ -3942,17 +3796,6 @@
       <key>Value</key>
       <real>1.0</real>
     </map>
-	<key>InventoryLinking</key>
-	<map>
-		<key>Comment</key>
-		<string>Enable ability to create links to folders and items via "Paste as link".</string>
-		<key>Persist</key>
-		<integer>1</integer>
-		<key>Type</key>
-		<string>Boolean</string>
-		<key>Value</key>
-		<integer>0</integer>
-	</map>
     <key>InventorySortOrder</key>
     <map>
       <key>Comment</key>
@@ -4217,17 +4060,6 @@
         <key>Value</key>
             <integer>1</integer>
         </map>
-    <key>LastGPUClass</key>
-    <map>
-      <key>Comment</key>
-      <string>[DO NOT MODIFY] previous GPU class for tracking hardware changes</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>-1</integer>
-    </map>
     <key>LastFeatureVersion</key>
     <map>
       <key>Comment</key>
@@ -4592,17 +4424,6 @@
       <key>Value</key>
       <real>128.0</real>
     </map>
-    <key>MapServerURL</key>
-    <map>
-      <key>Comment</key>
-      <string>World map URL template for locating map tiles</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://map.secondlife.com.s3.amazonaws.com/</string>
-    </map>
     <key>MapShowEvents</key>
     <map>
       <key>Comment</key>
@@ -4669,476 +4490,80 @@
       <key>Value</key>
       <string />
     </map>
-    <key>MarketplaceURL</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/</string>
-    </map>
-    <key>MarketplaceURL_objectFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Attachments Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/attachments</string>
-    </map>
-    <key>MarketplaceURL_objectMale</key>
+    <key>MaxDragDistance</key>
     <map>
       <key>Comment</key>
-      <string>URL to the Marketplace Attachments Male</string>
+      <string>Maximum allowed translation distance in a single operation of translate tool (meters from start point)</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>String</string>
+      <string>F32</string>
       <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/attachments</string>
+      <real>48.0</real>
     </map>
-    <key>MarketplaceURL_clothingFemale</key>
+    <key>MaxSelectDistance</key>
     <map>
       <key>Comment</key>
-      <string>URL to the Marketplace Clothing Female</string>
+      <string>Maximum allowed selection distance (meters from avatar)</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>String</string>
+      <string>F32</string>
       <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/clothing_female_avatar</string>
+      <real>64.0</real>
     </map>
-    <key>MarketplaceURL_clothingMale</key>
+    <key>MeanCollisionBump</key>
     <map>
       <key>Comment</key>
-      <string>URL to the Marketplace Clothing Male</string>
+      <string>You have experienced an abuse of being bumped by an object or avatar</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>String</string>
+      <string>Boolean</string>
       <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/clothing_male_avatar</string>
-    </map>
-    <key>MarketplaceURL_bodypartFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Bodyparts Female</string>
-      <key>Persist</key>
       <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com</string>
     </map>
-    <key>MarketplaceURL_bodypartMale</key>
+    <key>MeanCollisionPhysical</key>
     <map>
       <key>Comment</key>
-      <string>URL to the Marketplace Bodyparts Male</string>
+      <string>You have experienced an abuse from a physical object</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>String</string>
+      <string>Boolean</string>
       <key>Value</key>
-      <string>http://marketplace.secondlife.com/</string>
-    </map>
-    <key>MarketplaceURL_glovesMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Gloves Male</string>
-      <key>Persist</key>
       <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men</string>
     </map>
-    <key>MarketplaceURL_glovesFemale</key>
+    <key>MeanCollisionPushObject</key>
     <map>
       <key>Comment</key>
-      <string>URL to the Marketplace Gloves Female</string>
+      <string>You have experienced an abuse of being pushed by a scripted object</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>String</string>
+      <string>Boolean</string>
       <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men</string>
-    </map>
-    <key>MarketplaceURL_jacketFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Jacket Female</string>
-      <key>Persist</key>
       <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/jacket_womens</string>
     </map>
-    <key>MarketplaceURL_jacketMale</key>
+    <key>MeanCollisionScripted</key>
     <map>
       <key>Comment</key>
-      <string>URL to the Marketplace Jacket Male</string>
+      <string>You have experienced an abuse from a scripted object</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>String</string>
+      <string>Boolean</string>
       <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/jacket_mens</string>
-    </map>
-    <key>MarketplaceURL_shirtFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Shirt Female</string>
-      <key>Persist</key>
       <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/shirt_womens</string>
     </map>
-    <key>MarketplaceURL_shirtMale</key>
+    <key>MeanCollisionSelected</key>
     <map>
       <key>Comment</key>
-      <string>URL to the Marketplace Shirt Male</string>
+      <string>You have experienced an abuse of being pushed via a selected object</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/shirt_mens</string>
-    </map>
-    <key>MarketplaceURL_undershirtFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Undershirt Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/undershirt_womens</string>
-    </map>
-    <key>MarketplaceURL_undershirtMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Undershirt Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/undershirt_mens</string>
-    </map>
-    <key>MarketplaceURL_skirtFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Skirt Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/skirts_women</string>
-    </map>
-    <key>MarketplaceURL_skirtMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Skirt Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/skirts_women</string>
-    </map>
-    <key>MarketplaceURL_pantsFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Pants Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/pants_women</string>
-    </map>
-    <key>MarketplaceURL_pantsMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Pants Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/pants_men</string>
-    </map>
-    <key>MarketplaceURL_underpantsFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Underwear Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/underwear_women</string>
-    </map>
-    <key>MarketplaceURL_underpantsMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Underwear Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/underwear_men</string>
-    </map>
-    <key>MarketplaceURL_shoesFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Shoes Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/shoes_women</string>
-    </map>
-    <key>MarketplaceURL_shoesMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Shoes Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/shoes_men</string>
-    </map>
-    <key>MarketplaceURL_socksFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Socks Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/socks_women</string>
-    </map>
-    <key>MarketplaceURL_socksMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Socks Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/socks_women</string>
-    </map>
-    <key>MarketplaceURL_tattooMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Tattoo Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men</string>
-    </map>
-    <key>MarketplaceURL_tattooFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Tattoo Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men</string>
-    </map>
-    <key>MarketplaceURL_hairFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Hair Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/womens_hair</string>
-    </map>
-    <key>MarketplaceURL_hairMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Hair Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/mens_hair</string>
-    </map>
-    <key>MarketplaceURL_eyesFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Eyes Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/womens_eyes</string>
-    </map>
-    <key>MarketplaceURL_eyesMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Eyes Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/mens_eyes</string>
-    </map>
-    <key>MarketplaceURL_shapeFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Shape Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/womens_shape</string>
-    </map>
-    <key>MarketplaceURL_shapeMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Shape Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/mens_shape</string>
-    </map>
-    <key>MarketplaceURL_skinFemale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Skin Female</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/womens_skin</string>
-    </map>
-    <key>MarketplaceURL_skinMale</key>
-    <map>
-      <key>Comment</key>
-      <string>URL to the Marketplace Skins Male</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://marketplace.secondlife.com/trampoline/viewer21/mens_skin</string>
-    </map>
-    <key>MaxDragDistance</key>
-    <map>
-      <key>Comment</key>
-      <string>Maximum allowed translation distance in a single operation of translate tool (meters from start point)</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>F32</string>
-      <key>Value</key>
-      <real>48.0</real>
-    </map>
-    <key>MaxSelectDistance</key>
-    <map>
-      <key>Comment</key>
-      <string>Maximum allowed selection distance (meters from avatar)</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>F32</string>
-      <key>Value</key>
-      <real>64.0</real>
-    </map>
-    <key>MaxWearableWaitTime</key>
-    <map>
-      <key>Comment</key>
-      <string>Max seconds to wait for wearable assets to fetch.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>F32</string>
-      <key>Value</key>
-      <real>60.0</real>
-    </map>
-    <key>MeanCollisionBump</key>
-    <map>
-      <key>Comment</key>
-      <string>You have experienced an abuse of being bumped by an object or avatar</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>MeanCollisionPhysical</key>
-    <map>
-      <key>Comment</key>
-      <string>You have experienced an abuse from a physical object</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>MeanCollisionPushObject</key>
-    <map>
-      <key>Comment</key>
-      <string>You have experienced an abuse of being pushed by a scripted object</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>MeanCollisionScripted</key>
-    <map>
-      <key>Comment</key>
-      <string>You have experienced an abuse from a scripted object</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>MeanCollisionSelected</key>
-    <map>
-      <key>Comment</key>
-      <string>You have experienced an abuse of being pushed via a selected object</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
+      <string>Boolean</string>
       <key>Value</key>
       <integer>0</integer>
     </map>
@@ -5361,7 +4786,7 @@
       <string>Boolean</string>
       <key>Value</key>
       <integer>0</integer>
-    </map> 
+    </map>
     <key>MouseSun</key>
     <map>
       <key>Comment</key>
@@ -5373,18 +4798,7 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>MultipleAttachments</key>
-    <map>
-      <key>Comment</key>
-      <string>Allow multiple objects to be attached to a single attachment point.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-   <key>MuteAmbient</key>
+    <key>MuteAmbient</key>
     <map>
       <key>Comment</key>
       <string>Ambient sound effects, such as wind noise, play at 0 volume</string>
@@ -5981,17 +5395,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>ParticipantListShowIcons</key>
-    <map>
-      <key>Comment</key>
-      <string>Show/hide people icons in participant list</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
     <key>PerAccountSettingsFile</key>
     <map>
       <key>Comment</key>
@@ -6170,19 +5573,6 @@
       <key>Value</key>
       <integer>8</integer>
     </map>
-
-   <key>PluginUseReadThread</key>
-    <map>
-      <key>Comment</key>
-      <string>Use a separate thread to read incoming messages from plugins</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-
     <key>PrecachingDelay</key>
     <map>
       <key>Comment</key>
@@ -6436,40 +5826,7 @@
         <key>Value</key>
             <real>1.0</real>
         </map>
-  <key>MediaRollOffRate</key>
-  <map>
-    <key>Comment</key>
-    <string>Multiplier to change rate of media attenuation</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>0.125</real>
-  </map>
-  <key>MediaRollOffMin</key>
-  <map>
-    <key>Comment</key>
-    <string>Adjusts the distance at which media attentuation starts</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>5.0</real>
-  </map>
-  <key>MediaRollOffMax</key>
-  <map>
-    <key>Comment</key>
-    <string>Distance at which media volume is set to 0</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>F32</string>
-    <key>Value</key>
-    <real>30.0</real>
-  </map>
-  <key>RecentItemsSortOrder</key>
+    <key>RecentItemsSortOrder</key>
     <map>
       <key>Comment</key>
       <string>Specifies sort key for recent inventory items (+0 = name, +1 = date, +2 = folders always by name, +4 = system folders to top)</string>
@@ -6502,17 +5859,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>QuickBuyCurrency</key>
-    <map>
-      <key>Comment</key>
-      <string>Toggle between HTML based currency purchase floater and legacy XUI version</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
     <key>RegionTextureSize</key>
     <map>
       <key>Comment</key>
@@ -6621,7 +5967,7 @@
       <key>Type</key>
       <string>S32</string>
       <key>Value</key>
-      <integer>12</integer>
+      <integer>35</integer>
     </map>
     <key>RenderAvatarVP</key>
     <map>
@@ -8196,17 +7542,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-  <key>RenderUseStreamVBO</key>
-  <map>
-    <key>Comment</key>
-    <string>Use VBO's for stream buffers</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>Boolean</string>
-    <key>Value</key>
-    <integer>1</integer>
-  </map>
     <key>RenderVolumeLODFactor</key>
     <map>
       <key>Comment</key>
@@ -8361,17 +7696,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>SecondLifeEnterprise</key>
-    <map>
-      <key>Comment</key>
-      <string>Enables Second Life Enterprise features</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>	
     <key>SelectMovableOnly</key>
     <map>
       <key>Comment</key>
@@ -8548,28 +7872,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>ShowBuildButton</key>
-    <map>
-      <key>Comment</key>
-      <string>Shows/Hides Build button in the bottom tray.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>ShowCameraButton</key>
-    <map>
-      <key>Comment</key>
-      <string>Show/Hide View button in the bottom tray.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
     <key>ShowConsoleWindow</key>
     <map>
       <key>Comment</key>
@@ -8603,17 +7905,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>ShowBetaGrids</key>
-    <map>
-      <key>Comment</key>
-      <string>Display the beta grids in the grid selection control.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>	
     <key>ShowCrosshairs</key>
     <map>
       <key>Comment</key>
@@ -8636,10 +7927,10 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>ShowEmptyFoldersWhenSearching</key>
+    <key>ShowDebugAppearanceEditor</key>
     <map>
       <key>Comment</key>
-      <string>Shows folders that do not have any visible contents when applying a filter to inventory</string>
+      <string>Show debugging appearance editor</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
@@ -8647,16 +7938,16 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>ShowGestureButton</key>
+    <key>ShowEmptyFoldersWhenSearching</key>
     <map>
       <key>Comment</key>
-      <string>Shows/Hides Gesture button in the bottom tray.</string>
+      <string>Shows folders that do not have any visible contents when applying a filter to inventory</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>0</integer>
     </map>
     <key>ShowHoverTips</key>
     <map>
@@ -8680,27 +7971,16 @@
       <key>Value</key>
       <integer>0</integer>
     </map>    
-    <key>ShowMiniMapButton</key>
+    <key>ShowCameraButton</key>                
     <map>
       <key>Comment</key>
-      <string>Shows/Hides Mini-Map button in the bottom tray.</string>
+      <string>Show/Hide Camera button in the bottom tray</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>ShowMoveButton</key>
-    <map>
-      <key>Comment</key>
-      <string>Shows/Hides Move button in the bottom tray.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
+      <integer>1</integer>   
     </map>
 	<key>ShowScriptErrors</key>
     <map>
@@ -8722,45 +8002,34 @@
       <key>Type</key>
       <string>S32</string>
       <key>Value</key>
-      <integer>1</integer>
-    </map>
-    <key>ShowSearchButton</key>
-    <map>
-      <key>Comment</key>
-      <string>Shows/Hides Search button in the bottom tray.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>ShowSnapshotButton</key>
+    <key>ShowSnapshotButton</key>                
     <map>
       <key>Comment</key>
-      <string>Shows/Hides Snapshot button button in the bottom tray.</string>
+      <string>Show/Hide Snapshot button button in the bottom tray</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>1</integer>   
     </map>
-    <key>ShowObjectRenderingCost</key>                
+    <key>ShowMoveButton</key>                
     <map>
       <key>Comment</key>
-      <string>Show the object rendering cost  in  build tools</string>
+      <string>Show/Hide Move button in the bottom tray</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
       <integer>1</integer>   
-    </map>        
-    <key>ShowNavbarFavoritesPanel</key>    
+    </map>    
+    <key>ShowGestureButton</key>                
     <map>
       <key>Comment</key>
-      <string>Show/Hide Navigation Bar Favorites Panel</string>
+      <string>Show/Hide Gesture button in the bottom tray</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
@@ -8768,49 +8037,38 @@
       <key>Value</key>
       <integer>1</integer>   
     </map>
-    <key>ShowNavbarNavigationPanel</key>        
+    <key>ShowObjectRenderingCost</key>                
     <map>
       <key>Comment</key>
-      <string>Show/Hide Navigation Bar Navigation Panel</string>
+      <string>Show the object rendering cost  in  build tools</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
       <integer>1</integer>   
-    </map>
-    <key>ShowWorldMapButton</key>
-    <map>
-      <key>Comment</key>
-      <string>Shows/Hides Map button in the bottom tray.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>ShowMiniLocationPanel</key>
+    </map>        
+    <key>ShowNavbarFavoritesPanel</key>    
     <map>
       <key>Comment</key>
-      <string>Show/Hide Mini-Location Panel</string>
+      <string>Show/Hide Navigation Bar Favorites Panel</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>   
     </map>
-    <key>SidebarCameraMovement</key>
+    <key>ShowNavbarNavigationPanel</key>        
     <map>
       <key>Comment</key>
-      <string>Reflects world rect changing while changing sidebar visibility.</string>
+      <string>Show/Hide Navigation Bar Navigation Panel</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>1</integer>   
     </map>
     <key>GroupListShowIcons</key>
     <map>
@@ -9277,6 +8535,17 @@
 		<key>Value</key>
 		<integer>0</integer>
 	</map>
+	<key>ShowVoiceChannelPopup</key>
+    <map>
+      <key>Comment</key>
+      <string>Controls visibility of the current voice channel popup above the voice tab</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>ShowVoiceVisualizersInCalls</key>
     <map>
       <key>Comment</key>
@@ -9288,6 +8557,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>ShowVolumeSettingsPopup</key>
+    <map>
+      <key>Comment</key>
+      <string>Show individual volume slider for voice, sound effects, etc</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>SkinCurrent</key>
     <map>
       <key>Comment</key>
@@ -9626,17 +8906,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>TextureDiscardLevel</key>
-    <map>
-      <key>Comment</key>
-      <string>Specify texture resolution (0 = highest, 5 = lowest)</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>U32</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
     <key>TextureLoadFullRes</key>
     <map>
       <key>Comment</key>
@@ -10924,17 +10193,7 @@
       <key>Value</key>
       <real>10.0</real>
     </map>
-    <key>UseNewWalkRun</key>
-    <map>
-      <key>Comment</key>
-      <string>Replace standard walk/run animations with new ones.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
+
     <key>UseStartScreen</key>
     <map>
       <key>Comment</key>
@@ -11134,17 +10393,6 @@
       <key>Value</key>
       <string></string>
     </map>
-    <key>VivoxDebugSIPURIHostName</key>
-    <map>
-      <key>Comment</key>
-      <string>Hostname portion of vivox SIP URIs (empty string for the default).</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string></string>
-    </map>
     <key>VivoxDebugVoiceAccountServerURI</key>
     <map>
       <key>Comment</key>
@@ -11156,28 +10404,6 @@
       <key>Value</key>
       <string></string>
     </map>
-    <key>VivoxVoiceHost</key>
-    <map>
-      <key>Comment</key>
-      <string>Client SLVoice host to connect to</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>127.0.0.1</string>
-    </map>
-    <key>VivoxVoicePort</key>
-    <map>
-      <key>Comment</key>
-      <string>Client SLVoice port to connect to</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>U32</string>
-      <key>Value</key>
-      <integer>44125</integer>
-    </map>
     <key>VoiceCallsFriendsOnly</key>
     <map>
       <key>Comment</key>
@@ -11189,28 +10415,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>VoiceEffectExpiryWarningTime</key>
-    <map>
-      <key>Comment</key>
-      <string>How much notice to give of Voice Morph subscriptions expiry, in seconds.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>259200</integer>
-    </map>
-    <key>VoiceMorphingEnabled</key>
-    <map>
-      <key>Comment</key>
-      <string>Whether or not to enable Voice Morphs and show the UI.</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
     <key>AutoDisengageMic</key>
     <map>
       <key>Comment</key>
@@ -11332,17 +10536,6 @@
       <key>Value</key>
       <string>Default</string>
     </map>
-    <key>VoiceLogFile</key>
-    <map>
-      <key>Comment</key>
-      <string>Log file to use when launching the voice daemon</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string></string>
-    </map>
     <key>VoiceOutputAudioDevice</key>
     <map>
       <key>Comment</key>
@@ -11387,17 +10580,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>VoiceServerType</key>
-    <map>
-      <key>Comment</key>
-      <string>The type of voice server to connect to.</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>vivox</string>
-    </map>
     <key>WLSkyDetail</key>
     <map>
       <key>Comment</key>
@@ -11416,9 +10598,9 @@
       <key>Persist</key>
       <integer>0</integer>
       <key>Type</key>
-      <string>S32</string>
+      <string>Boolean</string>
       <key>Value</key>
-      <integer>-1</integer>
+      <integer>0</integer>
     </map>
     <key>WaterEditPresets</key>
     <map>
@@ -11464,38 +10646,27 @@
       <key>Value</key>
       <real>50.0</real>
     </map>
-    <key>WellIconFlashCount</key>
+    <key>WindLightUseAtmosShaders</key>
     <map>
       <key>Comment</key>
-      <string>Number of flashes of IM Well and Notification Well icons after which flashing buttons stay lit up. Requires restart.</string>
+      <string>Whether to enable or disable WindLight atmospheric shaders.</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>S32</string>
+      <string>Boolean</string>
       <key>Value</key>
-      <integer>3</integer>
-    </map>
-    <key>WellIconFlashPeriod</key>
-    <map>
-      <key>Comment</key>
-      <string>Period at which IM Well and Notification Well icons flash (seconds). Requires restart.</string>
-      <key>Persist</key>
       <integer>1</integer>
-      <key>Type</key>
-      <string>F32</string>
-      <key>Value</key>
-      <real>0.25</real>
     </map>
-    <key>WindLightUseAtmosShaders</key>
+    <key>WindowFullScreen</key>
     <map>
       <key>Comment</key>
-      <string>Whether to enable or disable WindLight atmospheric shaders.</string>
+      <string>Run SL in fullscreen mode</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>0</integer>
     </map>
     <key>WindowHeight</key>
     <map>
@@ -11761,124 +10932,5 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-
-    <!-- Settings below are for back compatibility only.
-    They are not used in current viewer anymore. But they can't be removed to avoid
-    influence on previous versions of the viewer in case of settings are not used or default value
-    should be changed. See also EXT-6661. -->
-    <!-- 1.23 settings -->
-    <key>ShowVoiceChannelPopup</key>
-    <map>
-      <key>Comment</key>
-      <string>Controls visibility of the current voice channel popup above the voice tab</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>ShowVolumeSettingsPopup</key>
-    <map>
-      <key>Comment</key>
-      <string>Show individual volume slider for voice, sound effects, etc</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>max_texture_dimension_X</key>
-    <map>
-      <key>Comment</key>
-      <string>Maximum texture width for user uploaded textures</string>
-      <key>Persist</key>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>2048</integer>
-    </map>
-    <key>max_texture_dimension_Y</key>
-    <map>
-      <key>Comment</key>
-      <string>Maximum texture height for user uploaded textures</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>2048</integer>
-    </map>
-    <!-- End of back compatibility settings -->
-    <key>teleport_offer_invitation_max_length</key>
-    <map>
-      <key>Comment</key>
-      <string>Maximum length of teleport offer invitation line editor. 254 - max_location_url_length(76) = 178</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>178</integer>
-    </map>
-    <key>always_showable_floaters</key>
-    <map>
-      <key>Comment</key>
-      <string>Floaters that can be shown despite mouselook mode</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>LLSD</string>
-      <key>Value</key>
-      <array>
-	      <string>snapshot</string>
-	      <string>mini_map</string>
-      </array>
-    </map>
-    <key>LandmarksSortedByDate</key>
-    <map>
-      <key>Comment</key>
-      <string>Reflects landmarks panel sorting order.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
-    <key>OutfitOperationsTimeout</key>
-    <map>
-      <key>Comment</key>
-      <string>Timeout for outfit related operations.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>180</integer>
-    </map>
-    <key>HeightUnits</key>
-    <map>
-      <key>Comment</key>
-      <string>Determines which metric units are used: 1(TRUE) for meter and 0(FALSE) for foot.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
-    <key>TipToastMessageLineCount</key>
-    <map>
-      <key>Comment</key>
-      <string>Max line count of text message on tip toast.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>10</integer>
-    </map>
 </map>
 </llsd>
diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi
index 3ea7897501fd728f811944528cf1d19e56db9fd8..a7322749ca835d4c4be7699a7a207acbe8db1a34 100644
--- a/indra/newview/installers/windows/installer_template.nsi
+++ b/indra/newview/installers/windows/installer_template.nsi
@@ -1,6 +1,6 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; secondlife setup.nsi
-;; Copyright 2004-2010, Linden Research, Inc.
+;; Copyright 2004-2008, Linden Research, Inc.
 ;;
 ;; NSIS Unicode 2.38.1 or higher required
 ;; http://www.scratchpaper.com/
@@ -797,12 +797,6 @@ WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
 ;; URL param must be last item passed to viewer, it ignores subsequent params
 ;; to avoid parameter injection attacks.
 WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
-WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info"(default)" "URL:Second Life"
-WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info" "URL Protocol" ""
-WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
-;; URL param must be last item passed to viewer, it ignores subsequent params
-;; to avoid parameter injection attacks.
-WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
 
 ; write out uninstaller
 WriteUninstaller "$INSTDIR\uninst.exe"
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 42b78a84af2557bc0917ef90edf502441e0db610..ec465358faaeadfde36ca23f4deaf0439afb6704 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -2,25 +2,31 @@
  * @file llagent.cpp
  * @brief LLAgent class implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -39,6 +45,7 @@
 #include "llchannelmanager.h"
 #include "llconsole.h"
 #include "llfloatercamera.h"
+#include "llfloatercustomize.h"
 #include "llfloaterreg.h"
 #include "llfloatertools.h"
 #include "llgroupactions.h"
@@ -51,7 +58,6 @@
 #include "llnavigationbar.h" // to show/hide navigation bar when changing mouse look state
 #include "llnearbychatbar.h"
 #include "llnotificationsutil.h"
-#include "llpaneltopinfobar.h"
 #include "llparcel.h"
 #include "llrendersphere.h"
 #include "llsdutil.h"
@@ -67,7 +73,6 @@
 #include "llviewerdisplay.h"
 #include "llviewerjoystick.h"
 #include "llviewermediafocus.h"
-#include "llviewermenu.h"
 #include "llviewerobjectlist.h"
 #include "llviewerparcelmgr.h"
 #include "llviewerstats.h"
@@ -1221,10 +1226,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s
 	if ( distance > 1.f && heightDelta > (sqrtf(mAutoPilotStopDistance) + 1.f))
 	{
 		setFlying(TRUE);
-		// Do not force flying for "Sit" behavior to prevent flying after pressing "Stand"
-		// from an object. See EXT-1655.
-		if ("Sit" != mAutoPilotBehaviorName)
-			mAutoPilotFlyOnStop = TRUE;
+		mAutoPilotFlyOnStop = TRUE;
 	}
 
 	mAutoPilot = TRUE;
@@ -1293,8 +1295,6 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
 		{
 			resetAxes(mAutoPilotTargetFacing);
 		}
-		// Restore previous flying state before invoking mAutoPilotFinishedCallback to allow
-		// callback function to change the flying state (like in near_sit_down_point()).
 		// If the user cancelled, don't change the fly state
 		if (!user_cancel)
 		{
@@ -1490,8 +1490,6 @@ void LLAgent::propagate(const F32 dt)
 		floater_move->mBackwardButton  ->setToggleState( gAgentCamera.getAtKey() < 0 || gAgentCamera.getWalkKey() < 0 );
 		floater_move->mTurnLeftButton  ->setToggleState( gAgentCamera.getYawKey() > 0.f );
 		floater_move->mTurnRightButton ->setToggleState( gAgentCamera.getYawKey() < 0.f );
-		floater_move->mSlideLeftButton  ->setToggleState( gAgentCamera.getLeftKey() > 0.f );
-		floater_move->mSlideRightButton ->setToggleState( gAgentCamera.getLeftKey() < 0.f );
 		floater_move->mMoveUpButton    ->setToggleState( gAgentCamera.getUpKey() > 0 );
 		floater_move->mMoveDownButton  ->setToggleState( gAgentCamera.getUpKey() < 0 );
 	}
@@ -1688,11 +1686,6 @@ void LLAgent::endAnimationUpdateUI()
 		LLNavigationBar::getInstance()->setVisible(TRUE);
 		gStatusBar->setVisibleForMouselook(true);
 
-		if (gSavedSettings.getBOOL("ShowMiniLocationPanel"))
-		{
-			LLPanelTopInfoBar::getInstance()->setVisible(TRUE);
-		}
-
 		LLBottomTray::getInstance()->onMouselookModeOut();
 
 		LLSideTray::getInstance()->getButtonsPanel()->setVisible(TRUE);
@@ -1791,8 +1784,6 @@ void LLAgent::endAnimationUpdateUI()
 		LLNavigationBar::getInstance()->setVisible(FALSE);
 		gStatusBar->setVisibleForMouselook(false);
 
-		LLPanelTopInfoBar::getInstance()->setVisible(FALSE);
-
 		LLBottomTray::getInstance()->onMouselookModeIn();
 
 		LLSideTray::getInstance()->getButtonsPanel()->setVisible(FALSE);
@@ -3069,7 +3060,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
 		return;
 	}
 
-	if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures())
+	if (gAgentCamera.cameraCustomizeAvatar())
 	{
 		// ignore baked textures when in customize mode
 		return;
@@ -3090,30 +3081,21 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
 		mesgsys->getUUIDFast(_PREHASH_WearableData, _PREHASH_TextureID, texture_id, texture_block);
 		mesgsys->getU8Fast(_PREHASH_WearableData, _PREHASH_TextureIndex, texture_index, texture_block);
 
-
-		if ((S32)texture_index < TEX_NUM_INDICES )
-		{	
-			const LLVOAvatarDictionary::TextureEntry *texture_entry = LLVOAvatarDictionary::instance().getTexture((ETextureIndex)texture_index);
-			if (texture_entry)
+		if ((S32)texture_index < BAKED_NUM_INDICES 
+			&& gAgentQueryManager.mActiveCacheQueries[texture_index] == query_id)
+		{
+			if (texture_id.notNull())
 			{
-				EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex;
-
-				if (gAgentQueryManager.mActiveCacheQueries[baked_index] == query_id)
-				{
-					if (texture_id.notNull())
-					{
-						//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
-						gAgentAvatarp->setCachedBakedTexture((ETextureIndex)texture_index, texture_id);
-						//gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
-						gAgentQueryManager.mActiveCacheQueries[baked_index] = 0;
-						num_results++;
-					}
-					else
-					{
-						// no cache of this bake. request upload.
-						gAgentAvatarp->requestLayerSetUpload(baked_index);
-					}
-				}
+				//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
+				gAgentAvatarp->setCachedBakedTexture(LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)texture_index), texture_id);
+				//gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
+				gAgentQueryManager.mActiveCacheQueries[texture_index] = 0;
+				num_results++;
+			}
+			else
+			{
+				// no cache of this bake. request upload.
+				gAgentAvatarp->requestLayerSetUpload((EBakedTextureIndex)texture_index);
 			}
 		}
 	}
@@ -3228,9 +3210,6 @@ bool LLAgent::teleportCore(bool is_local)
 	// hide land floater too - it'll be out of date
 	LLFloaterReg::hideInstance("about_land");
 
-	// hide the search floater (EXT-8276)
-	LLFloaterReg::hideInstance("search");
-
 	LLViewerParcelMgr::getInstance()->deselectLand();
 	LLViewerMediaFocus::getInstance()->clearFocus();
 
@@ -3252,7 +3231,7 @@ bool LLAgent::teleportCore(bool is_local)
 	
 	// MBW -- Let the voice client know a teleport has begun so it can leave the existing channel.
 	// This was breaking the case of teleporting within a single sim.  Backing it out for now.
-//	LLVoiceClient::getInstance()->leaveChannel();
+//	gVoiceClient->leaveChannel();
 	
 	return true;
 }
@@ -3396,13 +3375,10 @@ void LLAgent::setTeleportState(ETeleportState state)
 	if (mTeleportState == TELEPORT_MOVING)
 	{
 		// We're outa here. Save "back" slurl.
-		LLAgentUI::buildSLURL(mTeleportSourceSLURL);
+		mTeleportSourceSLURL = LLAgentUI::buildSLURL();
 	}
 	else if(mTeleportState == TELEPORT_ARRIVING)
 	{
-		// First two position updates after a teleport tend to be weird
-		LLViewerStats::getInstance()->mAgentPositionSnaps.mCountOfNextUpdatesToIgnore = 2;
-
 		// Let the interested parties know we've teleported.
 		LLViewerParcelMgr::getInstance()->onTeleportFinished(false, getPositionGlobal());
 	}
@@ -3538,11 +3514,12 @@ void LLAgent::sendAgentSetAppearance()
 {
 	if (!isAgentAvatarValid()) return;
 
-	if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && gAgentAvatarp->isUsingBakedTextures())) 
+	if (gAgentQueryManager.mNumPendingQueries > 0 && !gAgentCamera.cameraCustomizeAvatar()) 
 	{
 		return;
 	}
 
+
 	llinfos << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << llendl;
 	//dumpAvatarTEs( "sendAgentSetAppearance()" );
 
@@ -3574,7 +3551,7 @@ void LLAgent::sendAgentSetAppearance()
 		const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
 
 		// if we're not wearing a skirt, we don't need the texture to be baked
-		if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
+		if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(WT_SKIRT))
 		{
 			continue;
 		}
@@ -3593,21 +3570,29 @@ void LLAgent::sendAgentSetAppearance()
 		llinfos << "TAT: Sending cached texture data" << llendl;
 		for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
 		{
-			BOOL generate_valid_hash = TRUE;
-			if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLVOAvatarDefines::EBakedTextureIndex)baked_index))
+			const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
+			LLUUID hash;
+			for (U8 i=0; i < baked_dict->mWearables.size(); i++)
 			{
-				generate_valid_hash = FALSE;
-				llinfos << "Not caching baked texture upload for " << (U32)baked_index << " due to being uploaded at low resolution." << llendl;
+				// EWearableType wearable_type = gBakedWearableMap[baked_index][wearable_num];
+				const EWearableType wearable_type = baked_dict->mWearables[i];
+				// MULTI-WEARABLE: fixed to 0th - extend to everything once messaging works.
+				const LLWearable* wearable = gAgentWearables.getWearable(wearable_type,0);
+				if (wearable)
+				{
+					hash ^= wearable->getAssetID();
+				}
 			}
-
-			const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, generate_valid_hash);
 			if (hash.notNull())
 			{
-				ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index);
-				msg->nextBlockFast(_PREHASH_WearableData);
-				msg->addUUIDFast(_PREHASH_CacheID, hash);
-				msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
+				hash ^= baked_dict->mWearablesHashID;
 			}
+
+			const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
+
+			msg->nextBlockFast(_PREHASH_WearableData);
+			msg->addUUIDFast(_PREHASH_CacheID, hash);
+			msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
 		}
 		msg->nextBlockFast(_PREHASH_ObjectData);
 		gAgentAvatarp->sendAppearanceMessage( gMessageSystem );
@@ -3627,7 +3612,7 @@ void LLAgent::sendAgentSetAppearance()
 		 param;
 		 param = (LLViewerVisualParam*)gAgentAvatarp->getNextVisualParam())
 	{
-		if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) // do not transmit params of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
+		if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
 		{
 			msg->nextBlockFast(_PREHASH_VisualParam );
 			
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 0d95683a9837c60a731af0e3a8a1fbd752a5c7db..a460077b7e7ae119a3b5970084f82fa86594f113 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -2,25 +2,31 @@
  * @file llagent.h
  * @brief LLAgent class header file
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -36,7 +42,6 @@
 #include "llpointer.h"
 #include "lluicolor.h"
 #include "llvoavatardefines.h"
-#include "llslurl.h"
 
 extern const BOOL 	ANIMATE;
 extern const U8 	AGENT_STATE_TYPING;  // Typing indication
@@ -509,13 +514,13 @@ class LLAgent : public LLOldEvents::LLObservable
 
 public:
 	static void 	parseTeleportMessages(const std::string& xml_filename);
-	const void getTeleportSourceSLURL(LLSLURL& slurl) const { slurl = mTeleportSourceSLURL; }
+	const std::string getTeleportSourceSLURL() const { return mTeleportSourceSLURL; }
 public:
 	// ! TODO ! Define ERROR and PROGRESS enums here instead of exposing the mappings.
 	static std::map<std::string, std::string> sTeleportErrorMessages;
 	static std::map<std::string, std::string> sTeleportProgressMessages;
 private:
-	LLSLURL	mTeleportSourceSLURL; 			// SLURL where last TP began
+	std::string		mTeleportSourceSLURL; 			// SLURL where last TP began
 
 	//--------------------------------------------------------------------
 	// Teleport Actions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 6c050a1309f05cdf251063a4af475f1d5ddca7f0..9638d0e94f821482f7454dc1b92425699dfcce8c 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -2,25 +2,31 @@
  * @file llagentcamera.cpp
  * @brief LLAgent class implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,6 +38,7 @@
 #include "llagent.h"
 #include "llanimationstates.h"
 #include "llfloatercamera.h"
+#include "llfloatercustomize.h"
 #include "llfloaterreg.h"
 #include "llhudmanager.h"
 #include "lljoystickbutton.h"
@@ -41,7 +48,6 @@
 #include "llviewercamera.h"
 #include "llviewercontrol.h"
 #include "llviewerjoystick.h"
-#include "llviewermenu.h"
 #include "llviewerobjectlist.h"
 #include "llviewerregion.h"
 #include "llviewerwindow.h"
@@ -79,7 +85,7 @@ const F32 MAX_CAMERA_SMOOTH_DISTANCE = 50.0f;
 
 const F32 HEAD_BUFFER_SIZE = 0.3f;
 
-const F32 CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP = 0.1f;
+const F32 CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP = 0.2f;
 
 const F32 LAND_MIN_ZOOM = 0.15f;
 
@@ -89,8 +95,6 @@ const F32 OBJECT_MIN_ZOOM = 0.02f;
 const F32 APPEARANCE_MIN_ZOOM = 0.39f;
 const F32 APPEARANCE_MAX_ZOOM = 8.f;
 
-const F32 CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST = 3.5f;
-
 const F32 GROUND_TO_AIR_CAMERA_TRANSITION_TIME = 0.5f;
 const F32 GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME = 0.5f;
 
@@ -152,6 +156,7 @@ LLAgentCamera::LLAgentCamera() :
 	mFocusObjectOffset(),
 	mFocusDotRadius( 0.1f ),			// meters
 	mTrackFocusObject(TRUE),
+	mUIOffset(0.f),
 
 	mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed
 	mWalkKey(0), // like AtKey, but causes less forward thrust
@@ -202,13 +207,13 @@ void LLAgentCamera::init()
 	
 	mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset");
 
-	mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView");
-	mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView");
-	mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView");
+	mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getVector3("CameraOffsetRearView");
+	mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getVector3("CameraOffsetFrontView");
+	mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getVector3("CameraOffsetGroupView");
 
-	mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView");
-	mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView");
-	mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView");
+	mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getVector3d("FocusOffsetRearView");
+	mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getVector3d("FocusOffsetFrontView");
+	mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getVector3d("FocusOffsetGroupView");
 
 	mCameraCollidePlane.clearVec();
 	mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale");
@@ -935,7 +940,7 @@ void LLAgentCamera::cameraZoomIn(const F32 fraction)
 		*/
 	}
 
-	if(cameraCustomizeAvatar())
+	if( cameraCustomizeAvatar() )
 	{
 		new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM );
 	}
@@ -1402,6 +1407,13 @@ void LLAgentCamera::updateCamera()
 
 //	llinfos << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << llendl;
 
+	F32 ui_offset = 0.f;
+	if( CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode ) 
+	{
+		ui_offset = calcCustomizeAvatarUIOffset( camera_pos_global );
+	}
+
+
 	LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal);
 	
 	mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global);
@@ -1412,6 +1424,9 @@ void LLAgentCamera::updateCamera()
 	LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent);
 	//LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent);
 	//end Ventrella
+
+	//RN: translate UI offset after camera is oriented properly
+	LLViewerCamera::getInstance()->translate(LLViewerCamera::getInstance()->getLeftAxis() * ui_offset);
 	
 	// Change FOV
 	LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor));
@@ -1516,6 +1531,38 @@ void LLAgentCamera::validateFocusObject()
 	}
 }
 
+//-----------------------------------------------------------------------------
+// calcCustomizeAvatarUIOffset()
+//-----------------------------------------------------------------------------
+F32 LLAgentCamera::calcCustomizeAvatarUIOffset(const LLVector3d& camera_pos_global)
+{
+	F32 ui_offset = 0.f;
+
+	if (gFloaterCustomize)
+	{
+		const LLRect& rect = gFloaterCustomize->getRect();
+
+		// Move the camera so that the avatar isn't covered up by this floater.
+		F32 fraction_of_fov = 0.5f - (0.5f * (1.f - llmin(1.f, ((F32)rect.getWidth() / (F32)gViewerWindow->getWindowWidthScaled()))));
+		F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();  // radians
+		F32 offset = tan(apparent_angle);
+
+		if( rect.mLeft < (gViewerWindow->getWindowWidthScaled() - rect.mRight) )
+		{
+			// Move the avatar to the right (camera to the left)
+			ui_offset = offset;
+		}
+		else
+		{
+			// Move the avatar to the left (camera to the right)
+			ui_offset = -offset;
+		}
+	}
+	F32 range = (F32)dist_vec(camera_pos_global, getFocusGlobal());
+	mUIOffset = lerp(mUIOffset, ui_offset, LLCriticalDamp::getInterpolant(0.05f));
+	return mUIOffset * range;
+}
+
 //-----------------------------------------------------------------------------
 // calcFocusPositionTargetGlobal()
 //-----------------------------------------------------------------------------
@@ -1616,8 +1663,8 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset()
 		agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation();
 	}
 
-	focus_offset = convert_from_llsd<LLVector3d>(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, "");
-	return focus_offset * agent_rot;
+	focus_offset = mFocusOffsetInitial[mCameraPreset] * agent_rot;
+	return focus_offset;
 }
 
 void LLAgentCamera::setupSitCamera()
@@ -1951,7 +1998,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 
 LLVector3 LLAgentCamera::getCameraOffsetInitial()
 {
-	return convert_from_llsd<LLVector3>(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, "");
+	return mCameraOffsetInitial[mCameraPreset];
 }
 
 
@@ -2057,10 +2104,6 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate)
 	// visibility changes at end of animation
 	gViewerWindow->getWindow()->resetBusyCount();
 
-	// Menus should not remain open on switching to mouselook...
-	LLMenuGL::sMenuContainer->hideMenus();
-	LLUI::clearPopups();
-
 	// unpause avatar animation
 	gAgent.unpauseAnimation();
 
@@ -2164,7 +2207,12 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate)
 		// unpause avatar animation
 		gAgent.unpauseAnimation();
 
+		const U32 old_flags = gAgent.getControlFlags();
 		gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
+		if (old_flags != gAgent.getControlFlags())
+		{
+			gAgent.setFlagsDirty();
+		}
 
 		if (animate)
 		{
@@ -2223,7 +2271,13 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
 		}
 		updateLastCamera();
 		mCameraMode = CAMERA_MODE_THIRD_PERSON;
+		const U32 old_flags = gAgent.getControlFlags();
 		gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
+		if (old_flags != gAgent.getControlFlags())
+		{
+			gAgent.setFlagsDirty();
+		}
+
 	}
 
 	// Remove any pitch from the avatar
@@ -2258,7 +2312,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
 //-----------------------------------------------------------------------------
 // changeCameraToCustomizeAvatar()
 //-----------------------------------------------------------------------------
-void LLAgentCamera::changeCameraToCustomizeAvatar()
+void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_animate)
 {
 	if (LLViewerJoystick::getInstance()->getOverrideCamera())
 	{
@@ -2273,23 +2327,40 @@ void LLAgentCamera::changeCameraToCustomizeAvatar()
 		LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset);
 	}
 
-	startCameraAnimation();
+	if (camera_animate)
+	{
+		startCameraAnimation();
+	}
+
+	// Remove any pitch from the avatar
+	//LLVector3 at = gAgent.getFrameAgent().getAtAxis();
+	//at.mV[VZ] = 0.f;
+	//at.normalize();
+	//gAgent.resetAxes(at);
 
 	if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR)
 	{
 		updateLastCamera();
 		mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR;
+		const U32 old_flags = gAgent.getControlFlags();
 		gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
+		if (old_flags != gAgent.getControlFlags())
+		{
+			gAgent.setFlagsDirty();
+		}
 
 		gFocusMgr.setKeyboardFocus( NULL );
 		gFocusMgr.setMouseCapture( NULL );
 
 		LLVOAvatarSelf::onCustomizeStart();
+	}
 
-		if (isAgentAvatarValid())
+	if (isAgentAvatarValid())
+	{
+		if(avatar_animate)
 		{
-			// Remove any pitch or rotation from the avatar
-			LLVector3 at = gAgent.getAtAxis();
+			// Remove any pitch from the avatar
+			LLVector3 at = gAgent.getFrameAgent().getAtAxis();
 			at.mV[VZ] = 0.f;
 			at.normalize();
 			gAgent.resetAxes(at);
@@ -2301,31 +2372,21 @@ void LLAgentCamera::changeCameraToCustomizeAvatar()
 
 			if (turn_motion)
 			{
-				// delay camera animation long enough to play through turn animation
-				setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP);
-			}
+				mAnimationDuration = turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP;
 
-			gAgentAvatarp->invalidateAll();
-			gAgentAvatarp->updateMeshTextures();
+			}
+			else
+			{
+				mAnimationDuration = gSavedSettings.getF32("ZoomTime");
+			}
 		}
+		setFocusGlobal(LLVector3d::zero);
+	}
+	else
+	{
+		mCameraAnimating = FALSE;
+		gAgent.endAnimationUpdateUI();
 	}
-
-	LLVector3 agent_at = gAgent.getAtAxis();
-	agent_at.mV[VZ] = 0.f;
-	agent_at.normalize();
-
-	// default focus point for customize avatar
-	LLVector3 focus_target = isAgentAvatarValid() 
-		? gAgentAvatarp->mHeadp->getWorldPosition()
-		: gAgent.getPositionAgent();
-
-	LLVector3d camera_offset(agent_at * -1.0);
-	// push camera up and out from avatar
-	camera_offset.mdV[VZ] = 0.1f; 
-	camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST;
-	LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target);
-	setAnimationDuration(gSavedSettings.getF32("ZoomTime"));
-	setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID());
 }
 
 
@@ -2347,20 +2408,6 @@ void LLAgentCamera::switchCameraPreset(ECameraPreset preset)
 // Focus point management
 //
 
-void LLAgentCamera::setAnimationDuration(F32 duration)
-{ 
-	if (mCameraAnimating)
-	{
-		// do not cut any existing camera animation short
-		F32 animation_left = llmax(0.f, mAnimationDuration - mAnimationTimer.getElapsedTimeF32());
-		mAnimationDuration = llmax(duration, animation_left);
-	}
-	else
-	{
-		mAnimationDuration = duration; 
-	}
-}
-
 //-----------------------------------------------------------------------------
 // startCameraAnimation()
 //-----------------------------------------------------------------------------
@@ -2368,9 +2415,9 @@ void LLAgentCamera::startCameraAnimation()
 {
 	mAnimationCameraStartGlobal = getCameraPositionGlobal();
 	mAnimationFocusStartGlobal = mFocusGlobal;
-	setAnimationDuration(gSavedSettings.getF32("ZoomTime"));
 	mAnimationTimer.reset();
 	mCameraAnimating = TRUE;
+	mAnimationDuration = gSavedSettings.getF32("ZoomTime");
 }
 
 //-----------------------------------------------------------------------------
@@ -2509,13 +2556,19 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object
 //-----------------------------------------------------------------------------
 void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, const LLVector3d& focus, const LLUUID &object_id)
 {
-	LLVector3d old_focus = mFocusTargetGlobal.isExactlyZero() ? focus : mFocusTargetGlobal;
+	LLVector3d old_focus = mFocusTargetGlobal;
 
 	F64 focus_delta_squared = (old_focus - focus).magVecSquared();
 	const F64 ANIM_EPSILON_SQUARED = 0.0001;
 	if (focus_delta_squared > ANIM_EPSILON_SQUARED)
 	{
 		startCameraAnimation();
+
+		if (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode) 
+		{
+			// Compensate for the fact that the camera has already been offset to make room for LLFloaterCustomize.
+			mAnimationCameraStartGlobal -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * calcCustomizeAvatarUIOffset( mAnimationCameraStartGlobal ));
+		}
 	}
 	
 	//LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) );
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 00fa6ea189095d0a5c269cc8942b539992f8483c..5cbb1de6f4b482e32d99597f18f751159e7f9776 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -2,25 +2,31 @@
  * @file llagent.h
  * @brief LLAgent class header file
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -33,7 +39,6 @@
 
 class LLPickInfo;
 class LLVOAvatarSelf;
-class LLControlVariable;
 
 //--------------------------------------------------------------------
 // Types
@@ -76,7 +81,6 @@ class LLAgentCamera
 	void			init();
 	void			cleanup();
 	void		    setAvatarObject(LLVOAvatarSelf* avatar);
-	bool			isInitialized() { return mInitialized; }
 private:
 	bool			mInitialized;
 
@@ -88,7 +92,7 @@ class LLAgentCamera
 	void			changeCameraToDefault();
 	void			changeCameraToMouselook(BOOL animate = TRUE);
 	void			changeCameraToThirdPerson(BOOL animate = TRUE);
-	void			changeCameraToCustomizeAvatar(); // Trigger transition animation
+	void			changeCameraToCustomizeAvatar(BOOL avatar_animate = TRUE, BOOL camera_animate = TRUE); // Trigger transition animation
 	void			changeCameraToFollow(BOOL animate = TRUE); 	// Ventrella
 	BOOL			cameraThirdPerson() const		{ return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); }
 	BOOL			cameraMouselook() const			{ return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); }
@@ -117,10 +121,10 @@ class LLAgentCamera
 	ECameraPreset mCameraPreset; 
 
 	/** Initial camera offsets */
-	std::map<ECameraPreset, LLPointer<LLControlVariable> > mCameraOffsetInitial;
+	std::map<ECameraPreset, LLVector3> mCameraOffsetInitial;
 
 	/** Initial focus offsets */
-	std::map<ECameraPreset, LLPointer<LLControlVariable> > mFocusOffsetInitial;
+	std::map<ECameraPreset, LLVector3d> mFocusOffsetInitial;
 
 	//--------------------------------------------------------------------
 	// Position
@@ -132,6 +136,7 @@ class LLAgentCamera
 	F32				getCameraMinOffGround(); 		// Minimum height off ground for this mode, meters
 	void			setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; }
 	BOOL			calcCameraMinDistance(F32 &obj_min_distance);
+	F32				calcCustomizeAvatarUIOffset(const LLVector3d& camera_pos_global);
 	F32				getCurrentCameraBuildOffset() 	{ return (F32)mCameraFocusOffset.length(); }
 	void			clearCameraLag() { mCameraLag.clearVec(); }
 private:
@@ -178,7 +183,7 @@ class LLAgentCamera
 public:
 	void			setCameraAnimating(BOOL b)			{ mCameraAnimating = b; }
 	BOOL			getCameraAnimating()				{ return mCameraAnimating; }
-	void			setAnimationDuration(F32 seconds);
+	void			setAnimationDuration(F32 seconds) 	{ mAnimationDuration = seconds; }
 	void			startCameraAnimation();
 	void			stopCameraAnimation();
 private:
@@ -219,6 +224,7 @@ class LLAgentCamera
 	LLVector3		mFocusObjectOffset;
 	F32				mFocusDotRadius; 				// Meters
 	BOOL			mTrackFocusObject;
+	F32				mUIOffset;	
 	
 	//--------------------------------------------------------------------
 	// Lookat / Pointat
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index d520debc31f9f37e70b53f552b815f2c75661b09..b3ed7c353ed577a9fc2b75015dc77ec26264a31c 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -4,25 +4,8 @@
  * @date   2009-07-10
  * @brief  Implementation for llagentlistener.
  * 
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
  * $/LicenseInfo$
  */
 
@@ -70,10 +53,7 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
 	}
 	else
 	{
-		std::string url = LLSLURL(event_data["regionname"], 
-								  LLVector3(event_data["x"].asReal(), 
-											event_data["y"].asReal(), 
-											event_data["z"].asReal())).getSLURLString();
+		std::string url = LLSLURL::buildSLURL(event_data["regionname"], event_data["x"], event_data["y"], event_data["z"]);
 		LLURLDispatcher::dispatch(url, NULL, false);
 	}
 }
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index f52f1361181f948a011312c35832d2a8f8f8dfd1..c4597ad6f8d55199e584c84be77f5a122fdc752d 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -2,25 +2,31 @@
  * @file llagentui.cpp
  * @brief Utility methods to process agent's data as slurl's etc. before displaying
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -70,15 +76,16 @@ void LLAgentUI::buildFullname(std::string& name)
 }
 
 //static
-void LLAgentUI::buildSLURL(LLSLURL& slurl, const bool escaped /*= true*/)
+std::string LLAgentUI::buildSLURL(const bool escaped /*= true*/)
 {
-      LLSLURL return_slurl;
-      LLViewerRegion *regionp = gAgent.getRegion();
-      if (regionp)
-      {
-		  return_slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal());
-      }
-	slurl = return_slurl;
+	std::string slurl;
+	LLViewerRegion *regionp = gAgent.getRegion();
+	if (regionp)
+	{
+		LLVector3d agentPos = gAgent.getPositionGlobal();
+		slurl = LLSLURL::buildSLURLfromPosGlobal(regionp->getName(), agentPos, escaped);
+	}
+	return slurl;
 }
 
 //static
diff --git a/indra/newview/llagentui.h b/indra/newview/llagentui.h
index afc0ba5d9a623d86fe4df0d043a744e4109b11f5..3478793e38f3f198c5e4af2ca5b24a6892d03c8b 100644
--- a/indra/newview/llagentui.h
+++ b/indra/newview/llagentui.h
@@ -2,33 +2,37 @@
  * @file llagentui.h
  * @brief Utility methods to process agent's data as slurl's etc. before displaying
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #ifndef LLAGENTUI_H
 #define LLAGENTUI_H
 
-class LLSLURL;
-
 class LLAgentUI
 {
 public:
@@ -44,7 +48,7 @@ class LLAgentUI
 	static void buildName(std::string& name);
 	static void buildFullname(std::string &name);
 
-	static void buildSLURL(LLSLURL& slurl, const bool escaped = true);
+	static std::string buildSLURL(const bool escaped = true);
 	//build location string using the current position of gAgent.
 	static BOOL buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK);
 	//build location string using a region position of the avatar. 
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index a1ce556458474f7d9afdf86cd20b4268b0a0e7e8..9d3b5763e8841877d589efa38fa68d6b2480c0e4 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -2,25 +2,31 @@
  * @file llagentwearables.cpp
  * @brief LLAgentWearables class implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -33,6 +39,7 @@
 #include "llagentwearablesfetch.h"
 #include "llappearancemgr.h"
 #include "llcallbacklist.h"
+#include "llfloatercustomize.h"
 #include "llfolderview.h"
 #include "llgesturemgr.h"
 #include "llinventorybridge.h"
@@ -41,8 +48,7 @@
 #include "llinventorypanel.h"
 #include "llmd5.h"
 #include "llnotificationsutil.h"
-#include "lloutfitobserver.h"
-#include "llsidepanelappearance.h"
+#include "llpaneloutfitsinventory.h"
 #include "llsidetray.h"
 #include "lltexlayer.h"
 #include "llviewerregion.h"
@@ -58,25 +64,6 @@ BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE;
 
 using namespace LLVOAvatarDefines;
 
-///////////////////////////////////////////////////////////////////////////////
-
-// Callback to wear and start editing an item that has just been created.
-class LLWearAndEditCallback : public LLInventoryCallback
-{
-	void fire(const LLUUID& inv_item)
-	{
-		if (inv_item.isNull()) return;
-
-		// Request editing the item after it gets worn.
-		gAgentWearables.requestEditingWearable(inv_item);
-
-		// Wear it.
-		LLAppearanceMgr::instance().wearItemOnAvatar(inv_item);
-	}
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
 // HACK: For EXT-3923: Pants item shows in inventory with skin icon and messes with "current look"
 // Some db items are corrupted, have inventory flags = 0, implying wearable type = shape, even though
 // wearable type stored in asset is some other value.
@@ -113,13 +100,13 @@ void checkWearableAgainstInventory(LLWearable *wearable)
 void LLAgentWearables::dump()
 {
 	llinfos << "LLAgentWearablesDump" << llendl;
-	for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
+	for (S32 i = 0; i < WT_COUNT; i++)
 	{
-		U32 count = getWearableCount((LLWearableType::EType)i);
+		U32 count = getWearableCount((EWearableType)i);
 		llinfos << "Type: " << i << " count " << count << llendl;
 		for (U32 j=0; j<count; j++)
 		{
-			LLWearable* wearable = getWearable((LLWearableType::EType)i,j);
+			LLWearable* wearable = getWearable((EWearableType)i,j);
 			if (wearable == NULL)
 			{
 				llinfos << "    " << j << " NULL wearable" << llendl;
@@ -138,6 +125,7 @@ void LLAgentWearables::dump()
 	}
 }
 
+// MULTI-WEARABLE: debugging
 struct LLAgentDumper
 {
 	LLAgentDumper(std::string name):
@@ -160,7 +148,6 @@ struct LLAgentDumper
 
 LLAgentWearables::LLAgentWearables() :
 	mWearablesLoaded(FALSE)
-,	mCOFChangeInProgress(false)
 {
 }
 
@@ -173,14 +160,6 @@ void LLAgentWearables::cleanup()
 {
 }
 
-// static
-void LLAgentWearables::initClass()
-{
-	// this can not be called from constructor because its instance is global and is created too early.
-	// Subscribe to "COF is Saved" signal to notify observers about this (Loading indicator for ex.).
-	LLOutfitObserver::instance().addCOFSavedCallback(boost::bind(&LLAgentWearables::notifyLoadingFinished, &gAgentWearables));
-}
-
 void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
 { 
 	if (avatar)
@@ -212,7 +191,7 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal
  * @param todo Bitmask of actions to take on completion.
  */
 LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback(
-	LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLWearable* wearable, U32 todo) :
+	LLPointer<LLRefCount> cb, S32 type, U32 index, LLWearable* wearable, U32 todo) :
 	mType(type),
 	mIndex(index),	
 	mWearable(wearable),
@@ -261,7 +240,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
 	}
 }
 
-void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::EType type,
+void LLAgentWearables::addWearabletoAgentInventoryDone(const S32 type,
 													   const U32 index,
 													   const LLUUID& item_id,
 													   LLWearable* wearable)
@@ -271,7 +250,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
 	if (item_id.isNull())
 		return;
 
-	LLUUID old_item_id = getWearableItemID(type,index);
+	LLUUID old_item_id = getWearableItemID((EWearableType)type,index);
 
 	if (wearable)
 	{
@@ -280,11 +259,11 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
 		if (old_item_id.notNull())
 		{	
 			gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
-			setWearable(type,index,wearable);
+			setWearable((EWearableType)type,index,wearable);
 		}
 		else
 		{
-			pushWearable(type,wearable);
+			pushWearable((EWearableType)type,wearable);
 		}
 	}
 
@@ -306,12 +285,13 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
 
 void LLAgentWearables::sendAgentWearablesUpdate()
 {
+	// MULTI-WEARABLE: call i "type" or something.
 	// First make sure that we have inventory items for each wearable
-	for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
+	for (S32 type=0; type < WT_COUNT; ++type)
 	{
-		for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index)
+		for (U32 j=0; j < getWearableCount((EWearableType)type); ++j)
 		{
-			LLWearable* wearable = getWearable((LLWearableType::EType)type,index);
+			LLWearable* wearable = getWearable((EWearableType)type,j);
 			if (wearable)
 			{
 				if (wearable->getItemID().isNull())
@@ -319,8 +299,8 @@ void LLAgentWearables::sendAgentWearablesUpdate()
 					LLPointer<LLInventoryCallback> cb =
 						new addWearableToAgentInventoryCallback(
 							LLPointer<LLRefCount>(NULL),
-							(LLWearableType::EType)type,
-							index,
+							type,
+							j,
 							wearable,
 							addWearableToAgentInventoryCallback::CALL_NONE);
 					addWearableToAgentInventory(cb, wearable);
@@ -345,15 +325,16 @@ void LLAgentWearables::sendAgentWearablesUpdate()
 	gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
 
 	lldebugs << "sendAgentWearablesUpdate()" << llendl;
-	// MULTI-WEARABLE: DEPRECATED: HACK: index to 0- server database tables don't support concept of multiwearables.
-	for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
+	// MULTI-WEARABLE: update for multi-wearables after server-side support is in.
+	for (S32 type=0; type < WT_COUNT; ++type)
 	{
 		gMessageSystem->nextBlockFast(_PREHASH_WearableData);
 
 		U8 type_u8 = (U8)type;
 		gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8);
 
-		LLWearable* wearable = getWearable((LLWearableType::EType)type, 0);
+		// MULTI-WEARABLE: TODO: hacked index to 0, needs to loop over all once messages support this.
+		LLWearable* wearable = getWearable((EWearableType)type, 0);
 		if (wearable)
 		{
 			//llinfos << "Sending wearable " << wearable->getName() << llendl;
@@ -369,17 +350,16 @@ void LLAgentWearables::sendAgentWearablesUpdate()
 		}
 		else
 		{
-			//llinfos << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)i) << llendl;
+			//llinfos << "Not wearing wearable type " << LLWearableDictionary::getInstance()->getWearable((EWearableType)i) << llendl;
 			gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null);
 		}
 
-		lldebugs << "       " << LLWearableType::getTypeLabel((LLWearableType::EType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << llendl;
+		lldebugs << "       " << LLWearableDictionary::getTypeLabel((EWearableType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << llendl;
 	}
 	gAgent.sendReliableMessage();
 }
 
-void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update,
-									const std::string new_name)
+void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, BOOL send_update)
 {
 	LLWearable* old_wearable = getWearable(type, index);
 	if (old_wearable && (old_wearable->isDirty() || old_wearable->isOldVersion()))
@@ -397,14 +377,6 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
 		LLInventoryItem* item = gInventory.getItem(old_item_id);
 		if (item)
 		{
-			std::string item_name = item->getName();
-			bool name_changed = false;
-			if (!new_name.empty() && (new_name != item->getName()))
-			{
-				llinfos << "saveWearable changing name from "  << item->getName() << " to " << new_name << llendl;
-				item_name = new_name;
-				name_changed = true;
-			}
 			// Update existing inventory item
 			LLPointer<LLViewerInventoryItem> template_item =
 				new LLViewerInventoryItem(item->getUUID(),
@@ -413,7 +385,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
 										  new_wearable->getAssetID(),
 										  new_wearable->getAssetType(),
 										  item->getInventoryType(),
-										  item_name,
+										  item->getName(),
 										  item->getDescription(),
 										  item->getSaleInfo(),
 										  item->getFlags(),
@@ -421,10 +393,6 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
 			template_item->setTransactionID(new_wearable->getTransactionID());
 			template_item->updateServer(FALSE);
 			gInventory.updateItem(template_item);
-			if (name_changed)
-			{
-				gInventory.notifyObservers();
-			}
 		}
 		else
 		{
@@ -437,7 +405,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
 			LLPointer<LLInventoryCallback> cb =
 				new addWearableToAgentInventoryCallback(
 					LLPointer<LLRefCount>(NULL),
-					type,
+					(S32)type,
 					index,
 					new_wearable,
 					todo);
@@ -454,7 +422,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
 	}
 }
 
-void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
+void LLAgentWearables::saveWearableAs(const EWearableType type,
 									  const U32 index,
 									  const std::string& new_name,
 									  BOOL save_in_lost_and_found)
@@ -515,14 +483,10 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
 	old_wearable->revertValues();
 }
 
-void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
+void LLAgentWearables::revertWearable(const EWearableType type, const U32 index)
 {
 	LLWearable* wearable = getWearable(type, index);
-	llassert(wearable);
-	if (wearable)
-	{
-		wearable->revertValues();
-	}
+	wearable->revertValues();
 
 	gAgent.sendAgentSetAppearance();
 }
@@ -534,10 +498,10 @@ void LLAgentWearables::saveAllWearables()
 	//	return;
 	//}
 
-	for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+	for (S32 i=0; i < WT_COUNT; i++)
 	{
-		for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
-			saveWearable((LLWearableType::EType)i, j, FALSE);
+		for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
+			saveWearable((EWearableType)i, j, FALSE);
 	}
 	sendAgentWearablesUpdate();
 }
@@ -545,16 +509,15 @@ void LLAgentWearables::saveAllWearables()
 // Called when the user changes the name of a wearable inventory item that is currently being worn.
 void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& new_name)
 {
-	for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+	for (S32 i=0; i < WT_COUNT; i++)
 	{
-		for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+		for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
 		{
-			LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
+			LLUUID curr_item_id = getWearableItemID((EWearableType)i,j);
 			if (curr_item_id == item_id)
 			{
-				LLWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
+				LLWearable* old_wearable = getWearable((EWearableType)i,j);
 				llassert(old_wearable);
-				if (!old_wearable) continue;
 
 				std::string old_name = old_wearable->getName();
 				old_wearable->setName(new_name);
@@ -567,7 +530,7 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
 				}
 				old_wearable->setName(old_name);
 
-				setWearable((LLWearableType::EType)i,j,new_wearable);
+				setWearable((EWearableType)i,j,new_wearable);
 				sendAgentWearablesUpdate();
 				break;
 			}
@@ -576,18 +539,12 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
 }
 
 
-BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const
+BOOL LLAgentWearables::isWearableModifiable(EWearableType type, U32 index) const
 {
 	LLUUID item_id = getWearableItemID(type, index);
-	return item_id.notNull() ? isWearableModifiable(item_id) : FALSE;
-}
-
-BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const
-{
-	const LLUUID& linked_id = gInventory.getLinkedItemID(item_id);
-	if (linked_id.notNull())
+	if (!item_id.isNull())
 	{
-		LLInventoryItem* item = gInventory.getItem(linked_id);
+		LLInventoryItem* item = gInventory.getItem(item_id);
 		if (item && item->getPermissions().allowModifyBy(gAgent.getID(),
 														 gAgent.getGroupID()))
 		{
@@ -597,7 +554,7 @@ BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const
 	return FALSE;
 }
 
-BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const
+BOOL LLAgentWearables::isWearableCopyable(EWearableType type, U32 index) const
 {
 	LLUUID item_id = getWearableItemID(type, index);
 	if (!item_id.isNull())
@@ -613,7 +570,7 @@ BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index)
 }
 
 /*
-  U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type)
+  U32 LLAgentWearables::getWearablePermMask(EWearableType type)
   {
   LLUUID item_id = getWearableItemID(type);
   if (!item_id.isNull())
@@ -628,7 +585,7 @@ BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index)
   }
 */
 
-LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type, U32 index)
+LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type, U32 index)
 {
 	LLUUID item_id = getWearableItemID(type,index);
 	LLInventoryItem* item = NULL;
@@ -641,30 +598,12 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::ETyp
 
 const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const
 {
-	const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
-	for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+	for (S32 i=0; i < WT_COUNT; i++)
 	{
-		for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+		for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
 		{
-			const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
-			if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
-			{
-				return curr_wearable;
-			}
-		}
-	}
-	return NULL;
-}
-
-LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
-{
-	const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
-	for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
-	{
-		for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
-		{
-			LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
-			if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
+			const LLWearable * curr_wearable = getWearable((EWearableType)i, j);
+			if (curr_wearable && (curr_wearable->getItemID() == item_id))
 			{
 				return curr_wearable;
 			}
@@ -675,11 +614,11 @@ LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
 
 LLWearable*	LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id) 
 {
-	for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+	for (S32 i=0; i < WT_COUNT; i++)
 	{
-		for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+		for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
 		{
-			LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
+			LLWearable * curr_wearable = getWearable((EWearableType)i, j);
 			if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
 			{
 				return curr_wearable;
@@ -699,12 +638,12 @@ void LLAgentWearables::sendAgentWearablesRequest()
 }
 
 // static
-BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
+BOOL LLAgentWearables::selfHasWearable(EWearableType type)
 {
 	return (gAgentWearables.getWearableCount(type) > 0);
 }
 
-LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index)
+LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index)
 {
 	wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
 	if (wearable_iter == mWearableDatas.end())
@@ -722,7 +661,7 @@ LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32
 	}
 }
 
-void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
+void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearable *wearable)
 {
 
 	LLWearable *old_wearable = getWearable(type,index);
@@ -752,27 +691,27 @@ void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index,
 	}
 }
 
-U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable *wearable)
+U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearable)
 {
 	if (wearable == NULL)
 	{
 		// no null wearables please!
 		llwarns << "Null wearable sent for type " << type << llendl;
-		return MAX_CLOTHING_PER_TYPE;
+		return MAX_WEARABLES_PER_TYPE;
 	}
-	if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE)
+	if (type < WT_COUNT || mWearableDatas[type].size() < MAX_WEARABLES_PER_TYPE)
 	{
 		mWearableDatas[type].push_back(wearable);
 		wearableUpdated(wearable);
 		checkWearableAgainstInventory(wearable);
 		return mWearableDatas[type].size()-1;
 	}
-	return MAX_CLOTHING_PER_TYPE;
+	return MAX_WEARABLES_PER_TYPE;
 }
 
 void LLAgentWearables::wearableUpdated(LLWearable *wearable)
 {
-	gAgentAvatarp->wearableUpdated(wearable->getType(), FALSE);
+	gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
 	wearable->refreshName();
 	wearable->setLabelUpdated();
 
@@ -802,15 +741,15 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
 	}
 
 	U32 index = getWearableIndex(wearable);
-	LLWearableType::EType type = wearable->getType();
+	EWearableType type = wearable->getType();
 
-	if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type))
+	if (index < MAX_WEARABLES_PER_TYPE && index < getWearableCount(type))
 	{
 		popWearable(type, index);
 	}
 }
 
-void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
+void LLAgentWearables::popWearable(const EWearableType type, U32 index)
 {
 	LLWearable *wearable = getWearable(type, index);
 	if (wearable)
@@ -825,15 +764,15 @@ U32	LLAgentWearables::getWearableIndex(LLWearable *wearable)
 {
 	if (wearable == NULL)
 	{
-		return MAX_CLOTHING_PER_TYPE;
+		return MAX_WEARABLES_PER_TYPE;
 	}
 
-	const LLWearableType::EType type = wearable->getType();
+	const EWearableType type = wearable->getType();
 	wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
 	if (wearable_iter == mWearableDatas.end())
 	{
 		llwarns << "tried to get wearable index with an invalid type!" << llendl;
-		return MAX_CLOTHING_PER_TYPE;
+		return MAX_WEARABLES_PER_TYPE;
 	}
 	const wearableentry_vec_t& wearable_vec = wearable_iter->second;
 	for(U32 index = 0; index < wearable_vec.size(); index++)
@@ -844,10 +783,10 @@ U32	LLAgentWearables::getWearableIndex(LLWearable *wearable)
 		}
 	}
 
-	return MAX_CLOTHING_PER_TYPE;
+	return MAX_WEARABLES_PER_TYPE;
 }
 
-const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const
+const LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index) const
 {
 	wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
 	if (wearable_iter == mWearableDatas.end())
@@ -865,7 +804,7 @@ const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type
 	}
 }
 
-LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
+LLWearable* LLAgentWearables::getTopWearable(const EWearableType type)
 {
 	U32 count = getWearableCount(type);
 	if ( count == 0)
@@ -876,17 +815,7 @@ LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
 	return getWearable(type, count-1);
 }
 
-LLWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type)
-{
-	if (getWearableCount(type) == 0)
-	{
-		return NULL;
-	}
-
-	return getWearable(type, 0);
-}
-
-U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
+U32 LLAgentWearables::getWearableCount(const EWearableType type) const
 {
 	wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
 	if (wearable_iter == mWearableDatas.end())
@@ -899,7 +828,7 @@ U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
 
 U32 LLAgentWearables::getWearableCount(const U32 tex_index) const
 {
-	const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((LLVOAvatarDefines::ETextureIndex)tex_index);
+	const EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType((LLVOAvatarDefines::ETextureIndex)tex_index);
 	return getWearableCount(wearable_type);
 }
 
@@ -914,7 +843,7 @@ U32 LLAgentWearables::itemUpdatePendingCount() const
 	return mItemsAwaitingWearableUpdate.size();
 }
 
-const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
+const LLUUID LLAgentWearables::getWearableItemID(EWearableType type, U32 index) const
 {
 	const LLWearable *wearable = getWearable(type,index);
 	if (wearable)
@@ -923,7 +852,7 @@ const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32
 		return LLUUID();
 }
 
-const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
+const LLUUID LLAgentWearables::getWearableAssetID(EWearableType type, U32 index) const
 {
 	const LLWearable *wearable = getWearable(type,index);
 	if (wearable)
@@ -934,26 +863,25 @@ const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U3
 
 BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id) const
 {
-	return getWearableFromItemID(item_id) != NULL;
+	const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+	if (getWearableFromItemID(base_item_id) != NULL) 
+	{
+		return TRUE;
+	}
+	return FALSE;
 }
 
-// MULTI-WEARABLE: DEPRECATED (see backwards compatibility)
+// MULTI-WEARABLE: update for multiple
 // static
 // ! BACKWARDS COMPATIBILITY ! When we stop supporting viewer1.23, we can assume
 // that viewers have a Current Outfit Folder and won't need this message, and thus
-// we can remove/ignore this whole function. EXCEPT gAgentWearables.notifyLoadingStarted
+// we can remove/ignore this whole function.
 void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data)
 {
 	// We should only receive this message a single time.  Ignore subsequent AgentWearablesUpdates
 	// that may result from AgentWearablesRequest having been sent more than once.
 	if (mInitialWearablesUpdateReceived)
 		return;
-
-	// notify subscribers that wearables started loading. See EXT-7777
-	// *TODO: find more proper place to not be called from deprecated method.
-	// Seems such place is found: LLInitialWearablesFetch::processContents()
-	gAgentWearables.notifyLoadingStarted();
-
 	mInitialWearablesUpdateReceived = true;
 
 	LLUUID agent_id;
@@ -977,22 +905,23 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 
 		// Get the UUID of the current outfit folder (will be created if it doesn't exist)
 		const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
-		LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch(current_outfit_id);
+		
+		LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch();
 		
 		//lldebugs << "processAgentInitialWearablesUpdate()" << llendl;
 		// Add wearables
-		// MULTI-WEARABLE: DEPRECATED: Message only supports one wearable per type, will be ignored in future.
+		// MULTI-WEARABLE: TODO: update once messages change.  Currently use results to populate the zeroth element.
 		gAgentWearables.mItemsAwaitingWearableUpdate.clear();
 		for (S32 i=0; i < num_wearables; i++)
 		{
 			// Parse initial wearables data from message system
 			U8 type_u8 = 0;
 			gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i);
-			if (type_u8 >= LLWearableType::WT_COUNT)
+			if (type_u8 >= WT_COUNT)
 			{
 				continue;
 			}
-			const LLWearableType::EType type = (LLWearableType::EType) type_u8;
+			const EWearableType type = (EWearableType) type_u8;
 			
 			LLUUID item_id;
 			gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i);
@@ -1005,26 +934,28 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 			}
 			else
 			{
-				LLAssetType::EType asset_type = LLWearableType::getAssetType(type);
+				LLAssetType::EType asset_type = LLWearableDictionary::getAssetType(type);
 				if (asset_type == LLAssetType::AT_NONE)
 				{
 					continue;
 				}
 				
-				// MULTI-WEARABLE: DEPRECATED: this message only supports one wearable per type. Should be ignored in future versions
+				// MULTI-WEARABLE: TODO: update once messages change.  Currently use results to populate the zeroth element.
 				
 				// Store initial wearables data until we know whether we have the current outfit folder or need to use the data.
-				LLInitialWearablesFetch::InitialWearableData wearable_data(type, item_id, asset_id);
+				LLInitialWearablesFetch::InitialWearableData wearable_data(type, item_id, asset_id); // MULTI-WEARABLE: update
 				outfit->add(wearable_data);
 			}
 			
-			lldebugs << "       " << LLWearableType::getTypeLabel(type) << llendl;
+			lldebugs << "       " << LLWearableDictionary::getTypeLabel(type) << llendl;
 		}
 		
 		// Get the complete information on the items in the inventory and set up an observer
 		// that will trigger when the complete information is fetched.
-		outfit->startFetch();
-		if(outfit->isFinished())
+		uuid_vec_t folders;
+		folders.push_back(current_outfit_id);
+		outfit->fetch(folders);
+		if(outfit->isEverythingComplete())
 		{
 			// everything is already here - call done.
 			outfit->done();
@@ -1042,13 +973,14 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 // Normally, all wearables referred to "AgentWearablesUpdate" will correspond to actual assets in the
 // database.  If for some reason, we can't load one of those assets, we can try to reconstruct it so that
 // the user isn't left without a shape, for example.  (We can do that only after the inventory has loaded.)
-void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type, U32 index)
+void LLAgentWearables::recoverMissingWearable(const EWearableType type, U32 index)
 {
 	// Try to recover by replacing missing wearable with a new one.
 	LLNotificationsUtil::add("ReplacedMissingWearable");
-	lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded.  Replaced inventory item with default wearable." << llendl;
+	lldebugs << "Wearable " << LLWearableDictionary::getTypeLabel(type) << " could not be downloaded.  Replaced inventory item with default wearable." << llendl;
 	LLWearable* new_wearable = LLWearableList::instance().createNewWearable(type);
 
+	S32 type_s32 = (S32) type;
 	setWearable(type,index,new_wearable);
 	//new_wearable->writeToAvatar(TRUE);
 
@@ -1059,7 +991,7 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type,
 	LLPointer<LLInventoryCallback> cb =
 		new addWearableToAgentInventoryCallback(
 			LLPointer<LLRefCount>(NULL),
-			type,
+			type_s32,
 			index,
 			new_wearable,
 			addWearableToAgentInventoryCallback::CALL_RECOVERDONE);
@@ -1082,9 +1014,9 @@ void LLAgentWearables::recoverMissingWearableDone()
 	}
 }
 
-void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index)
+void LLAgentWearables::addLocalTextureObject(const EWearableType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index)
 {
-	LLWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index);
+	LLWearable* wearable = getWearable((EWearableType)wearable_type, wearable_index);
 	if (!wearable)
 	{
 		llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl;
@@ -1098,7 +1030,7 @@ class OnWearableItemCreatedCB: public LLInventoryCallback
 {
 public:
 	OnWearableItemCreatedCB():
-		mWearablesAwaitingItems(LLWearableType::WT_COUNT,NULL)
+		mWearablesAwaitingItems(WT_COUNT,NULL)
 	{
 		llinfos << "created callback" << llendl;
 	}
@@ -1124,8 +1056,8 @@ class OnWearableItemCreatedCB: public LLInventoryCallback
 			llwarns << "no wearable" << llendl;
 			return;
 		}
-		LLWearableType::EType type = wearable->getType();
-		if (type<LLWearableType::WT_COUNT)
+		EWearableType type = wearable->getType();
+		if (type<WT_COUNT)
 		{
 			mWearablesAwaitingItems[type] = wearable;
 		}
@@ -1149,8 +1081,8 @@ class OnWearableItemCreatedCB: public LLInventoryCallback
 		}
 		if (item && item->isWearableType())
 		{
-			LLWearableType::EType type = item->getWearableType();
-			if (type < LLWearableType::WT_COUNT)
+			EWearableType type = item->getWearableType();
+			if (type < WT_COUNT)
 			{
 				LLWearable *wearable = mWearablesAwaitingItems[type];
 				if (wearable)
@@ -1177,30 +1109,30 @@ void LLAgentWearables::createStandardWearables(BOOL female)
 
 	gAgentAvatarp->setSex(female ? SEX_FEMALE : SEX_MALE);
 
-	const BOOL create[LLWearableType::WT_COUNT] = 
+	const BOOL create[WT_COUNT] = 
 		{
-			TRUE,  //LLWearableType::WT_SHAPE
-			TRUE,  //LLWearableType::WT_SKIN
-			TRUE,  //LLWearableType::WT_HAIR
-			TRUE,  //LLWearableType::WT_EYES
-			TRUE,  //LLWearableType::WT_SHIRT
-			TRUE,  //LLWearableType::WT_PANTS
-			TRUE,  //LLWearableType::WT_SHOES
-			TRUE,  //LLWearableType::WT_SOCKS
-			FALSE, //LLWearableType::WT_JACKET
-			FALSE, //LLWearableType::WT_GLOVES
-			TRUE,  //LLWearableType::WT_UNDERSHIRT
-			TRUE,  //LLWearableType::WT_UNDERPANTS
-			FALSE  //LLWearableType::WT_SKIRT
+			TRUE,  //WT_SHAPE
+			TRUE,  //WT_SKIN
+			TRUE,  //WT_HAIR
+			TRUE,  //WT_EYES
+			TRUE,  //WT_SHIRT
+			TRUE,  //WT_PANTS
+			TRUE,  //WT_SHOES
+			TRUE,  //WT_SOCKS
+			FALSE, //WT_JACKET
+			FALSE, //WT_GLOVES
+			TRUE,  //WT_UNDERSHIRT
+			TRUE,  //WT_UNDERPANTS
+			FALSE  //WT_SKIRT
 		};
 
 	LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB;
-	for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+	for (S32 i=0; i < WT_COUNT; i++)
 	{
 		if (create[i])
 		{
-			llassert(getWearableCount((LLWearableType::EType)i) == 0);
-			LLWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i);
+			llassert(getWearableCount((EWearableType)i) == 0);
+			LLWearable* wearable = LLWearableList::instance().createNewWearable((EWearableType)i);
 			((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable);
 			// no need to update here...
 			LLUUID category_id = LLUUID::null;
@@ -1235,7 +1167,6 @@ void LLAgentWearables::createStandardWearablesAllDone()
 
 	mWearablesLoaded = TRUE; 
 	checkWearablesLoaded();
-	notifyLoadingFinished();
 	
 	updateServer();
 
@@ -1243,9 +1174,217 @@ void LLAgentWearables::createStandardWearablesAllDone()
 	gAgentAvatarp->onFirstTEMessageReceived();
 }
 
+// MULTI-WEARABLE: Properly handle multiwearables later.
+void LLAgentWearables::getAllWearablesArray(LLDynamicArray<S32>& wearables)
+{
+	for( S32 i = 0; i < WT_COUNT; ++i )
+	{
+		if (getWearableCount((EWearableType) i) !=  0)
+		{
+			wearables.push_back(i);
+		}
+	}
+}
+
+// Note:	wearables_to_include should be a list of EWearableType types
+//			attachments_to_include should be a list of attachment points
+void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
+									 const LLDynamicArray<S32>& wearables_to_include,
+									 const LLDynamicArray<S32>& attachments_to_include,
+									 BOOL rename_clothing)
+{
+	if (!isAgentAvatarValid()) return;
+
+	// First, make a folder in the Clothes directory.
+	LLUUID folder_id = gInventory.createNewCategory(
+		gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING),
+		LLFolderType::FT_NONE,
+		new_folder_name);
+
+	bool found_first_item = false;
+
+	///////////////////
+	// Wearables
+
+	if (wearables_to_include.count())
+	{
+		// Then, iterate though each of the wearables and save copies of them in the folder.
+		S32 i;
+		S32 count = wearables_to_include.count();
+		LLDynamicArray<LLUUID> delete_items;
+		LLPointer<LLRefCount> cbdone = NULL;
+		for (i = 0; i < count; ++i)
+		{
+			const S32 type = wearables_to_include[i];
+			for (U32 j=0; j<getWearableCount((EWearableType)i); j++)
+			{
+				LLWearable* old_wearable = getWearable((EWearableType)type, j);
+				if (old_wearable)
+				{
+					std::string new_name;
+					LLWearable* new_wearable;
+					new_wearable = LLWearableList::instance().createCopy(old_wearable);
+					if (rename_clothing)
+					{
+						new_name = new_folder_name;
+						new_name.append(" ");
+						new_name.append(old_wearable->getTypeLabel());
+						LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN);
+						new_wearable->setName(new_name);
+					}
+
+					LLViewerInventoryItem* item = gInventory.getItem(getWearableItemID((EWearableType)type,j));
+					S32 todo = addWearableToAgentInventoryCallback::CALL_NONE;
+					if (!found_first_item)
+					{
+						found_first_item = true;
+						/* set the focus to the first item */
+						todo |= addWearableToAgentInventoryCallback::CALL_MAKENEWOUTFITDONE;
+						/* send the agent wearables update when done */
+						cbdone = new sendAgentWearablesUpdateCallback;
+					}
+					LLPointer<LLInventoryCallback> cb =
+						new addWearableToAgentInventoryCallback(
+							cbdone,
+							type,
+							j,
+							new_wearable,
+							todo);
+					llassert(item);
+					if (item)
+					{
+						if (isWearableCopyable((EWearableType)type, j))
+						{
+							copy_inventory_item(
+									    gAgent.getID(),
+									    item->getPermissions().getOwner(),
+									    item->getUUID(),
+									    folder_id,
+									    new_name,
+									    cb);
+						}
+						else
+						{
+							move_inventory_item(
+									    gAgent.getID(),
+									    gAgent.getSessionID(),
+									    item->getUUID(),
+									    folder_id,
+									    new_name,
+									    cb);
+						}
+					}
+				}
+			}
+		}
+		gInventory.notifyObservers();
+	}
+
+
+	///////////////////
+	// Attachments
+
+	if (attachments_to_include.count())
+	{
+		BOOL msg_started = FALSE;
+		LLMessageSystem* msg = gMessageSystem;
+		for (S32 i = 0; i < attachments_to_include.count(); i++)
+		{
+			S32 attachment_pt = attachments_to_include[i];
+			LLViewerJointAttachment* attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL);
+			if (!attachment) continue;
+			for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+				 attachment_iter != attachment->mAttachedObjects.end();
+				 ++attachment_iter)
+			{
+				LLViewerObject *attached_object = (*attachment_iter);
+				if(!attached_object) continue;
+				const LLUUID& item_id = (*attachment_iter)->getItemID();
+				if(item_id.isNull()) continue;
+				LLInventoryItem* item = gInventory.getItem(item_id);
+				if(!item) continue;
+				if(!msg_started)
+				{
+					msg_started = TRUE;
+					msg->newMessage("CreateNewOutfitAttachments");
+					msg->nextBlock("AgentData");
+					msg->addUUID("AgentID", gAgent.getID());
+					msg->addUUID("SessionID", gAgent.getSessionID());
+					msg->nextBlock("HeaderData");
+					msg->addUUID("NewFolderID", folder_id);
+				}
+				msg->nextBlock("ObjectData");
+				msg->addUUID("OldItemID", item_id);
+				msg->addUUID("OldFolderID", item->getParentUUID());
+			}
+		}
+
+		if (msg_started)
+		{
+			gAgent.sendReliableMessage();
+		}
+
+	} 
+}
+
+class LLShowCreatedOutfit: public LLInventoryCallback
+{
+public:
+	LLShowCreatedOutfit(LLUUID& folder_id):
+		mFolderID(folder_id)
+	{
+	}
+
+	virtual ~LLShowCreatedOutfit()
+	{
+		LLSD key;
+		LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
+		LLPanelOutfitsInventory *outfit_panel =
+			dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory"));
+		if (outfit_panel)
+		{
+			outfit_panel->getRootFolder()->clearSelection();
+			outfit_panel->getRootFolder()->setSelectionByID(mFolderID, TRUE);
+		}
+		LLAccordionCtrlTab* tab_outfits = outfit_panel ? outfit_panel->findChild<LLAccordionCtrlTab>("tab_outfits") : 0;
+		if (tab_outfits && !tab_outfits->getDisplayChildren())
+		{
+			tab_outfits->changeOpenClose(tab_outfits->getDisplayChildren());
+		}
+
+		LLAppearanceMgr::instance().updateIsDirty();
+		LLAppearanceMgr::instance().updatePanelOutfitName("");
+	}
+	
+	virtual void fire(const LLUUID&)
+	{
+	}
+	
+private:
+	LLUUID mFolderID;
+};
+
+LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name)
+{
+	if (!isAgentAvatarValid()) return LLUUID::null;
+
+	// First, make a folder in the My Outfits directory.
+	const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+	LLUUID folder_id = gInventory.createNewCategory(
+		parent_id,
+		LLFolderType::FT_OUTFIT,
+		new_folder_name);
+
+	LLPointer<LLInventoryCallback> cb = new LLShowCreatedOutfit(folder_id);
+	LLAppearanceMgr::instance().shallowCopyCategoryContents(LLAppearanceMgr::instance().getCOF(),folder_id, cb);
+	LLAppearanceMgr::instance().createBaseOutfitLink(folder_id, cb);
+
+	return folder_id;
+}
+
 void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
 {
-	LLUUID first_item_id = getWearableItemID((LLWearableType::EType)type, index);
+	LLUUID first_item_id = getWearableItemID((EWearableType)type, index);
 	// Open the inventory and select the first item we added.
 	if (first_item_id.notNull())
 	{
@@ -1276,10 +1415,10 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback
 						  cb);
 }
 
-void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_remove_all, U32 index)
+void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_all, U32 index)
 {
 	if (gAgent.isTeen() &&
-		(type == LLWearableType::WT_UNDERSHIRT || type == LLWearableType::WT_UNDERPANTS))
+		(type == WT_UNDERSHIRT || type == WT_UNDERPANTS))
 	{
 		// Can't take off underclothing in simple UI mode or on PG accounts
 		// TODO: enable the removing of a single undershirt/underpants if multiple are worn. - Nyx
@@ -1323,7 +1462,7 @@ void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_
 bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response)
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	LLWearableType::EType type = (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger();
+	EWearableType type = (EWearableType)notification["payload"]["wearable_type"].asInteger();
 	S32 index = (S32)notification["payload"]["wearable_index"].asInteger();
 	switch(option)
 	{
@@ -1347,7 +1486,7 @@ bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LL
 }
 
 // Called by removeWearable() and onRemoveWearableDialog() to actually do the removal.
-void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, bool do_remove_all, U32 index)
+void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_remove_all, U32 index)
 {
 	//LLAgentDumper dumper("removeWearable");
 	if (do_remove_all)
@@ -1396,11 +1535,11 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 	{
 		// note: shirt is the first non-body part wearable item. Update if wearable order changes.
 		// This loop should remove all clothing, but not any body parts
-		for (S32 type = 0; type < (S32)LLWearableType::WT_COUNT; type++)
+		for (S32 type = 0; type < (S32)WT_COUNT; type++)
 		{
-			if (LLWearableType::getAssetType((LLWearableType::EType)type) == LLAssetType::AT_CLOTHING)
+			if (LLWearableDictionary::getAssetType((EWearableType)type) == LLAssetType::AT_CLOTHING)
 			{
-				removeWearable((LLWearableType::EType)type, true, 0);
+				removeWearable((EWearableType)type, true, 0);
 			}
 		}
 	}
@@ -1417,12 +1556,12 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 		llassert(new_wearable);
 		if (new_wearable)
 		{
-			const LLWearableType::EType type = new_wearable->getType();
+			const EWearableType type = new_wearable->getType();
 		
 			new_wearable->setName(new_item->getName());
 			new_wearable->setItemID(new_item->getUUID());
 
-			if (LLWearableType::getAssetType(type) == LLAssetType::AT_BODYPART)
+			if (LLWearableDictionary::getAssetType(type) == LLAssetType::AT_BODYPART)
 			{
 				// exactly one wearable per body part
 				setWearable(type,0,new_wearable);
@@ -1448,12 +1587,9 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 	// Start rendering & update the server
 	mWearablesLoaded = TRUE; 
 	checkWearablesLoaded();
-	notifyLoadingFinished();
 	queryWearableCache();
 	updateServer();
 
-	gAgentAvatarp->dumpAvatarTEs("setWearableOutfit");
-
 	lldebugs << "setWearableOutfit() end" << llendl;
 }
 
@@ -1468,7 +1604,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
 		return;
 	}
 	
-	const LLWearableType::EType type = new_wearable->getType();
+	const EWearableType type = new_wearable->getType();
 
 	if (!do_append)
 	{
@@ -1481,7 +1617,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
 			if ((old_wearable->getAssetID() == new_wearable->getAssetID()) &&
 				(old_item_id == new_item->getUUID()))
 			{
-				lldebugs << "No change to wearable asset and item: " << LLWearableType::getTypeName(type) << llendl;
+				lldebugs << "No change to wearable asset and item: " << LLWearableDictionary::getInstance()->getWearableEntry(type) << llendl;
 				return;
 			}
 			
@@ -1538,7 +1674,7 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD&
 // MULTI_WEARABLE: unify code after null objects are gone.
 void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append)
 {
-	const LLWearableType::EType type = new_wearable->getType();
+	const EWearableType type = new_wearable->getType();
 
 	if (do_append && getWearableItemID(type,0).notNull())
 	{
@@ -1603,18 +1739,37 @@ void LLAgentWearables::queryWearableCache()
 	S32 num_queries = 0;
 	for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
 	{
-		LLUUID hash_id = computeBakedTextureHash((EBakedTextureIndex) baked_index);
-		if (hash_id.notNull())
+		const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
+		LLMD5 hash;
+		bool hash_computed = false;
+		for (U8 i=0; i < baked_dict->mWearables.size(); i++)
 		{
+			const EWearableType baked_type = baked_dict->mWearables[i];
+			const U32 num_wearables = getWearableCount(baked_type);
+			for (U32 index = 0; index < num_wearables; ++index)
+			{
+				const LLWearable* wearable = getWearable(baked_type,index);
+				if (wearable)
+				{
+					LLUUID asset_id = wearable->getAssetID();
+					hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
+					hash_computed = true;
+				}
+			}
+		}
+		hash.finalize();
+		if (hash_computed)
+		{
+			LLUUID hash_id;
+			hash.raw_digest(hash_id.mData);
+			hash_id ^= baked_dict->mWearablesHashID;
 			num_queries++;
 			// *NOTE: make sure at least one request gets packed
 
-			ETextureIndex te_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
-
 			//llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl;
 			gMessageSystem->nextBlockFast(_PREHASH_WearableData);
 			gMessageSystem->addUUIDFast(_PREHASH_ID, hash_id);
-			gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)te_index);
+			gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)baked_index);
 		}
 
 		gAgentQueryManager.mActiveCacheQueries[baked_index] = gAgentQueryManager.mWearablesCacheQueryID;
@@ -1626,64 +1781,22 @@ void LLAgentWearables::queryWearableCache()
 	gAgentQueryManager.mWearablesCacheQueryID++;
 }
 
-LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
-												 BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache
-{
-	LLUUID hash_id;
-	bool hash_computed = false;
-	LLMD5 hash;
-	const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
-
-	for (U8 i=0; i < baked_dict->mWearables.size(); i++)
-	{
-		const LLWearableType::EType baked_type = baked_dict->mWearables[i];
-		const U32 num_wearables = getWearableCount(baked_type);
-		for (U32 index = 0; index < num_wearables; ++index)
-		{
-			const LLWearable* wearable = getWearable(baked_type,index);
-			if (wearable)
-			{
-				LLUUID asset_id = wearable->getAssetID();
-				hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
-				hash_computed = true;
-			}
-		}
-	}
-	if (hash_computed)
-	{
-		hash.update((const unsigned char*)baked_dict->mWearablesHashID.mData, UUID_BYTES);
-
-		// Add some garbage into the hash so that it becomes invalid.
-		if (!generate_valid_hash)
-		{
-			if (isAgentAvatarValid())
-			{
-				hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES);
-			}
-		}
-		hash.finalize();
-		hash.raw_digest(hash_id.mData);
-	}
-
-	return hash_id;
-}
-
 // User has picked "remove from avatar" from a menu.
 // static
-void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type, const U32 &index)
+void LLAgentWearables::userRemoveWearable(const EWearableType &type, const U32 &index)
 {
-	if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
-		//!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
+	if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&&
+		//!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT)))
 	{
 		gAgentWearables.removeWearable(type,false,index);
 	}
 }
 
 //static 
-void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &type)
+void LLAgentWearables::userRemoveWearablesOfType(const EWearableType &type)
 {
-	if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
-		//!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
+	if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&&
+		//!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT)))
 	{
 		gAgentWearables.removeWearable(type,true,0);
 	}
@@ -1693,12 +1806,14 @@ void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &ty
 void LLAgentWearables::userRemoveAllClothes()
 {
 	// We have to do this up front to avoid having to deal with the case of multiple wearables being dirty.
-	if (gAgentCamera.cameraCustomizeAvatar())
+	if (gFloaterCustomize)
+	{
+		gFloaterCustomize->askToSaveIfDirty(userRemoveAllClothesStep2);
+	}
+	else
 	{
-		// switching to outfit editor should automagically save any currently edited wearable
-		LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit"));
+		userRemoveAllClothesStep2(TRUE);
 	}
-	userRemoveAllClothesStep2(TRUE);
 }
 
 // static
@@ -1706,17 +1821,17 @@ void LLAgentWearables::userRemoveAllClothesStep2(BOOL proceed)
 {
 	if (proceed)
 	{
-		gAgentWearables.removeWearable(LLWearableType::WT_SHIRT,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_PANTS,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_SHOES,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_SOCKS,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_JACKET,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_GLOVES,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_UNDERSHIRT,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_UNDERPANTS,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_SKIRT,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_ALPHA,true,0);
-		gAgentWearables.removeWearable(LLWearableType::WT_TATTOO,true,0);
+		gAgentWearables.removeWearable(WT_SHIRT,true,0);
+		gAgentWearables.removeWearable(WT_PANTS,true,0);
+		gAgentWearables.removeWearable(WT_SHOES,true,0);
+		gAgentWearables.removeWearable(WT_SOCKS,true,0);
+		gAgentWearables.removeWearable(WT_JACKET,true,0);
+		gAgentWearables.removeWearable(WT_GLOVES,true,0);
+		gAgentWearables.removeWearable(WT_UNDERSHIRT,true,0);
+		gAgentWearables.removeWearable(WT_UNDERPANTS,true,0);
+		gAgentWearables.removeWearable(WT_SKIRT,true,0);
+		gAgentWearables.removeWearable(WT_ALPHA,true,0);
+		gAgentWearables.removeWearable(WT_TATTOO,true,0);
 	}
 }
 
@@ -1879,10 +1994,7 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
 		msg->nextBlockFast(_PREHASH_ObjectData );
 		msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID());
 		msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner());
-		if (gSavedSettings.getBOOL("MultipleAttachments"))
-			msg->addU8Fast(_PREHASH_AttachmentPt, 0 | ATTACHMENT_ADD );
-		else
-			msg->addU8Fast(_PREHASH_AttachmentPt, 0 );	// Wear at the previous or default attachment point
+		msg->addU8Fast(_PREHASH_AttachmentPt, 0 );	// Wear at the previous or default attachment point
 		pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
 		msg->addStringFast(_PREHASH_Name, item->getName());
 		msg->addStringFast(_PREHASH_Description, item->getDescription());
@@ -1906,166 +2018,39 @@ void LLAgentWearables::checkWearablesLoaded() const
 #endif
 }
 
-// Returns false if the given wearable is already topmost/bottommost
-// (depending on closer_to_body parameter).
-bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body)
-{
-	const LLWearable* wearable = getWearableFromItemID(item_id);
-	if (!wearable) return false;
-
-	LLWearableType::EType wtype = wearable->getType();
-	const LLWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype);
-	if (!marginal_wearable) return false;
-
-	return wearable != marginal_wearable;
-}
-
 BOOL LLAgentWearables::areWearablesLoaded() const
 {
 	checkWearablesLoaded();
 	return mWearablesLoaded;
 }
 
-// MULTI-WEARABLE: DEPRECATED: item pending count relies on old messages that don't support multi-wearables. do not trust to be accurate
+// MULTI-WEARABLE: update for multiple indices.
 void LLAgentWearables::updateWearablesLoaded()
 {
 	mWearablesLoaded = (itemUpdatePendingCount()==0);
-	if (mWearablesLoaded)
-	{
-		notifyLoadingFinished();
-	}
 }
 
 bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const
 {
 	if (!wearable) return false;
 	
-	LLWearableType::EType type = wearable->getType();
+	EWearableType type = wearable->getType();
 	// Make sure the user always has at least one shape, skin, eyes, and hair type currently worn.
-	return !(((type == LLWearableType::WT_SHAPE) || (type == LLWearableType::WT_SKIN) || (type == LLWearableType::WT_HAIR) || (type == LLWearableType::WT_EYES))
+	return !(((type == WT_SHAPE) || (type == WT_SKIN) || (type == WT_HAIR) || (type == WT_EYES))
 			 && (getWearableCount(type) <= 1) );		  
 }
 void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
 {
-	for( S32 type = 0; type < LLWearableType::WT_COUNT; ++type )
+	for( S32 type = 0; type < WT_COUNT; ++type )
 	{
-		for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
+		for (S32 count = 0; count < (S32)getWearableCount((EWearableType)type); ++count)
 		{
-			LLWearable *wearable = getWearable((LLWearableType::EType)type,count);
-			llassert(wearable);
-			if (wearable)
-			{
-				wearable->animateParams(delta, upload_bake);
-			}
+			LLWearable *wearable = getWearable((EWearableType)type,count);
+			wearable->animateParams(delta, upload_bake);
 		}
 	}
 }
 
-bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool closer_to_body)
-{
-	if (!item) return false;
-	if (!item->isWearableType()) return false;
-
-	wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(item->getWearableType());
-	if (wearable_iter == mWearableDatas.end()) return false;
-
-	wearableentry_vec_t& wearable_vec = wearable_iter->second;
-	if (wearable_vec.empty()) return false;
-
-	const LLUUID& asset_id = item->getAssetUUID();
-
-	//nowhere to move if the wearable is already on any boundary (closest to the body/furthest from the body)
-	if (closer_to_body && asset_id == wearable_vec.front()->getAssetID()) return false;
-	if (!closer_to_body && asset_id == wearable_vec.back()->getAssetID()) return false;
-
-	for (U32 i = 0; i < wearable_vec.size(); ++i)
-	{
-		LLWearable* wearable = wearable_vec[i];
-		if (!wearable) continue;
-		if (wearable->getAssetID() != asset_id) continue;
-		
-		//swapping wearables
-		U32 swap_i = closer_to_body ? i-1 : i+1;
-		wearable_vec[i] = wearable_vec[swap_i];
-		wearable_vec[swap_i] = wearable;
-		return true;
-	}
-
-	return false;
-}
-
-// static
-void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, const LLUUID& parent_id)
-{
-	if (type == LLWearableType::WT_INVALID || type == LLWearableType::WT_NONE) return;
-
-	LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
-	LLAssetType::EType asset_type = wearable->getAssetType();
-	LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE;
-	LLPointer<LLInventoryCallback> cb = wear ? new LLWearAndEditCallback : NULL;
-	LLUUID folder_id;
-
-	if (parent_id.notNull())
-	{
-		folder_id = parent_id;
-	}
-	else
-	{
-		LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(asset_type);
-		folder_id = gInventory.findCategoryUUIDForType(folder_type);
-	}
-
-	create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
-						  folder_id, wearable->getTransactionID(), wearable->getName(),
-						  wearable->getDescription(), asset_type, inv_type, wearable->getType(),
-						  wearable->getPermissions().getMaskNextOwner(),
-						  cb);
-}
-
-// static
-void LLAgentWearables::editWearable(const LLUUID& item_id)
-{
-	LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id);
-	if (!item)
-	{
-		llwarns << "Failed to get linked item" << llendl;
-		return;
-	}
-
-	LLWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
-	if (!wearable)
-	{
-		llwarns << "Cannot get wearable" << llendl;
-		return;
-	}
-
-	if (!gAgentWearables.isWearableModifiable(item->getUUID()))
-	{
-		llwarns << "Cannot modify wearable" << llendl;
-		return;
-	}
-
-	LLPanel* panel = LLSideTray::getInstance()->getPanel("sidepanel_appearance");
-	LLSidepanelAppearance::editWearable(wearable, panel);
-}
-
-// Request editing the item after it gets worn.
-void LLAgentWearables::requestEditingWearable(const LLUUID& item_id)
-{
-	mItemToEdit = gInventory.getLinkedItemID(item_id);
-}
-
-// Start editing the item if previously requested.
-void LLAgentWearables::editWearableIfRequested(const LLUUID& item_id)
-{
-	if (mItemToEdit.notNull() &&
-		mItemToEdit == gInventory.getLinkedItemID(item_id))
-	{
-		LLAgentWearables::editWearable(item_id);
-		mItemToEdit.setNull();
-	}
-}
-
 void LLAgentWearables::updateServer()
 {
 	sendAgentWearablesUpdate();
@@ -2076,39 +2061,18 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
 {	
 	llinfos << "starting outfit population" << llendl;
 
-	const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
-	LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(my_outfits_id);
-	outfits->mMyOutfitsID = my_outfits_id;
+	LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch();
 	
 	// Get the complete information on the items in the inventory and 
 	// setup an observer that will wait for that to happen.
+	uuid_vec_t folders;
+	outfits->mMyOutfitsID = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+
+	folders.push_back(outfits->mMyOutfitsID);
 	gInventory.addObserver(outfits);
-	outfits->startFetch();
-	if (outfits->isFinished())
+	outfits->fetch(folders);
+	if (outfits->isEverythingComplete())
 	{
 		outfits->done();
 	}
 }
-
-boost::signals2::connection LLAgentWearables::addLoadingStartedCallback(loading_started_callback_t cb)
-{
-	return mLoadingStartedSignal.connect(cb);
-}
-
-boost::signals2::connection LLAgentWearables::addLoadedCallback(loaded_callback_t cb)
-{
-	return mLoadedSignal.connect(cb);
-}
-
-void LLAgentWearables::notifyLoadingStarted()
-{
-	mCOFChangeInProgress = true;
-	mLoadingStartedSignal();
-}
-
-void LLAgentWearables::notifyLoadingFinished()
-{
-	mCOFChangeInProgress = false;
-	mLoadedSignal();
-}
-// EOF
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index d7e77a5a5bd9a323e53a6fb8fbbd0941d42ed0af..b76367324ce24550536f70b5bdc12dcd436d319b 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -2,38 +2,40 @@
  * @file llagentwearables.h
  * @brief LLAgentWearables class header file
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #ifndef LL_LLAGENTWEARABLES_H
 #define LL_LLAGENTWEARABLES_H
 
-// libraries
 #include "llmemory.h"
-#include "llui.h"
 #include "lluuid.h"
 #include "llinventory.h"
-
-// newview
 #include "llinventorymodel.h"
 #include "llviewerinventory.h"
 #include "llvoavatardefines.h"
@@ -45,7 +47,7 @@ class LLInitialWearablesFetch;
 class LLViewerObject;
 class LLTexLayerTemplate;
 
-class LLAgentWearables : public LLInitClass<LLAgentWearables>
+class LLAgentWearables
 {
 	//--------------------------------------------------------------------
 	// Constructors / destructors / Initializers
@@ -59,10 +61,8 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>
 	void			createStandardWearables(BOOL female); 
 	void			cleanup();
 	void			dump();
-
-	// LLInitClass interface
-	static void initClass();
 protected:
+	// MULTI-WEARABLE: assuming one per type.  Type is called index - rename.
 	void			createStandardWearablesDone(S32 type, U32 index/* = 0*/);
 	void			createStandardWearablesAllDone();
 	
@@ -71,59 +71,51 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>
 	//--------------------------------------------------------------------
 public:
 	BOOL			isWearingItem(const LLUUID& item_id) const;
-	BOOL			isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const;
-	BOOL			isWearableModifiable(const LLUUID& item_id) const;
-
-	BOOL			isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const;
+	BOOL			isWearableModifiable(EWearableType type, U32 index /*= 0*/) const;
+	BOOL			isWearableCopyable(EWearableType type, U32 index /*= 0*/) const;
 	BOOL			areWearablesLoaded() const;
-	bool			isCOFChangeInProgress() const { return mCOFChangeInProgress; }
 	void			updateWearablesLoaded();
 	void			checkWearablesLoaded() const;
-	bool			canMoveWearable(const LLUUID& item_id, bool closer_to_body);
 	
 	// Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
 	bool			canWearableBeRemoved(const LLWearable* wearable) const;
 
 	void			animateAllWearableParams(F32 delta, BOOL upload_bake);
-
+	
 	//--------------------------------------------------------------------
 	// Accessors
 	//--------------------------------------------------------------------
 public:
-	const LLUUID		getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const;
-	const LLUUID		getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
+	const LLUUID		getWearableItemID(EWearableType type, U32 index /*= 0*/) const;
+	const LLUUID		getWearableAssetID(EWearableType type, U32 index /*= 0*/) const;
 	const LLWearable*	getWearableFromItemID(const LLUUID& item_id) const;
-	LLWearable*	getWearableFromItemID(const LLUUID& item_id);
 	LLWearable*	getWearableFromAssetID(const LLUUID& asset_id);
-	LLInventoryItem*	getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/);
-	static BOOL			selfHasWearable(LLWearableType::EType type);
-	LLWearable*			getWearable(const LLWearableType::EType type, U32 index /*= 0*/); 
-	const LLWearable* 	getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
-	LLWearable*		getTopWearable(const LLWearableType::EType type);
-	LLWearable*		getBottomWearable(const LLWearableType::EType type);
-	U32				getWearableCount(const LLWearableType::EType type) const;
+	LLInventoryItem*	getWearableInventoryItem(EWearableType type, U32 index /*= 0*/);
+	// MULTI-WEARABLE: assuming one per type.
+	static BOOL			selfHasWearable(EWearableType type);
+	LLWearable*			getWearable(const EWearableType type, U32 index /*= 0*/); 
+	const LLWearable* 	getWearable(const EWearableType type, U32 index /*= 0*/) const;
+	LLWearable*		getTopWearable(const EWearableType type);
+	U32				getWearableCount(const EWearableType type) const;
 	U32				getWearableCount(const U32 tex_index) const;
 
-	static const U32 MAX_CLOTHING_PER_TYPE = 5; 
-
-
 	//--------------------------------------------------------------------
 	// Setters
 	//--------------------------------------------------------------------
 
 private:
 	// Low-level data structure setter - public access is via setWearableItem, etc.
-	void 			setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
-	U32 			pushWearable(const LLWearableType::EType type, LLWearable *wearable);
+	void 			setWearable(const EWearableType type, U32 index, LLWearable *wearable);
+	U32 			pushWearable(const EWearableType type, LLWearable *wearable);
 	void			wearableUpdated(LLWearable *wearable);
 	void 			popWearable(LLWearable *wearable);
-	void			popWearable(const LLWearableType::EType type, U32 index);
+	void			popWearable(const EWearableType type, U32 index);
 	
 public:
 	void			setWearableItem(LLInventoryItem* new_item, LLWearable* wearable, bool do_append = false);
 	void			setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove);
 	void			setWearableName(const LLUUID& item_id, const std::string& new_name);
-	void			addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index);
+	void			addLocalTextureObject(const EWearableType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index);
 	U32				getWearableIndex(LLWearable *wearable);
 
 protected:
@@ -134,35 +126,20 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>
 												LLWearable* wearable, 
 												const LLUUID& category_id = LLUUID::null,
 												BOOL notify = TRUE);
-	void 			addWearabletoAgentInventoryDone(const LLWearableType::EType type,
+	void 			addWearabletoAgentInventoryDone(const S32 type,
 													const U32 index,
 													const LLUUID& item_id,
 													LLWearable* wearable);
-	void			recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/);
+	void			recoverMissingWearable(const EWearableType type, U32 index /*= 0*/);
 	void			recoverMissingWearableDone();
 
-	//--------------------------------------------------------------------
-	// Editing/moving wearables
-	//--------------------------------------------------------------------
-
-public:
-	static void		createWearable(LLWearableType::EType type, bool wear = false, const LLUUID& parent_id = LLUUID::null);
-	static void		editWearable(const LLUUID& item_id);
-	bool			moveWearable(const LLViewerInventoryItem* item, bool closer_to_body);
-
-	void			requestEditingWearable(const LLUUID& item_id);
-	void			editWearableIfRequested(const LLUUID& item_id);
-
-private:
-	LLUUID			mItemToEdit;
-
 	//--------------------------------------------------------------------
 	// Removing wearables
 	//--------------------------------------------------------------------
 public:
-	void			removeWearable(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
+	void			removeWearable(const EWearableType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
 private:
-	void			removeWearableFinal(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
+	void			removeWearableFinal(const EWearableType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
 protected:
 	static bool		onRemoveWearableDialog(const LLSD& notification, const LLSD& response);
 	static void		userRemoveAllClothesStep2(BOOL proceed); // userdata is NULL
@@ -173,9 +150,6 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>
 public:
 	// Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant)
 	static void		processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
-	LLUUID			computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
-											BOOL generate_valid_hash = TRUE);
-
 protected:
 	void			sendAgentWearablesUpdate();
 	void			sendAgentWearablesRequest();
@@ -187,6 +161,16 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>
 	// Outfits
 	//--------------------------------------------------------------------
 public:
+	void 			getAllWearablesArray(LLDynamicArray<S32>& wearables);
+	
+	// Note:	wearables_to_include should be a list of EWearableType types
+	//			attachments_to_include should be a list of attachment points
+	void			makeNewOutfit(const std::string& new_folder_name,
+								  const LLDynamicArray<S32>& wearables_to_include,
+								  const LLDynamicArray<S32>& attachments_to_include,
+								  BOOL rename_clothing);
+	
+	LLUUID			makeNewOutfitLinks(const std::string& new_folder_name);
 	
 	// Should only be called if we *know* we've never done so before, since users may
 	// not want the Library outfits to stay in their quick outfit selector and can delete them.
@@ -199,18 +183,18 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>
 	// Save Wearables
 	//--------------------------------------------------------------------
 public:	
-	void			saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found);
-	void			saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE,
-								 const std::string new_name = "");
+    // MULTI-WEARABLE: assumes one per type.
+	void			saveWearableAs(const EWearableType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found);
+	void			saveWearable(const EWearableType type, const U32 index, BOOL send_update = TRUE);
 	void			saveAllWearables();
-	void			revertWearable(const LLWearableType::EType type, const U32 index);
+	void			revertWearable(const EWearableType type, const U32 index);
 
 	//--------------------------------------------------------------------
 	// Static UI hooks
 	//--------------------------------------------------------------------
 public:
-	static void		userRemoveWearable(const LLWearableType::EType &type, const U32 &index);
-	static void		userRemoveWearablesOfType(const LLWearableType::EType &type);
+	static void		userRemoveWearable(const EWearableType &type, const U32 &index);
+	static void		userRemoveWearablesOfType(const EWearableType &type);
 	static void		userRemoveAllClothes();	
 	
 	typedef std::vector<LLViewerObject*> llvo_vec_t;
@@ -223,41 +207,17 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>
 	BOOL			itemUpdatePending(const LLUUID& item_id) const;
 	U32				itemUpdatePendingCount() const;
 
-	//--------------------------------------------------------------------
-	// Signals
-	//--------------------------------------------------------------------
-public:
-	typedef boost::function<void()>			loading_started_callback_t;
-	typedef boost::signals2::signal<void()>	loading_started_signal_t;
-	boost::signals2::connection				addLoadingStartedCallback(loading_started_callback_t cb);
-
-	typedef boost::function<void()>			loaded_callback_t;
-	typedef boost::signals2::signal<void()>	loaded_signal_t;
-	boost::signals2::connection				addLoadedCallback(loaded_callback_t cb);
-
-	void									notifyLoadingStarted();
-	void									notifyLoadingFinished();
-
-private:
-	loading_started_signal_t				mLoadingStartedSignal; // should be called before wearables are changed
-	loaded_signal_t							mLoadedSignal; // emitted when all agent wearables get loaded
-
 	//--------------------------------------------------------------------
 	// Member variables
 	//--------------------------------------------------------------------
 private:
 	typedef std::vector<LLWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
-	typedef std::map<LLWearableType::EType, wearableentry_vec_t> wearableentry_map_t;	// wearable "categories" arranged by wearable type
+	typedef std::map<EWearableType, wearableentry_vec_t> wearableentry_map_t;	// wearable "categories" arranged by wearable type
 	wearableentry_map_t mWearableDatas;
 
 	static BOOL		mInitialWearablesUpdateReceived;
 	BOOL			mWearablesLoaded;
 	std::set<LLUUID>	mItemsAwaitingWearableUpdate;
-
-	/**
-	 * True if agent's outfit is being changed now.
-	 */
-	BOOL			mCOFChangeInProgress;
 	
 	//--------------------------------------------------------------------------------
 	// Support classes
@@ -277,7 +237,7 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>
 	class addWearableToAgentInventoryCallback : public LLInventoryCallback
 	{
 	public:
-		enum ETodo
+		enum EType
 		{
 			CALL_NONE = 0,
 			CALL_UPDATE = 1,
@@ -287,20 +247,24 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>
 			CALL_WEARITEM = 16
 		};
 
+		// MULTI-WEARABLE: index is an EWearableType - more confusing usage.
+		// MULTI-WEARABLE: need to have type and index args both?
 		addWearableToAgentInventoryCallback(LLPointer<LLRefCount> cb,
-											LLWearableType::EType type,
+											S32 type,
 											U32 index,
 											LLWearable* wearable,
 											U32 todo = CALL_NONE);
 		virtual void fire(const LLUUID& inv_item);
 	private:
-		LLWearableType::EType mType;
+		S32 mType;
 		U32 mIndex;
 		LLWearable* mWearable;
 		U32 mTodo;
 		LLPointer<LLRefCount> mCB;
 	};
 
+	static const U32 MAX_WEARABLES_PER_TYPE = 1; 
+
 }; // LLAgentWearables
 
 extern LLAgentWearables gAgentWearables;
diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
index 9e15f24bea246f11058e6d75a488196de8e796e9..3d6740f5a1bf6fa5563ceaf600e0e72adb667b97 100644
--- a/indra/newview/llagentwearablesfetch.cpp
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -2,25 +2,31 @@
  * @file llagentwearablesfetch.cpp
  * @brief LLAgentWearblesFetch class implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -31,61 +37,9 @@
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
 #include "llinventoryfunctions.h"
-#include "llstartup.h"
 #include "llvoavatarself.h"
 
-
-class LLOrderMyOutfitsOnDestroy: public LLInventoryCallback
-{
-public:
-	LLOrderMyOutfitsOnDestroy() {};
-
-	virtual ~LLOrderMyOutfitsOnDestroy()
-	{
-		if (!LLApp::isRunning())
-		{
-			llwarns << "called during shutdown, skipping" << llendl;
-			return;
-		}
-		
-		const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
-		if (my_outfits_id.isNull()) return;
-
-		LLInventoryModel::cat_array_t* cats;
-		LLInventoryModel::item_array_t* items;
-		gInventory.getDirectDescendentsOf(my_outfits_id, cats, items);
-		if (!cats) return;
-
-		//My Outfits should at least contain saved initial outfit and one another outfit
-		if (cats->size() < 2)
-		{
-			llwarning("My Outfits category was not populated properly", 0);
-			return;
-		}
-
-		llinfos << "Starting updating My Outfits with wearables ordering information" << llendl;
-
-		for (LLInventoryModel::cat_array_t::iterator outfit_iter = cats->begin();
-			outfit_iter != cats->end(); ++outfit_iter)
-		{
-			const LLUUID& cat_id = (*outfit_iter)->getUUID();
-			if (cat_id.isNull()) continue;
-
-			// saved initial outfit already contains wearables ordering information
-			if (cat_id == LLAppearanceMgr::getInstance()->getBaseOutfitUUID()) continue;
-
-			LLAppearanceMgr::getInstance()->updateClothingOrderingInfo(cat_id);
-		}
-
-		llinfos << "Finished updating My Outfits with wearables ordering information" << llendl;
-	}
-
-	/* virtual */ void fire(const LLUUID& inv_item) {};
-};
-
-
-LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) :
-	LLInventoryFetchDescendentsObserver(cof_id)
+LLInitialWearablesFetch::LLInitialWearablesFetch()
 {
 }
 
@@ -121,7 +75,6 @@ void LLInitialWearablesFetch::processContents()
 	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
 	if (wearable_array.count() > 0)
 	{
-		gAgentWearables.notifyLoadingStarted();
 		LLAppearanceMgr::instance().updateAppearanceFromCOF();
 	}
 	else
@@ -133,11 +86,12 @@ void LLInitialWearablesFetch::processContents()
 	delete this;
 }
 
-class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver
+class LLFetchAndLinkObserver: public LLInventoryFetchObserver
 {
 public:
 	LLFetchAndLinkObserver(uuid_vec_t& ids):
-		LLInventoryFetchItemsObserver(ids)
+		m_ids(ids),
+		LLInventoryFetchObserver(true) // retry for missing items
 	{
 	}
 	~LLFetchAndLinkObserver()
@@ -149,8 +103,8 @@ class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver
 
 		// Link to all fetched items in COF.
 		LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
-		for (uuid_vec_t::iterator it = mIDs.begin();
-			 it != mIDs.end();
+		for (uuid_vec_t::iterator it = m_ids.begin();
+			 it != m_ids.end();
 			 ++it)
 		{
 			LLUUID id = *it;
@@ -165,11 +119,12 @@ class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver
 								item->getLinkedUUID(),
 								LLAppearanceMgr::instance().getCOF(),
 								item->getName(),
-								item->getDescription(),
 								LLAssetType::AT_LINK,
 								link_waiter);
 		}
 	}
+private:
+	uuid_vec_t m_ids;
 };
 
 void LLInitialWearablesFetch::processWearablesMessage()
@@ -218,10 +173,10 @@ void LLInitialWearablesFetch::processWearablesMessage()
 
 		// Need to fetch the inventory items for ids, then create links to them after they arrive.
 		LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids);
-		fetcher->startFetch();
+		fetcher->fetch(ids);
 		// If no items to be fetched, done will never be triggered.
-		// TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition.
-		if (fetcher->isFinished())
+		// TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition.
+		if (fetcher->isEverythingComplete())
 		{
 			fetcher->done();
 		}
@@ -236,13 +191,10 @@ void LLInitialWearablesFetch::processWearablesMessage()
 	}
 }
 
-LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const LLUUID& my_outfits_id) : 
-	LLInventoryFetchDescendentsObserver(my_outfits_id),
+LLLibraryOutfitsFetch::LLLibraryOutfitsFetch() : 
 	mCurrFetchStep(LOFS_FOLDER), 
 	mOutfitsPopulated(false) 
 {
-	llinfos << "created" << llendl;
-
 	mMyOutfitsID = LLUUID::null;
 	mClothingID = LLUUID::null;
 	mLibraryClothingID = LLUUID::null;
@@ -252,13 +204,10 @@ LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const LLUUID& my_outfits_id) :
 
 LLLibraryOutfitsFetch::~LLLibraryOutfitsFetch()
 {
-	llinfos << "destroyed" << llendl;
 }
 
 void LLLibraryOutfitsFetch::done()
 {
-	llinfos << "start" << llendl;
-
 	// Delay this until idle() routine, since it's a heavy operation and
 	// we also can't have it run within notifyObservers.
 	doOnIdleOneTime(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this));
@@ -267,8 +216,6 @@ void LLLibraryOutfitsFetch::done()
 
 void LLLibraryOutfitsFetch::doneIdle()
 {
-	llinfos << "start" << llendl;
-
 	gInventory.addObserver(this); // Add this back in since it was taken out during ::done()
 	
 	switch (mCurrFetchStep)
@@ -309,16 +256,12 @@ void LLLibraryOutfitsFetch::doneIdle()
 
 void LLLibraryOutfitsFetch::folderDone()
 {
-	llinfos << "start" << llendl;
-
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	gInventory.collectDescendents(mMyOutfitsID, cat_array, wearable_array, 
 								  LLInventoryModel::EXCLUDE_TRASH);
-	
-	// Early out if we already have items in My Outfits
-	// except the case when My Outfits contains just initial outfit
-	if (cat_array.count() > 1)
+	// Early out if we already have items in My Outfits.
+	if (cat_array.count() > 0 || wearable_array.count() > 0)
 	{
 		mOutfitsPopulated = true;
 		return;
@@ -329,7 +272,6 @@ void LLLibraryOutfitsFetch::folderDone()
 
 	// If Library->Clothing->Initial Outfits exists, use that.
 	LLNameCategoryCollector matchFolderFunctor("Initial Outfits");
-	cat_array.clear();
 	gInventory.collectDescendentsIf(mLibraryClothingID,
 									cat_array, wearable_array, 
 									LLInventoryModel::EXCLUDE_TRASH,
@@ -346,9 +288,8 @@ void LLLibraryOutfitsFetch::folderDone()
 	uuid_vec_t folders;
 	folders.push_back(mClothingID);
 	folders.push_back(mLibraryClothingID);
-	setFetchIDs(folders);
-	startFetch();
-	if (isFinished())
+	fetch(folders);
+	if (isEverythingComplete())
 	{
 		done();
 	}
@@ -356,8 +297,6 @@ void LLLibraryOutfitsFetch::folderDone()
 
 void LLLibraryOutfitsFetch::outfitsDone()
 {
-	llinfos << "start" << llendl;
-
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	uuid_vec_t folders;
@@ -398,9 +337,9 @@ void LLLibraryOutfitsFetch::outfitsDone()
 	}
 	
 	mComplete.clear();
-	setFetchIDs(folders);
-	startFetch();
-	if (isFinished())
+	
+	fetch(folders);
+	if (isEverythingComplete())
 	{
 		done();
 	}
@@ -435,8 +374,6 @@ class LLLibraryOutfitsCopyDone: public LLInventoryCallback
 // Copy the clothing folders from the library into the imported clothing folder
 void LLLibraryOutfitsFetch::libraryDone()
 {
-	llinfos << "start" << llendl;
-
 	if (mImportedClothingID != LLUUID::null)
 	{
 		// Skip straight to fetching the contents of the imported folder
@@ -492,16 +429,14 @@ void LLLibraryOutfitsFetch::libraryDone()
 
 void LLLibraryOutfitsFetch::importedFolderFetch()
 {
-	llinfos << "start" << llendl;
-
 	// Fetch the contents of the Imported Clothing Folder
 	uuid_vec_t folders;
 	folders.push_back(mImportedClothingID);
 	
 	mComplete.clear();
-	setFetchIDs(folders);
-	startFetch();
-	if (isFinished())
+	
+	fetch(folders);
+	if (isEverythingComplete())
 	{
 		done();
 	}
@@ -509,8 +444,6 @@ void LLLibraryOutfitsFetch::importedFolderFetch()
 
 void LLLibraryOutfitsFetch::importedFolderDone()
 {
-	llinfos << "start" << llendl;
-
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	uuid_vec_t folders;
@@ -531,9 +464,8 @@ void LLLibraryOutfitsFetch::importedFolderDone()
 	}
 	
 	mComplete.clear();
-	setFetchIDs(folders);
-	startFetch();
-	if (isFinished())
+	fetch(folders);
+	if (isEverythingComplete())
 	{
 		done();
 	}
@@ -541,13 +473,9 @@ void LLLibraryOutfitsFetch::importedFolderDone()
 
 void LLLibraryOutfitsFetch::contentsDone()
 {		
-	llinfos << "start" << llendl;
-
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	
-	LLPointer<LLOrderMyOutfitsOnDestroy> order_myoutfits_on_destroy = new LLOrderMyOutfitsOnDestroy;
-
 	for (uuid_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin();
 		 folder_iter != mImportedClothingFolders.end();
 		 ++folder_iter)
@@ -559,9 +487,6 @@ void LLLibraryOutfitsFetch::contentsDone()
 			llwarns << "Library folder import for uuid:" << folder_id << " failed to find folder." << llendl;
 			continue;
 		}
-
-		//initial outfit should be already in My Outfits
-		if (cat->getName() == LLStartUp::getInitialOutfitName()) continue;
 		
 		// First, make a folder in the My Outfits directory.
 		LLUUID new_outfit_folder_id = gInventory.createNewCategory(mMyOutfitsID, LLFolderType::FT_OUTFIT, cat->getName());
@@ -581,9 +506,8 @@ void LLLibraryOutfitsFetch::contentsDone()
 								item->getLinkedUUID(),
 								new_outfit_folder_id,
 								item->getName(),
-								item->getDescription(),
 								LLAssetType::AT_LINK,
-								order_myoutfits_on_destroy);
+								NULL);
 		}
 	}
 
diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h
index 7dafab4a3359f702702553e2e4bf733991135149..1d0c6739bab1861312c37bd25d62f98c5e894485 100644
--- a/indra/newview/llagentwearablesfetch.h
+++ b/indra/newview/llagentwearablesfetch.h
@@ -2,25 +2,31 @@
  * @file llagentwearablesinitialfetch.h
  * @brief LLAgentWearablesInitialFetch class header file
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -28,7 +34,7 @@
 #define LL_LLAGENTWEARABLESINITIALFETCH_H
 
 #include "llinventoryobserver.h"
-#include "llwearabletype.h"
+#include "llwearabledictionary.h"
 #include "lluuid.h"
 
 //--------------------------------------------------------------------
@@ -41,16 +47,16 @@
 class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver
 {
 public:
-	LLInitialWearablesFetch(const LLUUID& cof_id);
+	LLInitialWearablesFetch();
 	~LLInitialWearablesFetch();
 	virtual void done();
 
 	struct InitialWearableData
 	{
-		LLWearableType::EType mType;
+		EWearableType mType;
 		LLUUID mItemID;
 		LLUUID mAssetID;
-		InitialWearableData(LLWearableType::EType type, LLUUID& itemID, LLUUID& assetID) :
+		InitialWearableData(EWearableType type, LLUUID& itemID, LLUUID& assetID) :
 			mType(type),
 			mItemID(itemID),
 			mAssetID(assetID)
@@ -86,7 +92,7 @@ class LLLibraryOutfitsFetch : public LLInventoryFetchDescendentsObserver
 		LOFS_CONTENTS
 	};
 
-	LLLibraryOutfitsFetch(const LLUUID& my_outfits_id);
+	LLLibraryOutfitsFetch();
 	~LLLibraryOutfitsFetch();
 
 	virtual void done();
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 04a5bcc256d6d50b1674fa1691427f2b318d502e..e0f1d5348dbf93e34dde52553a9d40d122e41ad4 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -2,122 +2,54 @@
  * @file llappearancemgr.cpp
  * @brief Manager for initiating appearance changes on the viewer
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 
-#include "llaccordionctrltab.h"
 #include "llagent.h"
-#include "llagentcamera.h"
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
 #include "llcommandhandler.h"
-#include "lleventtimer.h"
+#include "llfloatercustomize.h"
 #include "llgesturemgr.h"
 #include "llinventorybridge.h"
 #include "llinventoryfunctions.h"
 #include "llinventoryobserver.h"
 #include "llnotificationsutil.h"
-#include "lloutfitobserver.h"
-#include "lloutfitslist.h"
-#include "llselectmgr.h"
 #include "llsidepanelappearance.h"
 #include "llsidetray.h"
-#include "llviewerobjectlist.h"
 #include "llvoavatar.h"
 #include "llvoavatarself.h"
 #include "llviewerregion.h"
 #include "llwearablelist.h"
 
-// RAII thingy to guarantee that a variable gets reset when the Setter
-// goes out of scope.  More general utility would be handy - TODO:
-// check boost.
-class BoolSetter
-{
-public:
-	BoolSetter(bool& var):
-		mVar(var)
-	{
-		mVar = true;
-	}
-	~BoolSetter()
-	{
-		mVar = false; 
-	}
-private:
-	bool& mVar;
-};
-
-char ORDER_NUMBER_SEPARATOR('@');
-
-class LLOutfitUnLockTimer: public LLEventTimer
-{
-public:
-	LLOutfitUnLockTimer(F32 period) : LLEventTimer(period)
-	{
-		// restart timer on BOF changed event
-		LLOutfitObserver::instance().addBOFChangedCallback(boost::bind(
-				&LLOutfitUnLockTimer::reset, this));
-		stop();
-	}
-
-	/*virtual*/
-	BOOL tick()
-	{
-		if(mEventTimer.hasExpired())
-		{
-			LLAppearanceMgr::instance().setOutfitLocked(false);
-		}
-		return FALSE;
-	}
-	void stop() { mEventTimer.stop(); }
-	void start() { mEventTimer.start(); }
-	void reset() { mEventTimer.reset(); }
-	BOOL getStarted() { return mEventTimer.getStarted(); }
-
-	LLTimer&  getEventTimer() { return mEventTimer;}
-};
-
-// support for secondlife:///app/appearance SLapps
-class LLAppearanceHandler : public LLCommandHandler
-{
-public:
-	// requests will be throttled from a non-trusted browser
-	LLAppearanceHandler() : LLCommandHandler("appearance", UNTRUSTED_THROTTLE) {}
-
-	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
-	{
-		// support secondlife:///app/appearance/show, but for now we just
-		// make all secondlife:///app/appearance SLapps behave this way
-		LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD());
-		return true;
-	}
-};
-
-LLAppearanceHandler gAppearanceHandler;
-
-
-LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string& name)
+LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string& name)
 {
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t item_array;
@@ -184,26 +116,8 @@ class LLWearInventoryCategoryCallback : public LLInventoryCallback
 	bool mAppend;
 };
 
-
-//Inventory callback updating "dirty" state when destroyed
-class LLUpdateDirtyState: public LLInventoryCallback
-{
-public:
-	LLUpdateDirtyState() {}
-	virtual ~LLUpdateDirtyState()
-	{
-		if (LLAppearanceMgr::instanceExists())
-		{
-			LLAppearanceMgr::getInstance()->updateIsDirty();
-		}
-	}
-	virtual void fire(const LLUUID&) {}
-};
-
-
-LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy(bool update_base_outfit_ordering):
-	mFireCount(0),
-	mUpdateBaseOrder(update_base_outfit_ordering)
+LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy():
+	mFireCount(0)
 {
 }
 
@@ -213,17 +127,13 @@ LLUpdateAppearanceOnDestroy::~LLUpdateAppearanceOnDestroy()
 	
 	if (!LLApp::isExiting())
 	{
-		LLAppearanceMgr::instance().updateAppearanceFromCOF(mUpdateBaseOrder);
+		LLAppearanceMgr::instance().updateAppearanceFromCOF();
 	}
 }
 
 void LLUpdateAppearanceOnDestroy::fire(const LLUUID& inv_item)
 {
-	LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(inv_item);
-	const std::string item_name = item ? item->getName() : "ITEM NOT FOUND";
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-	llinfos << "callback fired [ name:" << item_name << " UUID:" << inv_item << " count:" << mFireCount << " ] " << llendl;
-#endif
+	llinfos << "callback fired" << llendl;
 	mFireCount++;
 }
 
@@ -231,31 +141,28 @@ struct LLFoundData
 {
 	LLFoundData() :
 		mAssetType(LLAssetType::AT_NONE),
-		mWearableType(LLWearableType::WT_INVALID),
+		mWearableType(WT_INVALID),
 		mWearable(NULL) {}
 
 	LLFoundData(const LLUUID& item_id,
 				const LLUUID& asset_id,
 				const std::string& name,
 				const LLAssetType::EType& asset_type,
-				const LLWearableType::EType& wearable_type,
-				const bool is_replacement = false
+				const EWearableType& wearable_type
 		) :
 		mItemID(item_id),
 		mAssetID(asset_id),
 		mName(name),
 		mAssetType(asset_type),
 		mWearableType(wearable_type),
-		mIsReplacement(is_replacement),
 		mWearable( NULL ) {}
 	
 	LLUUID mItemID;
 	LLUUID mAssetID;
 	std::string mName;
 	LLAssetType::EType mAssetType;
-	LLWearableType::EType mWearableType;
+	EWearableType mWearableType;
 	LLWearable* mWearable;
-	bool mIsReplacement;
 };
 
 	
@@ -273,23 +180,13 @@ class LLWearableHoldingPattern
 	void checkMissingWearables();
 	bool pollMissingWearables();
 	bool isMissingCompleted();
-	void recoverMissingWearable(LLWearableType::EType type);
+	void recoverMissingWearable(EWearableType type);
 	void clearCOFLinksForMissingWearables();
 	
 	void onWearableAssetFetch(LLWearable *wearable);
 	void onAllComplete();
-
-	typedef std::list<LLFoundData> found_list_t;
-	found_list_t& getFoundList();
-	void eraseTypeToLink(LLWearableType::EType type);
-	void eraseTypeToRecover(LLWearableType::EType type);
-	void setObjItems(const LLInventoryModel::item_array_t& items);
-	void setGestItems(const LLInventoryModel::item_array_t& items);
-	bool isMostRecent();
-	void handleLateArrivals();
-	void resetTime(F32 timeout);
 	
-private:
+	typedef std::list<LLFoundData> found_list_t;
 	found_list_t mFoundList;
 	LLInventoryModel::item_array_t mObjItems;
 	LLInventoryModel::item_array_t mGestItems;
@@ -299,128 +196,63 @@ class LLWearableHoldingPattern
 	S32 mResolved;
 	LLTimer mWaitTime;
 	bool mFired;
-	typedef std::set<LLWearableHoldingPattern*> type_set_hp;
-	static type_set_hp sActiveHoldingPatterns;
-	bool mIsMostRecent;
-	std::set<LLWearable*> mLateArrivals;
-	bool mIsAllComplete;
 };
 
-LLWearableHoldingPattern::type_set_hp LLWearableHoldingPattern::sActiveHoldingPatterns;
-
 LLWearableHoldingPattern::LLWearableHoldingPattern():
 	mResolved(0),
-	mFired(false),
-	mIsMostRecent(true),
-	mIsAllComplete(false)
+	mFired(false)
 {
-	if (sActiveHoldingPatterns.size()>0)
-	{
-		llinfos << "Creating LLWearableHoldingPattern when "
-				<< sActiveHoldingPatterns.size()
-				<< " other attempts are active."
-				<< " Flagging others as invalid."
-				<< llendl;
-		for (type_set_hp::iterator it = sActiveHoldingPatterns.begin();
-			 it != sActiveHoldingPatterns.end();
-			 ++it)
-		{
-			(*it)->mIsMostRecent = false;
-		}
-			 
-	}
-	sActiveHoldingPatterns.insert(this);
 }
 
 LLWearableHoldingPattern::~LLWearableHoldingPattern()
 {
-	sActiveHoldingPatterns.erase(this);
-}
-
-bool LLWearableHoldingPattern::isMostRecent()
-{
-	return mIsMostRecent;
-}
-
-LLWearableHoldingPattern::found_list_t& LLWearableHoldingPattern::getFoundList()
-{
-	return mFoundList;
-}
-
-void LLWearableHoldingPattern::eraseTypeToLink(LLWearableType::EType type)
-{
-	mTypesToLink.erase(type);
-}
-
-void LLWearableHoldingPattern::eraseTypeToRecover(LLWearableType::EType type)
-{
-	mTypesToRecover.erase(type);
-}
-
-void LLWearableHoldingPattern::setObjItems(const LLInventoryModel::item_array_t& items)
-{
-	mObjItems = items;
-}
-
-void LLWearableHoldingPattern::setGestItems(const LLInventoryModel::item_array_t& items)
-{
-	mGestItems = items;
 }
 
 bool LLWearableHoldingPattern::isFetchCompleted()
 {
-	return (mResolved >= (S32)getFoundList().size()); // have everything we were waiting for?
+	return (mResolved >= (S32)mFoundList.size()); // have everything we were waiting for?
 }
 
 bool LLWearableHoldingPattern::isTimedOut()
 {
-	return mWaitTime.hasExpired();
+	static F32 max_wait_time = 60.0;  // give up if wearable fetches haven't completed in max_wait_time seconds.
+	return mWaitTime.getElapsedTimeF32() > max_wait_time; 
 }
 
 void LLWearableHoldingPattern::checkMissingWearables()
 {
-	if (!isMostRecent())
-	{
-		llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
-	}
-		
-	std::vector<S32> found_by_type(LLWearableType::WT_COUNT,0);
-	std::vector<S32> requested_by_type(LLWearableType::WT_COUNT,0);
-	for (found_list_t::iterator it = getFoundList().begin(); it != getFoundList().end(); ++it)
+	std::vector<S32> found_by_type(WT_COUNT,0);
+	std::vector<S32> requested_by_type(WT_COUNT,0);
+	for (found_list_t::iterator it = mFoundList.begin(); it != mFoundList.end(); ++it)
 	{
 		LLFoundData &data = *it;
-		if (data.mWearableType < LLWearableType::WT_COUNT)
+		if (data.mWearableType < WT_COUNT)
 			requested_by_type[data.mWearableType]++;
 		if (data.mWearable)
 			found_by_type[data.mWearableType]++;
 	}
 
-	for (S32 type = 0; type < LLWearableType::WT_COUNT; ++type)
+	for (S32 type = 0; type < WT_COUNT; ++type)
 	{
-		if (requested_by_type[type] > found_by_type[type])
-		{
-			llwarns << "got fewer wearables than requested, type " << type << ": requested " << requested_by_type[type] << ", found " << found_by_type[type] << llendl;
-		}
+		llinfos << "type " << type << " requested " << requested_by_type[type] << " found " << found_by_type[type] << llendl;
 		if (found_by_type[type] > 0)
 			continue;
 		if (
-			// If at least one wearable of certain types (pants/shirt/skirt)
-			// was requested but none was found, create a default asset as a replacement.
-			// In all other cases, don't do anything.
-			// For critical types (shape/hair/skin/eyes), this will keep the avatar as a cloud 
-			// due to logic in LLVOAvatarSelf::getIsCloud().
-			// For non-critical types (tatoo, socks, etc.) the wearable will just be missing.
-			(requested_by_type[type] > 0) &&  
-			((type == LLWearableType::WT_PANTS) || (type == LLWearableType::WT_SHIRT) || (type == LLWearableType::WT_SKIRT)))
+			// Need to recover if at least one wearable of that type
+			// was requested but none was found (prevent missing
+			// pants)
+			(requested_by_type[type] > 0) ||  
+			// or if type is a body part and no wearables were found.
+			((type == WT_SHAPE) || (type == WT_SKIN) || (type == WT_HAIR) || (type == WT_EYES)))
 		{
 			mTypesToRecover.insert(type);
 			mTypesToLink.insert(type);
-			recoverMissingWearable((LLWearableType::EType)type);
+			recoverMissingWearable((EWearableType)type);
 			llwarns << "need to replace " << type << llendl; 
 		}
 	}
 
-	resetTime(60.0F);
+	mWaitTime.reset();
 	if (!pollMissingWearables())
 	{
 		doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollMissingWearables,this));
@@ -429,11 +261,6 @@ void LLWearableHoldingPattern::checkMissingWearables()
 
 void LLWearableHoldingPattern::onAllComplete()
 {
-	if (!isMostRecent())
-	{
-		llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
-	}
-
 	// Activate all gestures in this folder
 	if (mGestItems.count() > 0)
 	{
@@ -469,31 +296,16 @@ void LLWearableHoldingPattern::onAllComplete()
 		// Only safe to delete if all wearable callbacks and all missing wearables completed.
 		delete this;
 	}
-	else
-	{
-		mIsAllComplete = true;
-		handleLateArrivals();
-	}
 }
 
 void LLWearableHoldingPattern::onFetchCompletion()
 {
-	if (!isMostRecent())
-	{
-		llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
-	}
-
 	checkMissingWearables();
 }
 
 // Runs as an idle callback until all wearables are fetched (or we time out).
 bool LLWearableHoldingPattern::pollFetchCompletion()
 {
-	if (!isMostRecent())
-	{
-		llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
-	}
-
 	bool completed = isFetchCompleted();
 	bool timed_out = isTimedOut();
 	bool done = completed || timed_out;
@@ -518,7 +330,7 @@ bool LLWearableHoldingPattern::pollFetchCompletion()
 class RecoveredItemLinkCB: public LLInventoryCallback
 {
 public:
-	RecoveredItemLinkCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
+	RecoveredItemLinkCB(EWearableType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
 		mHolder(holder),
 		mWearable(wearable),
 		mType(type)
@@ -526,13 +338,8 @@ class RecoveredItemLinkCB: public LLInventoryCallback
 	}
 	void fire(const LLUUID& item_id)
 	{
-		if (!mHolder->isMostRecent())
-		{
-			llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
-		}
-
 		llinfos << "Recovered item link for type " << mType << llendl;
-		mHolder->eraseTypeToLink(mType);
+		mHolder->mTypesToLink.erase(mType);
 		// Add wearable to FoundData for actual wearing
 		LLViewerInventoryItem *item = gInventory.getItem(item_id);
 		LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
@@ -544,14 +351,13 @@ class RecoveredItemLinkCB: public LLInventoryCallback
 			if (item)
 			{
 				LLFoundData found(linked_item->getUUID(),
-								  linked_item->getAssetUUID(),
-								  linked_item->getName(),
-								  linked_item->getType(),
-								  linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID,
-								  true // is replacement
-					);
+						  linked_item->getAssetUUID(),
+						  linked_item->getName(),
+						  linked_item->getType(),
+						  linked_item->isWearableType() ? linked_item->getWearableType() : WT_INVALID
+						  );
 				found.mWearable = mWearable;
-				mHolder->getFoundList().push_front(found);
+				mHolder->mFoundList.push_front(found);
 			}
 			else
 			{
@@ -566,13 +372,13 @@ class RecoveredItemLinkCB: public LLInventoryCallback
 private:
 	LLWearableHoldingPattern* mHolder;
 	LLWearable *mWearable;
-	LLWearableType::EType mType;
+	EWearableType mType;
 };
 
 class RecoveredItemCB: public LLInventoryCallback
 {
 public:
-	RecoveredItemCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
+	RecoveredItemCB(EWearableType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
 		mHolder(holder),
 		mWearable(wearable),
 		mType(type)
@@ -580,16 +386,11 @@ class RecoveredItemCB: public LLInventoryCallback
 	}
 	void fire(const LLUUID& item_id)
 	{
-		if (!mHolder->isMostRecent())
-		{
-			llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
-		}
-
 		llinfos << "Recovered item for type " << mType << llendl;
 		LLViewerInventoryItem *itemp = gInventory.getItem(item_id);
 		mWearable->setItemID(item_id);
 		LLPointer<LLInventoryCallback> cb = new RecoveredItemLinkCB(mType,mWearable,mHolder);
-		mHolder->eraseTypeToRecover(mType);
+		mHolder->mTypesToRecover.erase(mType);
 		llassert(itemp);
 		if (itemp)
 		{
@@ -597,7 +398,6 @@ class RecoveredItemCB: public LLInventoryCallback
 					     item_id,
 					     LLAppearanceMgr::instance().getCOF(),
 					     itemp->getName(),
-						 itemp->getDescription(),
 					     LLAssetType::AT_LINK,
 					     cb);
 		}
@@ -605,19 +405,14 @@ class RecoveredItemCB: public LLInventoryCallback
 private:
 	LLWearableHoldingPattern* mHolder;
 	LLWearable *mWearable;
-	LLWearableType::EType mType;
+	EWearableType mType;
 };
 
-void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type)
+void LLWearableHoldingPattern::recoverMissingWearable(EWearableType type)
 {
-	if (!isMostRecent())
-	{
-		llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
-	}
-	
 		// Try to recover by replacing missing wearable with a new one.
 	LLNotificationsUtil::add("ReplacedMissingWearable");
-	lldebugs << "Wearable " << LLWearableType::getTypeLabel(type)
+	lldebugs << "Wearable " << LLWearableDictionary::getTypeLabel(type)
 			 << " could not be downloaded.  Replaced inventory item with default wearable." << llendl;
 	LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
 
@@ -645,10 +440,10 @@ bool LLWearableHoldingPattern::isMissingCompleted()
 
 void LLWearableHoldingPattern::clearCOFLinksForMissingWearables()
 {
-	for (found_list_t::iterator it = getFoundList().begin(); it != getFoundList().end(); ++it)
+	for (found_list_t::iterator it = mFoundList.begin(); it != mFoundList.end(); ++it)
 	{
 		LLFoundData &data = *it;
-		if ((data.mWearableType < LLWearableType::WT_COUNT) && (!data.mWearable))
+		if ((data.mWearableType < WT_COUNT) && (!data.mWearable))
 		{
 			// Wearable link that was never resolved; remove links to it from COF
 			llinfos << "removing link for unresolved item " << data.mItemID.asString() << llendl;
@@ -659,144 +454,33 @@ void LLWearableHoldingPattern::clearCOFLinksForMissingWearables()
 
 bool LLWearableHoldingPattern::pollMissingWearables()
 {
-	if (!isMostRecent())
-	{
-		llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
-	}
-	
 	bool timed_out = isTimedOut();
 	bool missing_completed = isMissingCompleted();
 	bool done = timed_out || missing_completed;
-
-	if (!done)
-	{
-		llinfos << "polling missing wearables, waiting for items " << mTypesToRecover.size()
-				<< " links " << mTypesToLink.size()
-				<< " wearables, timed out " << timed_out
-				<< " elapsed " << mWaitTime.getElapsedTimeF32()
-				<< " done " << done << llendl;
-	}
+	
+	llinfos << "polling missing wearables, waiting for items " << mTypesToRecover.size()
+			<< " links " << mTypesToLink.size()
+			<< " wearables, timed out " << timed_out
+			<< " elapsed " << mWaitTime.getElapsedTimeF32()
+			<< " done " << done << llendl;
 
 	if (done)
 	{
-		gAgentAvatarp->debugWearablesLoaded();
-
-		// BAP - if we don't call clearCOFLinksForMissingWearables()
-		// here, we won't have to add the link back in later if the
-		// wearable arrives late.  This is to avoid corruption of
-		// wearable ordering info.  Also has the effect of making
-		// unworn item links visible in the COF under some
-		// circumstances.
-
-		//clearCOFLinksForMissingWearables();
+		clearCOFLinksForMissingWearables();
 		onAllComplete();
 	}
 	return done;
 }
 
-// Handle wearables that arrived after the timeout period expired.
-void LLWearableHoldingPattern::handleLateArrivals()
-{
-	// Only safe to run if we have previously finished the missing
-	// wearables and other processing - otherwise we could be in some
-	// intermediate state - but have not been superceded by a later
-	// outfit change request.
-	if (mLateArrivals.size() == 0)
-	{
-		// Nothing to process.
-		return;
-	}
-	if (!isMostRecent())
-	{
-		llwarns << "Late arrivals not handled - outfit change no longer valid" << llendl;
-	}
-	if (!mIsAllComplete)
-	{
-		llwarns << "Late arrivals not handled - in middle of missing wearables processing" << llendl;
-	}
-
-	llinfos << "Need to handle " << mLateArrivals.size() << " late arriving wearables" << llendl;
-
-	// Update mFoundList using late-arriving wearables.
-	std::set<LLWearableType::EType> replaced_types;
-	for (LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin();
-		 iter != getFoundList().end(); ++iter)
-	{
-		LLFoundData& data = *iter;
-		for (std::set<LLWearable*>::iterator wear_it = mLateArrivals.begin();
-			 wear_it != mLateArrivals.end();
-			 ++wear_it)
-		{
-			LLWearable *wearable = *wear_it;
-
-			if(wearable->getAssetID() == data.mAssetID)
-			{
-				data.mWearable = wearable;
-
-				replaced_types.insert(data.mWearableType);
-
-				// BAP - if we didn't call
-				// clearCOFLinksForMissingWearables() earlier, we
-				// don't need to restore the link here.  Fixes
-				// wearable ordering problems.
-
-				// LLAppearanceMgr::instance().addCOFItemLink(data.mItemID,false);
-
-				// BAP failing this means inventory or asset server
-				// are corrupted in a way we don't handle.
-				llassert((data.mWearableType < LLWearableType::WT_COUNT) && (wearable->getType() == data.mWearableType));
-				break;
-			}
-		}
-	}
-
-	// Remove COF links for any default wearables previously used to replace the late arrivals.
-	// All this pussyfooting around with a while loop and explicit
-	// iterator incrementing is to allow removing items from the list
-	// without clobbering the iterator we're using to navigate.
-	LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin();
-	while (iter != getFoundList().end())
-	{
-		LLFoundData& data = *iter;
-
-		// If an item of this type has recently shown up, removed the corresponding replacement wearable from COF.
-		if (data.mWearable && data.mIsReplacement &&
-			replaced_types.find(data.mWearableType) != replaced_types.end())
-		{
-			LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID,false);
-			std::list<LLFoundData>::iterator clobber_ator = iter;
-			++iter;
-			getFoundList().erase(clobber_ator);
-		}
-		else
-		{
-			++iter;
-		}
-	}
-
-	// Clear contents of late arrivals.
-	mLateArrivals.clear();
-
-	// Update appearance based on mFoundList
-	LLAppearanceMgr::instance().updateAgentWearables(this, false);
-}
-
-void LLWearableHoldingPattern::resetTime(F32 timeout)
-{
-	mWaitTime.reset();
-	mWaitTime.setTimerExpirySec(timeout);
-}
-
 void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable)
 {
-	if (!isMostRecent())
+	mResolved += 1;  // just counting callbacks, not successes.
+	llinfos << "onWearableAssetFetch, resolved count " << mResolved << " of requested " << mFoundList.size() << llendl;
+	if (wearable)
 	{
-		llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl;
+		llinfos << "wearable found, type " << wearable->getType() << " asset " << wearable->getAssetID() << llendl;
 	}
-	
-	mResolved += 1;  // just counting callbacks, not successes.
-	llinfos << "resolved " << mResolved << "/" << getFoundList().size() << llendl;
-	if (!wearable)
+	else
 	{
 		llwarns << "no wearable found" << llendl;
 	}
@@ -804,14 +488,6 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable)
 	if (mFired)
 	{
 		llwarns << "called after holder fired" << llendl;
-		if (wearable)
-		{
-			mLateArrivals.insert(wearable);
-			if (mIsAllComplete)
-			{
-				handleLateArrivals();
-			}
-		}
 		return;
 	}
 
@@ -820,20 +496,16 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable)
 		return;
 	}
 
-	for (LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin();
-		 iter != getFoundList().end(); ++iter)
+	for (LLWearableHoldingPattern::found_list_t::iterator iter = mFoundList.begin();
+		 iter != mFoundList.end(); ++iter)
 	{
 		LLFoundData& data = *iter;
 		if(wearable->getAssetID() == data.mAssetID)
 		{
-			// Failing this means inventory or asset server are corrupted in a way we don't handle.
-			if ((data.mWearableType >= LLWearableType::WT_COUNT) || (wearable->getType() != data.mWearableType))
-			{
-				llwarns << "recovered wearable but type invalid. inventory wearable type: " << data.mWearableType << " asset wearable type: " << wearable->getType() << llendl;
-				break;
-			}
-
 			data.mWearable = wearable;
+			// Failing this means inventory or asset server are corrupted in a way we don't handle.
+			llassert((data.mWearableType < WT_COUNT) && (wearable->getType() == data.mWearableType));
+			break;
 		}
 	}
 }
@@ -900,13 +572,6 @@ const LLViewerInventoryItem* LLAppearanceMgr::getBaseOutfitLink()
 		const LLViewerInventoryCategory *cat = item->getLinkedCategory();
 		if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
 		{
-			const LLUUID parent_id = cat->getParentUUID();
-			LLViewerInventoryCategory*  parent_cat =  gInventory.getCategory(parent_id);
-			// if base outfit moved to trash it means that we don't have base outfit
-			if (parent_cat != NULL && parent_cat->getPreferredType() == LLFolderType::FT_TRASH)
-			{
-				return NULL;
-			}
 			return item;
 		}
 	}
@@ -928,92 +593,6 @@ bool LLAppearanceMgr::getBaseOutfitName(std::string& name)
 	return false;
 }
 
-const LLUUID LLAppearanceMgr::getBaseOutfitUUID()
-{
-	const LLViewerInventoryItem* outfit_link = getBaseOutfitLink();
-	if (!outfit_link || !outfit_link->getIsLinkType()) return LLUUID::null;
-
-	const LLViewerInventoryCategory* outfit_cat = outfit_link->getLinkedCategory();
-	if (!outfit_cat) return LLUUID::null;
-
-	if (outfit_cat->getPreferredType() != LLFolderType::FT_OUTFIT)
-	{
-		llwarns << "Expected outfit type:" << LLFolderType::FT_OUTFIT << " but got type:" << outfit_cat->getType() << " for folder name:" << outfit_cat->getName() << llendl;
-		return LLUUID::null;
-	}
-
-	return outfit_cat->getUUID();
-}
-
-bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_update, bool replace, LLPointer<LLInventoryCallback> cb)
-{
-	if (item_id_to_wear.isNull()) return false;
-
-	// *TODO: issue with multi-wearable should be fixed:
-	// in this case this method will be called N times - loading started for each item
-	// and than N times will be called - loading completed for each item.
-	// That means subscribers will be notified that loading is done after first item in a batch is worn.
-	// (loading indicator disappears for example before all selected items are worn)
-	// Have not fix this issue for 2.1 because of stability reason. EXT-7777.
-
-	// Disabled for now because it is *not* acceptable to call updateAppearanceFromCOF() multiple times
-//	gAgentWearables.notifyLoadingStarted();
-
-	LLViewerInventoryItem* item_to_wear = gInventory.getItem(item_id_to_wear);
-	if (!item_to_wear) return false;
-
-	if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.getLibraryRootFolderID()))
-	{
-		LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback(replace);
-		copy_inventory_item(gAgent.getID(), item_to_wear->getPermissions().getOwner(), item_to_wear->getUUID(), LLUUID::null, std::string(),cb);
-		return false;
-	} 
-	else if (!gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.getRootFolderID()))
-	{
-		return false; // not in library and not in agent's inventory
-	}
-	else if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH)))
-	{
-		LLNotificationsUtil::add("CannotWearTrash");
-		return false;
-	}
-	else if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), LLAppearanceMgr::instance().getCOF())) // EXT-84911
-	{
-		return false;
-	}
-
-	switch (item_to_wear->getType())
-	{
-	case LLAssetType::AT_CLOTHING:
-		if (gAgentWearables.areWearablesLoaded())
-		{
-			S32 wearable_count = gAgentWearables.getWearableCount(item_to_wear->getWearableType());
-			if ((replace && wearable_count != 0) ||
-				(wearable_count >= LLAgentWearables::MAX_CLOTHING_PER_TYPE) )
-			{
-				removeCOFItemLinks(gAgentWearables.getWearableItemID(item_to_wear->getWearableType(), wearable_count-1), false);
-			}
-			addCOFItemLink(item_to_wear, do_update, cb);
-		} 
-		break;
-	case LLAssetType::AT_BODYPART:
-		// TODO: investigate wearables may not be loaded at this point EXT-8231
-		
-		// Remove the existing wearables of the same type.
-		// Remove existing body parts anyway because we must not be able to wear e.g. two skins.
-		removeCOFLinksOfType(item_to_wear->getWearableType(), false);
-
-		addCOFItemLink(item_to_wear, do_update, cb);
-		break;
-	case LLAssetType::AT_OBJECT:
-		rez_attachment(item_to_wear, NULL);
-		break;
-	default: return false;;
-	}
-
-	return true;
-}
-
 // Update appearance from outfit folder.
 void LLAppearanceMgr::changeOutfit(bool proceed, const LLUUID& category, bool append)
 {
@@ -1022,90 +601,6 @@ void LLAppearanceMgr::changeOutfit(bool proceed, const LLUUID& category, bool ap
 	LLAppearanceMgr::instance().updateCOF(category,append);
 }
 
-void LLAppearanceMgr::replaceCurrentOutfit(const LLUUID& new_outfit)
-{
-	LLViewerInventoryCategory* cat = gInventory.getCategory(new_outfit);
-	wearInventoryCategory(cat, false, false);
-}
-
-// Open outfit renaming dialog.
-void LLAppearanceMgr::renameOutfit(const LLUUID& outfit_id)
-{
-	LLViewerInventoryCategory* cat = gInventory.getCategory(outfit_id);
-	if (!cat)
-	{
-		return;
-	}
-
-	LLSD args;
-	args["NAME"] = cat->getName();
-
-	LLSD payload;
-	payload["cat_id"] = outfit_id;
-
-	LLNotificationsUtil::add("RenameOutfit", args, payload, boost::bind(onOutfitRename, _1, _2));
-}
-
-// User typed new outfit name.
-// static
-void LLAppearanceMgr::onOutfitRename(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (option != 0) return; // canceled
-
-	std::string outfit_name = response["new_name"].asString();
-	LLStringUtil::trim(outfit_name);
-	if (!outfit_name.empty())
-	{
-		LLUUID cat_id = notification["payload"]["cat_id"].asUUID();
-		rename_category(&gInventory, cat_id, outfit_name);
-	}
-}
-
-void LLAppearanceMgr::setOutfitLocked(bool locked)
-{
-	if (mOutfitLocked == locked)
-	{
-		return;
-	}
-
-	mOutfitLocked = locked;
-	if (locked)
-	{
-		mUnlockOutfitTimer->reset();
-		mUnlockOutfitTimer->start();
-	}
-	else
-	{
-		mUnlockOutfitTimer->stop();
-	}
-
-	LLOutfitObserver::instance().notifyOutfitLockChanged();
-}
-
-void LLAppearanceMgr::addCategoryToCurrentOutfit(const LLUUID& cat_id)
-{
-	LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
-	wearInventoryCategory(cat, false, true);
-}
-
-void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id)
-{
-	LLInventoryModel::cat_array_t cats;
-	LLInventoryModel::item_array_t items;
-	LLFindWearablesEx collector(/*is_worn=*/ true, /*include_body_parts=*/ false);
-
-	gInventory.collectDescendentsIf(cat_id, cats, items, FALSE, collector);
-
-	LLInventoryModel::item_array_t::const_iterator it = items.begin();
-	const LLInventoryModel::item_array_t::const_iterator it_end = items.end();
-	for( ; it_end != it; ++it)
-	{
-		LLViewerInventoryItem* item = *it;
-		removeItemFromAvatar(item->getUUID());
-	}
-}
-
 // Create a copy of src_id + contents as a subfolder of dst_id.
 void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
 											  LLPointer<LLInventoryCallback> cb)
@@ -1116,7 +611,6 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds
 		llwarns << "folder not found for src " << src_id.asString() << llendl;
 		return;
 	}
-	llinfos << "starting, src_id " << src_id << " name " << src_cat->getName() << " dst_id " << dst_id << llendl;
 	LLUUID parent_id = dst_id;
 	if(parent_id.isNull())
 	{
@@ -1137,7 +631,6 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL
 	LLInventoryModel::cat_array_t* cats;
 	LLInventoryModel::item_array_t* items;
 	gInventory.getDirectDescendentsOf(src_id, cats, items);
-	llinfos << "copying " << items->count() << " items" << llendl;
 	for (LLInventoryModel::item_array_t::const_iterator iter = items->begin();
 		 iter != items->end();
 		 ++iter)
@@ -1147,13 +640,10 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL
 		{
 			case LLAssetType::AT_LINK:
 			{
-				//LLInventoryItem::getDescription() is used for a new description 
-				//to propagate ordering information saved in descriptions of links
 				link_inventory_item(gAgent.getID(),
 									item->getLinkedUUID(),
 									dst_id,
 									item->getName(),
-									item->LLInventoryItem::getDescription(),
 									LLAssetType::AT_LINK, cb);
 				break;
 			}
@@ -1167,7 +657,6 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL
 										item->getLinkedUUID(),
 										dst_id,
 										item->getName(),
-										item->getDescription(),
 										LLAssetType::AT_LINK_FOLDER, cb);
 				}
 				break;
@@ -1177,7 +666,6 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL
 			case LLAssetType::AT_BODYPART:
 			case LLAssetType::AT_GESTURE:
 			{
-				llinfos << "copying inventory item " << item->getName() << llendl;
 				copy_inventory_item(gAgent.getID(),
 									item->getPermissions().getOwner(),
 									item->getUUID(),
@@ -1198,10 +686,10 @@ BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id)
 	// These are the wearable items that are required for considering this
 	// folder as containing a complete outfit.
 	U32 required_wearables = 0;
-	required_wearables |= 1LL << LLWearableType::WT_SHAPE;
-	required_wearables |= 1LL << LLWearableType::WT_SKIN;
-	required_wearables |= 1LL << LLWearableType::WT_HAIR;
-	required_wearables |= 1LL << LLWearableType::WT_EYES;
+	required_wearables |= 1LL << WT_SHAPE;
+	required_wearables |= 1LL << WT_SKIN;
+	required_wearables |= 1LL << WT_HAIR;
+	required_wearables |= 1LL << WT_EYES;
 
 	// These are the wearables that the folder actually contains.
 	U32 folder_wearables = 0;
@@ -1215,7 +703,7 @@ BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id)
 		const LLViewerInventoryItem* item = (*iter);
 		if (item->isWearableType())
 		{
-			const LLWearableType::EType wearable_type = item->getWearableType();
+			const EWearableType wearable_type = item->getWearableType();
 			folder_wearables |= 1LL << wearable_type;
 		}
 	}
@@ -1224,100 +712,14 @@ BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id)
 	return ((required_wearables & folder_wearables) == required_wearables);
 }
 
-bool LLAppearanceMgr::getCanRemoveOutfit(const LLUUID& outfit_cat_id)
-{
-	// Disallow removing the base outfit.
-	if (outfit_cat_id == getBaseOutfitUUID())
-	{
-		return false;
-	}
-
-	// Check if the outfit folder itself is removable.
-	if (!get_is_category_removable(&gInventory, outfit_cat_id))
-	{
-		return false;
-	}
 
-	// Check for the folder's non-removable descendants.
-	LLFindNonRemovableObjects filter_non_removable;
+void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category)
+{
 	LLInventoryModel::cat_array_t cats;
 	LLInventoryModel::item_array_t items;
-	LLInventoryModel::item_array_t::const_iterator it;
-	gInventory.collectDescendentsIf(outfit_cat_id, cats, items, false, filter_non_removable);
-	if (!cats.empty() || !items.empty())
-	{
-		return false;
-	}
-
-	return true;
-}
-
-// static
-bool LLAppearanceMgr::getCanRemoveFromCOF(const LLUUID& outfit_cat_id)
-{
-	LLInventoryModel::cat_array_t cats;
-	LLInventoryModel::item_array_t items;
-	LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
-	gInventory.collectDescendentsIf(outfit_cat_id,
-		cats,
-		items,
-		LLInventoryModel::EXCLUDE_TRASH,
-		is_worn);
-	return items.size() > 0;
-}
-
-// static
-bool LLAppearanceMgr::getCanAddToCOF(const LLUUID& outfit_cat_id)
-{
-	if (gAgentWearables.isCOFChangeInProgress())
-	{
-		return false;
-	}
-
-	LLInventoryModel::cat_array_t cats;
-	LLInventoryModel::item_array_t items;
-	LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
-	gInventory.collectDescendentsIf(outfit_cat_id,
-		cats,
-		items,
-		LLInventoryModel::EXCLUDE_TRASH,
-		not_worn);
-	return items.size() > 0;
-}
-
-bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id)
-{
-	// Don't allow wearing anything while we're changing appearance.
-	if (gAgentWearables.isCOFChangeInProgress())
-	{
-		return false;
-	}
-
-	// Check whether it's the base outfit.
-	if (outfit_cat_id.isNull() || outfit_cat_id == getBaseOutfitUUID())
-	{
-		return false;
-	}
-
-	// Check whether the outfit contains any non-worn wearables.
-	LLInventoryModel::cat_array_t cats;
-	LLInventoryModel::item_array_t items;
-	LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ true);
-	gInventory.collectDescendentsIf(outfit_cat_id,
-		cats,
-		items,
-		LLInventoryModel::EXCLUDE_TRASH,
-		not_worn);
-	return items.size() > 0;
-}
-
-void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category)
-{
-	LLInventoryModel::cat_array_t cats;
-	LLInventoryModel::item_array_t items;
-	gInventory.collectDescendents(category, cats, items,
-								  LLInventoryModel::EXCLUDE_TRASH);
-	for (S32 i = 0; i < items.count(); ++i)
+	gInventory.collectDescendents(category, cats, items,
+								  LLInventoryModel::EXCLUDE_TRASH);
+	for (S32 i = 0; i < items.count(); ++i)
 	{
 		LLViewerInventoryItem *item = items.get(i);
 		if (item->getActualType() != LLAssetType::AT_LINK_FOLDER)
@@ -1357,12 +759,25 @@ void LLAppearanceMgr::filterWearableItems(
 	LLInventoryModel::item_array_t& items, S32 max_per_type)
 {
 	// Divvy items into arrays by wearable type.
-	std::vector<LLInventoryModel::item_array_t> items_by_type(LLWearableType::WT_COUNT);
-	divvyWearablesByType(items, items_by_type);
+	std::vector<LLInventoryModel::item_array_t> items_by_type(WT_COUNT);
+	for (S32 i=0; i<items.count(); i++)
+	{
+		LLViewerInventoryItem *item = items.get(i);
+		// Ignore non-wearables.
+		if (!item->isWearableType())
+			continue;
+		EWearableType type = item->getWearableType();
+		if(type < 0 || type >= WT_COUNT)
+		{
+			LL_WARNS("Appearance") << "Invalid wearable type. Inventory type does not match wearable flag bitfield." << LL_ENDL;
+			continue;
+		}
+		items_by_type[type].push_back(item);
+	}
 
 	// rebuild items list, retaining the last max_per_type of each array
 	items.clear();
-	for (S32 i=0; i<LLWearableType::WT_COUNT; i++)
+	for (S32 i=0; i<WT_COUNT; i++)
 	{
 		S32 size = items_by_type[i].size();
 		if (size <= 0)
@@ -1376,7 +791,7 @@ void LLAppearanceMgr::filterWearableItems(
 }
 
 // Create links to all listed items.
-void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid,
+void LLAppearanceMgr::linkAll(const LLUUID& category,
 								  LLInventoryModel::item_array_t& items,
 								  LLPointer<LLInventoryCallback> cb)
 {
@@ -1385,17 +800,10 @@ void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid,
 		const LLInventoryItem* item = items.get(i).get();
 		link_inventory_item(gAgent.getID(),
 							item->getLinkedUUID(),
-							cat_uuid,
+							category,
 							item->getName(),
-							item->LLInventoryItem::getDescription(),
 							LLAssetType::AT_LINK,
 							cb);
-
-		const LLViewerInventoryCategory *cat = gInventory.getCategory(cat_uuid);
-		const std::string cat_name = cat ? cat->getName() : "CAT NOT FOUND";
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-		llinfos << "Linking Item [ name:" << item->getName() << " UUID:" << item->getUUID() << " ] to Category [ name:" << cat_name << " UUID:" << cat_uuid << " ] " << llendl;
-#endif
 	}
 }
 
@@ -1425,12 +833,9 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
 
 	// - Body parts: always include COF contents as a fallback in case any
 	// required parts are missing.
-	// Preserve body parts from COF if appending.
 	LLInventoryModel::item_array_t body_items;
 	getDescendentsOfAssetType(cof, body_items, LLAssetType::AT_BODYPART, false);
 	getDescendentsOfAssetType(category, body_items, LLAssetType::AT_BODYPART, false);
-	if (append)
-		reverse(body_items.begin(), body_items.end());
 	// Reduce body items to max of one per type.
 	removeDuplicateItems(body_items);
 	filterWearableItems(body_items, 1);
@@ -1442,7 +847,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
 	getDescendentsOfAssetType(category, wear_items, LLAssetType::AT_CLOTHING, false);
 	// Reduce wearables to max of one per type.
 	removeDuplicateItems(wear_items);
-	filterWearableItems(wear_items, LLAgentWearables::MAX_CLOTHING_PER_TYPE);
+	filterWearableItems(wear_items, 5);
 
 	// - Attachments: include COF contents only if appending.
 	LLInventoryModel::item_array_t obj_items;
@@ -1465,26 +870,11 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
 
 	// Create links to new COF contents.
 	llinfos << "creating LLUpdateAppearanceOnDestroy" << llendl;
-	LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy(!append);
+	LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
 
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-	llinfos << "Linking body items" << llendl;
-#endif
 	linkAll(cof, body_items, link_waiter);
-
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-	llinfos << "Linking wear items" << llendl;
-#endif
 	linkAll(cof, wear_items, link_waiter);
-
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-	llinfos << "Linking obj items" << llendl;
-#endif
 	linkAll(cof, obj_items, link_waiter);
-
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-	llinfos << "Linking gesture items" << llendl;
-#endif
 	linkAll(cof, gest_items, link_waiter);
 
 	// Add link to outfit if category is an outfit. 
@@ -1515,7 +905,7 @@ void LLAppearanceMgr::createBaseOutfitLink(const LLUUID& category, LLPointer<LLI
 
 	if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
 	{
-		link_inventory_item(gAgent.getID(), category, cof, catp->getName(), "",
+		link_inventory_item(gAgent.getID(), category, cof, catp->getName(),
 							LLAssetType::AT_LINK_FOLDER, link_waiter);
 		new_outfit_name = catp->getName();
 	}
@@ -1529,17 +919,19 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
 	LLInventoryItem::item_array_t items;
 	LLDynamicArray< LLWearable* > wearables;
 
-	// For each wearable type, find the wearables of that type.
-	for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
+	// For each wearable type, find the first instance in the category
+	// that we recursed through.
+	for( S32 i = 0; i < WT_COUNT; i++ )
 	{
-		for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->getFoundList().begin();
-			 iter != holder->getFoundList().end(); ++iter)
+		for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->mFoundList.begin();
+			 iter != holder->mFoundList.end(); ++iter)
 		{
 			LLFoundData& data = *iter;
 			LLWearable* wearable = data.mWearable;
 			if( wearable && ((S32)wearable->getType() == i) )
 			{
-				LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
+				LLViewerInventoryItem* item;
+				item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
 				if( item && (item->getAssetUUID() == wearable->getAssetID()) )
 				{
 					items.put(item);
@@ -1573,104 +965,15 @@ static void remove_non_link_items(LLInventoryModel::item_array_t &items)
 	items = pruned_items;
 }
 
-//a predicate for sorting inventory items by actual descriptions
-bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* item2)
+void LLAppearanceMgr::updateAppearanceFromCOF()
 {
-	if (!item1 || !item2) 
-	{
-		llwarning("either item1 or item2 is NULL", 0);
-		return true;
-	}
-
-	return item1->LLInventoryItem::getDescription() < item2->LLInventoryItem::getDescription();
-}
-
-void item_array_diff(LLInventoryModel::item_array_t& full_list,
-					 LLInventoryModel::item_array_t& keep_list,
-					 LLInventoryModel::item_array_t& kill_list)
-	
-{
-	for (LLInventoryModel::item_array_t::iterator it = full_list.begin();
-		 it != full_list.end();
-		 ++it)
-	{
-		LLViewerInventoryItem *item = *it;
-		if (keep_list.find(item) < 0) // Why on earth does LLDynamicArray need to redefine find()?
-		{
-			kill_list.push_back(item);
-		}
-	}
-}
-
-void LLAppearanceMgr::enforceItemCountLimits()
-{
-	S32 purge_count = 0;
-	
-	LLInventoryModel::item_array_t body_items;
-	getDescendentsOfAssetType(getCOF(), body_items, LLAssetType::AT_BODYPART, false);
-	LLInventoryModel::item_array_t curr_body_items = body_items;
-	removeDuplicateItems(body_items);
-	filterWearableItems(body_items, 1);
-	LLInventoryModel::item_array_t kill_body_items;
-	item_array_diff(curr_body_items,body_items,kill_body_items);
-	for (LLInventoryModel::item_array_t::iterator it = kill_body_items.begin();
-		 it != kill_body_items.end();
-		 ++it)
-	{
-		LLViewerInventoryItem *item = *it;
-		llinfos << "purging dup body part " << item->getName() << llendl;
-		gInventory.purgeObject(item->getUUID());
-		purge_count++;
-	}
-	
-	LLInventoryModel::item_array_t wear_items;
-	getDescendentsOfAssetType(getCOF(), wear_items, LLAssetType::AT_CLOTHING, false);
-	LLInventoryModel::item_array_t curr_wear_items = wear_items;
-	removeDuplicateItems(wear_items);
-	filterWearableItems(wear_items, LLAgentWearables::MAX_CLOTHING_PER_TYPE);
-	LLInventoryModel::item_array_t kill_wear_items;
-	item_array_diff(curr_wear_items,wear_items,kill_wear_items);
-	for (LLInventoryModel::item_array_t::iterator it = kill_wear_items.begin();
-		 it != kill_wear_items.end();
-		 ++it)
-	{
-		LLViewerInventoryItem *item = *it;
-		llinfos << "purging excess clothing item " << item->getName() << llendl;
-		gInventory.purgeObject(item->getUUID());
-		purge_count++;
-	}
-
-	if (purge_count>0)
-	{
-		gInventory.notifyObservers();
-	}
-}
-
-void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering)
-{
-	if (mIsInUpdateAppearanceFromCOF)
-	{
-		llwarns << "Called updateAppearanceFromCOF inside updateAppearanceFromCOF, skipping" << llendl;
-		return;
-	}
-
-	BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF);
-
-	llinfos << "starting" << llendl;
-
-	//checking integrity of the COF in terms of ordering of wearables, 
-	//checking and updating links' descriptions of wearables in the COF (before analyzed for "dirty" state)
-	updateClothingOrderingInfo(LLUUID::null, update_base_outfit_ordering);
-
-	// Remove duplicate or excess wearables. Should normally be enforced at the UI level, but
-	// this should catch anything that gets through.
-	enforceItemCountLimits();
-	
 	// update dirty flag to see if the state of the COF matches
 	// the saved outfit stored as a folder link
+	llinfos << "starting" << llendl;
+
 	updateIsDirty();
 
-	//dumpCat(getCOF(),"COF, start");
+	dumpCat(getCOF(),"COF, start");
 
 	bool follow_folder_links = true;
 	LLUUID current_outfit_id = getCOF();
@@ -1686,23 +989,16 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering)
 	remove_non_link_items(obj_items);
 	remove_non_link_items(gest_items);
 
-	dumpItemArray(wear_items,"asset_dump: wear_item");
-	dumpItemArray(obj_items,"asset_dump: obj_item");
-
 	if(!wear_items.count())
 	{
 		LLNotificationsUtil::add("CouldNotPutOnOutfit");
 		return;
 	}
 
-	//preparing the list of wearables in the correct order for LLAgentWearables
-	sortItemsByActualDescription(wear_items);
-
-
 	LLWearableHoldingPattern* holder = new LLWearableHoldingPattern;
 
-	holder->setObjItems(obj_items);
-	holder->setGestItems(gest_items);
+	holder->mObjItems = obj_items;
+	holder->mGestItems = gest_items;
 		
 	// Note: can't do normal iteration, because if all the
 	// wearables can be resolved immediately, then the
@@ -1713,27 +1009,27 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering)
 	{
 		LLViewerInventoryItem *item = wear_items.get(i);
 		LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
-
-		// Fault injection: use debug setting to test asset 
-		// fetch failures (should be replaced by new defaults in
-		// lost&found).
-		U32 skip_type = gSavedSettings.getU32("ForceAssetFail");
-
 		if (item && item->getIsLinkType() && linked_item)
 		{
 			LLFoundData found(linked_item->getUUID(),
 							  linked_item->getAssetUUID(),
 							  linked_item->getName(),
 							  linked_item->getType(),
-							  linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID
+							  linked_item->isWearableType() ? linked_item->getWearableType() : WT_INVALID
 				);
 
-			if (skip_type != LLWearableType::WT_INVALID && skip_type == found.mWearableType)
+#if 0
+			// Fault injection: uncomment this block to test asset
+			// fetch failures (should be replaced by new defaults in
+			// lost&found).
+			if (found.mWearableType == WT_SHAPE || found.mWearableType == WT_JACKET)
 			{
 				found.mAssetID.generate(); // Replace with new UUID, guaranteed not to exist in DB
+				
 			}
-			//pushing back, not front, to preserve order of wearables for LLAgentWearables
-			holder->getFoundList().push_back(found);
+#endif
+
+			holder->mFoundList.push_front(found);
 		}
 		else
 		{
@@ -1748,12 +1044,12 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering)
 		}
 	}
 
-	for (LLWearableHoldingPattern::found_list_t::iterator it = holder->getFoundList().begin();
-		 it != holder->getFoundList().end(); ++it)
+	for (LLWearableHoldingPattern::found_list_t::iterator it = holder->mFoundList.begin();
+		 it != holder->mFoundList.end(); ++it)
 	{
 		LLFoundData& found = *it;
 
-		lldebugs << "waiting for onWearableAssetFetch callback, asset " << found.mAssetID.asString() << llendl;
+		llinfos << "waiting for onWearableAssetFetch callback, asset " << found.mAssetID.asString() << llendl;
 
 		// Fetch the wearables about to be worn.
 		LLWearableList::instance().getAsset(found.mAssetID,
@@ -1764,7 +1060,6 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering)
 
 	}
 
-	holder->resetTime(gSavedSettings.getF32("MaxWearableWaitTime"));
 	if (!holder->pollFetchCompletion())
 	{
 		doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollFetchCompletion,holder));
@@ -1825,14 +1120,12 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool
 {
 	if(!category) return;
 
-	gAgentWearables.notifyLoadingStarted();
-
 	llinfos << "wearInventoryCategory( " << category->getName()
 			 << " )" << llendl;
 
-	callAfterCategoryFetch(category->getUUID(), boost::bind(&LLAppearanceMgr::wearCategoryFinal,
-															&LLAppearanceMgr::instance(),
-															category->getUUID(), copy, append));
+	callAfterCategoryFetch(category->getUUID(),boost::bind(&LLAppearanceMgr::wearCategoryFinal,
+														   &LLAppearanceMgr::instance(),
+														   category->getUUID(), copy, append));
 }
 
 void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append)
@@ -1923,13 +1216,16 @@ void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* catego
 	llinfos << "wearInventoryCategoryOnAvatar( " << category->getName()
 			 << " )" << llendl;
 			 	
-	if (gAgentCamera.cameraCustomizeAvatar())
+	if( gFloaterCustomize )
 	{
-		// switching to outfit editor should automagically save any currently edited wearable
-		LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit"));
+		gFloaterCustomize->askToSaveIfDirty(boost::bind(&LLAppearanceMgr::changeOutfit,
+														&LLAppearanceMgr::instance(),
+														_1, category->getUUID(), append));
+	}
+	else
+	{
+		LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append);
 	}
-
-	LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append);
 }
 
 void LLAppearanceMgr::wearOutfitByName(const std::string& name)
@@ -1988,10 +1284,9 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor
 class LLDeferredCOFLinkObserver: public LLInventoryObserver
 {
 public:
-	LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update, LLPointer<LLInventoryCallback> cb = NULL):
+	LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update):
 		mItemID(item_id),
-		mDoUpdate(do_update),
-		mCallback(cb)
+		mDoUpdate(do_update)
 	{
 	}
 
@@ -2005,7 +1300,7 @@ class LLDeferredCOFLinkObserver: public LLInventoryObserver
 		if (item)
 		{
 			gInventory.removeObserver(this);
-			LLAppearanceMgr::instance().addCOFItemLink(item,mDoUpdate,mCallback);
+			LLAppearanceMgr::instance().addCOFItemLink(item,mDoUpdate);
 			delete this;
 		}
 	}
@@ -2013,27 +1308,26 @@ class LLDeferredCOFLinkObserver: public LLInventoryObserver
 private:
 	const LLUUID mItemID;
 	bool mDoUpdate;
-	LLPointer<LLInventoryCallback> mCallback;
 };
 
 
 // BAP - note that this runs asynchronously if the item is not already loaded from inventory.
 // Dangerous if caller assumes link will exist after calling the function.
-void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update, LLPointer<LLInventoryCallback> cb)
+void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update )
 {
 	const LLInventoryItem *item = gInventory.getItem(item_id);
 	if (!item)
 	{
-		LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update, cb);
+		LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update);
 		gInventory.addObserver(observer);
 	}
 	else
 	{
-		addCOFItemLink(item, do_update, cb);
+		addCOFItemLink(item, do_update);
 	}
 }
 
-void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update, LLPointer<LLInventoryCallback> cb)
+void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update )
 {		
 	const LLViewerInventoryItem *vitem = dynamic_cast<const LLViewerInventoryItem*>(item);
 	if (!vitem)
@@ -2051,39 +1345,25 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update
 								  item_array,
 								  LLInventoryModel::EXCLUDE_TRASH);
 	bool linked_already = false;
-	U32 count = 0;
 	for (S32 i=0; i<item_array.count(); i++)
 	{
 		// Are these links to the same object?
 		const LLViewerInventoryItem* inv_item = item_array.get(i).get();
-		const LLWearableType::EType wearable_type = inv_item->getWearableType();
-
-		const bool is_body_part =    (wearable_type == LLWearableType::WT_SHAPE) 
-								  || (wearable_type == LLWearableType::WT_HAIR) 
-								  || (wearable_type == LLWearableType::WT_EYES)
-								  || (wearable_type == LLWearableType::WT_SKIN);
-
 		if (inv_item->getLinkedUUID() == vitem->getLinkedUUID())
 		{
 			linked_already = true;
 		}
-		// Are these links to different items of the same body part
+		// Are these links to different items of the same wearable
 		// type? If so, new item will replace old.
-		else if ((vitem->isWearableType()) && (vitem->getWearableType() == wearable_type))
+		// MULTI-WEARABLES: revisit if more than one per type is allowed.
+		else if (areMatchingWearables(vitem,inv_item))
 		{
-			++count;
-			if (is_body_part && inv_item->getIsLinkType()  && (vitem->getWearableType() == wearable_type))
+			if (inv_item->getIsLinkType())
 			{
 				gInventory.purgeObject(inv_item->getUUID());
 			}
-			else if (count >= LLAgentWearables::MAX_CLOTHING_PER_TYPE)
-			{
-				// MULTI-WEARABLES: make sure we don't go over MAX_CLOTHING_PER_TYPE
-				gInventory.purgeObject(inv_item->getUUID());
-			}
 		}
 	}
-
 	if (linked_already)
 	{
 		if (do_update)
@@ -2094,16 +1374,11 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update
 	}
 	else
 	{
-		if(do_update && cb.isNull())
-		{
-			cb = new ModifiedCOFCallback;
-		}
-		const std::string description = vitem->getIsLinkType() ? vitem->getDescription() : "";
+		LLPointer<LLInventoryCallback> cb = do_update ? new ModifiedCOFCallback : 0;
 		link_inventory_item( gAgent.getID(),
 							 vitem->getLinkedUUID(),
 							 getCOF(),
 							 vitem->getName(),
-							 description,
 							 LLAssetType::AT_LINK,
 							 cb);
 	}
@@ -2120,7 +1395,6 @@ void LLAppearanceMgr::addEnsembleLink( LLInventoryCategory* cat, bool do_update
 						 cat->getLinkedUUID(),
 						 getCOF(),
 						 cat->getName(),
-						 cat->getDescription(),
 						 LLAssetType::AT_LINK_FOLDER,
 						 cb);
 #endif
@@ -2150,40 +1424,6 @@ void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, bool do_update)
 	}
 }
 
-void LLAppearanceMgr::removeCOFLinksOfType(LLWearableType::EType type, bool do_update)
-{
-	LLFindWearablesOfType filter_wearables_of_type(type);
-	LLInventoryModel::cat_array_t cats;
-	LLInventoryModel::item_array_t items;
-	LLInventoryModel::item_array_t::const_iterator it;
-
-	gInventory.collectDescendentsIf(getCOF(), cats, items, true, filter_wearables_of_type);
-	for (it = items.begin(); it != items.end(); ++it)
-	{
-		const LLViewerInventoryItem* item = *it;
-		if (item->getIsLinkType()) // we must operate on links only
-		{
-			gInventory.purgeObject(item->getUUID());
-		}
-	}
-
-	if (do_update)
-	{
-		updateAppearanceFromCOF();
-	}
-}
-
-bool sort_by_linked_uuid(const LLViewerInventoryItem* item1, const LLViewerInventoryItem* item2)
-{
-	if (!item1 || !item2)
-	{
-		llwarning("item1, item2 cannot be null, something is very wrong", 0);
-		return true;
-	}
-
-	return item1->getLinkedUUID() < item2->getLinkedUUID();
-}
-
 void LLAppearanceMgr::updateIsDirty()
 {
 	LLUUID cof = getCOF();
@@ -2208,45 +1448,48 @@ void LLAppearanceMgr::updateIsDirty()
 	}
 	else
 	{
-		LLIsOfAssetType collector = LLIsOfAssetType(LLAssetType::AT_LINK);
-
 		LLInventoryModel::cat_array_t cof_cats;
 		LLInventoryModel::item_array_t cof_items;
-		gInventory.collectDescendentsIf(cof, cof_cats, cof_items,
-									  LLInventoryModel::EXCLUDE_TRASH, collector);
+		gInventory.collectDescendents(cof, cof_cats, cof_items,
+									  LLInventoryModel::EXCLUDE_TRASH);
 
 		LLInventoryModel::cat_array_t outfit_cats;
 		LLInventoryModel::item_array_t outfit_items;
-		gInventory.collectDescendentsIf(base_outfit, outfit_cats, outfit_items,
-									  LLInventoryModel::EXCLUDE_TRASH, collector);
+		gInventory.collectDescendents(base_outfit, outfit_cats, outfit_items,
+									  LLInventoryModel::EXCLUDE_TRASH);
 
-		if(outfit_items.count() != cof_items.count())
+		if(outfit_items.count() != cof_items.count() -1)
 		{
 			// Current outfit folder should have one more item than the outfit folder.
 			// this one item is the link back to the outfit folder itself.
 			mOutfitIsDirty = true;
-			return;
 		}
-
-		//"dirty" - also means a difference in linked UUIDs and/or a difference in wearables order (links' descriptions)
-		std::sort(cof_items.begin(), cof_items.end(), sort_by_linked_uuid);
-		std::sort(outfit_items.begin(), outfit_items.end(), sort_by_linked_uuid);
-
-		for (U32 i = 0; i < cof_items.size(); ++i)
+		else
 		{
-			LLViewerInventoryItem *item1 = cof_items.get(i);
-			LLViewerInventoryItem *item2 = outfit_items.get(i);
+			typedef std::set<LLUUID> item_set_t;
+			item_set_t cof_set;
+			item_set_t outfit_set;
 
-			if (item1->getLinkedUUID() != item2->getLinkedUUID() || 
-				item1->getName() != item2->getName() ||
-				item1->LLInventoryItem::getDescription() != item2->LLInventoryItem::getDescription())
+			// sort COF items by UUID
+			for (S32 i = 0; i < cof_items.count(); ++i)
 			{
-				mOutfitIsDirty = true;
-				return;
+				LLViewerInventoryItem *item = cof_items.get(i);
+				// don't add the base outfit link to the list of objects we're comparing
+				if(item != base_outfit_item)
+				{
+					cof_set.insert(item->getLinkedUUID());
+				}
 			}
-		}
 
-		mOutfitIsDirty = false;
+			// sort outfit folder by UUID
+			for (S32 i = 0; i < outfit_items.count(); ++i)
+			{
+				LLViewerInventoryItem *item = outfit_items.get(i);
+				outfit_set.insert(item->getLinkedUUID());
+			}
+
+			mOutfitIsDirty = (outfit_set != cof_set);
+		}
 	}
 }
 
@@ -2270,331 +1513,9 @@ void LLAppearanceMgr::autopopulateOutfits()
 // Handler for anything that's deferred until avatar de-clouds.
 void LLAppearanceMgr::onFirstFullyVisible()
 {
-	gAgentAvatarp->debugAvatarVisible();
 	autopopulateOutfits();
 }
 
-bool LLAppearanceMgr::updateBaseOutfit()
-{
-	if (isOutfitLocked())
-	{
-		// don't allow modify locked outfit
-		llassert(!isOutfitLocked());
-		return false;
-	}
-	setOutfitLocked(true);
-
-	gAgentWearables.notifyLoadingStarted();
-
-	const LLUUID base_outfit_id = getBaseOutfitUUID();
-	if (base_outfit_id.isNull()) return false;
-
-	updateClothingOrderingInfo();
-
-	// in a Base Outfit we do not remove items, only links
-	purgeCategory(base_outfit_id, false);
-
-
-	LLPointer<LLInventoryCallback> dirty_state_updater = new LLUpdateDirtyState();
-
-	//COF contains only links so we copy to the Base Outfit only links
-	shallowCopyCategoryContents(getCOF(), base_outfit_id, dirty_state_updater);
-
-	return true;
-}
-
-void LLAppearanceMgr::divvyWearablesByType(const LLInventoryModel::item_array_t& items, wearables_by_type_t& items_by_type)
-{
-	items_by_type.reserve(LLWearableType::WT_COUNT);
-	if (items.empty()) return;
-
-	for (S32 i=0; i<items.count(); i++)
-	{
-		LLViewerInventoryItem *item = items.get(i);
-		// Ignore non-wearables.
-		if (!item->isWearableType())
-			continue;
-		LLWearableType::EType type = item->getWearableType();
-		if(type < 0 || type >= LLWearableType::WT_COUNT)
-		{
-			LL_WARNS("Appearance") << "Invalid wearable type. Inventory type does not match wearable flag bitfield." << LL_ENDL;
-			continue;
-		}
-		items_by_type[type].push_back(item);
-	}
-}
-
-std::string build_order_string(LLWearableType::EType type, U32 i)
-{
-		std::ostringstream order_num;
-		order_num << ORDER_NUMBER_SEPARATOR << type * 100 + i;
-		return order_num.str();
-}
-
-struct WearablesOrderComparator
-{
-	WearablesOrderComparator(const LLWearableType::EType type)
-	{
-		mControlSize = build_order_string(type, 0).size();
-	};
-
-	bool operator()(const LLInventoryItem* item1, const LLInventoryItem* item2)
-	{
-		if (!item1 || !item2)
-		{
-			llwarning("either item1 or item2 is NULL", 0);
-			return true;
-		}
-		
-		const std::string& desc1 = item1->LLInventoryItem::getDescription();
-		const std::string& desc2 = item2->LLInventoryItem::getDescription();
-		
-		bool item1_valid = (desc1.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc1[0]);
-		bool item2_valid = (desc2.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc2[0]);
-
-		if (item1_valid && item2_valid)
-			return desc1 < desc2;
-
-		//we need to sink down invalid items: items with empty descriptions, items with "Broken link" descriptions,
-		//items with ordering information but not for the associated wearables type
-		if (!item1_valid && item2_valid) 
-			return false;
-
-		return true;
-	}
-
-	U32 mControlSize;
-};
-
-void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base_outfit_ordering)
-{
-	if (cat_id.isNull())
-	{
-		cat_id = getCOF();
-		if (update_base_outfit_ordering)
-		{
-			const LLUUID base_outfit_id = getBaseOutfitUUID();
-			if (base_outfit_id.notNull())
-			{
-				updateClothingOrderingInfo(base_outfit_id,false);
-			}
-		}
-	}
-
-	// COF is processed if cat_id is not specified
-	LLInventoryModel::item_array_t wear_items;
-	getDescendentsOfAssetType(cat_id, wear_items, LLAssetType::AT_CLOTHING, false);
-
-	wearables_by_type_t items_by_type(LLWearableType::WT_COUNT);
-	divvyWearablesByType(wear_items, items_by_type);
-
-	bool inventory_changed = false;
-	for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++)
-	{
-		
-		U32 size = items_by_type[type].size();
-		if (!size) continue;
-
-		//sinking down invalid items which need reordering
-		std::sort(items_by_type[type].begin(), items_by_type[type].end(), WearablesOrderComparator((LLWearableType::EType) type));
-
-		//requesting updates only for those links which don't have "valid" descriptions
-		for (U32 i = 0; i < size; i++)
-		{
-			LLViewerInventoryItem* item = items_by_type[type][i];
-			if (!item) continue;
-
-			std::string new_order_str = build_order_string((LLWearableType::EType)type, i);
-			if (new_order_str == item->LLInventoryItem::getDescription()) continue;
-
-			item->setDescription(new_order_str);
-			item->setComplete(TRUE);
- 			item->updateServer(FALSE);
-			gInventory.updateItem(item);
-			
-			inventory_changed = true;
-		}
-	}
-
-	//*TODO do we really need to notify observers?
-	if (inventory_changed) gInventory.notifyObservers();
-}
-
-
-
-
-class LLShowCreatedOutfit: public LLInventoryCallback
-{
-public:
-	LLShowCreatedOutfit(LLUUID& folder_id, bool show_panel = true): mFolderID(folder_id), mShowPanel(show_panel)
-	{}
-
-	virtual ~LLShowCreatedOutfit()
-	{
-		LLSD key;
-		
-		//EXT-7727. For new accounts LLShowCreatedOutfit is created during login process
-		// add may be processed after login process is finished
-		if (mShowPanel)
-		{
-			LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
-		}
-		LLOutfitsList *outfits_list =
-			dynamic_cast<LLOutfitsList*>(LLSideTray::getInstance()->getPanel("outfitslist_tab"));
-		if (outfits_list)
-		{
-			outfits_list->setSelectedOutfitByUUID(mFolderID);
-		}
-
-		LLAppearanceMgr::getInstance()->updateIsDirty();
-		gAgentWearables.notifyLoadingFinished(); // New outfit is saved.
-		LLAppearanceMgr::getInstance()->updatePanelOutfitName("");
-	}
-
-	virtual void fire(const LLUUID&)
-	{}
-
-private:
-	LLUUID mFolderID;
-	bool mShowPanel;
-};
-
-LLUUID LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, bool show_panel)
-{
-	if (!isAgentAvatarValid()) return LLUUID::null;
-
-	gAgentWearables.notifyLoadingStarted();
-
-	// First, make a folder in the My Outfits directory.
-	const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
-	LLUUID folder_id = gInventory.createNewCategory(
-		parent_id,
-		LLFolderType::FT_OUTFIT,
-		new_folder_name);
-
-	updateClothingOrderingInfo();
-
-	LLPointer<LLInventoryCallback> cb = new LLShowCreatedOutfit(folder_id,show_panel);
-	shallowCopyCategoryContents(getCOF(),folder_id, cb);
-	createBaseOutfitLink(folder_id, cb);
-
-	dumpCat(folder_id,"COF, new outfit");
-
-	return folder_id;
-}
-
-void LLAppearanceMgr::wearBaseOutfit()
-{
-	const LLUUID& base_outfit_id = getBaseOutfitUUID();
-	if (base_outfit_id.isNull()) return;
-	
-	updateCOF(base_outfit_id);
-}
-
-void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove)
-{
-	LLViewerInventoryItem * item_to_remove = gInventory.getItem(id_to_remove);
-	if (!item_to_remove) return;
-
-	switch (item_to_remove->getType())
-	{
-	case LLAssetType::AT_CLOTHING:
-		if (get_is_item_worn(id_to_remove))
-		{
-			//*TODO move here the exact removing code from LLWearableBridge::removeItemFromAvatar in the future
-			LLWearableBridge::removeItemFromAvatar(item_to_remove);
-		}
-		break;
-	case LLAssetType::AT_OBJECT:
-		gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
-		gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
-		gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
-		gMessageSystem->addUUIDFast(_PREHASH_ItemID, item_to_remove->getLinkedUUID());
-		gMessageSystem->sendReliable( gAgent.getRegion()->getHost());
-
-		{
-			// this object might have been selected, so let the selection manager know it's gone now
-			LLViewerObject *found_obj = gObjectList.findObject(item_to_remove->getLinkedUUID());
-			if (found_obj)
-			{
-				LLSelectMgr::getInstance()->remove(found_obj);
-			};
-		}
-	default: break;
-	}
-
-	// *HACK: Force to remove garbage from COF.
-	// Unworn links or objects can't be processed by existed removing functionality
-	// since it is not designed for such cases. As example attachment object can't be removed
-	// since sever don't sends message _PREHASH_KillObject in that case.
-	// Also we can't check is link was successfully removed from COF since in case
-	// deleting attachment link removing performs asynchronously in process_kill_object callback.
-	removeCOFItemLinks(id_to_remove,false);
-}
-
-bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_body)
-{
-	if (!item || !item->isWearableType()) return false;
-	if (item->getType() != LLAssetType::AT_CLOTHING) return false;
-	if (!gInventory.isObjectDescendentOf(item->getUUID(), getCOF())) return false;
-
-	LLInventoryModel::cat_array_t cats;
-	LLInventoryModel::item_array_t items;
-	LLFindWearablesOfType filter_wearables_of_type(item->getWearableType());
-	gInventory.collectDescendentsIf(getCOF(), cats, items, true, filter_wearables_of_type);
-	if (items.empty()) return false;
-
-	// We assume that the items have valid descriptions.
-	std::sort(items.begin(), items.end(), WearablesOrderComparator(item->getWearableType()));
-
-	if (closer_to_body && items.front() == item) return false;
-	if (!closer_to_body && items.back() == item) return false;
-	
-	LLInventoryModel::item_array_t::iterator it = std::find(items.begin(), items.end(), item);
-	if (items.end() == it) return false;
-
-
-	//swapping descriptions
-	closer_to_body ? --it : ++it;
-	LLViewerInventoryItem* swap_item = *it;
-	if (!swap_item) return false;
-	std::string tmp = swap_item->LLInventoryItem::getDescription();
-	swap_item->setDescription(item->LLInventoryItem::getDescription());
-	item->setDescription(tmp);
-
-
-	//items need to be updated on a dataserver
-	item->setComplete(TRUE);
-	item->updateServer(FALSE);
-	gInventory.updateItem(item);
-
-	swap_item->setComplete(TRUE);
-	swap_item->updateServer(FALSE);
-	gInventory.updateItem(swap_item);
-
-	//to cause appearance of the agent to be updated
-	bool result = false;
-	if (result = gAgentWearables.moveWearable(item, closer_to_body))
-	{
-		gAgentAvatarp->wearableUpdated(item->getWearableType(), FALSE);
-	}
-
-	setOutfitDirty(true);
-
-	//*TODO do we need to notify observers here in such a way?
-	gInventory.notifyObservers();
-
-	return result;
-}
-
-//static
-void LLAppearanceMgr::sortItemsByActualDescription(LLInventoryModel::item_array_t& items)
-{
-	if (items.size() < 2) return;
-
-	std::sort(items.begin(), items.end(), sort_by_description);
-}
-
 //#define DUMP_CAT_VERBOSE
 
 void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg)
@@ -2621,33 +1542,19 @@ void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg)
 void LLAppearanceMgr::dumpItemArray(const LLInventoryModel::item_array_t& items,
 										const std::string& msg)
 {
+	llinfos << msg << llendl;
 	for (S32 i=0; i<items.count(); i++)
 	{
 		LLViewerInventoryItem *item = items.get(i);
-		LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
-		LLUUID asset_id;
-		if (linked_item)
-		{
-			asset_id = linked_item->getAssetUUID();
-		}
-		llinfos << msg << " " << i <<" " << (item ? item->getName() : "(nullitem)") << " " << asset_id.asString() << llendl;
+		llinfos << i <<" " << item->getName() << llendl;
 	}
 	llinfos << llendl;
 }
 
 LLAppearanceMgr::LLAppearanceMgr():
 	mAttachmentInvLinkEnabled(false),
-	mOutfitIsDirty(false),
-	mIsInUpdateAppearanceFromCOF(false)
+	mOutfitIsDirty(false)
 {
-	LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
-
-	// unlock outfit on save operation completed
-	outfit_observer.addCOFSavedCallback(boost::bind(
-			&LLAppearanceMgr::setOutfitLocked, this, false));
-
-	mUnlockOutfitTimer.reset(new LLOutfitUnLockTimer(gSavedSettings.getS32(
-			"OutfitOperationsTimeout")));
 }
 
 LLAppearanceMgr::~LLAppearanceMgr()
@@ -2685,9 +1592,6 @@ void LLAppearanceMgr::registerAttachment(const LLUUID& item_id)
 
 	   if (mAttachmentInvLinkEnabled)
 	   {
-		   // we have to pass do_update = true to call LLAppearanceMgr::updateAppearanceFromCOF.
-		   // it will trigger gAgentWariables.notifyLoadingFinished()
-		   // But it is not acceptable solution. See EXT-7777
 		   LLAppearanceMgr::addCOFItemLink(item_id, false);  // Add COF link for item.
 	   }
 	   else
@@ -2728,21 +1632,6 @@ BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const
 	return gInventory.isObjectDescendentOf(obj_id, getCOF());
 }
 
-// static
-bool LLAppearanceMgr::isLinkInCOF(const LLUUID& obj_id)
-{
-	 LLInventoryModel::cat_array_t cats;
-	 LLInventoryModel::item_array_t items;
-	 LLLinkedItemIDMatches find_links(gInventory.getLinkedItemID(obj_id));
-	 gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(),
-	 cats,
-	 items,
-	 LLInventoryModel::EXCLUDE_TRASH,
-	 find_links);
-
-	 return !items.empty();
-}
-
 BOOL LLAppearanceMgr::getIsProtectedCOFItem(const LLUUID& obj_id) const
 {
 	if (!getIsInCOF(obj_id)) return FALSE;
@@ -2770,192 +1659,3 @@ BOOL LLAppearanceMgr::getIsProtectedCOFItem(const LLUUID& obj_id) const
 	return FALSE;
 	*/
 }
-
-// Shim class to allow arbitrary boost::bind
-// expressions to be run as one-time idle callbacks.
-//
-// TODO: rework idle function spec to take a boost::function in the first place.
-class OnIdleCallbackOneTime
-{
-public:
-	OnIdleCallbackOneTime(nullary_func_t callable):
-		mCallable(callable)
-	{
-	}
-	static void onIdle(void *data)
-	{
-		gIdleCallbacks.deleteFunction(onIdle, data);
-		OnIdleCallbackOneTime* self = reinterpret_cast<OnIdleCallbackOneTime*>(data);
-		self->call();
-		delete self;
-	}
-	void call()
-	{
-		mCallable();
-	}
-private:
-	nullary_func_t mCallable;
-};
-
-void doOnIdleOneTime(nullary_func_t callable)
-{
-	OnIdleCallbackOneTime* cb_functor = new OnIdleCallbackOneTime(callable);
-	gIdleCallbacks.addFunction(&OnIdleCallbackOneTime::onIdle,cb_functor);
-}
-
-// Shim class to allow generic boost functions to be run as
-// recurring idle callbacks.  Callable should return true when done,
-// false to continue getting called.
-//
-// TODO: rework idle function spec to take a boost::function in the first place.
-class OnIdleCallbackRepeating
-{
-public:
-	OnIdleCallbackRepeating(bool_func_t callable):
-		mCallable(callable)
-	{
-	}
-	// Will keep getting called until the callable returns true.
-	static void onIdle(void *data)
-	{
-		OnIdleCallbackRepeating* self = reinterpret_cast<OnIdleCallbackRepeating*>(data);
-		bool done = self->call();
-		if (done)
-		{
-			gIdleCallbacks.deleteFunction(onIdle, data);
-			delete self;
-		}
-	}
-	bool call()
-	{
-		return mCallable();
-	}
-private:
-	bool_func_t mCallable;
-};
-
-void doOnIdleRepeating(bool_func_t callable)
-{
-	OnIdleCallbackRepeating* cb_functor = new OnIdleCallbackRepeating(callable);
-	gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor);
-}
-
-class CallAfterCategoryFetchStage2: public LLInventoryFetchItemsObserver
-{
-public:
-	CallAfterCategoryFetchStage2(const uuid_vec_t& ids,
-								 nullary_func_t callable) :
-		LLInventoryFetchItemsObserver(ids),
-		mCallable(callable)
-	{
-	}
-	~CallAfterCategoryFetchStage2()
-	{
-	}
-	virtual void done()
-	{
-		llinfos << this << " done with incomplete " << mIncomplete.size()
-				<< " complete " << mComplete.size() <<  " calling callable" << llendl;
-
-		gInventory.removeObserver(this);
-		doOnIdleOneTime(mCallable);
-		delete this;
-	}
-protected:
-	nullary_func_t mCallable;
-};
-
-class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver
-{
-public:
-	CallAfterCategoryFetchStage1(const LLUUID& cat_id, nullary_func_t callable) :
-		LLInventoryFetchDescendentsObserver(cat_id),
-		mCallable(callable)
-	{
-	}
-	~CallAfterCategoryFetchStage1()
-	{
-	}
-	virtual void done()
-	{
-		// What we do here is get the complete information on the items in
-		// the library, and set up an observer that will wait for that to
-		// happen.
-		LLInventoryModel::cat_array_t cat_array;
-		LLInventoryModel::item_array_t item_array;
-		gInventory.collectDescendents(mComplete.front(),
-									  cat_array,
-									  item_array,
-									  LLInventoryModel::EXCLUDE_TRASH);
-		S32 count = item_array.count();
-		if(!count)
-		{
-			llwarns << "Nothing fetched in category " << mComplete.front()
-					<< llendl;
-			//dec_busy_count();
-			gInventory.removeObserver(this);
-
-			// lets notify observers that loading is finished.
-			gAgentWearables.notifyLoadingFinished();
-			delete this;
-			return;
-		}
-
-		llinfos << "stage1 got " << item_array.count() << " items, passing to stage2 " << llendl;
-		uuid_vec_t ids;
-		for(S32 i = 0; i < count; ++i)
-		{
-			ids.push_back(item_array.get(i)->getUUID());
-		}
-		
-		gInventory.removeObserver(this);
-		
-		// do the fetch
-		CallAfterCategoryFetchStage2 *stage2 = new CallAfterCategoryFetchStage2(ids, mCallable);
-		stage2->startFetch();
-		if(stage2->isFinished())
-		{
-			// everything is already here - call done.
-			stage2->done();
-		}
-		else
-		{
-			// it's all on it's way - add an observer, and the inventory
-			// will call done for us when everything is here.
-			gInventory.addObserver(stage2);
-		}
-		delete this;
-	}
-protected:
-	nullary_func_t mCallable;
-};
-
-void callAfterCategoryFetch(const LLUUID& cat_id, nullary_func_t cb)
-{
-	CallAfterCategoryFetchStage1 *stage1 = new CallAfterCategoryFetchStage1(cat_id, cb);
-	stage1->startFetch();
-	if (stage1->isFinished())
-	{
-		stage1->done();
-	}
-	else
-	{
-		gInventory.addObserver(stage1);
-	}
-}
-
-void wear_multiple(const uuid_vec_t& ids, bool replace)
-{
-	LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
-	
-	bool first = true;
-	uuid_vec_t::const_iterator it;
-	for (it = ids.begin(); it != ids.end(); ++it)
-	{
-		// if replace is requested, the first item worn will replace the current top
-		// item, and others will be added.
-		LLAppearanceMgr::instance().wearItemOnAvatar(*it,false,first && replace,cb);
-		first = false;
-	}
-}
-
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index e7442537d28486bb824a588d02127b285e994bf2..40b8844731c4276b87d15b2510cf90d71dd22dc4 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -2,25 +2,31 @@
  * @file llappearancemgr.h
  * @brief Manager for initiating appearance changes on the viewer
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -28,27 +34,21 @@
 #define LL_LLAPPEARANCEMGR_H
 
 #include "llsingleton.h"
-
-#include "llagentwearables.h"
-#include "llcallbacklist.h"
 #include "llinventorymodel.h"
 #include "llinventoryobserver.h"
 #include "llviewerinventory.h"
+#include "llcallbacklist.h"
 
 class LLWearable;
 class LLWearableHoldingPattern;
 class LLInventoryCallback;
-class LLOutfitUnLockTimer;
 
 class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 {
 	friend class LLSingleton<LLAppearanceMgr>;
-	friend class LLOutfitUnLockTimer;
 	
 public:
-	typedef std::vector<LLInventoryModel::item_array_t> wearables_by_type_t;
-
-	void updateAppearanceFromCOF(bool update_base_outfit_ordering = false);
+	void updateAppearanceFromCOF();
 	bool needToSaveCOF();
 	void updateCOF(const LLUUID& category, bool append = false);
 	void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append);
@@ -56,11 +56,6 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 	void wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append);
 	void wearOutfitByName(const std::string& name);
 	void changeOutfit(bool proceed, const LLUUID& category, bool append);
-	void replaceCurrentOutfit(const LLUUID& new_outfit);
-	void renameOutfit(const LLUUID& outfit_id);
-	void takeOffOutfit(const LLUUID& cat_id);
-	void addCategoryToCurrentOutfit(const LLUUID& cat_id);
-	void enforceItemCountLimits();
 
 	// Copy all items and the src category itself.
 	void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
@@ -69,18 +64,6 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 	// Return whether this folder contains minimal contents suitable for making a full outfit.
 	BOOL getCanMakeFolderIntoOutfit(const LLUUID& folder_id);
 
-	// Determine whether a given outfit can be removed.
-	bool getCanRemoveOutfit(const LLUUID& outfit_cat_id);
-
-	// Determine whether we're wearing any of the outfit contents (excluding body parts).
-	static bool getCanRemoveFromCOF(const LLUUID& outfit_cat_id);
-
-	// Determine whether we can add anything (but body parts) from the outfit contents to COF.
-	static bool getCanAddToCOF(const LLUUID& outfit_cat_id);
-
-	// Determine whether we can replace current outfit with the given one.
-	bool getCanReplaceCOF(const LLUUID& outfit_cat_id);
-
 	// Copy all items in a category.
 	void shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id,
 									 LLPointer<LLInventoryCallback> cb);
@@ -92,12 +75,6 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 	const LLViewerInventoryItem *getBaseOutfitLink();
 	bool getBaseOutfitName(std::string &name);
 
-	// find the UUID of the currently worn outfit (Base Outfit)
-	const LLUUID getBaseOutfitUUID();
-
-	// Wear/attach an item (from a user's inventory) on the agent
-	bool wearItemOnAvatar(const LLUUID& item_to_wear, bool do_update = true, bool replace = false, LLPointer<LLInventoryCallback> cb = NULL);
-
 	// Update the displayed outfit name in UI.
 	void updatePanelOutfitName(const std::string& name);
 
@@ -121,12 +98,11 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 				 LLPointer<LLInventoryCallback> cb);
 
 	// Add COF link to individual item.
-	void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer<LLInventoryCallback> cb = NULL);
-	void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer<LLInventoryCallback> cb = NULL);
+	void addCOFItemLink(const LLUUID& item_id, bool do_update = true);
+	void addCOFItemLink(const LLInventoryItem *item, bool do_update = true);
 
 	// Remove COF entries
 	void removeCOFItemLinks(const LLUUID& item_id, bool do_update = true);
-	void removeCOFLinksOfType(LLWearableType::EType type, bool do_update = true);
 
 	// Add COF link to ensemble folder.
 	void addEnsembleLink(LLInventoryCategory* item, bool do_update = true);
@@ -147,33 +123,6 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 	// Create initial outfits from library.
 	void autopopulateOutfits();
 	
-	void wearBaseOutfit();
-
-	// Overrides the base outfit with the content from COF
-	// @return false if there is no base outfit
-	bool updateBaseOutfit();
-
-	//Remove clothing or detach an object from the agent (a bodypart cannot be removed)
-	void removeItemFromAvatar(const LLUUID& item_id);
-
-
-	LLUUID makeNewOutfitLinks(const std::string& new_folder_name,bool show_panel = true);
-
-	bool moveWearable(LLViewerInventoryItem* item, bool closer_to_body);
-
-	static void sortItemsByActualDescription(LLInventoryModel::item_array_t& items);
-
-	//Divvy items into arrays by wearable type
-	static void divvyWearablesByType(const LLInventoryModel::item_array_t& items, wearables_by_type_t& items_by_type);
-
-	//Check ordering information on wearables stored in links' descriptions and update if it is invalid
-	// COF is processed if cat_id is not specified
-	void updateClothingOrderingInfo(LLUUID cat_id = LLUUID::null, bool update_base_outfit_ordering = false);
-
-	bool isOutfitLocked() { return mOutfitLocked; }
-
-	bool isInUpdateAppearanceFromCOF() { return mIsInUpdateAppearanceFromCOF; }
-
 protected:
 	LLAppearanceMgr();
 	~LLAppearanceMgr();
@@ -196,22 +145,9 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 	void purgeCategory(const LLUUID& category, bool keep_outfit_links);
 	void purgeBaseOutfitLink(const LLUUID& category);
 
-	static void onOutfitRename(const LLSD& notification, const LLSD& response);
-
-	void setOutfitLocked(bool locked);
-
 	std::set<LLUUID> mRegisteredAttachments;
 	bool mAttachmentInvLinkEnabled;
 	bool mOutfitIsDirty;
-	bool mIsInUpdateAppearanceFromCOF; // to detect recursive calls.
-
-	/**
-	 * Lock for blocking operations on outfit until server reply or timeout exceed
-	 * to avoid unsynchronized outfit state or performing duplicate operations.
-	 */
-	bool mOutfitLocked;
-
-	std::auto_ptr<LLOutfitUnLockTimer> mUnlockOutfitTimer;
 
 	//////////////////////////////////////////////////////////////////////////////////
 	// Item-specific convenience functions 
@@ -220,23 +156,17 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 	BOOL getIsInCOF(const LLUUID& obj_id) const;
 	// Is this in the COF and can the user delete it from the COF?
 	BOOL getIsProtectedCOFItem(const LLUUID& obj_id) const;
-
-	/**
-	 * Checks if COF contains link to specified object.
-	 */
-	static bool isLinkInCOF(const LLUUID& obj_id);
 };
 
 class LLUpdateAppearanceOnDestroy: public LLInventoryCallback
 {
 public:
-	LLUpdateAppearanceOnDestroy(bool update_base_outfit_ordering = false);
+	LLUpdateAppearanceOnDestroy();
 	virtual ~LLUpdateAppearanceOnDestroy();
 	/* virtual */ void fire(const LLUUID& inv_item);
 
 private:
 	U32 mFireCount;
-	bool mUpdateBaseOrder;
 };
 
 
@@ -244,19 +174,172 @@ class LLUpdateAppearanceOnDestroy: public LLInventoryCallback
 
 LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string& name);
 
-typedef boost::function<void ()> nullary_func_t;
-typedef boost::function<bool ()> bool_func_t;
+// Shim class and template function to allow arbitrary boost::bind
+// expressions to be run as one-time idle callbacks.
+template <typename T>
+class OnIdleCallbackOneTime
+{
+public:
+	OnIdleCallbackOneTime(T callable):
+		mCallable(callable)
+	{
+	}
+	static void onIdle(void *data)
+	{
+		gIdleCallbacks.deleteFunction(onIdle, data);
+		OnIdleCallbackOneTime<T>* self = reinterpret_cast<OnIdleCallbackOneTime<T>*>(data);
+		self->call();
+		delete self;
+	}
+	void call()
+	{
+		mCallable();
+	}
+private:
+	T mCallable;
+};
+
+template <typename T>
+void doOnIdleOneTime(T callable)
+{
+	OnIdleCallbackOneTime<T>* cb_functor = new OnIdleCallbackOneTime<T>(callable);
+	gIdleCallbacks.addFunction(&OnIdleCallbackOneTime<T>::onIdle,cb_functor);
+}
+
+// Shim class and template function to allow arbitrary boost::bind
+// expressions to be run as recurring idle callbacks.
+// Callable should return true when done, false to continue getting called.
+template <typename T>
+class OnIdleCallbackRepeating
+{
+public:
+	OnIdleCallbackRepeating(T callable):
+		mCallable(callable)
+	{
+	}
+	// Will keep getting called until the callable returns true.
+	static void onIdle(void *data)
+	{
+		OnIdleCallbackRepeating<T>* self = reinterpret_cast<OnIdleCallbackRepeating<T>*>(data);
+		bool done = self->call();
+		if (done)
+		{
+			gIdleCallbacks.deleteFunction(onIdle, data);
+			delete self;
+		}
+	}
+	bool call()
+	{
+		return mCallable();
+	}
+private:
+	T mCallable;
+};
 
-// Call a given callable once in idle loop.
-void doOnIdleOneTime(nullary_func_t callable);
+template <typename T>
+void doOnIdleRepeating(T callable)
+{
+	OnIdleCallbackRepeating<T>* cb_functor = new OnIdleCallbackRepeating<T>(callable);
+	gIdleCallbacks.addFunction(&OnIdleCallbackRepeating<T>::onIdle,cb_functor);
+}
 
-// Repeatedly call a callable in idle loop until it returns true.
-void doOnIdleRepeating(bool_func_t callable);
+template <class T>
+class CallAfterCategoryFetchStage2: public LLInventoryFetchObserver
+{
+public:
+	CallAfterCategoryFetchStage2(T callable):
+		mCallable(callable)
+	{
+	}
+	~CallAfterCategoryFetchStage2()
+	{
+	}
+	virtual void done()
+	{
+		gInventory.removeObserver(this);
+		doOnIdleOneTime(mCallable);
+		delete this;
+	}
+protected:
+	T mCallable;
+};
 
-// Invoke a given callable after category contents are fully fetched.
-void callAfterCategoryFetch(const LLUUID& cat_id, nullary_func_t cb);
+template <class T>
+class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver
+{
+public:
+	CallAfterCategoryFetchStage1(T callable):
+		mCallable(callable)
+	{
+	}
+	~CallAfterCategoryFetchStage1()
+	{
+	}
+	virtual void done()
+	{
+		// What we do here is get the complete information on the items in
+		// the library, and set up an observer that will wait for that to
+		// happen.
+		LLInventoryModel::cat_array_t cat_array;
+		LLInventoryModel::item_array_t item_array;
+		gInventory.collectDescendents(mComplete.front(),
+									  cat_array,
+									  item_array,
+									  LLInventoryModel::EXCLUDE_TRASH);
+		S32 count = item_array.count();
+		if(!count)
+		{
+			llwarns << "Nothing fetched in category " << mComplete.front()
+					<< llendl;
+			//dec_busy_count();
+			gInventory.removeObserver(this);
+			delete this;
+			return;
+		}
+
+		CallAfterCategoryFetchStage2<T> *stage2 = new CallAfterCategoryFetchStage2<T>(mCallable);
+		uuid_vec_t ids;
+		for(S32 i = 0; i < count; ++i)
+		{
+			ids.push_back(item_array.get(i)->getUUID());
+		}
+		
+		gInventory.removeObserver(this);
+		
+		// do the fetch
+		stage2->fetch(ids);
+		if(stage2->isEverythingComplete())
+		{
+			// everything is already here - call done.
+			stage2->done();
+		}
+		else
+		{
+			// it's all on it's way - add an observer, and the inventory
+			// will call done for us when everything is here.
+			gInventory.addObserver(stage2);
+		}
+		delete this;
+	}
+protected:
+	T mCallable;
+};
 
-// Wear all items in a uuid vector.
-void wear_multiple(const uuid_vec_t& ids, bool replace);
+template <class T> 
+void callAfterCategoryFetch(const LLUUID& cat_id, T callable)
+{
+	CallAfterCategoryFetchStage1<T> *stage1 = new CallAfterCategoryFetchStage1<T>(callable);
+	uuid_vec_t folders;
+	folders.push_back(cat_id);
+	stage1->fetch(folders);
+	if (stage1->isEverythingComplete())
+	{
+		stage1->done();
+	}
+	else
+	{
+		gInventory.addObserver(stage1);
+	}
+}
 
 #endif
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 7f4ba2f2d2c216f51105e473488ce52d56fa7eff..43c8c679c69c6ba3c2074d2198d5c5b4f931d834 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2,25 +2,31 @@
  * @file llappviewer.cpp
  * @brief The LLAppViewer class definitions
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -39,7 +45,6 @@
 #include "llgroupmgr.h"
 #include "llagent.h"
 #include "llagentcamera.h"
-#include "llagentlanguage.h"
 #include "llagentwearables.h"
 #include "llwindow.h"
 #include "llviewerstats.h"
@@ -76,9 +81,7 @@
 #include "llvoicechannel.h"
 #include "llvoavatarself.h"
 #include "llsidetray.h"
-#include "llfeaturemanager.h"
-#include "llurlmatch.h"
-#include "lltextutil.h"
+
 
 #include "llweb.h"
 #include "llsecondlifeurls.h"
@@ -100,8 +103,8 @@
 // Third party library includes
 #include <boost/bind.hpp>
 
-
 #if LL_WINDOWS
+	#include "llwindebug.h"
 #	include <share.h> // For _SH_DENYWR in initMarkerFile
 #else
 #   include <sys/file.h> // For initMarkerFile support
@@ -150,7 +153,7 @@
 #include "llworld.h"
 #include "llhudeffecttrail.h"
 #include "llvectorperfoptions.h"
-#include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llwatchdog.h"
 
 // Included so that constants/settings might be initialized
@@ -189,11 +192,6 @@
 #include "llviewerthrottle.h"
 #include "llparcel.h"
 #include "llavatariconctrl.h"
-#include "llgroupiconctrl.h"
-
-// Include for security api initialization
-#include "llsecapi.h"
-#include "llmachineid.h"
 
 // *FIX: These extern globals should be cleaned up.
 // The globals either represent state/config/resource-storage of either 
@@ -329,6 +327,10 @@ const char *VFS_INDEX_FILE_BASE = "index.db2.x.";
 
 static std::string gWindowTitle;
 
+std::string gLoginPage;
+std::vector<std::string> gLoginURIs;
+static std::string gHelperURI;
+
 LLAppViewer::LLUpdaterInfo *LLAppViewer::sUpdaterInfo = NULL ;
 
 void idle_afk_check()
@@ -349,45 +351,6 @@ static void ui_audio_callback(const LLUUID& uuid)
 	}
 }
 
-bool	create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base)
-{
-	if(!match || !base || base->getPlainText())
-		return false;
-
-	LLUUID match_id = match->getID();
-
-	LLIconCtrl* icon;
-
-	if(gAgent.isInGroup(match_id, TRUE))
-	{
-		LLGroupIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLGroupIconCtrl>();
-		icon_params.group_id = match_id;
-		icon_params.rect = LLRect(0, 16, 16, 0);
-		icon_params.visible = true;
-		icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params);
-	}
-	else
-	{
-		LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>();
-		icon_params.avatar_id = match_id;
-		icon_params.rect = LLRect(0, 16, 16, 0);
-		icon_params.visible = true;
-		icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params);
-	}
-
-	LLInlineViewSegment::Params params;
-	params.force_newline = false;
-	params.view = icon;
-	params.left_pad = 4;
-	params.right_pad = 4;
-	params.top_pad = -2;
-	params.bottom_pad = 2;
-
-	base->appendWidget(params," ",false);
-	
-	return true;
-}
-
 void request_initial_instant_messages()
 {
 	static BOOL requested = FALSE;
@@ -416,8 +379,14 @@ bool handleCrashSubmitBehaviorChanged(const LLSD& newvalue)
 	const S32 NEVER_SUBMIT_REPORT = 2;
 	if(cb == NEVER_SUBMIT_REPORT)
 	{
+// 		LLWatchdog::getInstance()->cleanup(); // SJB: cleaning up a running watchdog thread is unsafe
 		LLAppViewer::instance()->destroyMainloopTimeout();
 	}
+	else if(gSavedSettings.getBOOL("WatchdogEnabled") == TRUE)
+	{
+		// Don't re-enable the watchdog when we change the setting; this may get called before it's started
+// 		LLWatchdog::getInstance()->init();
+	}
 	return true;
 }
 
@@ -443,7 +412,7 @@ static void settings_to_globals()
 	LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor");
 	LLVOTree::sTreeFactor				= gSavedSettings.getF32("RenderTreeLODFactor");
 	LLVOAvatar::sLODFactor				= gSavedSettings.getF32("RenderAvatarLODFactor");
-	LLVOAvatar::sMaxVisible				= (U32)gSavedSettings.getS32("RenderAvatarMaxVisible");
+	LLVOAvatar::sMaxVisible				= gSavedSettings.getS32("RenderAvatarMaxVisible");
 	LLVOAvatar::sVisibleInFirstPerson	= gSavedSettings.getBOOL("FirstPersonAvatarVisible");
 	// clamp auto-open time to some minimum usable value
 	LLFolderView::sAutoOpenTime			= llmax(0.25f, gSavedSettings.getF32("FolderAutoOpenDelay"));
@@ -538,6 +507,35 @@ class LLFastTimerLogThread : public LLThread
 	}
 };
 
+void LLAppViewer::initGridChoice()
+{
+	// Load	up the initial grid	choice from:
+	//	- hard coded defaults...
+	//	- command line settings...
+	//	- if dev build,	persisted settings...
+
+	// Set the "grid choice", this is specified	by command line.
+	std::string	grid_choice	= gSavedSettings.getString("CmdLineGridChoice");
+	LLViewerLogin::getInstance()->setGridChoice(grid_choice);
+
+	// Load last server choice by default 
+	// ignored if the command line grid	choice has been	set
+	if(grid_choice.empty())
+	{
+		S32	server = gSavedSettings.getS32("ServerChoice");
+		server = llclamp(server, 0,	(S32)GRID_INFO_COUNT - 1);
+		if(server == GRID_INFO_OTHER)
+		{
+			std::string custom_server = gSavedSettings.getString("CustomServer");
+			LLViewerLogin::getInstance()->setGridChoice(custom_server);
+		}
+		else if(server != (S32)GRID_INFO_NONE)
+		{
+			LLViewerLogin::getInstance()->setGridChoice((EGridInfo)server);
+		}
+	}
+}
+
 //virtual
 bool LLAppViewer::initSLURLHandler()
 {
@@ -630,11 +628,6 @@ bool LLAppViewer::init()
 	if (!initConfiguration())
 		return false;
 
-	// write Google Breakpad minidump files to our log directory
-	std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
-	logdir += gDirUtilp->getDirDelimiter();
-	setMiniDumpDir(logdir);
-
 	// Although initLogging() is the right place to mess with
 	// setFatalFunction(), we can't query gSavedSettings until after
 	// initConfiguration().
@@ -652,9 +645,9 @@ bool LLAppViewer::init()
     // *NOTE:Mani - LLCurl::initClass is not thread safe. 
     // Called before threads are created.
     LLCurl::initClass();
-    LLMachineID::init();
 
     initThreads();
+
     writeSystemInfo();
 
 	// Build a string representing the current version number.
@@ -784,6 +777,10 @@ bool LLAppViewer::init()
 		return false;
 	}
 
+	// Always fetch the Ethernet MAC address, needed both for login
+	// and password load.
+	LLUUID::getNodeID(gMACAddress);
+
 	// Prepare for out-of-memory situations, during which we will crash on
 	// purpose and save a dump.
 #if LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP
@@ -865,7 +862,7 @@ bool LLAppViewer::init()
 			minSpecs += "\n";
 			unsupported = true;
 		}
-		if(gSysCPU.getMHz() < minCPU)
+		if(gSysCPU.getMhz() < minCPU)
 		{
 			minSpecs += LLNotifications::instance().getGlobalString("UnsupportedCPU");
 			minSpecs += "\n";
@@ -895,7 +892,6 @@ bool LLAppViewer::init()
 		}
 	}
 
-
 	// save the graphics card
 	gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString();
 
@@ -906,17 +902,6 @@ bool LLAppViewer::init()
 	gSimFrames = (F32)gFrameCount;
 
 	LLViewerJoystick::getInstance()->init(false);
-
-	try {
-		initializeSecHandler();
-	}
-	catch (LLProtectedDataException ex)
-	{
-	  LLNotificationsUtil::add("CorruptedProtectedDataStore");
-	}
-	LLHTTPClient::setCertVerifyCallback(secapiSSLCertVerifyCallback);
-
-
 	gGLActive = FALSE;
 	if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0)
 	{
@@ -924,25 +909,7 @@ bool LLAppViewer::init()
 	}
 	
 	LLViewerMedia::initClass();
-	LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match;
-
-	//EXT-7013 - On windows for some locale (Japanese) standard 
-	//datetime formatting functions didn't support some parameters such as "weekday".
-	std::string language = LLControlGroup::getInstance(sGlobalSettingsName)->getString("Language");
-	if(language == "ja")
-	{
-		LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames"));
-		LLStringOps::setupWeekDaysShortNames(LLTrans::getString("dateTimeWeekdaysShortNames"));
-		LLStringOps::setupMonthNames(LLTrans::getString("dateTimeMonthNames"));
-		LLStringOps::setupMonthShortNames(LLTrans::getString("dateTimeMonthShortNames"));
-		LLStringOps::setupDayFormat(LLTrans::getString("dateTimeDayFormat"));
-
-		LLStringOps::sAM = LLTrans::getString("dateTimeAM");
-		LLStringOps::sPM = LLTrans::getString("dateTimePM");
-	}
-
-	LLAgentLanguage::init();
-
+	
 	return true;
 }
 
@@ -969,11 +936,13 @@ bool LLAppViewer::mainLoop()
 	gServicePump = new LLPumpIO(gAPRPoolp);
 	LLHTTPClient::setPump(*gServicePump);
 	LLCurl::setCAFile(gDirUtilp->getCAFile());
-
+	LLCurl::setSSLVerify(! gSavedSettings.getBOOL("NoVerifySSLCert"));
+	
 	// Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
 
 	LLVoiceChannel::initClass();
-	LLVoiceClient::getInstance()->init(gServicePump);
+	LLVoiceClient::init(gServicePump);
+
 	LLTimer frameTimer,idleTimer;
 	LLTimer debugTime;
 	LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
@@ -1278,14 +1247,6 @@ bool LLAppViewer::cleanup()
 	// workaround for DEV-35406 crash on shutdown
 	LLEventPumps::instance().reset();
 
-	// remove any old breakpad minidump files from the log directory
-	if (! isError())
-	{
-		std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
-		logdir += gDirUtilp->getDirDelimiter();
-		gDirUtilp->deleteFilesInDir(logdir, "*-*-*-*-*.dmp");
-	}
-
 	// *TODO - generalize this and move DSO wrangling to a helper class -brad
 	std::set<struct apr_dso_handle_t *>::const_iterator i;
 	for(i = mPlugins.begin(); i != mPlugins.end(); ++i)
@@ -1312,7 +1273,7 @@ bool LLAppViewer::cleanup()
 	// to ensure shutdown order
 	LLMortician::setZealous(TRUE);
 
-	LLVoiceClient::getInstance()->terminate();
+	LLVoiceClient::terminate();
 	
 	disconnectViewer();
 
@@ -1511,6 +1472,13 @@ bool LLAppViewer::cleanup()
 
 	llinfos << "Saving Data" << llendflush;
 	
+	// Quitting with "Remember Password" turned off should always stomp your
+	// saved password, whether or not you successfully logged in.  JC
+	if (!gSavedSettings.getBOOL("RememberPassword"))
+	{
+		LLStartUp::deletePasswordFromDisk();
+	}
+	
 	// Store the time of our current logoff
 	gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
 
@@ -1562,9 +1530,6 @@ bool LLAppViewer::cleanup()
 	
 	LLViewerMedia::saveCookieFile();
 
-	// Stop the plugin read thread if it's running.
-	LLPluginProcessParent::setUseReadThread(false);
-
 	llinfos << "Shutting down Threads" << llendflush;
 
 	// Let threads finish
@@ -1723,6 +1688,14 @@ bool LLAppViewer::initThreads()
 	static const bool enable_threads = true;
 #endif
 
+	const S32 NEVER_SUBMIT_REPORT = 2;
+	bool use_watchdog = gSavedSettings.getBOOL("WatchdogEnabled");
+	bool send_reports = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) != NEVER_SUBMIT_REPORT;
+	if(use_watchdog && send_reports)
+	{
+		LLWatchdog::getInstance()->init(watchdog_killer_callback);
+	}
+
 	LLVFSThread::initClass(enable_threads && false);
 	LLLFSThread::initClass(enable_threads && false);
 
@@ -1858,7 +1831,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key,
 			}
 			else
 			{
-				llinfos << "Cannot load " << full_settings_path << " - No settings found." << llendl;
+				llwarns << "Cannot load " << full_settings_path << " - No settings found." << llendl;
 			}
 		}
 		else
@@ -1951,11 +1924,18 @@ bool LLAppViewer::initConfiguration()
 	}
 #endif
 
+	//*FIX:Mani - Set default to disabling watchdog mainloop 
+	// timeout for mac and linux. There is no call stack info 
+	// on these platform to help debug.
 #ifndef	LL_RELEASE_FOR_DOWNLOAD
+	gSavedSettings.setBOOL("WatchdogEnabled", FALSE);
 	gSavedSettings.setBOOL("QAMode", TRUE );
-	gSavedSettings.setS32("WatchdogEnabled", 0);
 #endif
-	
+
+#ifndef LL_WINDOWS
+	gSavedSettings.setBOOL("WatchdogEnabled", FALSE);
+#endif
+
 	gCrashSettings.getControl(CRASH_BEHAVIOR_SETTING)->getSignal()->connect(boost::bind(&handleCrashSubmitBehaviorChanged, _2));	
 
 	// These are warnings that appear on the first experience of that condition.
@@ -2067,6 +2047,7 @@ bool LLAppViewer::initConfiguration()
         }
     }
 
+    initGridChoice();
 
 	// If we have specified crash on startup, set the global so we'll trigger the crash at the right time
 	if(clp.hasOption("crashonstartup"))
@@ -2160,17 +2141,30 @@ bool LLAppViewer::initConfiguration()
     // injection and steal passwords. Phoenix. SL-55321
     if(clp.hasOption("url"))
     {
-		LLStartUp::setStartSLURL(LLSLURL(clp.getOption("url")[0]));
-		if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION) 
-		{  
-			LLGridManager::getInstance()->setGridChoice(LLStartUp::getStartSLURL().getGrid());
-			
-		}  
+        std::string slurl = clp.getOption("url")[0];
+        if (LLSLURL::isSLURLCommand(slurl))
+        {
+	        LLStartUp::sSLURLCommand = slurl;
+        }
+        else
+        {
+	        LLURLSimString::setString(slurl);
+        }
     }
     else if(clp.hasOption("slurl"))
     {
-		LLSLURL start_slurl(clp.getOption("slurl")[0]);
-		LLStartUp::setStartSLURL(start_slurl);
+        std::string slurl = clp.getOption("slurl")[0];
+        if(LLSLURL::isSLURL(slurl))
+        {
+            if (LLSLURL::isSLURLCommand(slurl))
+            {
+	            LLStartUp::sSLURLCommand = slurl;
+            }
+            else
+            {
+	            LLURLSimString::setString(slurl);
+            }
+        }
     }
 
     const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
@@ -2251,10 +2245,18 @@ bool LLAppViewer::initConfiguration()
 	// don't call anotherInstanceRunning() when doing URL handoff, as
 	// it relies on checking a marker file which will not work when running
 	// out of different directories
-
-	if (LLStartUp::getStartSLURL().isValid())
+	std::string slurl;
+	if (!LLStartUp::sSLURLCommand.empty())
+	{
+		slurl = LLStartUp::sSLURLCommand;
+	}
+	else if (LLURLSimString::parse())
+	{
+		slurl = LLURLSimString::getURL();
+	}
+	if (!slurl.empty())
 	{
-		if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString()))
+		if (sendURLToOtherInstance(slurl))
 		{
 			// successfully handed off URL to existing instance, exit
 			return false;
@@ -2310,9 +2312,9 @@ bool LLAppViewer::initConfiguration()
 
    	// need to do this here - need to have initialized global settings first
 	std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
-	if ( !nextLoginLocation.empty() )
+	if ( nextLoginLocation.length() )
 	{
-		LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
+		LLURLSimString::setString( nextLoginLocation );
 	};
 
 	gLastRunVersion = gSavedSettings.getString("LastRunVersion");
@@ -2327,7 +2329,17 @@ void LLAppViewer::checkForCrash(void)
 {
     
 #if LL_SEND_CRASH_REPORTS
+	//*NOTE:Mani The current state of the crash handler has the MacOSX
+	// sending all crash reports as freezes, in order to let 
+	// the MacOSX CrashRepoter generate stacks before spawning the 
+	// SL crash logger.
+	// The Linux and Windows clients generate their own stacks and
+	// spawn the SL crash logger immediately. This may change in the future. 
+#if LL_DARWIN
+	if(gLastExecEvent != LAST_EXEC_NORMAL)
+#else		
 	if (gLastExecEvent == LAST_EXEC_FROZE)
+#endif
     {
         llinfos << "Last execution froze, requesting to send crash report." << llendl;
         //
@@ -2383,30 +2395,18 @@ bool LLAppViewer::initWindow()
 		gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"),
 		FALSE, ignorePixelDepth);
 
-	// Need to load feature table before cheking to start watchdog.
-	const S32 NEVER_SUBMIT_REPORT = 2;
-	bool use_watchdog = false;
-	int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled");
-	if(watchdog_enabled_setting == -1){
-		use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled");
-	}
-	else
-	{
-		// The user has explicitly set this setting; always use that value.
-		use_watchdog = bool(watchdog_enabled_setting);
-	}
-
-	bool send_reports = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) != NEVER_SUBMIT_REPORT;
-	if(use_watchdog && send_reports)
-	{
-		LLWatchdog::getInstance()->init(watchdog_killer_callback);
-	}
-
 	LLNotificationsUI::LLNotificationManager::getInstance();
 		
+	if (gSavedSettings.getBOOL("WindowFullScreen"))
+	{
+		// request to go full screen... which will be delayed until login
+		gViewerWindow->toggleFullscreen(FALSE);
+	}
+	
 	if (gSavedSettings.getBOOL("WindowMaximized"))
 	{
 		gViewerWindow->mWindow->maximize();
+		gViewerWindow->getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio"));
 	}
 
 	if (!gNoRender)
@@ -2480,10 +2480,11 @@ void LLAppViewer::cleanupSavedSettings()
 		}
 	}
 
-	// save window position if not maximized
+	// save window position if not fullscreen
 	// as we don't track it in callbacks
+	BOOL fullscreen = gViewerWindow->mWindow->getFullscreen();
 	BOOL maximized = gViewerWindow->mWindow->getMaximized();
-	if (!maximized)
+	if (!fullscreen && !maximized)
 	{
 		LLCoordScreen window_pos;
 
@@ -2523,7 +2524,7 @@ void LLAppViewer::writeSystemInfo()
 
 	gDebugInfo["CPUInfo"]["CPUString"] = gSysCPU.getCPUString();
 	gDebugInfo["CPUInfo"]["CPUFamily"] = gSysCPU.getFamily();
-	gDebugInfo["CPUInfo"]["CPUMhz"] = (S32)gSysCPU.getMHz();
+	gDebugInfo["CPUInfo"]["CPUMhz"] = gSysCPU.getMhz();
 	gDebugInfo["CPUInfo"]["CPUAltivec"] = gSysCPU.hasAltivec();
 	gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE();
 	gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2();
@@ -2534,9 +2535,9 @@ void LLAppViewer::writeSystemInfo()
 
 	// The user is not logged on yet, but record the current grid choice login url
 	// which may have been the intended grid. This can b
-	gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
+	gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
 
-	// *FIX:Mani - move this down in llappviewerwin32
+	// *FIX:Mani - move this ddown in llappviewerwin32
 #ifdef LL_WINDOWS
 	DWORD thread_id = GetCurrentThreadId();
 	gDebugInfo["MainloopThreadID"] = (S32)thread_id;
@@ -2548,15 +2549,6 @@ void LLAppViewer::writeSystemInfo()
 	// If the crash is handled by LLAppViewer::handleViewerCrash, ie not a freeze,
 	// then the value of "CrashNotHandled" will be set to true.
 	gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true;
-
-	// Insert crash host url (url to post crash log to) if configured. This insures
-	// that the crash report will go to the proper location in the case of a 
-	// prior freeze.
-	std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl");
-	if(crashHostUrl != "")
-	{
-		gDebugInfo["CrashHostUrl"] = crashHostUrl;
-	}
 	
 	// Dump some debugging info
 	LL_INFOS("SystemInfo") << LLTrans::getString("APP_NAME")
@@ -2578,12 +2570,17 @@ void LLAppViewer::writeSystemInfo()
 	writeDebugInfo(); // Save out debug_info.log early, in case of crash.
 }
 
+void LLAppViewer::handleSyncViewerCrash()
+{
+	LLAppViewer* pApp = LLAppViewer::instance();
+	// Call to pure virtual, handled by platform specific llappviewer instance.
+	pApp->handleSyncCrashTrace(); 
+}
+
 void LLAppViewer::handleViewerCrash()
 {
 	llinfos << "Handle viewer crash entry." << llendl;
 
-	llinfos << "Last render pool type: " << LLPipeline::sCurRenderPoolType << llendl ;
-
 	//print out recorded call stacks if there are any.
 	LLError::LLCallStacks::print();
 
@@ -2601,13 +2598,9 @@ void LLAppViewer::handleViewerCrash()
 		return;
 	}
 	pApp->mReportedCrash = TRUE;
-	
-	// Insert crash host url (url to post crash log to) if configured.
-	std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl");
-	if(crashHostUrl != "")
-	{
-		gDebugInfo["CrashHostUrl"] = crashHostUrl;
-	}
+
+	// Make sure the watchdog gets turned off...
+// 	pApp->destroyMainloopTimeout(); // SJB: Bah. This causes the crash handler to hang, not sure why.
 	
 	//We already do this in writeSystemInfo(), but we do it again here to make /sure/ we have a version
 	//to check against no matter what
@@ -2639,12 +2632,6 @@ void LLAppViewer::handleViewerCrash()
 	gDebugInfo["FirstLogin"] = (LLSD::Boolean) gAgent.isFirstLogin();
 	gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall");
 
-	char *minidump_file = pApp->getMiniDumpFilename();
-	if(minidump_file && minidump_file[0] != 0)
-	{
-		gDebugInfo["MinidumpPath"] = minidump_file;
-	}
-	
 	if(gLogoutInProgress)
 	{
 		gDebugInfo["LastExecEvent"] = LAST_EXEC_LOGOUT_CRASH;
@@ -2722,6 +2709,10 @@ void LLAppViewer::handleViewerCrash()
 
 	LLError::logToFile("");
 
+// On Mac, we send the report on the next run, since we need macs crash report
+// for a stack trace, so we have to let it the app fail.
+#if !LL_DARWIN
+
 	// Remove the marker file, since otherwise we'll spawn a process that'll keep it locked
 	if(gDebugInfo["LastExecEvent"].asInteger() == LAST_EXEC_LOGOUT_CRASH)
 	{
@@ -2734,6 +2725,8 @@ void LLAppViewer::handleViewerCrash()
 	
 	// Call to pure virtual, handled by platform specific llappviewer instance.
 	pApp->handleCrashReporting(); 
+
+#endif //!LL_DARWIN
     
 	return;
 }
@@ -3023,97 +3016,41 @@ void LLAppViewer::migrateCacheDirectory()
 #endif // LL_WINDOWS || LL_DARWIN
 }
 
-//static
-S32 LLAppViewer::getCacheVersion() 
-{
-	static const S32 cache_version = 7;
-
-	return cache_version ;
-}
-
-void dumpVFSCaches()
+bool LLAppViewer::initCache()
 {
-	llinfos << "======= Static VFS ========" << llendl;
-	gStaticVFS->listFiles();
-#if LL_WINDOWS
-	llinfos << "======= Dumping static VFS to StaticVFSDump ========" << llendl;
-	WCHAR w_str[MAX_PATH];
-	GetCurrentDirectory(MAX_PATH, w_str);
-	S32 res = LLFile::mkdir("StaticVFSDump");
-	if (res == -1)
+	mPurgeCache = false;
+	// Purge cache if user requested it
+	if (gSavedSettings.getBOOL("PurgeCacheOnStartup") ||
+		gSavedSettings.getBOOL("PurgeCacheOnNextStartup"))
 	{
-		if (errno != EEXIST)
-		{
-			llwarns << "Couldn't create dir StaticVFSDump" << llendl;
-		}
+		gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false);
+		mPurgeCache = true;
 	}
-	SetCurrentDirectory(utf8str_to_utf16str("StaticVFSDump").c_str());
-	gStaticVFS->dumpFiles();
-	SetCurrentDirectory(w_str);
-#endif
-						
-	llinfos << "========= Dynamic VFS ====" << llendl;
-	gVFS->listFiles();
-#if LL_WINDOWS
-	llinfos << "========= Dumping dynamic VFS to VFSDump ====" << llendl;
-	res = LLFile::mkdir("VFSDump");
-	if (res == -1)
+	// Purge cache if it belongs to an old version
+	else
 	{
-		if (errno != EEXIST)
+		static const S32 cache_version = 6;
+		if (gSavedSettings.getS32("LocalCacheVersion") != cache_version)
 		{
-			llwarns << "Couldn't create dir VFSDump" << llendl;
+			mPurgeCache = true;
+			gSavedSettings.setS32("LocalCacheVersion", cache_version);
 		}
 	}
-	SetCurrentDirectory(utf8str_to_utf16str("VFSDump").c_str());
-	gVFS->dumpFiles();
-	SetCurrentDirectory(w_str);
-#endif
-}
-bool LLAppViewer::initCache()
-{
-	mPurgeCache = false;
-	BOOL disable_texture_cache = FALSE ;
-	BOOL read_only = mSecondInstance ? TRUE : FALSE;
-	LLAppViewer::getTextureCache()->setReadOnly(read_only) ;
+	
+	// We have moved the location of the cache directory over time.
+	migrateCacheDirectory();
 
-	if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getCacheVersion()) 
+	// Setup and verify the cache location
+	std::string cache_location = gSavedSettings.getString("CacheLocation");
+	std::string new_cache_location = gSavedSettings.getString("NewCacheLocation");
+	if (new_cache_location != cache_location)
 	{
-		if(read_only) 
-		{
-			disable_texture_cache = TRUE ; //if the cache version of this viewer is different from the running one, this viewer can not use the texture cache.
-		}
-		else
-		{
-			mPurgeCache = true; // Purge cache if the version number is different.
-			gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getCacheVersion());
-		}
+		gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"));
+		purgeCache(); // purge old cache
+		gSavedSettings.setString("CacheLocation", new_cache_location);
+		gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location));
 	}
-
-	if(!read_only)
-	{
-		// Purge cache if user requested it
-		if (gSavedSettings.getBOOL("PurgeCacheOnStartup") ||
-			gSavedSettings.getBOOL("PurgeCacheOnNextStartup"))
-		{
-			gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false);
-		mPurgeCache = true;
-		}
 	
-		// We have moved the location of the cache directory over time.
-		migrateCacheDirectory();
-	
-		// Setup and verify the cache location
-		std::string cache_location = gSavedSettings.getString("CacheLocation");
-		std::string new_cache_location = gSavedSettings.getString("NewCacheLocation");
-		if (new_cache_location != cache_location)
-		{
-			gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"));
-			purgeCache(); // purge old cache
-			gSavedSettings.setString("CacheLocation", new_cache_location);
-			gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location));
-		}
-	}
-
 	if (!gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")))
 	{
 		LL_WARNS("AppCache") << "Unable to set cache location" << LL_ENDL;
@@ -3121,7 +3058,7 @@ bool LLAppViewer::initCache()
 		gSavedSettings.setString("CacheLocationTopFolder", "");
 	}
 	
-	if (mPurgeCache && !read_only)
+	if (mPurgeCache)
 	{
 		LLSplashScreen::update(LLTrans::getString("StartupClearingCache"));
 		purgeCache();
@@ -3130,13 +3067,14 @@ bool LLAppViewer::initCache()
 	LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache"));
 	
 	// Init the texture cache
-	// Allocate 80% of the cache size for textures	
+	// Allocate 80% of the cache size for textures
+	BOOL read_only = mSecondInstance ? TRUE : FALSE;
 	const S32 MB = 1024*1024;
 	S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB;
 	const S64 MAX_CACHE_SIZE = 1024*MB;
 	cache_size = llmin(cache_size, MAX_CACHE_SIZE);
 	S64 texture_cache_size = ((cache_size * 8)/10);
-	S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, disable_texture_cache);
+	S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, read_only);
 	texture_cache_size -= extra;
 
 	LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS"));
@@ -3285,14 +3223,6 @@ bool LLAppViewer::initCache()
 	else
 	{
 		LLVFile::initClass();
-
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-		if (gSavedSettings.getBOOL("DumpVFSCaches"))
-		{
-			dumpVFSCaches();
-		}
-#endif
-		
 		return true;
 	}
 }
@@ -3377,6 +3307,13 @@ void LLAppViewer::badNetworkHandler()
 
 	mPurgeOnExit = TRUE;
 
+#if LL_WINDOWS
+	// Generates the minidump.
+	LLWinDebug::generateCrashStacks(NULL);
+#endif
+	LLAppViewer::handleSyncViewerCrash();
+	LLAppViewer::handleViewerCrash();
+
 	std::ostringstream message;
 	message <<
 		"The viewer has detected mangled network data indicative\n"
@@ -3389,8 +3326,6 @@ void LLAppViewer::badNetworkHandler()
 		"If the problem continues, see the Tech Support FAQ at: \n"
 		"www.secondlife.com/support";
 	forceDisconnect(message.str());
-	
-	LLApp::instance()->writeMiniDump();
 }
 
 // This routine may get called more than once during the shutdown process.
@@ -3951,7 +3886,7 @@ void LLAppViewer::sendLogoutRequest()
 		gLogoutMaxTime = LOGOUT_REQUEST_TIME;
 		mLogoutRequestSent = TRUE;
 		
-		LLVoiceClient::getInstance()->leaveChannel();
+		gVoiceClient->leaveChannel();
 
 		//Set internal status variables and marker files
 		gLogoutInProgress = TRUE;
@@ -3989,7 +3924,9 @@ void LLAppViewer::idleNetwork()
 {
 	LLMemType mt_in(LLMemType::MTYPE_IDLE_NETWORK);
 	pingMainloopTimeout("idleNetwork");
-	
+	LLError::LLCallStacks::clear() ;
+	llpushcallstacks ;
+
 	gObjectList.mNumNewObjects = 0;
 	S32 total_decoded = 0;
 
@@ -3999,6 +3936,7 @@ void LLAppViewer::idleNetwork()
 		
 		// deal with any queued name requests and replies.
 		gCacheName->processPending();
+		llpushcallstacks ;
 		LLTimer check_message_timer;
 		//  Read all available packets from network 
 		const S64 frame_count = gFrameCount;  // U32->S64
@@ -4068,13 +4006,16 @@ void LLAppViewer::idleNetwork()
 			gPrintMessagesThisFrame = FALSE;
 		}
 	}
+	llpushcallstacks ;
 	LLViewerStats::getInstance()->mNumNewObjectsStat.addValue(gObjectList.mNumNewObjects);
 
 	// Retransmit unacknowledged packets.
 	gXferManager->retransmitUnackedPackets();
 	gAssetStorage->checkForTimeouts();
+	llpushcallstacks ;
 	gViewerThrottle.updateDynamicThrottle();
 
+	llpushcallstacks ;
 	// Check that the circuit between the viewer and the agent's current
 	// region is still alive
 	LLViewerRegion *agent_region = gAgent.getRegion();
@@ -4090,6 +4031,7 @@ void LLAppViewer::idleNetwork()
 		mAgentRegionLastID = this_region_id;
 		mAgentRegionLastAlive = this_region_alive;
 	}
+	llpushcallstacks ;
 }
 
 void LLAppViewer::disconnectViewer()
@@ -4171,7 +4113,7 @@ void LLAppViewer::forceErrorBreakpoint()
 void LLAppViewer::forceErrorBadMemoryAccess()
 {
     S32* crash = NULL;
-    *crash = 0xDEADBEEF;  
+    *crash = 0xDEADBEEF;
     return;
 }
 
@@ -4364,7 +4306,7 @@ void LLAppViewer::launchUpdater()
 #endif
 	// *TODO change userserver to be grid on both viewer and sim, since
 	// userserver no longer exists.
-	query_map["userserver"] = LLGridManager::getInstance()->getGridLabel();
+	query_map["userserver"] = LLViewerLogin::getInstance()->getGridLabel();
 	query_map["channel"] = gSavedSettings.getString("VersionChannelName");
 	// *TODO constantize this guy
 	// *NOTE: This URL is also used in win_setup/lldownloader.cpp
@@ -4377,10 +4319,10 @@ void LLAppViewer::launchUpdater()
 	LLAppViewer::sUpdaterInfo = new LLAppViewer::LLUpdaterInfo() ;
 
 	// if a sim name was passed in via command line parameter (typically through a SLURL)
-	if ( LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION )
+	if ( LLURLSimString::sInstance.mSimString.length() )
 	{
 		// record the location to start at next time
-		gSavedSettings.setString( "NextLoginLocation", LLStartUp::getStartSLURL().getSLURLString()); 
+		gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString ); 
 	};
 
 #if LL_WINDOWS
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 1fcf38d18ad8ffd41a43a4e378ff113ffc73acaf..a915b7fa50c8da0dc88223b4b9d4ed5fce9cc1a8 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -2,25 +2,31 @@
  * @file llappviewer.h
  * @brief The LLAppViewer class declaration
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -86,7 +92,9 @@ class LLAppViewer : public LLApp
 	virtual bool restoreErrorTrap() = 0; // Require platform specific override to reset error handling mechanism.
 	                                     // return false if the error trap needed restoration.
 	virtual void handleCrashReporting(bool reportFreeze = false) = 0; // What to do with crash report?
+	virtual void handleSyncCrashTrace() = 0; // any low-level crash-prep that has to happen in the context of the crashing thread before the crash report is delivered.
 	static void handleViewerCrash(); // Hey! The viewer crashed. Do this, soon.
+	static void handleSyncViewerCrash(); // Hey! The viewer crashed. Do this right NOW in the context of the crashing thread.
     void checkForCrash();
     
 	// Thread accessors
@@ -94,8 +102,6 @@ class LLAppViewer : public LLApp
 	static LLImageDecodeThread* getImageDecodeThread() { return sImageDecodeThread; }
 	static LLTextureFetch* getTextureFetch() { return sTextureFetch; }
 
-	static S32 getCacheVersion() ;
-
 	const std::string& getSerialNumber() { return mSerialNumber; }
 	
 	bool getPurgeCache() const { return mPurgeCache; }
@@ -185,6 +191,7 @@ class LLAppViewer : public LLApp
 
 	bool initThreads(); // Initialize viewer threads, return false on failure.
 	bool initConfiguration(); // Initialize settings from the command line/config file.
+	void initGridChoice();
 
 	bool initCache(); // Initialize local client cache.
 
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index 7629265730b7aa3ce8962e278edf6dee797b3136..d34bcb4a685503d4b734523641cceefc960022b1 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -2,25 +2,31 @@
  * @file llappviewerlinux.cpp
  * @brief The LLAppViewerLinux class definitions
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */ 
 
@@ -40,6 +46,23 @@
 
 #include <exception>
 
+#if LL_LINUX
+# include <dlfcn.h>		// RTLD_LAZY
+# include <execinfo.h>  // backtrace - glibc only
+#elif LL_SOLARIS
+# include <sys/types.h>
+# include <unistd.h>
+# include <fcntl.h>
+# include <ucontext.h>
+#endif
+
+#ifdef LL_ELFBIN
+# ifdef __GNUC__
+#  include <cxxabi.h>			// for symbol demangling
+# endif
+# include "ELFIO/ELFIO.h"		// for better backtraces
+#endif
+
 #if LL_DBUS_ENABLED
 # include "llappviewerlinux_api_dbus.h"
 
@@ -63,6 +86,7 @@ static void exceptionTerminateHandler()
 	// reinstall default terminate() handler in case we re-terminate.
 	if (gOldTerminateHandler) std::set_terminate(gOldTerminateHandler);
 	// treat this like a regular viewer crash, with nice stacktrace etc.
+	LLAppViewer::handleSyncViewerCrash();
 	LLAppViewer::handleViewerCrash();
 	// we've probably been killed-off before now, but...
 	gOldTerminateHandler(); // call old terminate() handler
@@ -85,6 +109,7 @@ int main( int argc, char **argv )
 	gOldTerminateHandler = std::set_terminate(exceptionTerminateHandler);
 	// install crash handlers
 	viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
+	viewer_app_ptr->setSyncErrorHandler(LLAppViewer::handleSyncViewerCrash);
 
 	bool ok = viewer_app_ptr->init();
 	if(!ok)
@@ -113,6 +138,201 @@ int main( int argc, char **argv )
 	return 0;
 }
 
+#ifdef LL_SOLARIS
+static inline BOOL do_basic_glibc_backtrace()
+{
+	BOOL success = FALSE;
+
+	std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log");
+	llinfos << "Opening stack trace file " << strace_filename << llendl;
+	LLFILE* StraceFile = LLFile::fopen(strace_filename, "w");
+	if (!StraceFile)
+	{
+		llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl;
+		StraceFile = stderr;
+	}
+
+	printstack(fileno(StraceFile));
+
+	if (StraceFile != stderr)
+		fclose(StraceFile);
+
+	return success;
+}
+#else
+#define MAX_STACK_TRACE_DEPTH 40
+// This uses glibc's basic built-in stack-trace functions for a not very
+// amazing backtrace.
+static inline BOOL do_basic_glibc_backtrace()
+{
+	void *stackarray[MAX_STACK_TRACE_DEPTH];
+	size_t size;
+	char **strings;
+	size_t i;
+	BOOL success = FALSE;
+
+	size = backtrace(stackarray, MAX_STACK_TRACE_DEPTH);
+	strings = backtrace_symbols(stackarray, size);
+
+	std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log");
+	llinfos << "Opening stack trace file " << strace_filename << llendl;
+	LLFILE* StraceFile = LLFile::fopen(strace_filename, "w");		// Flawfinder: ignore
+        if (!StraceFile)
+	{
+		llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl;
+		StraceFile = stderr;
+	}
+
+	if (size)
+	{
+		for (i = 0; i < size; i++)
+		{
+			// the format of the StraceFile is very specific, to allow (kludgy) machine-parsing
+			fprintf(StraceFile, "%-3lu ", (unsigned long)i);
+			fprintf(StraceFile, "%-32s\t", "unknown");
+			fprintf(StraceFile, "%p ", stackarray[i]);
+			fprintf(StraceFile, "%s\n", strings[i]);
+		}
+
+		success = TRUE;
+	}
+	
+	if (StraceFile != stderr)
+		fclose(StraceFile);
+
+	free (strings);
+	return success;
+}
+
+#if LL_ELFBIN
+// This uses glibc's basic built-in stack-trace functions together with
+// ELFIO's ability to parse the .symtab ELF section for better symbol
+// extraction without exporting symbols (which'd cause subtle, fatal bugs).
+static inline BOOL do_elfio_glibc_backtrace()
+{
+	void *stackarray[MAX_STACK_TRACE_DEPTH];
+	size_t btsize;
+	char **strings;
+	BOOL success = FALSE;
+
+	std::string appfilename = gDirUtilp->getExecutablePathAndName();
+
+	std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log");
+	llinfos << "Opening stack trace file " << strace_filename << llendl;
+	LLFILE* StraceFile = LLFile::fopen(strace_filename, "w");		// Flawfinder: ignore
+        if (!StraceFile)
+	{
+		llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl;
+		StraceFile = stderr;
+	}
+
+	// get backtrace address list and basic symbol info
+	btsize = backtrace(stackarray, MAX_STACK_TRACE_DEPTH);
+	strings = backtrace_symbols(stackarray, btsize);
+
+	// create ELF reader for our app binary
+	IELFI* pReader;
+	const IELFISection* pSec = NULL;
+	IELFISymbolTable* pSymTbl = 0;
+	if (ERR_ELFIO_NO_ERROR != ELFIO::GetInstance()->CreateELFI(&pReader) ||
+	    ERR_ELFIO_NO_ERROR != pReader->Load(appfilename.c_str()) ||
+	    // find symbol table, create reader-object
+	    NULL == (pSec = pReader->GetSection( ".symtab" )) ||
+	    ERR_ELFIO_NO_ERROR != pReader->CreateSectionReader(IELFI::ELFI_SYMBOL, pSec, (void**)&pSymTbl) )
+	{
+		// Failed to open our binary and read its symbol table somehow
+		llinfos << "Could not initialize ELF symbol reading - doing basic backtrace." << llendl;
+		if (StraceFile != stderr)
+			fclose(StraceFile);
+		// note that we may be leaking some of the above ELFIO
+		// objects now, but it's expected that we'll be dead soon
+		// and we want to tread delicately until we get *some* kind
+		// of useful backtrace.
+		return do_basic_glibc_backtrace();
+	}
+
+	// iterate over trace and symtab, looking for plausible symbols
+	std::string   name;
+	Elf32_Addr    value;
+	Elf32_Word    ssize;
+	unsigned char bind;
+	unsigned char type;
+	Elf32_Half    section;
+	int nSymNo = pSymTbl->GetSymbolNum();
+	size_t btpos;
+	for (btpos = 0; btpos < btsize; ++btpos)
+	{
+		// the format of the StraceFile is very specific, to allow (kludgy) machine-parsing
+		fprintf(StraceFile, "%-3ld ", (long)btpos);
+		int symidx;
+		for (symidx = 0; symidx < nSymNo; ++symidx)
+		{
+			if (ERR_ELFIO_NO_ERROR ==
+			    pSymTbl->GetSymbol(symidx, name, value, ssize,
+					       bind, type, section))
+			{
+				// check if trace address within symbol range
+				if (uintptr_t(stackarray[btpos]) >= value &&
+				    uintptr_t(stackarray[btpos]) < value+ssize)
+				{
+					// symbol is inside viewer
+					fprintf(StraceFile, "%-32s\t", "com.secondlife.indra.viewer");
+					fprintf(StraceFile, "%p ", stackarray[btpos]);
+
+					char *demangled_str = NULL;
+					int demangle_result = 1;
+					demangled_str =
+						abi::__cxa_demangle
+						(name.c_str(), NULL, NULL,
+						 &demangle_result);
+					if (0 == demangle_result &&
+					    NULL != demangled_str) {
+						fprintf(StraceFile,
+							"%s", demangled_str);
+						free(demangled_str);
+					}
+					else // failed demangle; print it raw
+					{
+						fprintf(StraceFile,
+							"%s", name.c_str());
+					}
+					// print offset from symbol start
+					fprintf(StraceFile,
+						" + %lu\n",
+						uintptr_t(stackarray[btpos]) -
+						value);
+					goto got_sym; // early escape
+				}
+			}
+		}
+		// Fallback:
+		// Didn't find a suitable symbol in the binary - it's probably
+		// a symbol in a DSO; use glibc's idea of what it should be.
+		fprintf(StraceFile, "%-32s\t", "unknown");
+		fprintf(StraceFile, "%p ", stackarray[btpos]);
+		fprintf(StraceFile, "%s\n", strings[btpos]);
+	got_sym:;
+	}
+	
+	if (StraceFile != stderr)
+		fclose(StraceFile);
+
+	pSymTbl->Release();
+	pSec->Release();
+	pReader->Release();
+
+	free(strings);
+
+	llinfos << "Finished generating stack trace." << llendl;
+
+	success = TRUE;
+	return success;
+}
+#endif // LL_ELFBIN
+
+#endif // LL_SOLARIS
+
+
 LLAppViewerLinux::LLAppViewerLinux()
 {
 }
@@ -321,6 +541,16 @@ bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)
 }
 #endif // LL_DBUS_ENABLED
 
+void LLAppViewerLinux::handleSyncCrashTrace()
+{
+	// This backtrace writes into stack_trace.log
+#  if LL_ELFBIN
+	do_elfio_glibc_backtrace(); // more useful backtrace
+#  else
+	do_basic_glibc_backtrace(); // only slightly useful backtrace
+#  endif // LL_ELFBIN
+}
+
 void LLAppViewerLinux::handleCrashReporting(bool reportFreeze)
 {
 	std::string cmd =gDirUtilp->getExecutableDir();
@@ -374,7 +604,7 @@ void LLAppViewerLinux::handleCrashReporting(bool reportFreeze)
 				{cmd.c_str(),
 				 ask_dialog,
 				 "-user",
-				 (char*)LLGridManager::getInstance()->getGridLabel().c_str(),
+				 (char*)LLViewerLogin::getInstance()->getGridLabel().c_str(),
 				 "-name",
 				 LLAppViewer::instance()->getSecondLifeTitle().c_str(),
 				 NULL};
@@ -456,8 +686,6 @@ bool LLAppViewerLinux::beingDebugged()
 bool LLAppViewerLinux::initLogging()
 {
 	// Remove the last stack trace, if any
-	// This file is no longer created, since the move to Google Breakpad
-	// The code is left here to clean out any old state in the log dir
 	std::string old_stack_file =
 		gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log");
 	LLFile::remove(old_stack_file);
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 1cd80986d8cbef91410bcac44d284bb6d7608e36..80d9b143457412dcefa0a8f33302e2417865ab9a 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -2,25 +2,31 @@
  * @file llappviewermacosx.cpp
  * @brief The LLAppViewerMacOSX class definitions
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */ 
 
@@ -38,6 +44,7 @@
 #include "llviewernetwork.h"
 #include "llviewercontrol.h"
 #include "llmd5.h"
+#include "llurlsimstring.h"
 #include "llfloaterworldmap.h"
 #include "llurldispatcher.h"
 #include <Carbon/Carbon.h>
@@ -258,6 +265,11 @@ bool LLAppViewerMacOSX::restoreErrorTrap()
 	return reset_count == 0;
 }
 
+void LLAppViewerMacOSX::handleSyncCrashTrace()
+{
+	// do nothing
+}
+
 static OSStatus CarbonEventHandler(EventHandlerCallRef inHandlerCallRef, 
 								   EventRef inEvent, 
 								   void* inUserData)
@@ -279,7 +291,6 @@ static OSStatus CarbonEventHandler(EventHandlerCallRef inHandlerCallRef,
 		if(os_result >= 0 && matching_psn)
 		{
 			sCrashReporterIsRunning = false;
-			QuitApplicationEventLoop();
 		}
     }
     return noErr;
@@ -315,7 +326,7 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze)
 			// *NOTE:Mani A better way - make a copy of the data that the crash reporter will send
 			// and let SL go about its business. This way makes the mac work like windows and linux
 			// and is the smallest patch for the issue. 
-			sCrashReporterIsRunning = false;
+			sCrashReporterIsRunning = true;
 			ProcessSerialNumber o_psn;
 
 			static EventHandlerRef sCarbonEventsRef = NULL;
@@ -345,13 +356,15 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze)
 			
 			if(os_result >= 0)
 			{	
-				sCrashReporterIsRunning = true;
-			}
-
-			while(sCrashReporterIsRunning)
-			{
-				RunApplicationEventLoop();
-			}
+				EventRecord evt;
+				while(sCrashReporterIsRunning)
+				{
+					while(WaitNextEvent(osMask, &evt, 0, NULL))
+					{
+						// null op!?!
+					}
+				}
+			}	
 
 			// Re-install the apps quit handler.
 			AEInstallEventHandler(kCoreEventClass, 
@@ -373,6 +386,38 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze)
 		}
 		
 	}
+
+	if(!reportFreeze)
+	{
+		_exit(1);
+	}
+	
+	// TODO from palmer: Find a better way to handle managing old crash logs
+	// when this is a separate imbedable module.  Ideally just sort crash stack
+	// logs based on date, and grab the latest one as opposed to deleting them
+	// for thoughts on what the module would look like.
+	// See: https://wiki.lindenlab.com/wiki/Viewer_Crash_Reporter_Round_4
+	
+	// Remove the crash stack log from previous executions.
+	// Since we've started logging a new instance of the app, we can assume 
+	// The old crash stack is invalid for the next crash report.
+	char path[MAX_PATH];		
+	FSRef folder;
+	if(FSFindFolder(kUserDomain, kLogsFolderType, false, &folder) == noErr)
+	{
+		// folder is an FSRef to ~/Library/Logs/
+		if(FSRefMakePath(&folder, (UInt8*)&path, sizeof(path)) == noErr)
+		{
+			std::string pathname = std::string(path) + std::string("/CrashReporter/");
+			std::string mask = "Second Life*";
+			std::string file_name;
+			while(gDirUtilp->getNextFileInDir(pathname, mask, file_name, false))
+			{
+				LLFile::remove(pathname + file_name);
+			}
+		}
+	}
+	
 }
 
 std::string LLAppViewerMacOSX::generateSerialNumber()
@@ -408,17 +453,16 @@ std::string LLAppViewerMacOSX::generateSerialNumber()
 static AudioDeviceID get_default_audio_output_device(void)
 {
 	AudioDeviceID device = 0;
-	UInt32 size = sizeof(device);
-	AudioObjectPropertyAddress device_address = { kAudioHardwarePropertyDefaultOutputDevice,
-												  kAudioObjectPropertyScopeGlobal,
-												  kAudioObjectPropertyElementMaster };
-
-	OSStatus err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &device_address, 0, NULL, &size, &device);
+	UInt32 size;
+	OSStatus err;
+	
+	size = sizeof(device);
+	err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &device);
 	if(err != noErr)
 	{
 		LL_DEBUGS("SystemMute") << "Couldn't get default audio output device (0x" << std::hex << err << ")" << LL_ENDL;
 	}
-
+	
 	return device;
 }
 
@@ -426,15 +470,11 @@ static AudioDeviceID get_default_audio_output_device(void)
 void LLAppViewerMacOSX::setMasterSystemAudioMute(bool new_mute)
 {
 	AudioDeviceID device = get_default_audio_output_device();
-
+	
 	if(device != 0)
 	{
 		UInt32 mute = new_mute;
-		AudioObjectPropertyAddress device_address = { kAudioDevicePropertyMute,
-													  kAudioDevicePropertyScopeOutput,
-													  kAudioObjectPropertyElementMaster };
-
-		OSStatus err = AudioObjectSetPropertyData(device, &device_address, 0, NULL, sizeof(mute), &mute);
+		OSStatus err = AudioDeviceSetProperty(device, NULL, 0, false, kAudioDevicePropertyMute, sizeof(mute), &mute);
 		if(err != noErr)
 		{
 			LL_INFOS("SystemMute") << "Couldn't set audio mute property (0x" << std::hex << err << ")" << LL_ENDL;
@@ -447,17 +487,13 @@ bool LLAppViewerMacOSX::getMasterSystemAudioMute()
 {
 	// Assume the system isn't muted 
 	UInt32 mute = 0;
-
+	
 	AudioDeviceID device = get_default_audio_output_device();
-
+	
 	if(device != 0)
 	{
 		UInt32 size = sizeof(mute);
-		AudioObjectPropertyAddress device_address = { kAudioDevicePropertyMute,
-													  kAudioDevicePropertyScopeOutput,
-													  kAudioObjectPropertyElementMaster };
-
-		OSStatus err = AudioObjectGetPropertyData(device, &device_address, 0, NULL, &size, &mute);
+		OSStatus err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyMute, &size, &mute);
 		if(err != noErr)
 		{
 			LL_DEBUGS("SystemMute") << "Couldn't get audio mute property (0x" << std::hex << err << ")" << LL_ENDL;
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index d328567a0e0f4f2e7e919fffebdaad9618af947a..60a6d2f072be002643486eb135a88033178e8155 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -2,25 +2,31 @@
  * @file llappviewerwin32.cpp
  * @brief The LLAppViewerWin32 class definitions
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */ 
 
@@ -51,6 +57,8 @@
 #include "llweb.h"
 #include "llsecondlifeurls.h"
 
+#include "llwindebug.h"
+
 #include "llviewernetwork.h"
 #include "llmd5.h"
 #include "llfindlocale.h"
@@ -58,10 +66,6 @@
 #include "llcommandlineparser.h"
 #include "lltrans.h"
 
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-#include "llwindebug.h"
-#endif
-
 // *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib
 // The lib was compiled under VS2005 - in VS2003 we need to remap assert
 #ifdef LL_DEBUG
@@ -77,6 +81,51 @@ extern "C" {
 
 const std::string LLAppViewerWin32::sWindowClass = "Second Life";
 
+LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop)
+{
+    // *NOTE:Mani - this code is stolen from LLApp, where its never actually used.
+	//OSMessageBox("Attach Debugger Now", "Error", OSMB_OK);
+    // *TODO: Translate the signals/exceptions into cross-platform stuff
+	// Windows implementation
+    _tprintf( _T("Entering Windows Exception Handler...\n") );
+	llinfos << "Entering Windows Exception Handler..." << llendl;
+
+	// Make sure the user sees something to indicate that the app crashed.
+	LONG retval;
+
+	if (LLApp::isError())
+	{
+	    _tprintf( _T("Got another fatal signal while in the error handler, die now!\n") );
+		llwarns << "Got another fatal signal while in the error handler, die now!" << llendl;
+
+		retval = EXCEPTION_EXECUTE_HANDLER;
+		return retval;
+	}
+
+	// Generate a minidump if we can.
+	// Before we wake the error thread...
+	// Which will start the crash reporting.
+	LLWinDebug::generateCrashStacks(exception_infop);
+	
+	// Flag status to error, so thread_error starts its work
+	LLApp::setError();
+
+	// Block in the exception handler until the app has stopped
+	// This is pretty sketchy, but appears to work just fine
+	while (!LLApp::isStopped())
+	{
+		ms_sleep(10);
+	}
+
+	//
+	// At this point, we always want to exit the app.  There's no graceful
+	// recovery for an unhandled exception.
+	// 
+	// Just kill the process.
+	retval = EXCEPTION_EXECUTE_HANDLER;	
+	return retval;
+}
+
 // Create app mutex creates a unique global windows object. 
 // If the object can be created it returns true, otherwise
 // it returns false. The false result can be used to determine 
@@ -142,6 +191,8 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
 	gIconResource = MAKEINTRESOURCE(IDI_LL_ICON);
 
 	LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(lpCmdLine);
+
+	LLWinDebug::initExceptionHandler(viewer_windows_exception_handler); 
 	
 	viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
 
@@ -340,10 +391,6 @@ bool LLAppViewerWin32::init()
 	llinfos << "Turning off Windows error reporting." << llendl;
 	disableWinErrorReporting();
 
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-	LLWinDebug::instance().init();
-#endif
-
 	return LLAppViewer::init();
 }
 
@@ -358,6 +405,12 @@ bool LLAppViewerWin32::cleanup()
 
 bool LLAppViewerWin32::initLogging()
 {
+	// Remove the crash stack log from previous executions.
+	// Since we've started logging a new instance of the app, we can assume 
+	// *NOTE: This should happen before the we send a 'previous instance froze'
+	// crash report, but it must happen after we initialize the DirUtil.
+	LLWinDebug::clearCrashStacks();
+
 	return LLAppViewer::initLogging();
 }
 
@@ -476,9 +529,13 @@ bool LLAppViewerWin32::initParseCommandLine(LLCommandLineParser& clp)
 }
 
 bool LLAppViewerWin32::restoreErrorTrap()
-{	
-	return true;
-	//return LLWinDebug::checkExceptionHandler();
+{
+	return LLWinDebug::checkExceptionHandler();
+}
+
+void LLAppViewerWin32::handleSyncCrashTrace()
+{
+	// do nothing
 }
 
 void LLAppViewerWin32::handleCrashReporting(bool reportFreeze)
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index f12bc16d4b958eff310c64053081e92f15f93ab3..2f90d652e4938956c2c54e63497d6e9411b77fa9 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -2,25 +2,31 @@
  * @file llassetuploadresponders.cpp
  * @brief Processes responses received for asset upload requests.
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */ 
 
@@ -31,7 +37,7 @@
 // viewer includes
 #include "llagent.h"
 #include "llcompilequeue.h"
-#include "llbuycurrencyhtml.h"
+#include "llfloaterbuycurrency.h"
 #include "llfilepicker.h"
 #include "llinventorydefines.h"
 #include "llinventoryobserver.h"
@@ -180,7 +186,7 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content)
 		S32 price = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
 		LLStringUtil::format_map_t args;
 		args["AMOUNT"] = llformat("%d", price);
-		LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("uploading_costs", args), price );
+		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("uploading_costs", args), price);
 	}
 	else
 	{
@@ -197,13 +203,19 @@ void LLAssetUploadResponder::uploadComplete(const LLSD& content)
 
 LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data,
 														   const LLUUID& vfile_id,
-														   LLAssetType::EType asset_type)
-: LLAssetUploadResponder(post_data, vfile_id, asset_type)
+														   LLAssetType::EType asset_type,
+														   boost::function<void(const LLUUID& uuid)> callback)
+: LLAssetUploadResponder(post_data, vfile_id, asset_type),
+  mCallback(callback)
 {
 }
 
-LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name, LLAssetType::EType asset_type)
-: LLAssetUploadResponder(post_data, file_name, asset_type)
+LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, 
+														   const std::string& file_name, 
+														   LLAssetType::EType asset_type, 
+														   boost::function<void(const LLUUID& uuid)> callback)
+: LLAssetUploadResponder(post_data, file_name, asset_type),
+  mCallback(callback)
 {
 }
 
@@ -281,6 +293,12 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
 										creation_date_now);
 		gInventory.updateItem(item);
 		gInventory.notifyObservers();
+		
+		if (mCallback)
+		{
+			// call the callback with the new Asset UUID
+			mCallback(item->getAssetUUID());
+		}
 
 		// Show the preview panel for textures and sounds to let
 		// user know that the image (or snapshot) arrived intact.
@@ -328,13 +346,11 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
 		U32 group_perms      = mPostData.has("group_mask")      ? mPostData.get("group_mask"     ).asInteger() : PERM_NONE;
 		U32 next_owner_perms = mPostData.has("next_owner_mask") ? mPostData.get("next_owner_mask").asInteger() : PERM_NONE;
 		std::string display_name = LLStringUtil::null;
-		LLAssetStorage::LLStoreAssetCallback callback = NULL;
-		void *userdata = NULL;
 		upload_new_resource(next_file, asset_name, asset_name,
-				    0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
+				    LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
 				    next_owner_perms, group_perms,
 				    everyone_perms, display_name,
-				    callback, expected_upload_cost, userdata);
+				    NULL, expected_upload_cost);
 	}
 }
 
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index eedadb962f7e54aaa65267a04f8c968ab1ada59f..c85c72837c17e6b27035a712aad4da01d140df94 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -2,25 +2,31 @@
  * @file llavataractions.cpp
  * @brief Friend-related actions (add, remove, offer teleport, etc)
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -29,8 +35,6 @@
 
 #include "llavataractions.h"
 
-#include "boost/lambda/lambda.hpp"	// for lambda::constant
-
 #include "llsd.h"
 #include "lldarray.h"
 #include "llnotifications.h"
@@ -42,19 +46,14 @@
 #include "llappviewer.h"		// for gLastVersionChannel
 #include "llcachename.h"
 #include "llcallingcard.h"		// for LLAvatarTracker
-#include "llfloateravatarpicker.h"	// for LLFloaterAvatarPicker
 #include "llfloatergroupinvite.h"
 #include "llfloatergroups.h"
 #include "llfloaterreg.h"
 #include "llfloaterpay.h"
 #include "llfloaterworldmap.h"
-#include "llgiveinventory.h"
 #include "llinventorymodel.h"	// for gInventory.findCategoryUUIDForType
-#include "llinventorypanel.h"
 #include "llimview.h"			// for gIMMgr
 #include "llmutelist.h"
-#include "llnotificationsutil.h"	// for LLNotificationsUtil
-#include "llpaneloutfitedit.h"
 #include "llrecentpeople.h"
 #include "llsidetray.h"
 #include "lltrans.h"
@@ -283,7 +282,7 @@ bool LLAvatarActions::isCalling(const LLUUID &id)
 //static
 bool LLAvatarActions::canCall()
 {
-		return LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+		return LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
 }
 
 // static
@@ -426,252 +425,6 @@ void LLAvatarActions::share(const LLUUID& id)
 	}
 }
 
-namespace action_give_inventory
-{
-	typedef std::set<LLUUID> uuid_set_t;
-
-	/**
-	 * Returns a pointer to 'Add More' inventory panel of Edit Outfit SP.
-	 */
-	static LLInventoryPanel* get_outfit_editor_inventory_panel()
-	{
-		LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast<LLPanelOutfitEdit*>(LLSideTray::getInstance()->getPanel("panel_outfit_edit"));
-		if (NULL == panel_outfit_edit) return NULL;
-
-		LLInventoryPanel* inventory_panel = panel_outfit_edit->findChild<LLInventoryPanel>("folder_view");
-		return inventory_panel;
-	}
-
-	/**
-	 * Checks My Inventory visibility.
-	 */
-	static bool is_give_inventory_acceptable()
-	{
-		LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
-		if (!active_panel)
-		{
-			active_panel = get_outfit_editor_inventory_panel();
-			if (!active_panel) return false;
-		}
-
-		// check selection in the panel
-		const uuid_set_t inventory_selected_uuids = active_panel->getRootFolder()->getSelectionList();
-		if (inventory_selected_uuids.empty()) return false; // nothing selected
-
-		bool acceptable = false;
-		uuid_set_t::const_iterator it = inventory_selected_uuids.begin();
-		const uuid_set_t::const_iterator it_end = inventory_selected_uuids.end();
-		for (; it != it_end; ++it)
-		{
-			LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
-			// any category can be offered.
-			if (inv_cat)
-			{
-				acceptable = true;
-				continue;
-			}
-
-			LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
-			// check if inventory item can be given
-			if (LLGiveInventory::isInventoryGiveAcceptable(inv_item))
-			{
-				acceptable = true;
-				continue;
-			}
-
-			// there are neither item nor category in inventory
-			acceptable = false;
-			break;
-		}
-		return acceptable;
-	}
-
-	static void build_residents_string(const std::vector<std::string>& avatar_names, std::string& residents_string)
-	{
-		llassert(avatar_names.size() > 0);
-
-		const std::string& separator = LLTrans::getString("words_separator");
-		for (std::vector<std::string>::const_iterator it = avatar_names.begin(); ; )
-		{
-			residents_string.append(*it);
-			if	(++it == avatar_names.end())
-			{
-				break;
-			}
-			residents_string.append(separator);
-		}
-	}
-
-	static void build_items_string(const uuid_set_t& inventory_selected_uuids , std::string& items_string)
-	{
-		llassert(inventory_selected_uuids.size() > 0);
-
-		const std::string& separator = LLTrans::getString("words_separator");
-		for (uuid_set_t::const_iterator it = inventory_selected_uuids.begin(); ; )
-		{
-			LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
-			if (NULL != inv_cat)
-			{
-				items_string = inv_cat->getName();
-				break;
-			}
-			LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
-			if (NULL != inv_item)
-			{
-				items_string.append(inv_item->getName());
-			}
-			if(++it == inventory_selected_uuids.end())
-			{
-				break;
-			}
-			items_string.append(separator);
-		}
-	}
-
-	struct LLShareInfo : public LLSingleton<LLShareInfo>
-	{
-		std::vector<std::string> mAvatarNames;
-		uuid_vec_t mAvatarUuids;
-	};
-
-	static void give_inventory_cb(const LLSD& notification, const LLSD& response)
-	{
-		S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-		// if Cancel pressed
-		if (option == 1)
-		{
-			return;
-		}
-
-		LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
-		if (!active_panel)
-		{
-			active_panel = get_outfit_editor_inventory_panel();
-			if (!active_panel) return;
-		}
-
-		const uuid_set_t inventory_selected_uuids = active_panel->getRootFolder()->getSelectionList();
-		if (inventory_selected_uuids.empty())
-		{
-			return;
-		}
-
-		S32 count = LLShareInfo::instance().mAvatarNames.size();
-		bool shared = false;
-
-		// iterate through avatars
-		for(S32 i = 0; i < count; ++i)
-		{
-			const LLUUID& avatar_uuid = LLShareInfo::instance().mAvatarUuids[i];
-
-			// We souldn't open IM session, just calculate session ID for logging purpose. See EXT-6710
-			const LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, avatar_uuid);
-
-			uuid_set_t::const_iterator it = inventory_selected_uuids.begin();
-			const uuid_set_t::const_iterator it_end = inventory_selected_uuids.end();
-
-			const std::string& separator = LLTrans::getString("words_separator");
-			std::string noncopy_item_names;
-			LLSD noncopy_items = LLSD::emptyArray();
-			// iterate through selected inventory objects
-			for (; it != it_end; ++it)
-			{
-				LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
-				if (inv_cat)
-				{
-					LLGiveInventory::doGiveInventoryCategory(avatar_uuid, inv_cat, session_id);
-					shared = true;
-					break;
-				}
-				LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
-				if (!inv_item->getPermissions().allowCopyBy(gAgentID))
-				{
-					if (!noncopy_item_names.empty())
-					{
-						noncopy_item_names.append(separator);
-					}
-					noncopy_item_names.append(inv_item->getName());
-					noncopy_items.append(*it);
-				}
-				else
-				{
-					LLGiveInventory::doGiveInventoryItem(avatar_uuid, inv_item, session_id);
-					shared = true;
-				}
-			}
-			if (noncopy_items.beginArray() != noncopy_items.endArray())
-			{
-				LLSD substitutions;
-				substitutions["ITEMS"] = noncopy_item_names;
-				LLSD payload;
-				payload["agent_id"] = avatar_uuid;
-				payload["items"] = noncopy_items;
-				LLNotificationsUtil::add("CannotCopyWarning", substitutions, payload,
-					&LLGiveInventory::handleCopyProtectedItem);
-				break;
-			}
-		}
-		if (shared)
-		{
-			LLFloaterReg::hideInstance("avatar_picker");
-			LLNotificationsUtil::add("ItemsShared");
-		}
-	}
-
-	/**
-	 * Performs "give inventory" operations for provided avatars.
-	 *
-	 * Sends one requests to give all selected inventory items for each passed avatar.
-	 * Avatars are represent by two vectors: names and UUIDs which must be sychronized with each other.
-	 *
-	 * @param avatar_names - avatar names request to be sent.
-	 * @param avatar_uuids - avatar names request to be sent.
-	 */
-	static void give_inventory(const std::vector<std::string>& avatar_names, const uuid_vec_t& avatar_uuids)
-	{
-		llassert(avatar_names.size() == avatar_uuids.size());
-
-
-		LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
-		if (!active_panel)
-		{
-			active_panel = get_outfit_editor_inventory_panel();
-			if (!active_panel) return;
-		}
-
-		const uuid_set_t inventory_selected_uuids = active_panel->getRootFolder()->getSelectionList();
-		if (inventory_selected_uuids.empty())
-		{
-			return;
-		}
-
-		std::string residents;
-		build_residents_string(avatar_names, residents);
-
-		std::string items;
-		build_items_string(inventory_selected_uuids, items);
-
-		LLSD substitutions;
-		substitutions["RESIDENTS"] = residents;
-		substitutions["ITEMS"] = items;
-		LLShareInfo::instance().mAvatarNames = avatar_names;
-		LLShareInfo::instance().mAvatarUuids = avatar_uuids;
-		LLNotificationsUtil::add("ShareItemsConfirmation", substitutions, LLSD(), &give_inventory_cb);
-	}
-}
-
-//static
-void LLAvatarActions::shareWithAvatars()
-{
-	using namespace action_give_inventory;
-
-	LLFloaterAvatarPicker* picker =
-		LLFloaterAvatarPicker::show(boost::bind(give_inventory, _1, _2), TRUE, FALSE);
-	picker->setOkBtnEnableCb(boost::bind(is_give_inventory_acceptable));
-	picker->openFriendsTab();
-	LLNotificationsUtil::add("ShareNotification");
-}
-
 // static
 void LLAvatarActions::toggleBlock(const LLUUID& id)
 {
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index cd8ac3b653691a408311f09adc65c001b679885e..9d8b4b4e238dd315670b8f6a321f07f3d2e4dd4c 100644
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -2,25 +2,31 @@
  * @file llavataractions.h
  * @brief Friend-related actions (add, remove, offer teleport, etc)
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -107,11 +113,6 @@ class LLAvatarActions
 	 */
 	static void share(const LLUUID& id);
 
-	/**
-	 * Share items with the picked avatars.
-	 */
-	static void shareWithAvatars();
-
 	/**
 	 * Block/unblock the avatar.
 	 */
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 76ad9b4afb6ab9284c79cad76f6c475957417efd..407c5b6153eba2bea7ab4991d27a457b608c5ba3 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -2,45 +2,42 @@
  * @file llavatarlist.h
  * @brief Generic avatar list
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 
 #include "llavatarlist.h"
-
-// common
-#include "lltrans.h"
-#include "llcommonutils.h"
-
-// llui
-#include "lltextutil.h"
+#include "llagentdata.h" // for comparator
 
 // newview
-#include "llagentdata.h" // for comparator
-#include "llavatariconctrl.h"
 #include "llcallingcard.h" // for LLAvatarTracker
 #include "llcachename.h"
-#include "lllistcontextmenu.h"
 #include "llrecentpeople.h"
 #include "lluuid.h"
 #include "llvoiceclient.h"
@@ -111,7 +108,7 @@ LLAvatarList::Params::Params()
 }
 
 LLAvatarList::LLAvatarList(const Params& p)
-:	LLFlatListViewEx(p)
+:	LLFlatListView(p)
 , mIgnoreOnlineStatus(p.ignore_online_status)
 , mShowLastInteractionTime(p.show_last_interaction_time)
 , mContextMenu(NULL)
@@ -152,7 +149,7 @@ void LLAvatarList::draw()
 	// *NOTE dzaporozhan
 	// Call refresh() after draw() to avoid flickering of avatar list items.
 
-	LLFlatListViewEx::draw();
+	LLFlatListView::draw();
 
 	if (mDirty)
 		refresh();
@@ -169,20 +166,14 @@ void LLAvatarList::clear()
 {
 	getIDs().clear();
 	setDirty(true);
-	LLFlatListViewEx::clear();
+	LLFlatListView::clear();
 }
 
 void LLAvatarList::setNameFilter(const std::string& filter)
 {
-	std::string filter_upper = filter;
-	LLStringUtil::toUpper(filter_upper);
-	if (mNameFilter != filter_upper)
+	if (mNameFilter != filter)
 	{
-		mNameFilter = filter_upper;
-
-		// update message for empty state here instead of refresh() to avoid blinking when switch
-		// between tabs.
-		updateNoItemsMessage(filter);
+		mNameFilter = filter;
 		setDirty();
 	}
 }
@@ -202,18 +193,6 @@ void LLAvatarList::setDirty(bool val /*= true*/, bool force_refresh /*= false*/)
 	}
 }
 
-void LLAvatarList::addAvalineItem(const LLUUID& item_id, const LLUUID& session_id, const std::string& item_name)
-{
-	LL_DEBUGS("Avaline") << "Adding avaline item into the list: " << item_name << "|" << item_id << ", session: " << session_id << LL_ENDL;
-	LLAvalineListItem* item = new LLAvalineListItem(/*hide_number=*/false);
-	item->setAvatarId(item_id, session_id, true, false);
-	item->setName(item_name);
-
-	addItem(item, item_id);
-	mIDs.push_back(item_id);
-	sort();
-}
-
 //////////////////////////////////////////////////////////////////////////
 // PROTECTED SECTION
 //////////////////////////////////////////////////////////////////////////
@@ -313,7 +292,9 @@ void LLAvatarList::refresh()
 		}
 
 		// Send refresh_complete signal.
-		mRefreshCompleteSignal(this, LLSD((S32)size(false)));
+		std::vector<LLSD> cur_values;
+		getValues(cur_values);
+		mRefreshCompleteSignal(this, LLSD((S32)cur_values.size()));
 	}
 
 	// Commit if we've added/removed items.
@@ -362,7 +343,7 @@ S32 LLAvatarList::notifyParent(const LLSD& info)
 		sort();
 		return 1;
 	}
-	return LLFlatListViewEx::notifyParent(info);
+	return LLFlatListView::notifyParent(info);
 }
 
 void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos)
@@ -396,21 +377,13 @@ BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	return handled;
 }
 
-void LLAvatarList::setVisible(BOOL visible)
-{
-	if ( visible == FALSE && mContextMenu )
-	{
-		mContextMenu->hide();
-	}
-	LLFlatListViewEx::setVisible(visible);
-}
-
 void LLAvatarList::computeDifference(
 	const uuid_vec_t& vnew_unsorted,
 	uuid_vec_t& vadded,
 	uuid_vec_t& vremoved)
 {
 	uuid_vec_t vcur;
+	uuid_vec_t vnew = vnew_unsorted;
 
 	// Convert LLSDs to LLUUIDs.
 	{
@@ -421,7 +394,21 @@ void LLAvatarList::computeDifference(
 			vcur.push_back(vcur_values[i].asUUID());
 	}
 
-	LLCommonUtils::computeDifference(vnew_unsorted, vcur, vadded, vremoved);
+	std::sort(vcur.begin(), vcur.end());
+	std::sort(vnew.begin(), vnew.end());
+
+	uuid_vec_t::iterator it;
+	size_t maxsize = llmax(vcur.size(), vnew.size());
+	vadded.resize(maxsize);
+	vremoved.resize(maxsize);
+
+	// what to remove
+	it = set_difference(vcur.begin(), vcur.end(), vnew.begin(), vnew.end(), vremoved.begin());
+	vremoved.erase(it, vremoved.end());
+
+	// what to add
+	it = set_difference(vnew.begin(), vnew.end(), vcur.begin(), vcur.end(), vadded.begin());
+	vadded.erase(it, vadded.end());
 }
 
 // Refresh shown time of our last interaction with all listed avatars.
@@ -484,61 +471,3 @@ bool LLAvatarItemAgentOnTopComparator::doCompare(const LLAvatarListItem* avatar_
 	}
 	return LLAvatarItemNameComparator::doCompare(avatar_item1,avatar_item2);
 }
-
-/************************************************************************/
-/*             class LLAvalineListItem                                  */
-/************************************************************************/
-LLAvalineListItem::LLAvalineListItem(bool hide_number/* = true*/) : LLAvatarListItem(false)
-, mIsHideNumber(hide_number)
-{
-	// should not use buildPanel from the base class to ensure LLAvalineListItem::postBuild is called.
-	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml");
-}
-
-BOOL LLAvalineListItem::postBuild()
-{
-	BOOL rv = LLAvatarListItem::postBuild();
-
-	if (rv)
-	{
-		setOnline(true);
-		showLastInteractionTime(false);
-		setShowProfileBtn(false);
-		setShowInfoBtn(false);
-		mAvatarIcon->setValue("Avaline_Icon");
-		mAvatarIcon->setToolTip(std::string(""));
-	}
-	return rv;
-}
-
-// to work correctly this method should be called AFTER setAvatarId for avaline callers with hidden phone number
-void LLAvalineListItem::setName(const std::string& name)
-{
-	if (mIsHideNumber)
-	{
-		static U32 order = 0;
-		typedef std::map<LLUUID, U32> avaline_callers_nums_t;
-		static avaline_callers_nums_t mAvalineCallersNums;
-
-		llassert(getAvatarId() != LLUUID::null);
-
-		const LLUUID &uuid = getAvatarId();
-
-		if (mAvalineCallersNums.find(uuid) == mAvalineCallersNums.end())
-		{
-			mAvalineCallersNums[uuid] = ++order;
-			LL_DEBUGS("Avaline") << "Set name for new avaline caller: " << uuid << ", order: " << order << LL_ENDL;
-		}
-		LLStringUtil::format_map_t args;
-		args["[ORDER]"] = llformat("%u", mAvalineCallersNums[uuid]);
-		std::string hidden_name = LLTrans::getString("AvalineCaller", args);
-
-		LL_DEBUGS("Avaline") << "Avaline caller: " << uuid << ", name: " << hidden_name << LL_ENDL;
-		LLAvatarListItem::setName(hidden_name);
-	}
-	else
-	{
-		const std::string& formatted_phone = LLTextUtil::formatPhoneNumber(name);
-		LLAvatarListItem::setName(formatted_phone);
-	}
-}
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 84800842e94503687c3b9d09040e19a052ecf3d9..0203617867ffeccebbfbbea026ecbbc071f34ea7 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -2,25 +2,31 @@
  * @file llavatarlist.h
  * @brief Generic avatar list
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,7 +38,6 @@
 #include "llavatarlistitem.h"
 
 class LLTimer;
-class LLListContextMenu;
 
 /**
  * Generic list of avatars.
@@ -44,11 +49,11 @@ class LLListContextMenu;
  * @see setDirty()
  * @see setNameFilter()
  */
-class LLAvatarList : public LLFlatListViewEx
+class LLAvatarList : public LLFlatListView
 {
 	LOG_CLASS(LLAvatarList);
 public:
-	struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
+	struct Params : public LLInitParam::Block<Params, LLFlatListView::Params> 
 	{
 		Optional<bool>	ignore_online_status, // show all items as online
 						show_last_interaction_time, // show most recent interaction time. *HACK: move this to a derived class
@@ -65,14 +70,12 @@ class LLAvatarList : public LLFlatListViewEx
 
 	virtual void clear();
 
-	virtual void setVisible(BOOL visible);
-
 	void setNameFilter(const std::string& filter);
 	void setDirty(bool val = true, bool force_refresh = false);
 	uuid_vec_t& getIDs() 							{ return mIDs; }
 	bool contains(const LLUUID& id);
 
-	void setContextMenu(LLListContextMenu* menu) { mContextMenu = menu; }
+	void setContextMenu(LLAvatarListItem::ContextMenu* menu) { mContextMenu = menu; }
 	void setSessionID(const LLUUID& session_id) { mSessionID = session_id; }
 	const LLUUID& getSessionID() { return mSessionID; }
 
@@ -93,8 +96,6 @@ class LLAvatarList : public LLFlatListViewEx
 
 	virtual S32 notifyParent(const LLSD& info);
 
-	void addAvalineItem(const LLUUID& item_id, const LLUUID& session_id, const std::string& item_name);
-
 protected:
 	void refresh();
 
@@ -122,7 +123,7 @@ class LLAvatarList : public LLFlatListViewEx
 	uuid_vec_t				mIDs;
 	LLUUID					mSessionID;
 
-	LLListContextMenu*	mContextMenu;
+	LLAvatarListItem::ContextMenu* mContextMenu;
 
 	commit_signal_t mRefreshCompleteSignal;
 	mouse_signal_t mItemDoubleClickSignal;
@@ -174,27 +175,4 @@ class LLAvatarItemAgentOnTopComparator : public LLAvatarItemNameComparator
 	virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
 };
 
-/**
- * Represents Avaline caller in Avatar list in Voice Control Panel and group chats.
- */
-class LLAvalineListItem : public LLAvatarListItem
-{
-public:
-
-	/**
-	 * Constructor
-	 *
-	 * @param hide_number - flag indicating if number should be hidden.
-	 *		In this case It will be shown as "Avaline Caller 1", "Avaline Caller 1", etc.
-	 */
-	LLAvalineListItem(bool hide_number = true);
-
-	/*virtual*/ BOOL postBuild();
-
-	/*virtual*/ void setName(const std::string& name);
-
-private:
-	bool mIsHideNumber;
-};
-
 #endif // LL_LLAVATARLIST_H
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 706f20404d3ac8a9d58ff3cb0c93e05fab31eee2..44f88cce297802607a590398f419ac729572ada4 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -1,26 +1,32 @@
 /** 
  * @file llavatarlistitem.cpp
- * @brief avatar list item source file
+ * @avatar list item source file
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -30,13 +36,12 @@
 #include "llavataractions.h"
 #include "llavatarlistitem.h"
 
-#include "llbutton.h"
 #include "llfloaterreg.h"
-#include "lltextutil.h"
-
 #include "llagent.h"
-#include "llavatariconctrl.h"
 #include "lloutputmonitorctrl.h"
+#include "llavatariconctrl.h"
+#include "lltextutil.h"
+#include "llbutton.h"
 
 bool LLAvatarListItem::sStaticInitialized = false;
 S32 LLAvatarListItem::sLeftPadding = 0;
@@ -207,25 +212,21 @@ void LLAvatarListItem::setState(EItemState item_style)
 	mAvatarIcon->setColor(item_icon_color_map[item_style]);
 }
 
-void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes/* = false*/, bool is_resident/* = true*/)
+void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes)
 {
 	if (mAvatarId.notNull())
 		LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this);
 
 	mAvatarId = id;
+	mAvatarIcon->setValue(id);
 	mSpeakingIndicator->setSpeakerId(id, session_id);
 
 	// We'll be notified on avatar online status changes
 	if (!ignore_status_changes && mAvatarId.notNull())
 		LLAvatarTracker::instance().addParticularFriendObserver(mAvatarId, this);
 
-	if (is_resident)
-	{
-		mAvatarIcon->setValue(id);
-
-		// Set avatar name.
-		gCacheName->get(id, FALSE, boost::bind(&LLAvatarListItem::onNameCache, this, _2, _3));
-	}
+	// Set avatar name.
+	gCacheName->get(id, FALSE, boost::bind(&LLAvatarListItem::onNameCache, this, _2, _3));
 }
 
 void LLAvatarListItem::showLastInteractionTime(bool show)
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index e252e69ea9b614852d87c55aed039281808e6d2d..2db6484a30b74042935b27c8f41145f37a632fcb 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -1,26 +1,32 @@
 /** 
  * @file llavatarlistitem.h
- * @brief avatar list item header file
+ * @avatar list item header file
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -61,6 +67,12 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 		IS_OFFLINE,
 	} EItemState;
 
+	class ContextMenu
+	{
+	public:
+		virtual void show(LLView* spawning_view, const uuid_vec_t& selected_uuids, S32 x, S32 y) = 0;
+	};
+
 	/**
 	 * Creates an instance of LLAvatarListItem.
 	 *
@@ -88,7 +100,7 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 	void setName(const std::string& name);
 	void setHighlight(const std::string& highlight);
 	void setState(EItemState item_style);
-	void setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes = false, bool is_resident = true);
+	void setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes = false);
 	void setLastInteractionTime(U32 secs_since);
 	//Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly
 	void setShowProfileBtn(bool show);
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index c4177a420bd549c9ec95ef5b8c3c2321de6f5f0b..41bee540fc62d56a72eb306cc5c1cc34ab8f27a5 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -2,25 +2,31 @@
  * @file llbottomtray.cpp
  * @brief LLBottomTray class implementation
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -29,32 +35,20 @@
 #define LLBOTTOMTRAY_CPP
 #include "llbottomtray.h"
 
-// library includes
-#include "llfloaterreg.h"
-#include "llflyoutbutton.h"
-#include "lllayoutstack.h"
-#include "llnotifications.h"
-#include "llnotificationsutil.h"
-#include "lltexteditor.h"
-
-// newview includes
 #include "llagentcamera.h"
 #include "llchiclet.h"
-#include "llfloatercamera.h"
+#include "llfloaterreg.h"
+#include "llflyoutbutton.h"
 #include "llimfloater.h" // for LLIMFloater
+#include "lllayoutstack.h"
 #include "llnearbychatbar.h"
+#include "llnotificationsutil.h"
 #include "llspeakbutton.h"
 #include "llsplitbutton.h"
 #include "llsyswellwindow.h"
-#include "lltoolmgr.h"
-#include "llviewerparcelmgr.h"
-
-static void update_build_button_enable_state()
-{
-	bool can_edit = LLToolMgr::getInstance()->canEdit();
-
-	LLBottomTray::getInstance()->childSetEnabled("build_btn", can_edit);
-}
+#include "llfloatercamera.h"
+#include "lltexteditor.h"
+#include "llnotifications.h"
 
 // Build time optimization, generate extern template once in .cpp file
 template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance();
@@ -67,7 +61,7 @@ namespace
 	const std::string& PANEL_CAMERA_NAME	= "cam_panel";
 	const std::string& PANEL_GESTURE_NAME	= "gesture_panel";
 
-	S32 get_panel_min_width(LLLayoutStack* stack, LLView* panel)
+	S32 get_panel_min_width(LLLayoutStack* stack, LLPanel* panel)
 	{
 		S32 minimal_width = 0;
 		llassert(stack);
@@ -150,6 +144,10 @@ LLBottomTray::LLBottomTray(const LLSD&)
 ,	mMovementButton(NULL)
 ,	mResizeState(RS_NORESIZE)
 ,	mBottomTrayContextMenu(NULL)
+,	mMovementPanel(NULL)
+,	mCamPanel(NULL)
+,	mSnapshotPanel(NULL)
+,	mGesturePanel(NULL)
 ,	mCamButton(NULL)
 ,	mBottomTrayLite(NULL)
 ,	mIsInLiteMode(false)
@@ -162,7 +160,7 @@ LLBottomTray::LLBottomTray(const LLSD&)
 
 	LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml");
 
-	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
+	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraPresets, _2));
 
 	//this is to fix a crash that occurs because LLBottomTray is a singleton
 	//and thus is deleted at the end of the viewers lifetime, but to be cleanly
@@ -185,21 +183,24 @@ LLBottomTray::~LLBottomTray()
 	{
 		LLIMMgr::getInstance()->removeSessionObserver(this);
 	}
+}
 
-	if (mNearbyChatBar)
+void LLBottomTray::onChicletClick(LLUICtrl* ctrl)
+{
+	LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(ctrl);
+	if (chiclet)
 	{
-		// store custom width of chatbar panel.
-		S32 custom_width = mNearbyChatBar->getRect().getWidth();
-		gSavedSettings.setS32("ChatBarCustomWidth", custom_width);
-	}
+		// Until you can type into an IM Window and have a conversation,
+		// still show the old communicate window
+		//LLFloaterReg::showInstance("communicate", chiclet->getSessionId());
+
+		// Show after comm window so it is frontmost (and hence will not
+		// auto-hide)
 
-	// emulate previous floater behavior to be hidden on startup.
-	// override effect of save_visibility=true.
-	// this attribute is necessary to button.initial_callback=Button.SetFloaterToggle works properly:
-	//		i.g when floater changes its visibility - button changes its toggle state.
-	getChild<LLUICtrl>("build_btn")->setControlValue(false);
-	getChild<LLUICtrl>("search_btn")->setControlValue(false);
-	getChild<LLUICtrl>("world_map_btn")->setControlValue(false);
+// this logic has been moved to LLIMChiclet::handleMouseDown
+//		LLIMFloater::show(chiclet->getSessionId());
+//		chiclet->setCounter(0);
+	}
 }
 
 // *TODO Vadim: why void* ?
@@ -318,7 +319,7 @@ void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, b
 	// skipped to avoid button blinking
 	if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL)
 	{
-		mSpeakBtn->setFlyoutBtnEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
+		mSpeakBtn->setFlyoutBtnEnabled(LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
 	}
 }
 
@@ -378,20 +379,6 @@ S32 LLBottomTray::notifyParent(const LLSD& info)
 		showWellButton("im_well" == chiclet_name ? RS_IM_WELL : RS_NOTIFICATION_WELL, should_be_visible);
 		return 1;
 	}
-
-	if (info.has("action") && info["action"] == "resize")
-	{
-		const std::string& name = info["view_name"];
-
-		// expected only resize of nearby chatbar
-		if (mNearbyChatBar->getName() != name) return LLPanel::notifyParent(info);
-
-		const S32 new_width = info["new_width"];
-
-		processChatbarCustomization(new_width);
-
-		return 2;
-	}
 	return LLPanel::notifyParent(info);
 }
 
@@ -419,12 +406,22 @@ void LLBottomTray::updateContextMenu(S32 x, S32 y, MASK mask)
 
 	bool in_edit_box = edit_box->pointInView(local_x, local_y);
 
-	mBottomTrayContextMenu->setItemVisible("Separator", in_edit_box);
-	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Cut", in_edit_box);
-	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Copy", in_edit_box);
-	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Paste", in_edit_box);
-	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Delete", in_edit_box);
-	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Select_All", in_edit_box);
+	LLMenuItemGL* menu_item;
+	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Cut");
+	if(menu_item)
+		menu_item->setVisible(in_edit_box);
+	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Copy");
+	if(menu_item)
+		menu_item->setVisible(in_edit_box);
+	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Paste");
+	if(menu_item)
+		menu_item->setVisible(in_edit_box);
+	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Delete");
+	if(menu_item)
+		menu_item->setVisible(in_edit_box);
+	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Select_All");
+	if(menu_item)
+		menu_item->setVisible(in_edit_box);
 }
 
 void LLBottomTray::showGestureButton(BOOL visible)
@@ -471,8 +468,12 @@ BOOL LLBottomTray::postBuild()
 
 	mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar");
 	mToolbarStack = getChild<LLLayoutStack>("toolbar_stack");
-	mMovementButton = getChild<LLButton>("movement_btn");
-	mCamButton = getChild<LLButton>("camera_btn");
+	mMovementPanel = getChild<LLPanel>("movement_panel");
+	mMovementButton = mMovementPanel->getChild<LLButton>("movement_btn");
+	mGesturePanel = getChild<LLPanel>("gesture_panel");
+	mCamPanel = getChild<LLPanel>("cam_panel");
+	mCamButton = mCamPanel->getChild<LLButton>("camera_btn");
+	mSnapshotPanel = getChild<LLPanel>("snapshot_panel");
 	setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4));
 
 	mSpeakPanel = getChild<LLPanel>("speak_panel");
@@ -488,24 +489,24 @@ BOOL LLBottomTray::postBuild()
 	mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") );
 
 	// Registering Chat Bar to receive Voice client status change notifications.
-	LLVoiceClient::getInstance()->addObserver(this);
+	gVoiceClient->addObserver(this);
+
+	mObjectDefaultWidthMap[RS_BUTTON_GESTURES] = mGesturePanel->getRect().getWidth();
+	mObjectDefaultWidthMap[RS_BUTTON_MOVEMENT] = mMovementPanel->getRect().getWidth();
+	mObjectDefaultWidthMap[RS_BUTTON_CAMERA]   = mCamPanel->getRect().getWidth();
+	mObjectDefaultWidthMap[RS_BUTTON_SPEAK]	   = mSpeakPanel->getRect().getWidth();
 
 	mNearbyChatBar->getChatBox()->setContextMenu(NULL);
 
 	mChicletPanel = getChild<LLChicletPanel>("chiclet_list");
+	mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1));
 
-	initResizeStateContainers();
-
-	setButtonsControlsAndListeners();
-
-	initButtonsVisibility();
+	initStateProcessedObjectMap();
 
 	// update wells visibility:
 	showWellButton(RS_IM_WELL, !LLIMWellWindow::getInstance()->isWindowEmpty());
 	showWellButton(RS_NOTIFICATION_WELL, !LLNotificationWellWindow::getInstance()->isWindowEmpty());
 
-	LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&update_build_button_enable_state));
-
 	return TRUE;
 }
 
@@ -667,24 +668,6 @@ void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent)
 
 	if (mNearbyChatBar)			log(mNearbyChatBar, "after");
 	if (mChicletPanel)			log(mChicletPanel, "after");
-
-
-	// Restore width of the chatbar on first reshape.
-	// we can not to do this from postBuild because reshape is called from parent view on startup
-	// creation after it and reset width according to resize logic.
-	static bool needs_restore_custom_state = true;
-	if (mNearbyChatBar && needs_restore_custom_state)
-	{
-		// restore custom width of chatbar panel.
-		S32 new_width = gSavedSettings.getS32("ChatBarCustomWidth");
-		if (new_width > 0)
-		{
-			processChatbarCustomization(new_width);
-			mNearbyChatBar->reshape(new_width, mNearbyChatBar->getRect().getHeight());
-		}
-		needs_restore_custom_state = false;
-	}
-
 }
 
 S32 LLBottomTray::processWidthDecreased(S32 delta_width)
@@ -747,9 +730,27 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
 	S32 buttons_freed_width = 0;
 	if (still_should_be_processed)
 	{
-		processShrinkButtons(delta_width, buttons_freed_width);
+		processShrinkButtons(&delta_width, &buttons_freed_width);
 
-		processHideButtons(delta_width, buttons_freed_width);
+		if (delta_width < 0)
+		{
+			processHideButton(RS_BUTTON_SNAPSHOT, &delta_width, &buttons_freed_width);
+		}
+
+		if (delta_width < 0)
+		{
+			processHideButton(RS_BUTTON_CAMERA, &delta_width, &buttons_freed_width);
+		}
+
+		if (delta_width < 0)
+		{
+			processHideButton(RS_BUTTON_MOVEMENT, &delta_width, &buttons_freed_width);
+		}
+
+		if (delta_width < 0)
+		{
+			processHideButton(RS_BUTTON_GESTURES, &delta_width, &buttons_freed_width);
+		}
 
 		if (delta_width < 0)
 		{
@@ -794,10 +795,27 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
 		<< llendl;
 
 	S32 available_width = total_available_width;
+	if (available_width > 0)
+	{
+		processShowButton(RS_BUTTON_GESTURES, &available_width);
+	}
 
-	processShowButtons(available_width);
+	if (available_width > 0)
+	{
+		processShowButton(RS_BUTTON_MOVEMENT, &available_width);
+	}
 
-	processExtendButtons(available_width);
+	if (available_width > 0)
+	{
+		processShowButton(RS_BUTTON_CAMERA, &available_width);
+	}
+
+	if (available_width > 0)
+	{
+		processShowButton(RS_BUTTON_SNAPSHOT, &available_width);
+	}
+
+	processExtendButtons(&available_width);
 
 	// if we have to show/extend some buttons but resized delta width is not enough...
 	S32 processed_width = total_available_width - available_width;
@@ -854,23 +872,7 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
 	}
 }
 
-void LLBottomTray::processShowButtons(S32& available_width)
-{
-	// process buttons from left to right
-	resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin();
-	const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end();
-
-	for (; it != it_end; ++it)
-	{
-		// is there available space?
-		if (available_width <= 0) break;
-
-		// try to show next button
-		processShowButton(*it, available_width);
-	}
-}
-
-bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& available_width)
+bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width)
 {
 	lldebugs << "Trying to show object type: " << shown_object_type << llendl;
 	llassert(mStateProcessedObjectMap[shown_object_type] != NULL);
@@ -886,15 +888,15 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& availa
 	{
 		//validate if we have enough room to show this button
 		const S32 required_width = panel->getRect().getWidth();
-		can_be_shown = available_width >= required_width;
+		can_be_shown = *available_width >= required_width;
 		if (can_be_shown)
 		{
-			available_width -= required_width;
+			*available_width -= required_width;
 
 			setTrayButtonVisible(shown_object_type, true);
 
 			lldebugs << "processed object type: " << shown_object_type
-				<< ", rest available width: " << available_width
+				<< ", rest available width: " << *available_width
 				<< llendl;
 			mResizeState &= ~shown_object_type;
 		}
@@ -902,23 +904,7 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& availa
 	return can_be_shown;
 }
 
-void LLBottomTray::processHideButtons(S32& required_width, S32& buttons_freed_width)
-{
-	// process buttons from right to left
-	resize_state_vec_t::const_reverse_iterator it = mButtonsProcessOrder.rbegin();
-	const resize_state_vec_t::const_reverse_iterator it_end = mButtonsProcessOrder.rend();
-
-	for (; it != it_end; ++it)
-	{
-		// is it still necessary to hide a button?
-		if (required_width >= 0) break;
-
-		// try to hide next button
-		processHideButton(*it, required_width, buttons_freed_width);
-	}
-}
-
-void LLBottomTray::processHideButton(EResizeState processed_object_type, S32& required_width, S32& buttons_freed_width)
+void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width)
 {
 	lldebugs << "Trying to hide object type: " << processed_object_type << llendl;
 	llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
@@ -932,11 +918,11 @@ void LLBottomTray::processHideButton(EResizeState processed_object_type, S32& re
 
 	if (panel->getVisible())
 	{
-		required_width += panel->getRect().getWidth();
+		*required_width += panel->getRect().getWidth();
 
-		if (required_width > 0)
+		if (*required_width > 0)
 		{
-			buttons_freed_width += required_width;
+			*buttons_freed_width += *required_width;
 		}
 
 		setTrayButtonVisible(processed_object_type, false);
@@ -944,29 +930,24 @@ void LLBottomTray::processHideButton(EResizeState processed_object_type, S32& re
 		mResizeState |= processed_object_type;
 
 		lldebugs << "processing object type: " << processed_object_type
-			<< ", buttons_freed_width: " << buttons_freed_width
+			<< ", buttons_freed_width: " << *buttons_freed_width
 			<< llendl;
 	}
 }
 
-void LLBottomTray::processShrinkButtons(S32& required_width, S32& buttons_freed_width)
+void LLBottomTray::processShrinkButtons(S32* required_width, S32* buttons_freed_width)
 {
-	// process buttons from right to left
-	resize_state_vec_t::const_reverse_iterator it = mButtonsProcessOrder.rbegin();
-	const resize_state_vec_t::const_reverse_iterator it_end = mButtonsProcessOrder.rend();
+	processShrinkButton(RS_BUTTON_CAMERA, required_width);
 
-	// iterate through buttons in the mButtonsProcessOrder first
-	for (; it != it_end; ++it)
+	if (*required_width < 0)
 	{
-		// is it still necessary to hide a button?
-		if (required_width >= 0) break;
-
-		// try to shrink next button
-		processShrinkButton(*it, required_width);
+		processShrinkButton(RS_BUTTON_MOVEMENT, required_width);
 	}
-
-	// then shrink Speak button
-	if (required_width < 0)
+	if (*required_width < 0)
+	{
+		processShrinkButton(RS_BUTTON_GESTURES, required_width);
+	}
+	if (*required_width < 0)
 	{
 
 		S32 panel_min_width = 0;
@@ -986,23 +967,23 @@ void LLBottomTray::processShrinkButtons(S32& required_width, S32& buttons_freed_
 				mSpeakBtn->setLabelVisible(false);
 				mSpeakPanel->reshape(panel_width - possible_shrink_width, mSpeakPanel->getRect().getHeight());
 
-				required_width += possible_shrink_width;
+				*required_width += possible_shrink_width;
 
-				if (required_width > 0)
+				if (*required_width > 0)
 				{
-					buttons_freed_width += required_width;
+					*buttons_freed_width += *required_width;
 				}
 
-				lldebugs << "Shrunk Speak button panel: " << panel_name
+				lldebugs << "Shrunk panel: " << panel_name
 					<< ", shrunk width: " << possible_shrink_width
-					<< ", rest width to process: " << required_width
+					<< ", rest width to process: " << *required_width
 					<< llendl;
 			}
 		}
 	}
 }
 
-void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32& required_width)
+void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32* required_width)
 {
 	llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
 	LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
@@ -1030,68 +1011,63 @@ void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32&
 			// let calculate real width to shrink
 
 			// 1. apply all possible width
-			required_width += possible_shrink_width;
+			*required_width += possible_shrink_width;
 
 			// 2. it it is too much... 
-			if (required_width > 0)
+			if (*required_width > 0)
 			{
 				// reduce applied shrunk width to the excessive value.
-				possible_shrink_width -= required_width;
-				required_width = 0;
+				possible_shrink_width -= *required_width;
+				*required_width = 0;
 			}
 			panel->reshape(panel_width - possible_shrink_width, panel->getRect().getHeight());
 
 			lldebugs << "Shrunk panel: " << panel_name
 				<< ", shrunk width: " << possible_shrink_width
-				<< ", rest width to process: " << required_width
+				<< ", rest width to process: " << *required_width
 				<< llendl;
 		}
 	}
 }
 
 
-void LLBottomTray::processExtendButtons(S32& available_width)
+void LLBottomTray::processExtendButtons(S32* available_width)
 {
-	// do not allow extending any buttons if we have some buttons hidden via resize
+	// do not allow extending any buttons if we have some buttons hidden
 	if (mResizeState & RS_BUTTONS_CAN_BE_HIDDEN) return;
 
-	// process buttons from left to right
-	resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin();
-	const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end();
+	processExtendButton(RS_BUTTON_GESTURES, available_width);
 
-	// iterate through buttons in the mButtonsProcessOrder first
-	for (; it != it_end; ++it)
+	if (*available_width > 0)
 	{
-		// is there available space?
-		if (available_width <= 0) break;
-
-		// try to extend next button
-		processExtendButton(*it, available_width);
+		processExtendButton(RS_BUTTON_MOVEMENT, available_width);
 	}
-
-	// then try to extend Speak button
-	if (available_width > 0)
+	if (*available_width > 0)
+	{
+		processExtendButton(RS_BUTTON_CAMERA, available_width);
+	}
+	if (*available_width > 0)
 	{
 		S32 panel_max_width = mObjectDefaultWidthMap[RS_BUTTON_SPEAK];
 		S32 panel_width = mSpeakPanel->getRect().getWidth();
 		S32 possible_extend_width = panel_max_width - panel_width;
-		if (possible_extend_width >= 0 && possible_extend_width <= available_width)  // HACK: this button doesn't change size so possible_extend_width will be 0
+		if (possible_extend_width >= 0 && possible_extend_width <= *available_width)  // HACK: this button doesn't change size so possible_extend_width will be 0
 		{
 			mSpeakBtn->setLabelVisible(true);
 			mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight());
 			log(mSpeakBtn, "speak button is extended");
 
-			available_width -= possible_extend_width;
+			*available_width -= possible_extend_width;
 
-			lldebugs << "Extending Speak button panel: " << mSpeakPanel->getName()
+			lldebugs << "Extending panel: " << mSpeakPanel->getName()
 				<< ", extended width: " << possible_extend_width
-				<< ", rest width to process: " << available_width
+				<< ", rest width to process: " << *available_width
 				<< llendl;
 		}
 	}
 }
 
-void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32& available_width)
+void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32* available_width)
 {
 	llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
 	LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
@@ -1112,137 +1088,64 @@ void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32&
 		// let calculate real width to extend
 
 		// 1. apply all possible width
-		available_width -= possible_extend_width;
+		*available_width -= possible_extend_width;
 
 		// 2. it it is too much... 
-		if (available_width < 0)
+		if (*available_width < 0)
 		{
 			// reduce applied extended width to the excessive value.
-			possible_extend_width += available_width;
-			available_width = 0;
+			possible_extend_width += *available_width;
+			*available_width = 0;
 		}
 		panel->reshape(panel_width + possible_extend_width, panel->getRect().getHeight());
 
 		lldebugs << "Extending panel: " << panel->getName()
 			<< ", extended width: " << possible_extend_width
-			<< ", rest width to process: " << available_width
+			<< ", rest width to process: " << *available_width
 			<< llendl;
 	}
 }
 
 bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const
 {
-	// 0. Check if passed button was previously hidden on resize
 	bool can_be_shown = mResizeState & processed_object_type;
 	if (can_be_shown)
 	{
-		// Yes, it was. Lets now check that all buttons before it (that can be hidden on resize)
-		// are already shown
+		static MASK MOVEMENT_PREVIOUS_BUTTONS_MASK = RS_BUTTON_GESTURES;
+		static MASK CAMERA_PREVIOUS_BUTTONS_MASK = RS_BUTTON_GESTURES | RS_BUTTON_MOVEMENT;
+		static MASK SNAPSHOT_PREVIOUS_BUTTONS_MASK = RS_BUTTON_GESTURES | RS_BUTTON_MOVEMENT | RS_BUTTON_CAMERA;
 
-		// process buttons in direct order (from left to right)
-		resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin();
-		const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end();
-
-		// 1. Find and accumulate all buttons types before one passed into the method.
-		MASK buttons_before_mask = RS_NORESIZE;
-		for (; it != it_end; ++it)
+		switch(processed_object_type)
 		{
-			const EResizeState button_type = *it;
-			if (button_type == processed_object_type) break;
-
-			buttons_before_mask |= button_type;
+		case RS_BUTTON_GESTURES: // Gestures should be shown first
+			break;
+		case RS_BUTTON_MOVEMENT: // Move only if gesture is shown
+			can_be_shown = !(MOVEMENT_PREVIOUS_BUTTONS_MASK & mResizeState);
+			break;
+		case RS_BUTTON_CAMERA:
+			can_be_shown = !(CAMERA_PREVIOUS_BUTTONS_MASK & mResizeState);
+			break;
+		case RS_BUTTON_SNAPSHOT:
+			can_be_shown = !(SNAPSHOT_PREVIOUS_BUTTONS_MASK & mResizeState);
+			break;
+		default: // nothing to do here
+			break;
 		}
-
-		// 2. Check if some previous buttons are still hidden on resize
-		can_be_shown = !(buttons_before_mask & mResizeState);
 	}
 	return can_be_shown;
 }
 
-void LLBottomTray::initResizeStateContainers()
-{
-	// init map with objects should be processed for each type
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, getChild<LLPanel>("gesture_panel")));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, getChild<LLPanel>("movement_panel")));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, getChild<LLPanel>("cam_panel")));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, getChild<LLPanel>("snapshot_panel")));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_BUILD, getChild<LLPanel>("build_btn_panel")));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SEARCH, getChild<LLPanel>("search_btn_panel")));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_WORLD_MAP, getChild<LLPanel>("world_map_btn_panel")));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MINI_MAP, getChild<LLPanel>("mini_map_btn_panel")));
-
-	// init an order of processed buttons
-	mButtonsProcessOrder.push_back(RS_BUTTON_GESTURES);
-	mButtonsProcessOrder.push_back(RS_BUTTON_MOVEMENT);
-	mButtonsProcessOrder.push_back(RS_BUTTON_CAMERA);
-	mButtonsProcessOrder.push_back(RS_BUTTON_SNAPSHOT);
-	mButtonsProcessOrder.push_back(RS_BUTTON_BUILD);
-	mButtonsProcessOrder.push_back(RS_BUTTON_SEARCH);
-	mButtonsProcessOrder.push_back(RS_BUTTON_WORLD_MAP);
-	mButtonsProcessOrder.push_back(RS_BUTTON_MINI_MAP);
-
-	// init default widths
-
-	// process buttons that can be hidden on resize...
-	resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin();
-	const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end();
-
-	for (; it != it_end; ++it)
-	{
-		const EResizeState button_type = *it;
-		// is there an appropriate object?
-		llassert(mStateProcessedObjectMap.count(button_type) > 0);
-		if (0 == mStateProcessedObjectMap.count(button_type)) continue;
-
-		// set default width for it.
-		mObjectDefaultWidthMap[button_type] = mStateProcessedObjectMap[button_type]->getRect().getWidth();
-	}
-
-	// ... and add Speak button because it also can be shrunk.
-	mObjectDefaultWidthMap[RS_BUTTON_SPEAK]	   = mSpeakPanel->getRect().getWidth();
-
-}
-
-// this method must be called before restoring of the chat entry field on startup
-// because it resets chatbar's width according to resize logic.
-void LLBottomTray::initButtonsVisibility()
-{
-	setVisibleAndFitWidths(RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton"));
-	setVisibleAndFitWidths(RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton"));
-	setVisibleAndFitWidths(RS_BUTTON_CAMERA, gSavedSettings.getBOOL("ShowCameraButton"));
-	setVisibleAndFitWidths(RS_BUTTON_SNAPSHOT, gSavedSettings.getBOOL("ShowSnapshotButton"));
-	setVisibleAndFitWidths(RS_BUTTON_BUILD, gSavedSettings.getBOOL("ShowBuildButton"));
-	setVisibleAndFitWidths(RS_BUTTON_SEARCH, gSavedSettings.getBOOL("ShowSearchButton"));
-	setVisibleAndFitWidths(RS_BUTTON_WORLD_MAP, gSavedSettings.getBOOL("ShowWorldMapButton"));
-	setVisibleAndFitWidths(RS_BUTTON_MINI_MAP, gSavedSettings.getBOOL("ShowMiniMapButton"));
-}
-
-void LLBottomTray::setButtonsControlsAndListeners()
+void LLBottomTray::initStateProcessedObjectMap()
 {
-	gSavedSettings.getControl("ShowGestureButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_GESTURES, _2));
-	gSavedSettings.getControl("ShowMoveButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MOVEMENT, _2));
-	gSavedSettings.getControl("ShowCameraButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_CAMERA, _2));
-	gSavedSettings.getControl("ShowSnapshotButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SNAPSHOT, _2));
-	gSavedSettings.getControl("ShowBuildButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_BUILD, _2));
-	gSavedSettings.getControl("ShowSearchButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SEARCH, _2));
-	gSavedSettings.getControl("ShowWorldMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_WORLD_MAP, _2));
-	gSavedSettings.getControl("ShowMiniMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MINI_MAP, _2));
-
-
-	LLButton* build_btn = getChild<LLButton>("build_btn");
-	// set control name for Build button. It is not enough to link it with Button.SetFloaterToggle in xml
-	std::string vis_control_name = LLFloaterReg::declareVisibilityControl("build");
-	// Set the button control value (toggle state) to the floater visibility control (Sets the value as well)
-	build_btn->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name));
-}
-
-bool LLBottomTray::toggleShowButton(LLBottomTray::EResizeState button_type, const LLSD& new_visibility)
-{
-	if (LLBottomTray::instanceExists())
-	{
-		LLBottomTray::getInstance()->setTrayButtonVisibleIfPossible(button_type, new_visibility.asBoolean());
-	}
-	return true;
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, mGesturePanel));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, mMovementPanel));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, mCamPanel));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, mSnapshotPanel));
+
+	mDummiesMap.insert(std::make_pair(RS_BUTTON_GESTURES, getChild<LLUICtrl>("after_gesture_panel")));
+	mDummiesMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, getChild<LLUICtrl>("after_movement_panel")));
+	mDummiesMap.insert(std::make_pair(RS_BUTTON_CAMERA,   getChild<LLUICtrl>("after_cam_panel")));
+	mDummiesMap.insert(std::make_pair(RS_BUTTON_SPEAK,    getChild<LLUICtrl>("after_speak_panel")));
 }
 
 void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible)
@@ -1256,6 +1159,12 @@ void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool vis
 	}
 
 	panel->setVisible(visible);
+
+	if (mDummiesMap.count(shown_object_type))
+	{
+		// Hide/show layout panel for dummy icon.
+		mDummiesMap[shown_object_type]->getParent()->setVisible(visible);
+	}
 }
 
 void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification)
@@ -1278,13 +1187,20 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
 		return false;
 	}
 
+	const S32 dummy_width = mDummiesMap.count(object_type)
+		? mDummiesMap[object_type]->getParent()->getRect().getWidth()
+		: 0;
+
 	bool is_set = true;
 
 	if (visible)
 	{
-		// Assume that only chiclet panel can be auto-resized
+		// Assume that only chiclet panel can be auto-resized and
+		// don't take into account width of dummy widgets
 		const S32 available_width =
-			mChicletPanel->getParent()->getRect().getWidth() - mChicletPanel->getMinWidth();
+			mChicletPanel->getParent()->getRect().getWidth() -
+			mChicletPanel->getMinWidth() -
+			dummy_width;
 
 		S32 preferred_width = mObjectDefaultWidthMap[object_type];
 		S32 current_width = cur_panel->getRect().getWidth();
@@ -1308,18 +1224,17 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
 			const S32 chatbar_shrunk_width =
 				mNearbyChatBar->getRect().getWidth() - get_panel_min_width(mToolbarStack, mNearbyChatBar);
 
-			S32 sum_of_min_widths = get_panel_min_width(mToolbarStack, mSpeakPanel);
-			S32 sum_of_curr_widths = get_curr_width(mSpeakPanel);
+			const S32 sum_of_min_widths =
+				get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_CAMERA])   +
+				get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_MOVEMENT]) +
+				get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_GESTURES]) +
+				get_panel_min_width(mToolbarStack, mSpeakPanel);
 
-			resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin();
-			const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end();
-
-			for (; it != it_end; ++it)
-			{
-				LLPanel * cur_panel = mStateProcessedObjectMap[*it];
-				sum_of_min_widths += get_panel_min_width(mToolbarStack, cur_panel);
-				sum_of_curr_widths += get_curr_width(cur_panel);
-			}
+			const S32 sum_of_curr_widths =
+				get_curr_width(mStateProcessedObjectMap[RS_BUTTON_CAMERA])   +
+				get_curr_width(mStateProcessedObjectMap[RS_BUTTON_MOVEMENT]) +
+				get_curr_width(mStateProcessedObjectMap[RS_BUTTON_GESTURES]) +
+				get_curr_width(mSpeakPanel);
 
 			const S32 possible_shrunk_width =
 				chatbar_shrunk_width + (sum_of_curr_widths - sum_of_min_widths);
@@ -1348,12 +1263,12 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
 			current_width = result_width;
 		}
 
-		is_set = processShowButton(object_type, current_width);
+		is_set = processShowButton(object_type, &current_width);
 
 		// Shrink buttons if needed
 		if (is_set && decrease_width)
 		{
-			processWidthDecreased( -result_width);
+			processWidthDecreased( -result_width - dummy_width );
 		}
 	}
 	else
@@ -1368,7 +1283,7 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
 		// Extend other buttons if need
 		if (delta_width)
 		{
-			processWidthIncreased(delta_width);
+			processWidthIncreased(delta_width + dummy_width);
 		}
 	}
 	return is_set;
@@ -1399,34 +1314,4 @@ void LLBottomTray::showWellButton(EResizeState object_type, bool visible)
 	}
 }
 
-void LLBottomTray::processChatbarCustomization(S32 new_width)
-{
-	if (NULL == mNearbyChatBar) return;
-
-	const S32 delta_width = mNearbyChatBar->getRect().getWidth() - new_width;
-
-	if (delta_width == 0) return;
-
-	LLView * chiclet_layout_panel = mChicletPanel->getParent();
-	const S32 chiclet_min_width = get_panel_min_width(mToolbarStack, chiclet_layout_panel);
-	const S32 chiclet_panel_width = chiclet_layout_panel->getRect().getWidth();
-	const S32 available_chiclet_shrink_width = chiclet_panel_width - chiclet_min_width;
-	llassert(available_chiclet_shrink_width >= 0);
-
-	if (delta_width > 0) // panel gets narrowly
-	{
-		S32 total_possible_width = delta_width + available_chiclet_shrink_width;
-		processShowButtons(total_possible_width);
-		processExtendButtons(total_possible_width);
-	}
-	// here (delta_width < 0) // panel gets wider
-	else //if (-delta_width > available_chiclet_shrink_width)
-	{
-		S32 required_width = delta_width + available_chiclet_shrink_width;
-		S32 buttons_freed_width = 0;
-		processShrinkButtons(required_width, buttons_freed_width);
-		processHideButtons(required_width, buttons_freed_width);
-	}
-}
-
 //EOF
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h
index bd9d35f209a880ca1cb44449e4140232da438c24..3c45777645a8d6776388dbc2daf370f83e8f4a6f 100644
--- a/indra/newview/llbottomtray.h
+++ b/indra/newview/llbottomtray.h
@@ -2,25 +2,31 @@
 * @file llbottomtray.h
 * @brief LLBottomTray class header file
 *
-* $LicenseInfo:firstyear=2009&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2009&license=viewergpl$
+* 
+* Copyright (c) 2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 
@@ -114,151 +120,37 @@ class LLBottomTray
 		, RS_BUTTON_SPEAK		= 0x0040
 		, RS_IM_WELL			= 0x0080
 		, RS_NOTIFICATION_WELL	= 0x0100
-		, RS_BUTTON_BUILD		= 0x0200
-		, RS_BUTTON_SEARCH		= 0x0400
-		, RS_BUTTON_WORLD_MAP	= 0x0800
-		, RS_BUTTON_MINI_MAP	= 0x1000
-
-		/*
-		Once new button that can be hidden on resize is added don't forget to update related places:
-			- RS_BUTTONS_CAN_BE_HIDDEN enum value below.
-			- initResizeStateContainers(): mStateProcessedObjectMap and mButtonsProcessOrder
-		*/
 
 		/**
 		 * Specifies buttons which can be hidden when bottom tray is shrunk.
 		 * They are: Gestures, Movement (Move), Camera (View), Snapshot
-		 *		new: Build, Search, Map, World Map, Mini-Map.
 		 */
 		, RS_BUTTONS_CAN_BE_HIDDEN = RS_BUTTON_SNAPSHOT | RS_BUTTON_CAMERA | RS_BUTTON_MOVEMENT | RS_BUTTON_GESTURES
-									| RS_BUTTON_BUILD | RS_BUTTON_SEARCH | RS_BUTTON_WORLD_MAP | RS_BUTTON_MINI_MAP
 	}EResizeState;
 
-	/**
-	 * Updates child controls size and visibility when it is necessary to reduce total width.
-	 *
-	 * Process order:
-	 *	- reduce chiclet panel to its minimal width;
-	 *  - reduce chatbar to its minimal width;
-	 *  - reduce visible buttons from right to left to their minimal width;
-	 *  - hide visible buttons from right to left;
-	 * When button is hidden chatbar extended to fill released space if it is necessary.
-	 *
-	 * @param[in] delta_width - value by which bottom tray should be shrunk. It is a negative value.
-	 * @return positive value which bottom tray can not process when it reaches its minimal width.
-	 *		Zero if there was enough space to process delta_width.
-	 */
 	S32 processWidthDecreased(S32 delta_width);
-
-	/**
-	 * Updates child controls size and visibility when it is necessary to extend total width.
-	 *
-	 * Process order:
-	 *  - show invisible buttons should be shown from left to right if possible;
-	 *  - extend visible buttons from left to right to their default width;
-	 *  - extend chatbar to its maximal width;
-	 *	- extend chiclet panel to all available space;
-	 * When chatbar & chiclet panels are wider then their minimal width they can be reduced to allow
-	 * a button gets visible in case if passed delta_width is not enough (chatbar first).
-	 *
-	 * @param[in] delta_width - value by which bottom tray should be extended. It is a positive value.
-	 */
 	void processWidthIncreased(S32 delta_width);
-
-	/** helper function to log debug messages */
 	void log(LLView* panel, const std::string& descr);
-
-	/**
-	 * Tries to show hidden by resize buttons using available width.
-	 *
-	 * Gets buttons visible if there is enough space. Reduces available_width in this case.
-	 *
-	 * @params[in, out] available_width - reference to available width to be used to show buttons.
-	 * @see processShowButton()
-	 */
-	void processShowButtons(S32& available_width);
-
-	/**
-	 * Tries to show panel with specified button using available width.
-	 *
-	 * Shows button specified by type if there is enough space. Reduces available_width in this case.
-	 *
-	 * @params[in] shown_object_type - type of button to be shown.
-	 * @params[in, out] available_width - reference to available width to be used to show button.
-	 *
-	 * @return true if button can be shown, false otherwise
-	 */
-	bool processShowButton(EResizeState shown_object_type, S32& available_width);
-
-	/**
-	 * Hides visible panels with all buttons that may be hidden by resize if it is necessary.
-	 *
-	 * When button gets hidden some space is released in bottom tray.
-	 * This space is taken into account for several consecutive calls for several buttons.
-	 *
-	 * @params[in, out] required_width - reference to required width to be released. This is a negative value.
-	 *			Its absolute value is decreased by shown panel width.
-	 * @params[in, out] buttons_freed_width - reference to value released over required one.
-	 *			If panel's width is more than required difference is added to buttons_freed_width.
-	 * @see processHideButton()
-	 */
-	void processHideButtons(S32& required_width, S32& buttons_freed_width);
-
-	/**
-	 * Hides panel with specified button if it is visible.
-	 *
-	 * When button gets hidden some space is released in bottom tray.
-	 * This space is taken into account for several consecutive calls for several buttons.
-	 *
-	 * @params[in] processed_object_type - type of button to be hide.
-	 * @params[in, out] required_width - reference to required width to be released. This is a negative value.
-	 *			Its absolute value is decreased by panel width.
-	 * @params[in, out] buttons_freed_width - reference to value released over required one.
-	 *			If panel's width is more than required difference is added to buttons_freed_width.
-	 */
-	void processHideButton(EResizeState processed_object_type, S32& required_width, S32& buttons_freed_width);
+	bool processShowButton(EResizeState shown_object_type, S32* available_width);
+	void processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width);
 
 	/**
 	 * Shrinks shown buttons to reduce total taken space.
 	 *
-	 * Shrinks buttons that may be shrunk smoothly first. Then shrinks Speak button.
-	 *
-	 * @param[in, out] required_width - reference to width value which should be released when buttons are shrunk. It is a negative value.
+	 * @param - required_width - width which buttons can use to be shrunk. It is a negative value.
 	 * It is increased on the value processed by buttons.
-	 * @params[in, out] buttons_freed_width - reference to value released over required one.
-	 *			If width of panel with Speak button is more than required that difference is added
-	 *				to buttons_freed_width.
-	 *			This is because Speak button shrinks discretely unlike other buttons which are changed smoothly.
-	 */
-	void processShrinkButtons(S32& required_width, S32& buttons_freed_width);
-
-	/**
-	 * Shrinks panel with specified button if it is visible.
-	 *
-	 * @params[in] processed_object_type - type of button to be shrunk.
-	 * @param[in, out] required_width - reference to width value which should be released when button is shrunk. It is a negative value.
-	 * It is increased on the value released by the button.
 	 */
-	void processShrinkButton(EResizeState processed_object_type, S32& required_width);
+	void processShrinkButtons(S32* required_width, S32* buttons_freed_width);
+	void processShrinkButton(EResizeState processed_object_type, S32* required_width);
 
 	/**
 	 * Extends shown buttons to increase total taken space.
 	 *
-	 * Extends buttons that may be extended smoothly first. Then extends Speak button.
-	 *
-	 * @param[in, out] available_width - reference to width value which buttons can use to be extended.
-	 *		It is a positive value. It is decreased on the value processed by buttons.
-	 */
-	void processExtendButtons(S32& available_width);
-
-	/**
-	 * Extends shown button to increase total taken space.
-	 *
-	 * @params[in] processed_object_type - type of button to be extended.
-	 * @param[in, out] available_width - reference to width value which button can use to be extended.
-	 *		It is a positive value. It is decreased on the value processed by buttons.
+	 * @param - available_width - width which buttons can use to be extended. It is a positive value.
+	 * It is decreased on the value processed by buttons.
 	 */
-	void processExtendButton(EResizeState processed_object_type, S32& available_width);
+	void processExtendButtons(S32* available_width);
+	void processExtendButton(EResizeState processed_object_type, S32* available_width);
 
 	/**
 	 * Determines if specified by type object can be shown. It should be hidden by shrink before.
@@ -267,37 +159,7 @@ class LLBottomTray
 	 *   - Gestures, Move, View, Snapshot
 	 */
 	bool canButtonBeShown(EResizeState processed_object_type) const;
-
-	/**
-	 * Initializes all containers stored data related to children resize state.
-	 *
-	 * @see mStateProcessedObjectMap
-	 * @see mObjectDefaultWidthMap
-	 * @see mButtonsProcessOrder
-	 */
-	void initResizeStateContainers();
-
-	/**
-	 * Initializes buttons' visibility depend on stored Control Settings.
-	 */
-	void initButtonsVisibility();
-
-	/**
-	 * Initializes listeners of Control Settings to toggle appropriate buttons' visibility.
-	 *
-	 * @see toggleShowButton()
-	 */
-	void setButtonsControlsAndListeners();
-
-	/**
-	 * Toggles visibility of specified button depend on passed value.
-	 *
-	 * @param button_type - type of button to be toggled
-	 * @param new_visibility - new visibility of the button
-	 *
-	 * @see setButtonsControlsAndListeners()
-	 */
-	static bool toggleShowButton(EResizeState button_type, const LLSD& new_visibility);
+	void initStateProcessedObjectMap();
 
 	/**
 	 * Sets passed visibility to object specified by resize type.
@@ -335,17 +197,6 @@ class LLBottomTray
 	 */
 	void showWellButton(EResizeState object_type, bool visible);
 
-	/**
-	 * Handles a customization of chatbar width.
-	 *
-	 * When chatbar gets wider layout stack will reduce chiclet panel (it is auto-resizable)
-	 *	But once chiclet panel reaches its minimal width Stack will force to reduce buttons width.
-	 *	including Speak button. The similar behavior is when chatbar gets narrowly.
-	 * This methods force resize behavior to resize buttons properly in these cases.
-	 */
-	void processChatbarCustomization(S32 new_width);
-
-
 	MASK mResizeState;
 
 	typedef std::map<EResizeState, LLPanel*> state_object_map_t;
@@ -354,17 +205,15 @@ class LLBottomTray
 	typedef std::map<EResizeState, S32> state_object_width_map_t;
 	state_object_width_map_t mObjectDefaultWidthMap;
 
-	typedef std::vector<EResizeState> resize_state_vec_t;
-
-	/**
-	 * Contains order in which child buttons should be processed in show/hide, extend/shrink methods.
-	 */
-	resize_state_vec_t mButtonsProcessOrder;
+	typedef std::map<EResizeState, LLUICtrl*> dummies_map_t;
+	dummies_map_t mDummiesMap;
 
 protected:
 
 	LLBottomTray(const LLSD& key = LLSD());
 
+	void onChicletClick(LLUICtrl* ctrl);
+
 	static void* createNearbyChatBar(void* userdata);
 
 	void updateContextMenu(S32 x, S32 y, MASK mask);
@@ -377,6 +226,10 @@ class LLBottomTray
 	LLNearbyChatBar*	mNearbyChatBar;
 	LLLayoutStack*		mToolbarStack;
 	LLMenuGL*			mBottomTrayContextMenu;
+	LLPanel*			mMovementPanel;
+	LLPanel*			mCamPanel;
+	LLPanel*			mSnapshotPanel;
+	LLPanel*			mGesturePanel;
 	LLButton*			mCamButton;
 	LLButton*			mMovementButton;
 	LLBottomTrayLite*   mBottomTrayLite;
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index f0e231e3d767e28bd8e75d7f7560b43c576ed6b2..44f1cefafed6737d078d5537b451b9ba2bfe877d 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -3,25 +3,31 @@
  * @author Mike Antipov
  * @brief Voice Control Panel in a Voice Chats (P2P, Group, Nearby...).
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -89,7 +95,7 @@ static void* create_non_avatar_caller(void*)
 	return new LLNonAvatarCaller;
 }
 
-LLVoiceChannel* LLCallFloater::sCurrentVoiceChannel = NULL;
+LLVoiceChannel* LLCallFloater::sCurrentVoiceCanel = NULL;
 
 LLCallFloater::LLCallFloater(const LLSD& key)
 : LLTransientDockableFloater(NULL, false, key)
@@ -107,7 +113,7 @@ LLCallFloater::LLCallFloater(const LLSD& key)
 	mSpeakerDelayRemover = new LLSpeakersDelayActionsStorage(boost::bind(&LLCallFloater::removeVoiceLeftParticipant, this, _1), voice_left_remove_delay);
 
 	mFactoryMap["non_avatar_caller"] = LLCallbackMap(create_non_avatar_caller, NULL);
-	LLVoiceClient::instance().addObserver(this);
+	LLVoiceClient::getInstance()->addObserver(this);
 	LLTransientFloaterMgr::getInstance()->addControlView(this);
 
 	// force docked state since this floater doesn't save it between recreations
@@ -127,7 +133,7 @@ LLCallFloater::~LLCallFloater()
 
 	if(LLVoiceClient::instanceExists())
 	{
-		LLVoiceClient::getInstance()->removeObserver(this);
+		gVoiceClient->removeObserver(this);
 	}
 	LLTransientFloaterMgr::getInstance()->removeControlView(this);
 }
@@ -152,6 +158,7 @@ BOOL LLCallFloater::postBuild()
 
 	initAgentData();
 
+
 	connectToChannel(LLVoiceChannel::getCurrentVoiceChannel());
 
 	setIsChrome(true);
@@ -182,7 +189,7 @@ void LLCallFloater::draw()
 	// Seems this is a problem somewhere in Voice Client (LLVoiceClient::participantAddedEvent)
 //	onChange();
 
-	bool is_moderator_muted = LLVoiceClient::getInstance()->getIsModeratorMuted(gAgentID);
+	bool is_moderator_muted = gVoiceClient->getIsModeratorMuted(gAgentID);
 
 	if (mIsModeratorMutedVoice != is_moderator_muted)
 	{
@@ -197,9 +204,10 @@ void LLCallFloater::draw()
 }
 
 // virtual
-void LLCallFloater::onParticipantsChanged()
+void LLCallFloater::onChange()
 {
 	if (NULL == mParticipants) return;
+
 	updateParticipantsVoiceState();
 
 	// Add newly joined participants.
@@ -220,7 +228,7 @@ void LLCallFloater::leaveCall()
 	LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
 	if (voice_channel)
 	{
-		gIMMgr->endCall(voice_channel->getSessionID());
+		voice_channel->deactivate();
 	}
 }
 
@@ -229,11 +237,11 @@ void LLCallFloater::updateSession()
 	LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
 	if (voice_channel)
 	{
-		LL_DEBUGS("Voice") << "Current voice channel: " << voice_channel->getSessionID() << LL_ENDL;
+		lldebugs << "Current voice channel: " << voice_channel->getSessionID() << llendl;
 
 		if (mSpeakerManager && voice_channel->getSessionID() == mSpeakerManager->getSessionID())
 		{
-			LL_DEBUGS("Voice") << "Speaker manager is already set for session: " << voice_channel->getSessionID() << LL_ENDL;
+			lldebugs << "Speaker manager is already set for session: " << voice_channel->getSessionID() << llendl;
 			return;
 		}
 		else
@@ -243,6 +251,7 @@ void LLCallFloater::updateSession()
 	}
 
 	const LLUUID& session_id = voice_channel ? voice_channel->getSessionID() : LLUUID::null;
+	lldebugs << "Set speaker manager for session: " << session_id << llendl;
 
 	LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
 	if (im_session)
@@ -280,22 +289,22 @@ void LLCallFloater::updateSession()
 
 	if (NULL == mSpeakerManager)
 	{
-		// By default show nearby chat participants
+		// by default let show nearby chat participants
 		mSpeakerManager = LLLocalSpeakerMgr::getInstance();
-		LL_DEBUGS("Voice") << "Set DEFAULT speaker manager" << LL_ENDL;
+		lldebugs << "Set DEFAULT speaker manager" << llendl;
 		mVoiceType = VC_LOCAL_CHAT;
 	}
 
 	updateTitle();
-
-	// Hide "Leave Call" button for nearby chat
+	
+	//hide "Leave Call" button for nearby chat
 	bool is_local_chat = mVoiceType == VC_LOCAL_CHAT;
 	childSetVisible("leave_call_btn_panel", !is_local_chat);
 
 	refreshParticipantList();
 	updateAgentModeratorState();
 
-	// Show floater for voice calls & only in CONNECTED to voice channel state
+	//show floater for voice calls & only in CONNECTED to voice channel state
 	if (!is_local_chat &&
 	    voice_channel &&
 	    LLVoiceChannel::STATE_CONNECTED == voice_channel->getState())
@@ -325,7 +334,7 @@ void LLCallFloater::refreshParticipantList()
 
 	if (!non_avatar_caller)
 	{
-		mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT, false);
+		mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT);
 		mParticipants->setValidateSpeakerCallback(boost::bind(&LLCallFloater::validateSpeaker, this, _1));
 		mParticipants->setSortOrder(LLParticipantList::E_SORT_BY_RECENT_SPEAKERS);
 
@@ -361,7 +370,7 @@ void LLCallFloater::sOnCurrentChannelChanged(const LLUUID& /*session_id*/)
 	// *NOTE: if signal was sent for voice channel with LLVoiceChannel::STATE_NO_CHANNEL_INFO
 	// it sill be sent for the same channel again (when state is changed).
 	// So, lets ignore this call.
-	if (channel == sCurrentVoiceChannel) return;
+	if (channel == sCurrentVoiceCanel) return;
 
 	LLCallFloater* call_floater = LLFloaterReg::getTypedInstance<LLCallFloater>("voice_controls");
 
@@ -443,7 +452,7 @@ void LLCallFloater::updateAgentModeratorState()
 	if(gAgent.isInGroup(mSpeakerManager->getSessionID()))
 	{
 		// This method can be called when LLVoiceChannel.mState == STATE_NO_CHANNEL_INFO
-		// in this case there are not any speakers yet.
+		// in this case there are no any speakers yet.
 		if (mSpeakerManager->findSpeaker(gAgentID))
 		{
 			// Agent is Moderator
@@ -461,15 +470,16 @@ void LLCallFloater::updateAgentModeratorState()
 static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids)
 {
 	// Get a list of participants from VoiceClient
-       std::set<LLUUID> participants;
-       LLVoiceClient::getInstance()->getParticipantList(participants);
-	
-	for (std::set<LLUUID>::const_iterator iter = participants.begin();
-		 iter != participants.end(); ++iter)
+	LLVoiceClient::participantMap *voice_map = gVoiceClient->getParticipantList();
+	if (voice_map)
 	{
-		speakers_uuids.push_back(*iter);
+		for (LLVoiceClient::participantMap::const_iterator iter = voice_map->begin();
+			iter != voice_map->end(); ++iter)
+		{
+			LLUUID id = (*iter).second->mAvatarID;
+			speakers_uuids.push_back(id);
+		}
 	}
-
 }
 
 void LLCallFloater::initParticipantsVoiceState()
@@ -545,7 +555,7 @@ void LLCallFloater::updateParticipantsVoiceState()
 
 		uuid_vec_t::iterator speakers_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), participant_id);
 
-		LL_DEBUGS("Voice") << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << LL_ENDL;
+		lldebugs << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << llendl;
 
 		// If an avatarID assigned to a panel is found in a speakers list
 		// obtained from VoiceClient we assign the JOINED status to the owner
@@ -591,13 +601,10 @@ void LLCallFloater::updateNotInVoiceParticipantState(LLAvatarListItem* item)
 			}
 		}
 		break;
+	case STATE_INVITED:
 	case STATE_LEFT:
 		// nothing to do. These states should not be changed.
 		break;
-	case STATE_INVITED:
-		// If avatar was invited into group chat and went offline it is still exists in mSpeakerStateMap
-		// If it goes online it will be rendered as JOINED via LAvatarListItem.
-		// Lets update its visual representation. See EXT-6660
 	case STATE_UNKNOWN:
 		// If an avatarID is not found in a speakers list from VoiceClient and
 		// a panel with this ID has an UNKNOWN status this means that this person
@@ -708,9 +715,9 @@ void LLCallFloater::connectToChannel(LLVoiceChannel* channel)
 {
 	mVoiceChannelStateChangeConnection.disconnect();
 
-	sCurrentVoiceChannel = channel;
+	sCurrentVoiceCanel = channel;
 
-	mVoiceChannelStateChangeConnection = sCurrentVoiceChannel->setStateChangedCallback(boost::bind(&LLCallFloater::onVoiceChannelStateChanged, this, _1, _2));
+	mVoiceChannelStateChangeConnection = sCurrentVoiceCanel->setStateChangedCallback(boost::bind(&LLCallFloater::onVoiceChannelStateChanged, this, _1, _2));
 
 	updateState(channel->getState());
 }
@@ -718,7 +725,7 @@ void LLCallFloater::connectToChannel(LLVoiceChannel* channel)
 void LLCallFloater::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
 {
 	// check is voice operational and if it doesn't work hide VCP (EXT-4397)
-	if(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking())
+	if(LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking())
 	{
 		updateState(new_state);
 	}
@@ -730,7 +737,7 @@ void LLCallFloater::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old
 
 void LLCallFloater::updateState(const LLVoiceChannel::EState& new_state)
 {
-	LL_DEBUGS("Voice") << "Updating state: " << new_state << ", session name: " << sCurrentVoiceChannel->getSessionName() << LL_ENDL;
+	LL_DEBUGS("Voice") << "Updating state: " << new_state << ", session name: " << sCurrentVoiceCanel->getSessionName() << LL_ENDL;
 	if (LLVoiceChannel::STATE_CONNECTED == new_state)
 	{
 		updateSession();
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index a664dbe53af4257e365e90eca06c75730d6780d3..79a2631c31dd9375c4b2949d3db304fafe121914 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -2,25 +2,31 @@
  * @file llcallingcard.cpp
  * @brief Implementation of the LLPreviewCallingCard class
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -694,7 +700,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
 						args["FIRST"] = first;
 						args["LAST"] = last;
 					}
-
 				}
 			}
 			else
diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp
index 577b26a21140399068f4ea1b752c1885a80570e0..67d5d21b2abe5632521da8ebed2e59bd490e2088 100644
--- a/indra/newview/llchatbar.cpp
+++ b/indra/newview/llchatbar.cpp
@@ -2,25 +2,31 @@
  * @file llchatbar.cpp
  * @brief LLChatBar class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -143,6 +149,7 @@ BOOL LLChatBar::handleKeyHere( KEY key, MASK mask )
 {
 	BOOL handled = FALSE;
 
+	// ALT-RETURN is reserved for windowed/fullscreen toggle
 	if( KEY_RETURN == key )
 	{
 		if (mask == MASK_CONTROL)
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 0fdef20f4ae4e8a15b0766c2907e00a72776fafe..68c31d87facb6096b2dac7333843dc6c2f2d99f7 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -2,25 +2,31 @@
  * @file llchathistory.cpp
  * @brief LLTextEditor base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -105,12 +111,6 @@ class LLChatHistoryHeader: public LLPanel
 		return pInstance;
 	}
 
-	~LLChatHistoryHeader()
-	{
-		// Detach the info button so that it doesn't get destroyed (EXT-8463).
-		hideInfoCtrl();
-	}
-
 	BOOL handleMouseUp(S32 x, S32 y, MASK mask)
 	{
 		return LLPanel::handleMouseUp(x,y,mask);
@@ -243,7 +243,7 @@ class LLChatHistoryHeader: public LLPanel
 		gCacheName->get(mAvatarID, FALSE, boost::bind(&LLChatHistoryHeader::nameUpdatedCallback, this, _1, _2, _3, _4));
 
 		//*TODO overly defensive thing, source type should be maintained out there
-		if((chat.mFromID.isNull() && chat.mFromName.empty()) || chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull())
+		if((chat.mFromID.isNull() && chat.mFromName.empty()) || chat.mFromName == SYSTEM_FROM)
 		{
 			mSourceType = CHAT_SOURCE_SYSTEM;
 		}
@@ -382,18 +382,8 @@ class LLChatHistoryHeader: public LLPanel
 				
 		if (!sInfoCtrl)
 		{
-			// *TODO: Delete the button at exit.
 			sInfoCtrl = LLUICtrlFactory::createFromFile<LLUICtrl>("inspector_info_ctrl.xml", NULL, LLPanel::child_registry_t::instance());
-			if (sInfoCtrl)
-			{
-				sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
-			}
-		}
-
-		if (!sInfoCtrl)
-		{
-			llassert(sInfoCtrl != NULL);
-			return;
+			sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
 		}
 
 		LLTextBase* name = getChild<LLTextBase>("user_name");
@@ -567,14 +557,6 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 {
 	bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean();
 
-	llassert(mEditor);
-	if (!mEditor)
-	{
-		return;
-	}
-
-	mEditor->setPlainText(use_plain_text_chat_history);
-
 	if (!mEditor->scrolledToEnd() && chat.mFromID != gAgent.getID() && !chat.mFromName.empty())
 	{
 		mUnreadChatSources.insert(chat.mFromName);
@@ -665,21 +647,22 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 			if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull())
 			{
 				// for object IMs, create a secondlife:///app/objectim SLapp
-				std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString();
+				std::string url = LLSLURL::buildCommand("objectim", chat.mFromID, "");
 				url += "?name=" + chat.mFromName;
-				url += "&owner=" + chat.mOwnerID.asString();
+				url += "&owner=" + args["owner_id"].asString();
 
 				std::string slurl = args["slurl"].asString();
 				if (slurl.empty())
 				{
-				    LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
-				    if(region)
-				      {
-					LLSLURL region_slurl(region->getName(), chat.mPosAgent);
-					slurl = region_slurl.getLocationString();
-				      }
+					LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
+					if (region)
+					{
+						S32 x, y, z;
+						LLSLURL::globalPosToXYZ(LLVector3d(chat.mPosAgent), x, y, z);
+						slurl = region->getName() + llformat("/%d/%d/%d", x, y, z);
+					}
 				}
-				url += "&slurl=" + LLURI::escape(slurl);
+				url += "&slurl=" + slurl;
 
 				// set the link for the object name to be the objectim SLapp
 				// (don't let object names with hyperlinks override our objectim Url)
@@ -753,7 +736,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 		mIsLastMessageFromLog = message_from_log;
 	}
 
-	if (chat.mNotifId.notNull())
+   if (chat.mNotifId.notNull())
 	{
 		LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId);
 		if (notification != NULL)
@@ -845,7 +828,6 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 		
 		mEditor->appendText(message, FALSE, style_params);
 	}
-
 	mEditor->blockUndo();
 
 	// automatically scroll to end when receiving chat from myself
@@ -865,3 +847,12 @@ void LLChatHistory::draw()
 
 	LLUICtrl::draw();
 }
+
+void LLChatHistory::reshape(S32 width, S32 height, BOOL called_from_parent)
+{
+	bool is_scrolled_to_end = mEditor->scrolledToEnd();
+	LLUICtrl::reshape( width, height, called_from_parent );
+	// update scroll
+	if (is_scrolled_to_end)
+		mEditor->setCursorAndScrollToEnd();
+}
diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h
index 112a33f1ee1e09fd9df2468a3a8de6349136be67..950b32861bdd56b5e8d10c32aa84a7245816862b 100644
--- a/indra/newview/llchathistory.h
+++ b/indra/newview/llchathistory.h
@@ -2,25 +2,31 @@
  * @file llchathistory.h
  * @brief LLTextEditor base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -116,6 +122,7 @@ class LLChatHistory : public LLUICtrl
 		 */
 		void appendMessage(const LLChat& chat, const LLSD &args = LLSD(), const LLStyle::Params& input_append_params = LLStyle::Params());
 		/*virtual*/ void clear();
+		/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 
 	private:
 		std::string mLastFromName;
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index 8f385160e9e50c084a03a3f5b62515a4117a468c..e39384b7b29e4ddbc44eb3a71ef6cc332ce82f1e 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -2,25 +2,31 @@
  * @file llchiclet.cpp
  * @brief LLChiclet class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -125,6 +131,8 @@ LLSysWellChiclet::Params::Params()
 : button("button")
 , unread_notifications("unread_notifications")
 , max_displayed_count("max_displayed_count", 99)
+, flash_to_lit_count("flash_to_lit_count", 3)
+, flash_period("flash_period", 0.5F)
 {
 	button.name("button");
 	button.tab_stop(FALSE);
@@ -144,13 +152,7 @@ LLSysWellChiclet::LLSysWellChiclet(const Params& p)
 	mButton = LLUICtrlFactory::create<LLButton>(button_params);
 	addChild(mButton);
 
-	// use settings from settings.xml to be able change them via Debug settings. See EXT-5973.
-	// Due to Timer is implemented as derived class from EventTimer it is impossible to change period
-	// in runtime. So, both settings are made as required restart.
-	static S32 flash_to_lit_count = gSavedSettings.getS32("WellIconFlashCount");
-	static F32 flash_period = gSavedSettings.getF32("WellIconFlashPeriod");
-
-	mFlashToLitTimer = new FlashToLitTimer(flash_to_lit_count, flash_period, boost::bind(&LLSysWellChiclet::changeLitState, this));
+	mFlashToLitTimer = new FlashToLitTimer(p.flash_to_lit_count, p.flash_period, boost::bind(&LLSysWellChiclet::changeLitState, this));
 }
 
 LLSysWellChiclet::~LLSysWellChiclet()
@@ -177,6 +179,20 @@ void LLSysWellChiclet::setCounter(S32 counter)
 
 	mButton->setLabel(s_count);
 
+	setNewMessagesState(counter > mCounter);
+
+	// we have to flash to 'Lit' state each time new unread message is coming.
+	if (counter > mCounter)
+	{
+		mFlashToLitTimer->flash();
+	}
+	else if (counter == 0)
+	{
+		// if notification is resolved while well is flashing it can leave in the 'Lit' state
+		// when flashing finishes itself. Let break flashing here.
+		mFlashToLitTimer->stopFlashing();
+	}
+
 	mCounter = counter;
 }
 
@@ -296,26 +312,7 @@ void LLIMWellChiclet::createMenu()
 
 void LLIMWellChiclet::messageCountChanged(const LLSD& session_data)
 {
-	const LLUUID& session_id = session_data["session_id"];
-	const S32 counter = LLBottomTray::getInstance()->getTotalUnreadIMCount();
-	const bool im_not_visible = !LLFloaterReg::instanceVisible("im_container")
-		&& !LLFloaterReg::instanceVisible("impanel", session_id);
-
-	setNewMessagesState(counter > mCounter	&& im_not_visible);
-
-	// we have to flash to 'Lit' state each time new unread message is coming.
-	if (counter > mCounter && im_not_visible)
-	{
-		mFlashToLitTimer->flash();
-	}
-	else if (counter == 0)
-	{
-		// if notification is resolved while well is flashing it can leave in the 'Lit' state
-		// when flashing finishes itself. Let break flashing here.
-		mFlashToLitTimer->stopFlashing();
-	}
-
-	setCounter(counter);
+	setCounter(LLBottomTray::getInstance()->getTotalUnreadIMCount());
 }
 
 /************************************************************************/
@@ -464,7 +461,6 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)
 , mSpeakerCtrl(NULL)
 , mCounterCtrl(NULL)
 , mChicletButton(NULL)
-, mPopupMenu(NULL)
 {
 	enableCounterControl(p.enable_counter);
 }
@@ -648,37 +644,6 @@ LLIMChiclet::EType LLIMChiclet::getIMSessionType(const LLUUID& session_id)
 	return type;
 }
 
-BOOL LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
-{
-	if(!mPopupMenu)
-	{
-		createPopupMenu();
-	}
-
-	if (mPopupMenu)
-	{
-		updateMenuItems();
-		mPopupMenu->arrangeAndClear();
-		LLMenuGL::showPopup(this, mPopupMenu, x, y);
-	}
-
-	return TRUE;
-}
-
-bool LLIMChiclet::canCreateMenu()
-{
-	if(mPopupMenu)
-	{
-		llwarns << "Menu already exists" << llendl;
-		return false;
-	}
-	if(getSessionId().isNull())
-	{
-		return false;
-	}
-	return true;
-}
-
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -696,6 +661,7 @@ LLIMP2PChiclet::Params::Params()
 LLIMP2PChiclet::LLIMP2PChiclet(const Params& p)
 : LLIMChiclet(p)
 , mChicletIconCtrl(NULL)
+, mPopupMenu(NULL)
 {
 	LLButton::Params button_params = p.chiclet_button;
 	mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
@@ -750,10 +716,34 @@ void LLIMP2PChiclet::updateMenuItems()
 	mPopupMenu->getChild<LLUICtrl>("Add Friend")->setEnabled(!is_friend);
 }
 
+BOOL LLIMP2PChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
+{
+	if(!mPopupMenu)
+	{
+		createPopupMenu();
+	}
+
+	if (mPopupMenu)
+	{
+		updateMenuItems();
+		mPopupMenu->arrangeAndClear();
+		LLMenuGL::showPopup(this, mPopupMenu, x, y);
+	}
+
+	return TRUE;
+}
+
 void LLIMP2PChiclet::createPopupMenu()
 {
-	if(!canCreateMenu())
+	if(mPopupMenu)
+	{
+		llwarns << "Menu already exists" << llendl;
 		return;
+	}
+	if(getSessionId().isNull())
+	{
+		return;
+	}
 
 	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 	registrar.add("IMChicletMenu.Action", boost::bind(&LLIMP2PChiclet::onMenuItemClicked, this, _2));
@@ -803,6 +793,7 @@ LLAdHocChiclet::Params::Params()
 LLAdHocChiclet::LLAdHocChiclet(const Params& p)
 : LLIMChiclet(p)
 , mChicletIconCtrl(NULL)
+, mPopupMenu(NULL)
 {
 	LLButton::Params button_params = p.chiclet_button;
 	mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
@@ -872,8 +863,15 @@ void LLAdHocChiclet::switchToCurrentSpeaker()
 
 void LLAdHocChiclet::createPopupMenu()
 {
-	if(!canCreateMenu())
+	if(mPopupMenu)
+	{
+		llwarns << "Menu already exists" << llendl;
 		return;
+	}
+	if(getSessionId().isNull())
+	{
+		return;
+	}
 
 	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 	registrar.add("IMChicletMenu.Action", boost::bind(&LLAdHocChiclet::onMenuItemClicked, this, _2));
@@ -893,6 +891,22 @@ void LLAdHocChiclet::onMenuItemClicked(const LLSD& user_data)
 	}
 }
 
+BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
+{
+	if(!mPopupMenu)
+	{
+		createPopupMenu();
+	}
+
+	if (mPopupMenu)
+	{
+		mPopupMenu->arrangeAndClear();
+		LLMenuGL::showPopup(this, mPopupMenu, x, y);
+	}
+
+	return TRUE;
+}
+
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -911,6 +925,7 @@ LLIMGroupChiclet::LLIMGroupChiclet(const Params& p)
 : LLIMChiclet(p)
 , LLGroupMgrObserver(LLUUID::null)
 , mChicletIconCtrl(NULL)
+, mPopupMenu(NULL)
 {
 	LLButton::Params button_params = p.chiclet_button;
 	mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
@@ -1023,10 +1038,34 @@ void LLIMGroupChiclet::updateMenuItems()
 	mPopupMenu->getChild<LLUICtrl>("Chat")->setEnabled(!open_window_exists);
 }
 
+BOOL LLIMGroupChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
+{
+	if(!mPopupMenu)
+	{
+		createPopupMenu();
+	}
+
+	if (mPopupMenu)
+	{
+		updateMenuItems();
+		mPopupMenu->arrangeAndClear();
+		LLMenuGL::showPopup(this, mPopupMenu, x, y);
+	}
+
+	return TRUE;
+}
+
 void LLIMGroupChiclet::createPopupMenu()
 {
-	if(!canCreateMenu())
+	if(mPopupMenu)
+	{
+		llwarns << "Menu already exists" << llendl;
 		return;
+	}
+	if(getSessionId().isNull())
+	{
+		return;
+	}
 
 	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 	registrar.add("IMChicletMenu.Action", boost::bind(&LLIMGroupChiclet::onMenuItemClicked, this, _2));
@@ -1874,28 +1913,6 @@ void LLScriptChiclet::onMouseDown()
 	LLScriptFloaterManager::getInstance()->toggleScriptFloater(getSessionId());
 }
 
-void LLScriptChiclet::onMenuItemClicked(const LLSD& user_data)
-{
-	std::string action = user_data.asString();
-
-	if("end" == action)
-	{
-		LLScriptFloaterManager::instance().removeNotification(getSessionId());
-	}
-}
-
-void LLScriptChiclet::createPopupMenu()
-{
-	if(!canCreateMenu())
-		return;
-
-	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-	registrar.add("ScriptChiclet.Action", boost::bind(&LLScriptChiclet::onMenuItemClicked, this, _2));
-
-	mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>
-		("menu_script_chiclet.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-}
-
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -1957,26 +1974,4 @@ void LLInvOfferChiclet::onMouseDown()
 	LLScriptFloaterManager::instance().toggleScriptFloater(getSessionId());
 }
 
-void LLInvOfferChiclet::onMenuItemClicked(const LLSD& user_data)
-{
-	std::string action = user_data.asString();
-
-	if("end" == action)
-	{
-		LLScriptFloaterManager::instance().removeNotification(getSessionId());
-	}
-}
-
-void LLInvOfferChiclet::createPopupMenu()
-{
-	if(!canCreateMenu())
-		return;
-
-	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-	registrar.add("InvOfferChiclet.Action", boost::bind(&LLInvOfferChiclet::onMenuItemClicked, this, _2));
-
-	mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>
-		("menu_inv_offer_chiclet.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-}
-
 // EOF
diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp
index 117a0bb568d6eadc9c93c7fd90b60ccfc54d5f23..feb8c540ef9518d57c97032ed0bc5f3013da9e84 100644
--- a/indra/newview/llcompilequeue.cpp
+++ b/indra/newview/llcompilequeue.cpp
@@ -2,25 +2,31 @@
  * @file llcompilequeue.cpp
  * @brief LLCompileQueueData class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h
index 4ddab29d00eba0b62ccfa6c98dbb6cbadaca2c3f..4fde2572af4539efd9df892311bd9570cc933447 100644
--- a/indra/newview/llcompilequeue.h
+++ b/indra/newview/llcompilequeue.h
@@ -2,25 +2,31 @@
  * @file llcompilequeue.h
  * @brief LLCompileQueue class header file
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp
index adb291ede8b19450a37d0039d131fc243c47909a..be6c15eab4a036be7548f0913d48c09aaf8f4a2e 100644
--- a/indra/newview/llcurrencyuimanager.cpp
+++ b/indra/newview/llcurrencyuimanager.cpp
@@ -2,25 +2,31 @@
  * @file llcurrencyuimanager.cpp
  * @brief LLCurrencyUIManager class implementation
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -29,8 +35,6 @@
 #include "lluictrlfactory.h"
 #include "lltextbox.h"
 #include "lllineeditor.h"
-#include "llresmgr.h" // for LLLocale
-#include "lltrans.h"
 #include "llviewercontrol.h"
 #include "llversioninfo.h"
 
@@ -280,7 +284,7 @@ void LLCurrencyUIManager::Impl::startTransaction(TransactionType type,
 	static std::string transactionURI;
 	if (transactionURI.empty())
 	{
-		transactionURI = LLGridManager::getInstance()->getHelperURI() + "currency.php";
+		transactionURI = LLViewerLogin::getInstance()->getHelperURI() + "currency.php";
 	}
 
 	delete mTransaction;
@@ -319,12 +323,7 @@ std::string LLCurrencyUIManager::Impl::getLocalEstimate() const
 	if (mUSDCurrencyEstimated)
 	{
 		// we have the old-style USD-specific value
-		LLStringUtil::format_map_t args;
-		{
-			LLLocale locale_override(LLStringUtil::getLocale());
-			args["[AMOUNT]"] = llformat("%#.2f", mUSDCurrencyEstimatedCost / 100.0);
-		}
-		return LLTrans::getString("LocalEstimateUSD", args);
+		return "US$ " + llformat("%#.2f", mUSDCurrencyEstimatedCost / 100.0);
 	}
 	return "";
 }
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
index 8f47d3c5e5ff53c1ee2d210fd0b44dbbe69529a1..ebd767d654a9af92fcb3c3b6357ee92eda496c0a 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -2,25 +2,31 @@
  * @file lldriverparam.cpp
  * @brief A visual parameter that drives (controls) other visual parameters.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -528,7 +534,7 @@ void LLDriverParam::resetDrivenParams()
 	mDriven.reserve(getInfo()->mDrivenInfoList.size());
 }
 
-void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
+void LLDriverParam::updateCrossDrivenParams(EWearableType driven_type)
 {
 	bool needs_update = (getWearableType()==driven_type);
 
@@ -545,7 +551,7 @@ void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
 
 	if (needs_update)
 	{
-		LLWearableType::EType driver_type = (LLWearableType::EType)getWearableType();
+		EWearableType driver_type = (EWearableType)getWearableType();
 		
 		// If we've gotten here, we've added a new wearable of type "type"
 		// Thus this wearable needs to get updates from the driver wearable.
diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index 80cf99fc43d7c4e3d604530ee5ed975ea441242d..149ba2478dce7f8fccd0c088819901cef0a4b29a 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -2,25 +2,31 @@
  * @file llexpandabletextbox.cpp
  * @brief LLExpandableTextBox and related class implementations
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -134,13 +140,7 @@ void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text,cons
 	// LLTextBox::setText will obliterate the expander segment, so make sure
 	// we generate it again by clearing mExpanderVisible
 	mExpanderVisible = false;
-
-	// Workaround for EXT-8259: trim text before rendering it.
-	{
-		std::string trimmed_text(text);
-		LLStringUtil::trim(trimmed_text);
-		LLTextEditor::setText(trimmed_text, input_params);
-	}
+	LLTextEditor::setText(text, input_params);
 
 	// text contents have changed, segments are cleared out
 	// so hide the expander and determine if we need it
diff --git a/indra/newview/llexpandabletextbox.h b/indra/newview/llexpandabletextbox.h
index bce77225c4863d583058b574d46f5431b2cf19a9..5872592faed329b2b8cb488fcb46bf2bcd77f2cb 100644
--- a/indra/newview/llexpandabletextbox.h
+++ b/indra/newview/llexpandabletextbox.h
@@ -2,25 +2,31 @@
  * @file llexpandabletextbox.h
  * @brief LLExpandableTextBox and related class definitions
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 5796e676185ff76b36aa8bd6da40b5256e1b9353..ba92c33d5914bbf6a08d0525c36657bc935fac94 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -2,25 +2,31 @@
  * @file llfavoritesbar.cpp
  * @brief LLFavoritesBarCtrl class implementation
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -69,9 +75,7 @@ class LLLandmarkInfoGetter
 		mPosY(0),
 		mPosZ(0),
 		mLoaded(false) 
-	{
-		mHandle.bind(this);
-	}
+	{}
 
 	void setLandmarkID(const LLUUID& id) { mLandmarkID = id; }
 	const LLUUID& getLandmarkId() const { return mLandmarkID; }
@@ -118,21 +122,17 @@ class LLLandmarkInfoGetter
 		if(LLLandmarkActions::getLandmarkGlobalPos(mLandmarkID, g_pos))
 		{
 			LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(g_pos,
-				boost::bind(&LLLandmarkInfoGetter::landmarkNameCallback, static_cast<LLHandle<LLLandmarkInfoGetter> >(mHandle), _1, _2, _3, _4));
+				boost::bind(&LLLandmarkInfoGetter::landmarkNameCallback, this, _1, _2, _3, _4));
 		}
 	}
 
-	static void landmarkNameCallback(LLHandle<LLLandmarkInfoGetter> handle, const std::string& name, S32 x, S32 y, S32 z)
+	void landmarkNameCallback(const std::string& name, S32 x, S32 y, S32 z)
 	{
-		LLLandmarkInfoGetter* getter = handle.get();
-		if (getter)
-		{
-			getter->mPosX = x;
-			getter->mPosY = y;
-			getter->mPosZ = z;
-			getter->mName = name;
-			getter->mLoaded = true;
-		}
+		mPosX = x;
+		mPosY = y;
+		mPosZ = z;
+		mName = name;
+		mLoaded = true;
 	}
 
 	LLUUID mLandmarkID;
@@ -141,7 +141,6 @@ class LLLandmarkInfoGetter
 	S32 mPosY;
 	S32 mPosZ;
 	bool mLoaded;
-	LLRootHandle<LLLandmarkInfoGetter> mHandle;
 };
 
 /**
@@ -1159,17 +1158,6 @@ void LLFavoritesBarCtrl::pastFromClipboard() const
 
 void LLFavoritesBarCtrl::onButtonMouseDown(LLUUID id, LLUICtrl* ctrl, S32 x, S32 y, MASK mask)
 {
-	// EXT-6997 (Fav bar: Pop-up menu for LM in overflow dropdown is kept after LM was dragged away)
-	// mInventoryItemsPopupMenuHandle.get() - is a pop-up menu (of items) in already opened dropdown menu.
-	// We have to check and set visibility of pop-up menu in such a way instead of using
-	// LLMenuHolderGL::hideMenus() because it will close both menus(dropdown and pop-up), but
-	// we need to close only pop-up menu while dropdown one should be still opened.
-	LLMenuGL* menu = (LLMenuGL*)mInventoryItemsPopupMenuHandle.get();
-	if(menu && menu->getVisible())
-	{
-		menu->setVisible(FALSE);
-	}
-
 	mDragItemId = id;
 	mStartDrag = TRUE;
 
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 5ac006302e2efcb5288d66fc5789af9a7024a3e3..ef69f39ad2df5b575ecc7aac9d7575b45c638a94 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -3,25 +3,31 @@
  * @author James Cook
  * @brief The about box from Help->About
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
  
@@ -129,10 +135,10 @@ BOOL LLFloaterAbout::postBuild()
 
 	// Render the LLSD from getInfo() as a format_map_t
 	LLStringUtil::format_map_t args;
-
-	// allow the "Release Notes" URL label to be localized
+	// For reasons I don't yet understand, [ReleaseNotes] is not part of the
+	// default substitution strings whereas [APP_NAME] is. But it works to
+	// simply copy it into these specific args.
 	args["ReleaseNotes"] = LLTrans::getString("ReleaseNotes");
-
 	for (LLSD::map_const_iterator ii(info.beginMap()), iend(info.endMap());
 		 ii != iend; ++ii)
 	{
@@ -260,18 +266,8 @@ LLSD LLFloaterAbout::getInfo()
 	info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
 	bool want_fullname = true;
 	info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
-	if(LLVoiceClient::getInstance()->voiceEnabled())
-	{
-		LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
-		std::ostringstream version_string;
-		version_string << version.serverType << " " << version.serverVersion << std::endl;
-		info["VOICE_VERSION"] = version_string.str();
-	}
-	else 
-	{
-		info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
-	}
-	
+	info["VIVOX_VERSION"] = gVoiceClient ? gVoiceClient->getAPIVersion() : LLTrans::getString("NotConnected");
+
 	// TODO: Implement media plugin version query
 	info["QT_WEBKIT_VERSION"] = "4.6 (version number hard-coded)";
 
@@ -287,14 +283,14 @@ LLSD LLFloaterAbout::getInfo()
 
 static std::string get_viewer_release_notes_url()
 {
-	// return a URL to the release notes for this viewer, such as:
-	// http://wiki.secondlife.com/wiki/Release_Notes/Second Life Beta Viewer/2.1.0
-	std::string url = LLTrans::getString("RELEASE_NOTES_BASE_URL");
-	if (! LLStringUtil::endsWith(url, "/"))
-		url += "/";
-	url += gSavedSettings.getString("VersionChannelName") + "/";
-	url += LLVersionInfo::getShortVersion();
-	return LLWeb::escapeURL(url);
+	LLSD query;
+	query["channel"] = gSavedSettings.getString("VersionChannelName");
+	query["version"] = LLVersionInfo::getVersion();
+
+	std::ostringstream url;
+	url << LLTrans::getString("RELEASE_NOTES_BASE_URL") << LLURI::mapToQueryString(query);
+
+	return LLWeb::escapeURL(url.str());
 }
 
 class LLFloaterAboutListener: public LLEventAPI
diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp
index 8e0b348037c5e207bf3e0a5c3d0d2dbfb54cfaf8..434c89e8bac429749926bcafc54a1112aec6bf03 100644
--- a/indra/newview/llfloateranimpreview.cpp
+++ b/indra/newview/llfloateranimpreview.cpp
@@ -2,25 +2,31 @@
  * @file llfloateranimpreview.cpp
  * @brief LLFloaterAnimPreview class implementation
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -995,19 +1001,18 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata)
 			{
 				std::string name = floaterp->childGetValue("name_form").asString();
 				std::string desc = floaterp->childGetValue("description_form").asString();
-				LLAssetStorage::LLStoreAssetCallback callback = NULL;
 				S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
-				void *userdata = NULL;
 				upload_new_resource(floaterp->mTransactionID, // tid
 						    LLAssetType::AT_ANIMATION,
 						    name,
 						    desc,
-						    0,
 						    LLFolderType::FT_NONE,
 						    LLInventoryType::IT_ANIMATION,
-						    LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
+						    LLFloaterPerms::getNextOwnerPerms(), 
+							LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
 						    name,
-						    callback, expected_upload_cost, userdata);
+						    NULL, 
+							expected_upload_cost);
 			}
 			else
 			{
@@ -1063,12 +1068,6 @@ LLPreviewAnimation::~LLPreviewAnimation()
 	mDummyAvatar->markDead();
 }
 
-//virtual
-S8 LLPreviewAnimation::getType() const
-{
-	return LLViewerDynamicTexture::LL_PREVIEW_ANIMATION ;
-}
-
 //-----------------------------------------------------------------------------
 // update()
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index 501cf4ce9915935303f0bd99b0f88ccaf036c4c4..2cb0cdf36896ad9bb1a31eacbde5012f8ce2566c 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file llfloateravatarpicker.cpp
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,8 +38,6 @@
 #include "llcallingcard.h"
 #include "llfocusmgr.h"
 #include "llfloaterreg.h"
-#include "llimview.h"			// for gIMMgr
-#include "lltooldraganddrop.h"	// for LLToolDragAndDrop
 #include "llviewercontrol.h"
 #include "llworld.h"
 
@@ -308,18 +312,6 @@ void LLFloaterAvatarPicker::populateFriend()
 
 void LLFloaterAvatarPicker::draw()
 {
-	// sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars).
-	// lets check this via mOkButtonValidateSignal callback periodically.
-	static LLFrameTimer timer;
-	if (timer.hasExpired())
-	{
-		timer.setTimerExpirySec(0.33f); // three times per second should be enough.
-
-		// simulate list changes.
-		onList();
-		timer.start();
-	}
-
 	LLFloater::draw();
 	if (!mNearMeListComplete && childGetVisibleTab("ResidentChooserTabs") == getChild<LLPanel>("NearMePanel"))
 	{
@@ -378,81 +370,6 @@ void LLFloaterAvatarPicker::setAllowMultiple(BOOL allow_multiple)
 	getChild<LLScrollListCtrl>("Friends")->setAllowMultipleSelection(allow_multiple);
 }
 
-LLScrollListCtrl* LLFloaterAvatarPicker::getActiveList()
-{
-	std::string acvtive_panel_name;
-	LLScrollListCtrl* list = NULL;
-	LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");
-	if(active_panel)
-	{
-		acvtive_panel_name = active_panel->getName();
-	}
-	if(acvtive_panel_name == "SearchPanel")
-	{
-		list = getChild<LLScrollListCtrl>("SearchResults");
-	}
-	else if(acvtive_panel_name == "NearMePanel")
-	{
-		list = getChild<LLScrollListCtrl>("NearMe");
-	}
-	else if (acvtive_panel_name == "FriendsPanel")
-	{
-		list = getChild<LLScrollListCtrl>("Friends");
-	}
-	return list;
-}
-
-BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask,
-											  BOOL drop, EDragAndDropType cargo_type,
-											  void *cargo_data, EAcceptance *accept,
-											  std::string& tooltip_msg)
-{
-	LLScrollListCtrl* list = getActiveList();
-	if(list)
-	{
-		LLRect rc_list;
-		LLRect rc_point(x,y,x,y);
-		if (localRectToOtherView(rc_point, &rc_list, list))
-		{
-			// Keep selected only one item
-			list->deselectAllItems(TRUE);
-			list->selectItemAt(rc_list.mLeft, rc_list.mBottom, mask);
-			LLScrollListItem* selection = list->getFirstSelected();
-			if (selection)
-			{
-				LLUUID session_id = LLUUID::null;
-				LLUUID dest_agent_id = selection->getUUID();
-				std::string avatar_name = selection->getColumn(0)->getValue().asString();
-				if (dest_agent_id.notNull() && dest_agent_id != gAgentID)
-				{
-					if (drop)
-					{
-						// Start up IM before give the item
-						session_id = gIMMgr->addSession(avatar_name, IM_NOTHING_SPECIAL, dest_agent_id);
-					}
-					return LLToolDragAndDrop::handleGiveDragAndDrop(dest_agent_id, session_id, drop,
-																	cargo_type, cargo_data, accept, getName());
-				}
-			}
-		}
-	}
-	*accept = ACCEPT_NO;
-	return TRUE;
-}
-
-
-void LLFloaterAvatarPicker::openFriendsTab()
-{
-	LLTabContainer* tab_container = getChild<LLTabContainer>("ResidentChooserTabs");
-	if (tab_container == NULL)
-	{
-		llassert(tab_container != NULL);
-		return;
-	}
-
-	tab_container->selectTabByName("FriendsPanel");
-}
-
 // static 
 void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void**)
 {
@@ -470,8 +387,8 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
 	
 	LLFloaterAvatarPicker* floater = LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker");
 
-	// floater is closed or these are not results from our last request
-	if (NULL == floater || query_id != floater->mQueryID)
+	// these are not results from our last request
+	if (query_id != floater->mQueryID)
 	{
 		return;
 	}
diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h
index b476e898e9e29eebee108807a24c9b60723ea398..860f3930ef45fb58fa79a37b3197dad33c5d234e 100644
--- a/indra/newview/llfloateravatarpicker.h
+++ b/indra/newview/llfloateravatarpicker.h
@@ -2,25 +2,31 @@
  * @file llfloateravatarpicker.h
  * @brief was llavatarpicker.h
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -31,8 +37,6 @@
 
 #include <vector>
 
-class LLScrollListCtrl;
-
 class LLFloaterAvatarPicker : public LLFloater
 {
 public:
@@ -55,13 +59,6 @@ class LLFloaterAvatarPicker : public LLFloater
 
 	static void processAvatarPickerReply(class LLMessageSystem* msg, void**);
 
-	BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
-						   BOOL drop, EDragAndDropType cargo_type,
-						   void *cargo_data, EAcceptance *accept,
-						   std::string& tooltip_msg);
-
-	void openFriendsTab();
-
 private:
 	void editKeystroke(class LLLineEditor* caller, void* user_data);
 
@@ -80,7 +77,6 @@ class LLFloaterAvatarPicker : public LLFloater
 
 	void find();
 	void setAllowMultiple(BOOL allow_multiple);
-	LLScrollListCtrl* getActiveList();
 
 	virtual void draw();
 	virtual BOOL handleKeyHere(KEY key, MASK mask);
diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp
index a6613968fb3192a5ab971e37b4e22c97cae418be..18db60705bb1c4a39bc3655271606a4a68eff05b 100644
--- a/indra/newview/llfloateravatartextures.cpp
+++ b/indra/newview/llfloateravatartextures.cpp
@@ -2,25 +2,31 @@
  * @file llfloateravatartextures.cpp
  * @brief Debugging view showing underlying avatar textures and baked textures.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,7 +38,7 @@
 #include "lltexturectrl.h"
 #include "lluictrlfactory.h"
 #include "llviewerobjectlist.h"
-#include "llvoavatarself.h"
+#include "llvoavatar.h"
 
 using namespace LLVOAvatarDefines;
 
@@ -76,17 +82,14 @@ static void update_texture_ctrl(LLVOAvatar* avatarp,
 	const LLVOAvatarDictionary::TextureEntry* tex_entry = LLVOAvatarDictionary::getInstance()->getTexture(te);
 	if (tex_entry->mIsLocalTexture)
 	{
-		if (avatarp->isSelf())
+		const EWearableType wearable_type = tex_entry->mWearableType;
+		LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
+		if (wearable)
 		{
-			const LLWearableType::EType wearable_type = tex_entry->mWearableType;
-			LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
-			if (wearable)
+			LLLocalTextureObject *lto = wearable->getLocalTextureObject(te);
+			if (lto)
 			{
-				LLLocalTextureObject *lto = wearable->getLocalTextureObject(te);
-				if (lto)
-				{
-					id = lto->getID();
-				}
+				id = lto->getID();
 			}
 		}
 	}
@@ -98,12 +101,12 @@ static void update_texture_ctrl(LLVOAvatar* avatarp,
 	if (id == IMG_DEFAULT_AVATAR)
 	{
 		ctrl->setImageAssetID(LLUUID::null);
-		ctrl->setToolTip(tex_entry->mName + " : " + std::string("IMG_DEFAULT_AVATAR"));
+		ctrl->setToolTip(std::string("IMG_DEFAULT_AVATAR"));
 	}
 	else
 	{
 		ctrl->setImageAssetID(id);
-		ctrl->setToolTip(tex_entry->mName + " : " + id.asString());
+		ctrl->setToolTip(id.asString());
 	}
 }
 
@@ -154,45 +157,40 @@ void LLFloaterAvatarTextures::onClickDump(void* data)
 {
 	if (gAgent.isGodlike())
 	{
-		const LLVOAvatarSelf* avatarp = gAgentAvatarp;
+		LLFloaterAvatarTextures* self = (LLFloaterAvatarTextures*)data;
+		LLVOAvatar* avatarp = find_avatar(self->mID);
 		if (!avatarp) return;
+
 		for (S32 i = 0; i < avatarp->getNumTEs(); i++)
 		{
 			const LLTextureEntry* te = avatarp->getTE(i);
 			if (!te) continue;
 
-			const LLVOAvatarDictionary::TextureEntry* tex_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)(i));
-			if (!tex_entry)
-				continue;
-
 			if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i))
 			{
 				LLUUID id = IMG_DEFAULT_AVATAR;
-				LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i);
-				if (avatarp->isSelf())
+				EWearableType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i);
+				LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
+				if (wearable)
 				{
-					LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
-					if (wearable)
+					LLLocalTextureObject *lto = wearable->getLocalTextureObject(i);
+					if (lto)
 					{
-						LLLocalTextureObject *lto = wearable->getLocalTextureObject(i);
-						if (lto)
-						{
-							id = lto->getID();
-						}
+						id = lto->getID();
 					}
 				}
 				if (id != IMG_DEFAULT_AVATAR)
 				{
-					llinfos << "TE " << i << " name:" << tex_entry->mName << " id:" << id << llendl;
+					llinfos << "Avatar TE " << i << " id " << id << llendl;
 				}
 				else
 				{
-					llinfos << "TE " << i << " name:" << tex_entry->mName << " id:" << "<DEFAULT>" << llendl;
+					llinfos << "Avatar TE " << i << " id " << "<DEFAULT>" << llendl;
 				}
 			}
 			else
 			{
-				llinfos << "TE " << i << " name:" << tex_entry->mName << " id:" << te->getID() << llendl;
+				llinfos << "Avatar TE " << i << " id " << te->getID() << llendl;
 			}
 		}
 	}
diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp
index 02c7a6da7e684ee1e14def052494c6da0d0ab327..766fc0723c314489a275758d2b63c7b3872671e0 100644
--- a/indra/newview/llfloaterbulkpermission.cpp
+++ b/indra/newview/llfloaterbulkpermission.cpp
@@ -3,25 +3,31 @@
  * @author Michelle2 Zenovka
  * @brief A floater which allows task inventory item's properties to be changed on mass.
  *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloaterbulkpermission.h b/indra/newview/llfloaterbulkpermission.h
index 7dd05df7ee15e0962b648d120b689671d787d8f6..80dc88fbb1bd413404830a1b4fbf3ce94ca365f7 100644
--- a/indra/newview/llfloaterbulkpermission.h
+++ b/indra/newview/llfloaterbulkpermission.h
@@ -3,25 +3,31 @@
  * @brief Allow multiple task inventory properties to be set in one go.
  * @author Michelle2 Zenovka
  *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index 616383f1a5e511915e0c815390a4a023ad2efef9..44c82f1941eadf62f0a72249e97867cedf5d2192 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -3,25 +3,31 @@
  * @author James Cook
  * @brief LLFloaterBuy class implementation
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -37,7 +43,7 @@
 #include "llagent.h"			// for agent id
 #include "llinventorymodel.h"	// for gInventory
 #include "llfloaterreg.h"
-#include "llinventoryicon.h"
+#include "llfloaterinventory.h"	// for get_item_icon
 #include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llnotificationsutil.h"
@@ -146,8 +152,9 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
 	LLSD row;
 
 	// Compute icon for this item
-	std::string icon_name = LLInventoryIcon::getIconName(LLAssetType::AT_OBJECT, 
-									 LLInventoryType::IT_OBJECT);
+	std::string icon_name = get_item_icon_name(LLAssetType::AT_OBJECT, 
+									 LLInventoryType::IT_OBJECT,
+									 0x0, FALSE);
 
 	row["columns"][0]["column"] = "icon";
 	row["columns"][0]["type"] = "icon";
@@ -246,7 +253,7 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
 			item_is_multi = TRUE;
 		}
 
-		std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(), 
+		std::string icon_name = get_item_icon_name(inv_item->getType(), 
 							 inv_item->getInventoryType(),
 							 inv_item->getFlags(),
 							 item_is_multi);
diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h
index 3ec642dee1652db7334df71716e6c2eb38be0932..411c8fb00e0a536515887930ffdc3577655d591c 100644
--- a/indra/newview/llfloaterbuy.h
+++ b/indra/newview/llfloaterbuy.h
@@ -3,25 +3,31 @@
  * @author James Cook
  * @brief LLFloaterBuy class definition
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index 405d318720c83579f2d6205461e94c007f1998ec..1d989ad0fd5bb2ac2f41cc86040cd66a15c87eb7 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -3,25 +3,31 @@
  * @author James Cook
  * @brief LLFloaterBuyContents class implementation
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -42,7 +48,7 @@
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"	// for gInventory
 #include "llfloaterreg.h"
-#include "llfloaterinventory.h"	// for LLInventoryIcon::getIcon
+#include "llfloaterinventory.h"	// for get_item_icon
 #include "llnotificationsutil.h"
 #include "llselectmgr.h"
 #include "llscrolllistctrl.h"
@@ -215,7 +221,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 			item_is_multi = TRUE;
 		}
 
-		std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(), 
+		std::string icon_name = get_item_icon_name(inv_item->getType(), 
 								 inv_item->getInventoryType(),
 								 inv_item->getFlags(),
 								 item_is_multi);
diff --git a/indra/newview/llfloaterbuycontents.h b/indra/newview/llfloaterbuycontents.h
index 19393fb6af4b4e60b65020bd172fd01b198c70e1..ab161adfeaee504c38a0f1fb548adb6e5fce7fe0 100644
--- a/indra/newview/llfloaterbuycontents.h
+++ b/indra/newview/llfloaterbuycontents.h
@@ -3,25 +3,31 @@
  * @author James Cook
  * @brief LLFloaterBuyContents class header file
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 3f9d1dc8e889cffa5f6885651a2ae7c09ced13e3..d37bc01885ffdf4b3d93e685cef15a836af71759 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -2,25 +2,31 @@
  * @file llfloaterbuyland.cpp
  * @brief LLFloaterBuyLand class implementation
  *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ * 
+ * Copyright (c) 2005-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -48,7 +54,6 @@
 #include "llstatusbar.h"
 #include "lltextbox.h"
 #include "lltexturectrl.h"
-#include "lltrans.h"
 #include "llviewchildren.h"
 #include "llviewercontrol.h"
 #include "lluictrlfactory.h"
@@ -662,7 +667,6 @@ void LLFloaterBuyLandUI::updateWebSiteInfo()
 	keywordArgs.appendString(
 		"secureSessionId",
 		gAgent.getSecureSessionID().asString());
-	keywordArgs.appendString("language", LLUI::getLanguage());
 	keywordArgs.appendInt("billableArea", mPreflightAskBillableArea);
 	keywordArgs.appendInt("currencyBuy", mPreflightAskCurrencyBuy);
 	
@@ -826,7 +830,7 @@ void LLFloaterBuyLandUI::updateNames()
 	else
 	{
 		mParcelSellerName =
-			LLSLURL("agent", parcelp->getOwnerID(), "inspect").getSLURLString();
+			LLSLURL::buildCommand("agent", parcelp->getOwnerID(), "inspect");
 	}
 }
 
@@ -855,7 +859,7 @@ void LLFloaterBuyLandUI::startTransaction(TransactionType type, const LLXMLRPCVa
 	static std::string transaction_uri;
 	if (transaction_uri.empty())
 	{
-		transaction_uri = LLGridManager::getInstance()->getHelperURI() + "landtool.php";
+		transaction_uri = LLViewerLogin::getInstance()->getHelperURI() + "landtool.php";
 	}
 	
 	const char* method;
@@ -1168,13 +1172,13 @@ void LLFloaterBuyLandUI::refreshUI()
 		
 		if (!mParcelValid)
 		{
-			message += LLTrans::getString("sentences_separator") + getString("no_parcel_selected");
+			message += getString("no_parcel_selected");
 		}
 		else if (mParcelBillableArea == mParcelActualArea)
 		{
 			LLStringUtil::format_map_t string_args;
 			string_args["[AMOUNT]"] = llformat("%d ", mParcelActualArea);
-			message += LLTrans::getString("sentences_separator") + getString("parcel_meters", string_args);
+			message += getString("parcel_meters", string_args);
 		}
 		else
 		{
@@ -1183,13 +1187,13 @@ void LLFloaterBuyLandUI::refreshUI()
 			{	
 				LLStringUtil::format_map_t string_args;
 				string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
-				message += LLTrans::getString("sentences_separator") + getString("premium_land", string_args);
+				message += getString("premium_land", string_args);
 			}
 			else
 			{
 				LLStringUtil::format_map_t string_args;
 				string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
-				message += LLTrans::getString("sentences_separator") + getString("discounted_land", string_args);
+				message += getString("discounted_land", string_args);
 			}
 		}
 
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
index c2c2e7fe22a5fc72fa9be7b1e6565b913c8f1cbe..cdb9b8edb869101fae9b577e322672c3095aa415 100644
--- a/indra/newview/llfloaterchat.cpp
+++ b/indra/newview/llfloaterchat.cpp
@@ -2,25 +2,31 @@
  * @file llfloaterchat.cpp
  * @brief LLFloaterChat class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -160,7 +166,7 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4&
 	if (chat.mSourceType == CHAT_SOURCE_AGENT &&
 		chat.mFromID != LLUUID::null)
 	{
-		chat.mURL = LLSLURL("agent", chat.mFromID, "inspect").getSLURLString();
+		chat.mURL = LLSLURL::buildCommand("agent", chat.mFromID, "inspect");
 	}
 
 	// If the chat line has an associated url, link it up to the name.
diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp
index dc33e45dd46e2e76673b079b348ae91e07b3b3f2..774caaec904ab635702536b4e9d0530f5b754ede 100644
--- a/indra/newview/llfloaterchatterbox.cpp
+++ b/indra/newview/llfloaterchatterbox.cpp
@@ -4,25 +4,31 @@
  * @date 2007-05-08
  * @brief Implementation of the chatterbox integrated conversation ui
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -312,7 +318,7 @@ LLFloaterChatterBox* LLFloaterChatterBox::getInstance()
 //static 
 LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater()
 {
-	if (!LLVoiceClient::getInstance()->voiceEnabled())
+	if (!LLVoiceClient::voiceEnabled())
 	{
 		return NULL;
 	}
diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp
index ade4492174377e8b3f96b455ff2016cb3bdba309..97ebab34258d7c495b48eaa7d63180a45d43a2b3 100644
--- a/indra/newview/llfloaterevent.cpp
+++ b/indra/newview/llfloaterevent.cpp
@@ -2,25 +2,31 @@
  * @file llfloaterevent.cpp
  * @brief Display for events in the finder
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -107,6 +113,7 @@ BOOL LLFloaterEvent::postBuild()
 	mTBDuration = getChild<LLTextBox>("event_duration");
 
 	mTBDesc = getChild<LLExpandableTextBox>("event_desc");
+	mTBDesc->setEnabled(FALSE);
 
 	mTBRunBy = getChild<LLTextBox>("event_runby");
 	mTBLocation = getChild<LLTextBox>("event_location");
@@ -186,7 +193,7 @@ void LLFloaterEvent::processEventInfoReply(LLMessageSystem *msg, void **)
 		floater->mTBCategory->setText(floater->mEventInfo.mCategoryStr);
 		floater->mTBDate->setText(floater->mEventInfo.mTimeStr);
 		floater->mTBDesc->setText(floater->mEventInfo.mDesc);
-		floater->mTBRunBy->setText(LLSLURL("agent", floater->mEventInfo.mRunByID, "inspect").getSLURLString());
+		floater->mTBRunBy->setText(LLSLURL::buildCommand("agent", floater->mEventInfo.mRunByID, "inspect"));
 
 		floater->mTBDuration->setText(llformat("%d:%.2d", floater->mEventInfo.mDuration / 60, floater->mEventInfo.mDuration % 60));
 
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index 989f32c7c1bf0cf2623b03534b2178e29c7d354b..8ee8d13a9c09959246cb038fe856ef5808620c0e 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -2,25 +2,31 @@
  * @file llfloatergesture.cpp
  * @brief Read-only list of gestures from your inventory.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -142,8 +148,7 @@ void LLFloaterGesture::done()
 		if (!unloaded_folders.empty())
 		{
 			LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL;
-			setFetchIDs(unloaded_folders);
-			startFetch();
+			fetch(unloaded_folders);
 		}
 		else
 		{
@@ -197,8 +202,7 @@ BOOL LLFloaterGesture::postBuild()
 	folders.push_back(mGestureFolderID);
 	//perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details.
 	gInventory.addObserver(this);
-	setFetchIDs(folders);
-	startFetch();
+	fetch(folders);
 
 	if (mGestureList)
 	{
diff --git a/indra/newview/llfloatergesture.h b/indra/newview/llfloatergesture.h
index 8efb3e6461a901d1f865543d7a72b8681837d4c5..1676542c7703ca336809dbcb8f35a9be58525daa 100644
--- a/indra/newview/llfloatergesture.h
+++ b/indra/newview/llfloatergesture.h
@@ -2,25 +2,31 @@
  * @file llfloatergesture.h
  * @brief Read-only list of gestures from your inventory.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index fa8d7a57d5efc681468182179a3b42a77dc1b3ad..bd07cfdfbfe4fc48f03eb7e9fad69a1524e0fbaf 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -2,25 +2,31 @@
  * @file llfloatergodtools.cpp
  * @brief The on-screen rectangle with tool options.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h
index 60fc95580fd99c9812dbf1f03ab79f3c118c59bb..aee9db78a352414c75ec2d2f44bd71c5a166dec7 100644
--- a/indra/newview/llfloatergodtools.h
+++ b/indra/newview/llfloatergodtools.h
@@ -2,25 +2,31 @@
  * @file llfloatergodtools.h
  * @brief The on-screen rectangle with tool options.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloatergroupinvite.cpp b/indra/newview/llfloatergroupinvite.cpp
index 49da4e64b3c512b054961f6c61d4d3d2d14f0de0..5d1864b4c848745e65525fda80af4dacc64d9907 100644
--- a/indra/newview/llfloatergroupinvite.cpp
+++ b/indra/newview/llfloatergroupinvite.cpp
@@ -2,25 +2,31 @@
  * @file llfloatergroupinvite.cpp
  * @brief Floater to invite new members into a group.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloatergroupinvite.h b/indra/newview/llfloatergroupinvite.h
index f6a3ca55509b6c2a7e6c2b3b50a9e7fb50c4f58d..68943724dfb10ff1958763fb85b473296b873f59 100644
--- a/indra/newview/llfloatergroupinvite.h
+++ b/indra/newview/llfloatergroupinvite.h
@@ -3,25 +3,31 @@
  * @brief This floater is just a wrapper for LLPanelGroupInvite, which
  * is used to invite members to a specific group
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp
index dda4e8124236ad039cd3a22b2f45db516c534ce9..100cbdb217f98965a8cea4afe43f2880b7392e13 100644
--- a/indra/newview/llfloaterlagmeter.cpp
+++ b/indra/newview/llfloaterlagmeter.cpp
@@ -2,25 +2,31 @@
  * @file llfloaterlagmeter.cpp
  * @brief The "Lag-o-Meter" floater used to tell users what is causing lag.
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 027a32c832bba9b0b917e43c9dda7da5d347b17e..2ff483cd34c805f600f84dc2117d2876a7343c92 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -2,25 +2,31 @@
  * @file llfloaterland.cpp
  * @brief "About Land" floater, allowing display and editing of land parcel properties.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -36,6 +42,7 @@
 #include "llnotificationsutil.h"
 #include "llparcel.h"
 #include "message.h"
+#include "lluserauth.h"
 
 #include "llagent.h"
 #include "llbutton.h"
@@ -52,7 +59,6 @@
 #include "llpanellandaudio.h"
 #include "llpanellandmedia.h"
 #include "llradiogroup.h"
-#include "llresmgr.h"					// getMonetaryString
 #include "llscrolllistctrl.h"
 #include "llscrolllistitem.h"
 #include "llscrolllistcell.h"
@@ -567,7 +573,7 @@ void LLPanelLandGeneral::refresh()
 		if (regionp)
 		{
 			insert_maturity_into_textbox(mContentRating, gFloaterView->getParentFloater(this), MATURITY);
-			mLandType->setText(LLTrans::getString(regionp->getSimProductName()));
+			mLandType->setText(regionp->getSimProductName());
 		}
 
 		// estate owner/manager cannot edit other parts of the parcel
@@ -641,12 +647,9 @@ void LLPanelLandGeneral::refresh()
 			}
 
 			// Display claim date
+			// *TODO:Localize (Time format may need Translating)
 			time_t claim_date = parcel->getClaimDate();
-			std::string claim_date_str = getString("time_stamp_template");
-			LLSD substitution;
-			substitution["datetime"] = (S32) claim_date;
-			LLStringUtil::format (claim_date_str, substitution);
-			mTextClaimDate->setText(claim_date_str);
+			mTextClaimDate->setText(formatted_time(claim_date));
 			mTextClaimDate->setEnabled(is_leased);
 
 			BOOL enable_auction = (gAgent.getGodLevel() >= GOD_LIAISON)
@@ -734,8 +737,7 @@ void LLPanelLandGeneral::refresh()
 				cost_per_sqm = (F32)parcel->getSalePrice() / (F32)area;
 			}
 
-			S32 price = parcel->getSalePrice();
-			mSaleInfoForSale1->setTextArg("[PRICE]", LLResMgr::getInstance()->getMonetaryString(price));
+			mSaleInfoForSale1->setTextArg("[PRICE]", llformat("%d", parcel->getSalePrice()));
 			mSaleInfoForSale1->setTextArg("[PRICE_PER_SQM]", llformat("%.1f", cost_per_sqm));
 			if (can_be_sold)
 			{
@@ -803,7 +805,7 @@ void LLPanelLandGeneral::refreshNames()
 	else
 	{
 		// Figure out the owner's name
-		owner = LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
+		owner = LLSLURL::buildCommand("agent", parcel->getOwnerID(), "inspect");
 	}
 
 	if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
@@ -815,7 +817,7 @@ void LLPanelLandGeneral::refreshNames()
 	std::string group;
 	if (!parcel->getGroupID().isNull())
 	{
-		group = LLSLURL("group", parcel->getGroupID(), "inspect").getSLURLString();
+		group = LLSLURL::buildCommand("group", parcel->getGroupID(), "inspect");
 	}
 	mTextGroup->setText(group);
 
@@ -824,9 +826,9 @@ void LLPanelLandGeneral::refreshNames()
 		const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
 		if(auth_buyer_id.notNull())
 		{
-		  std::string name;
-		  name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString();
-		  mSaleInfoForSale2->setTextArg("[BUYER]", name);
+			std::string name;
+			name = LLSLURL::buildCommand("agent", auth_buyer_id, "inspect");
+			mSaleInfoForSale2->setTextArg("[BUYER]", name);
 		}
 		else
 		{
@@ -1936,6 +1938,8 @@ BOOL LLPanelLandOptions::postBuild()
 	mLandingTypeCombo = getChild<LLComboBox>( "landing type");
 	childSetCommitCallback("landing type", onCommitAny, this);
 
+	getChild<LLTextureCtrl>("snapshot_ctrl")->setFallbackImageName("default_land_picture.j2c");
+
 	return TRUE;
 }
 
@@ -2082,8 +2086,7 @@ void LLPanelLandOptions::refresh()
 			LLStyle::Params style;
 			style.image(LLUI::getUIImage(gFloaterView->getParentFloater(this)->getString("maturity_icon_moderate")));
 			LLCheckBoxWithTBAcess* fullaccess_mature_ctrl = (LLCheckBoxWithTBAcess*)mMatureCtrl;
-			fullaccess_mature_ctrl->getTextBox()->setText(LLStringExplicit(""));
-			fullaccess_mature_ctrl->getTextBox()->appendImageSegment(style);
+			fullaccess_mature_ctrl->getTextBox()->setText(std::string("icon"),style);
 			fullaccess_mature_ctrl->getTextBox()->appendText(getString("mature_check_mature"), false);
 			fullaccess_mature_ctrl->setToolTip(getString("mature_check_mature_tooltip"));
 			fullaccess_mature_ctrl->reshape(fullaccess_mature_ctrl->getRect().getWidth(), fullaccess_mature_ctrl->getRect().getHeight(), FALSE);
@@ -3017,9 +3020,8 @@ void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_fl
 	std::string text_after_rating = str_to_parse.substr(maturity_pos + MATURITY.length());
 
 	target_textbox->setText(text_before_rating);
-
-	target_textbox->appendImageSegment(style);
-
+	// any text may be here instead of "icon" except ""
+	target_textbox->appendText(std::string("icon"), false, style);
 	target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false);
 	target_textbox->appendText(text_after_rating, false);
 }
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index 868b4cf29b4cb8dee7ff125bcfb83f7cbeafc5a3..0a743e5215c39b81904b3ae4b2170b963d106871 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -3,25 +3,31 @@
  * @author James Cook
  * @brief "About Land" floater, allowing display and editing of land parcel properties.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index 0f8b709f29dd4657206af1f323de1a5c468ffa08..5677899dd9515aac7bf2756b080132e8a3b4c477 100644
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -2,25 +2,31 @@
  * @file llfloatermap.cpp
  * @brief The "mini-map" or radar in the upper right part of the screen.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -48,10 +54,7 @@
 // Constants
 //
 const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f;
-const S32 MAP_PADDING_LEFT = 0;
-const S32 MAP_PADDING_TOP = 2;
-const S32 MAP_PADDING_RIGHT = 2;
-const S32 MAP_PADDING_BOTTOM = 0;
+
 //
 // Member functions
 //
@@ -103,9 +106,6 @@ BOOL LLFloaterMap::postBuild()
 		mPopupMenu->setItemEnabled ("Stop Tracking", false);
 	}
 
-	stretchMiniMap(getRect().getWidth() - MAP_PADDING_LEFT - MAP_PADDING_RIGHT
-		,getRect().getHeight() - MAP_PADDING_TOP - MAP_PADDING_BOTTOM);
-
 	updateMinorDirections();
 
 	// Get the drag handle all the way in back
@@ -229,26 +229,9 @@ void LLFloaterMap::onFocusLost()
 	LLPanel::onFocusLost();
 }
 
-void LLFloaterMap::stretchMiniMap(S32 width,S32 height)
-{
-	//fix for ext-7112
-	//by default ctrl can't overlap caption area
-	if(mMap)
-	{
-		LLRect map_rect;
-		map_rect.setLeftTopAndSize( MAP_PADDING_LEFT, getRect().getHeight() - MAP_PADDING_TOP, width, height);
-		mMap->reshape( width, height, 1);
-		mMap->setRect(map_rect);
-	}
-}
-
 void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
 	LLFloater::reshape(width, height, called_from_parent);
-	
-	stretchMiniMap(width - MAP_PADDING_LEFT - MAP_PADDING_RIGHT
-		,height - MAP_PADDING_TOP - MAP_PADDING_BOTTOM);
-
 	updateMinorDirections();
 }
 
@@ -278,15 +261,4 @@ void LLFloaterMap::handleStopTracking (const LLSD& userdata)
 		LLTracker::stopTracking ((void*)LLTracker::isTracking(NULL));
 	}
 }
-void	LLFloaterMap::setMinimized(BOOL b)
-{
-	LLFloater::setMinimized(b);
-	if(b)
-	{
-		setTitle(getString("mini_map_caption"));
-	}
-	else
-	{
-		setTitle("");
-	}
-}
+
diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h
index 4cbb48fb3e1989335f8a4975f0386797d37f7545..9ff2f031803ebce13fd74c9cf64714a9082cd6a4 100644
--- a/indra/newview/llfloatermap.h
+++ b/indra/newview/llfloatermap.h
@@ -2,25 +2,31 @@
  * @file llfloatermap.h
  * @brief The "mini-map" or radar in the upper right part of the screen.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -49,16 +55,12 @@ class LLFloaterMap : public LLFloater
 	/*virtual*/ void	draw();
 	/*virtual*/ void	onFocusLost();
 	/*virtual*/ void	onFocusReceived();
-
-	/*virtual*/ void	setMinimized(BOOL b);
 	
 private:
 	void handleZoom(const LLSD& userdata);
 	void handleStopTracking (const LLSD& userdata);
 	void setDirectionPos( LLTextBox* text_box, F32 rotation );
 	void updateMinorDirections();
-
-	void stretchMiniMap(S32 width,S32 height);
 	
 	LLMenuGL*		mPopupMenu;
 
diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp
index 8e92a20bc1c3760d681b8b5b4d09a7800396b6c3..71bfae316a53ca90c80cc3580ec69d64cce70154 100644
--- a/indra/newview/llfloateropenobject.cpp
+++ b/indra/newview/llfloateropenobject.cpp
@@ -2,25 +2,31 @@
  * @file llfloateropenobject.cpp
  * @brief LLFloaterOpenObject class implementation
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -99,23 +105,49 @@ void LLFloaterOpenObject::refresh()
 	mPanelInventoryObject->refresh();
 
 	std::string name = "";
-	BOOL enabled = FALSE;
+	
+	// Enable the copy || copy & wear buttons only if we have something we can copy or copy & wear (respectively).
+	bool copy_enabled = false;
+	bool wear_enabled = false;
 
 	LLSelectNode* node = mObjectSelection->getFirstRootNode();
 	if (node) 
 	{
 		name = node->mName;
-		enabled = TRUE;
-	}
-	else
-	{
-		name = "";
-		enabled = FALSE;
+		copy_enabled = true;
+		
+		LLViewerObject* object = node->getObject();
+		if (object)
+		{
+			// this folder is coming from an object, as there is only one folder in an object, the root,
+			// we need to collect the entire contents and handle them as a group
+			LLInventoryObject::object_list_t inventory_objects;
+			object->getInventoryContents(inventory_objects);
+			
+			if (!inventory_objects.empty())
+			{
+				for (LLInventoryObject::object_list_t::iterator it = inventory_objects.begin(); 
+					 it != inventory_objects.end(); 
+					 ++it)
+				{
+					LLInventoryItem* item = static_cast<LLInventoryItem*> ((LLInventoryObject*)(*it));
+					LLInventoryType::EType type = item->getInventoryType();
+					if (type == LLInventoryType::IT_OBJECT 
+						|| type == LLInventoryType::IT_ATTACHMENT 
+						|| type == LLInventoryType::IT_WEARABLE
+						|| type == LLInventoryType::IT_GESTURE)
+					{
+						wear_enabled = true;
+						break;
+					}
+				}
+			}
+		}
 	}
-	
+
 	childSetTextArg("object_name", "[DESC]", name);
-	childSetEnabled("copy_to_inventory_button", enabled);
-	childSetEnabled("copy_and_wear_button", enabled);
+	childSetEnabled("copy_to_inventory_button", copy_enabled);
+	childSetEnabled("copy_and_wear_button", wear_enabled);
 
 }
 
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index ee8836bb4702706e16d13601c8b5ec7269378b97..60ce16aafb33b91d035a01f900c6b62a62f670ae 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -2,25 +2,31 @@
  * @file llfloaterpreference.cpp
  * @brief Global preferences with and without persistence.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -64,7 +70,6 @@
 #include "llscrolllistctrl.h"
 #include "llscrolllistitem.h"
 #include "llsliderctrl.h"
-#include "llsidetray.h"
 #include "lltabcontainer.h"
 #include "lltrans.h"
 #include "llviewercontrol.h"
@@ -304,7 +309,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
 	mCommitCallbackRegistrar.add("Pref.applyUIColor",			boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2));
 	mCommitCallbackRegistrar.add("Pref.getUIColor",				boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2));
 	mCommitCallbackRegistrar.add("Pref.MaturitySettings",		boost::bind(&LLFloaterPreference::onChangeMaturity, this));
-	mCommitCallbackRegistrar.add("Pref.BlockList",				boost::bind(&LLFloaterPreference::onClickBlockList, this));
 
 	sSkin = gSavedSettings.getString("SkinCurrent");
 }
@@ -326,28 +330,9 @@ BOOL LLFloaterPreference::postBuild()
 	std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
 	childSetText("cache_location", cache_location);
 
-	// if floater is opened before login set default localized busy message
-	if (LLStartUp::getStartupState() < STATE_STARTED)
-	{
-		gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault"));
-	}
-
 	return TRUE;
 }
 
-void LLFloaterPreference::onBusyResponseChanged()
-{
-	// set "BusyResponseChanged" TRUE if user edited message differs from default, FALSE otherwise
-	if(LLTrans::getString("BusyModeResponseDefault") != getChild<LLUICtrl>("busy_response")->getValue().asString())
-	{
-		gSavedPerAccountSettings.setBOOL("BusyResponseChanged", TRUE );
-	}
-	else
-	{
-		gSavedPerAccountSettings.setBOOL("BusyResponseChanged", FALSE );
-	}
-}
-
 LLFloaterPreference::~LLFloaterPreference()
 {
 	// clean up user data
@@ -461,6 +446,8 @@ void LLFloaterPreference::apply()
 			gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility);
 		}
 	}
+
+	applyResolution();
 }
 
 void LLFloaterPreference::cancel()
@@ -500,22 +487,6 @@ void LLFloaterPreference::cancel()
 
 void LLFloaterPreference::onOpen(const LLSD& key)
 {
-	// this variable and if that follows it are used to properly handle busy mode response message
-	static bool initialized = FALSE;
-	// if user is logged in and we haven't initialized busy_response yet, do it
-	if (!initialized && LLStartUp::getStartupState() == STATE_STARTED)
-	{
-		// Special approach is used for busy response localization, because "BusyModeResponse" is
-		// in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized.
-		// To keep track of whether busy response is default or changed by user additional setting BusyResponseChanged
-		// was added into per account settings.
-
-		// initialization should happen once,so setting variable to TRUE
-		initialized = TRUE;
-		// this connection is needed to properly set "BusyResponseChanged" setting when user makes changes in
-		// busy response message.
-		gSavedPerAccountSettings.getControl("BusyModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onBusyResponseChanged, this));
-	}
 	gAgent.sendAgentUserInfoRequest();
 
 	/////////////////////////// From LLPanelGeneral //////////////////////////
@@ -530,7 +501,7 @@ void LLFloaterPreference::onOpen(const LLSD& key)
 	if (can_choose_maturity)
 	{		
 		// if they're not adult or a god, they shouldn't see the adult selection, so delete it
-		if (!gAgent.isAdult() && !gAgent.isGodlikeWithoutAdminMenuFakery())
+		if (!gAgent.isAdult() && !gAgent.isGodlike())
 		{
 			// we're going to remove the adult entry from the combo
 			LLScrollListCtrl* maturity_list = maturity_combo->findChild<LLScrollListCtrl>("ComboBox");
@@ -569,16 +540,6 @@ void LLFloaterPreference::onVertexShaderEnable()
 	refreshEnabledGraphics();
 }
 
-//static
-void LLFloaterPreference::initBusyResponse()
-	{
-		if (!gSavedPerAccountSettings.getBOOL("BusyResponseChanged"))
-		{
-			//LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885)
-			gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault"));
-		}
-	}
-
 void LLFloaterPreference::setHardwareDefaults()
 {
 	LLFeatureManager::getInstance()->applyRecommendedSettings();
@@ -638,7 +599,7 @@ void LLFloaterPreference::onBtnOK()
 		llinfos << "Can't close preferences!" << llendl;
 	}
 
-	LLPanelLogin::updateLocationCombo( false );
+	LLPanelLogin::refreshLocation( false );
 }
 
 // static 
@@ -655,7 +616,7 @@ void LLFloaterPreference::onBtnApply( )
 	apply();
 	saveSettings();
 
-	LLPanelLogin::updateLocationCombo( false );
+	LLPanelLogin::refreshLocation( false );
 }
 
 // static 
@@ -999,6 +960,18 @@ void LLFloaterPreference::onChangeQuality(const LLSD& data)
 	refresh();
 }
 
+// static
+// DEV-24146 -  needs to be removed at a later date. jan-2009
+void LLFloaterPreference::cleanupBadSetting()
+{
+	if (gSavedPerAccountSettings.getString("BusyModeResponse2") == "|TOKEN COPY BusyModeResponse|")
+	{
+		llwarns << "cleaning old BusyModeResponse" << llendl;
+		//LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885)
+		gSavedPerAccountSettings.setString("BusyModeResponse2", LLTrans::getString("BusyModeResponseDefault"));
+	}
+}
+
 void LLFloaterPreference::onClickSetKey()
 {
 	LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance<LLVoiceSetKeyDialog>("voice_set_key", LLSD(), TRUE);
@@ -1110,8 +1083,10 @@ void LLFloaterPreference::onClickLogPath()
 	{
 		return; //Canceled!
 	}
-
-	gSavedPerAccountSettings.setString("InstantMessageLogPath", picker.getDirName());
+	std::string chat_log_dir = picker.getDirName();
+	std::string chat_log_top_folder= gDirUtilp->getBaseFileName(chat_log_dir);
+	gSavedPerAccountSettings.setString("InstantMessageLogPath",chat_log_dir);
+	gSavedPerAccountSettings.setString("InstantMessageLogFolder",chat_log_top_folder);
 }
 
 void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email)
@@ -1207,6 +1182,31 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b
 	}
 }
 
+void LLFloaterPreference::applyResolution()
+{
+	gGL.flush();
+	
+	// Screen resolution
+	S32 num_resolutions;
+	LLWindow::LLWindowResolution* supported_resolutions = 
+	gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions);
+	S32 resIndex = getChild<LLComboBox>("fullscreen combo")->getCurrentIndex();
+	if (resIndex == -1)
+	{
+		// use highest resolution if nothing selected
+		resIndex = num_resolutions - 1;
+	}
+	gSavedSettings.setS32("FullScreenWidth", supported_resolutions[resIndex].mWidth);
+	gSavedSettings.setS32("FullScreenHeight", supported_resolutions[resIndex].mHeight);
+	
+	gViewerWindow->requestResolutionUpdate(gSavedSettings.getBOOL("WindowFullScreen"));
+	
+	send_agent_update(TRUE);
+	
+	// Update enable/disable
+	refresh();
+}
+
 void LLFloaterPreference::onChangeMaturity()
 {
 	U8 sim_access = gSavedSettings.getU32("PreferredMaturity");
@@ -1221,17 +1221,6 @@ void LLFloaterPreference::onChangeMaturity()
 	getChild<LLIconCtrl>("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT);
 }
 
-// FIXME: this will stop you from spawning the sidetray from preferences dialog on login screen
-// but the UI for this will still be enabled
-void LLFloaterPreference::onClickBlockList()
-{
-	// don't create side tray on demand
-	if (LLSideTray::instanceCreated())
-	{
-		LLSideTray::getInstance()->showPanel("panel_block_list_sidetray");
-	}
-}
-
 
 void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param)
 {
diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp
index ebe98eb2e1f012d63dd2ffbb7eee7e1c93cbfbec..bb9d151cd261b718bb00c08e651bcaaac19b4d65 100644
--- a/indra/newview/llfloaterproperties.cpp
+++ b/indra/newview/llfloaterproperties.cpp
@@ -2,25 +2,31 @@
  * @file llfloaterproperties.cpp
  * @brief A floater which shows an inventory item's properties.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -231,7 +237,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
 
 	// do not enable the UI for incomplete items.
 	LLViewerInventoryItem* i = (LLViewerInventoryItem*)item;
-	BOOL is_complete = i->isFinished();
+	BOOL is_complete = i->isComplete();
 	const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(i->getInventoryType());
 	const BOOL is_calling_card = (i->getInventoryType() == LLInventoryType::IT_CALLINGCARD);
 	const LLPermissions& perm = item->getPermissions();
@@ -677,7 +683,7 @@ void LLFloaterProperties::onCommitPermissions()
 							CheckNextOwnerTransfer->get(), PERM_TRANSFER);
 	}
 	if(perm != item->getPermissions()
-		&& item->isFinished())
+		&& item->isComplete())
 	{
 		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
 		new_item->setPermissions(perm);
@@ -807,7 +813,7 @@ void LLFloaterProperties::updateSaleInfo()
 		sale_info.setSaleType(LLSaleInfo::FS_NOT);
 	}
 	if(sale_info != item->getSaleInfo()
-		&& item->isFinished())
+		&& item->isComplete())
 	{
 		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
 
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index fa7a4a57591689f90a64a8ffc08daf989c9437a7..3758cbe74f41d90f8a2dde797c32413cb33e060d 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -3,25 +3,31 @@
  * @author Aaron Brashears
  * @brief Implementation of the region info and controls floater and panels.
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -2916,7 +2922,8 @@ bool LLDispatchEstateUpdateInfo::operator()(
 	LLUUID owner_id(strings[1]);
 	regionp->setOwner(owner_id);
 	// Update estate owner name in UI
-	std::string owner_name = LLSLURL("agent", owner_id, "inspect").getSLURLString();
+	std::string owner_name =
+		LLSLURL::buildCommand("agent", owner_id, "inspect");
 	panel->setOwnerName(owner_name);
 
 	U32 estate_id = strtoul(strings[2].c_str(), NULL, 10);
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 342ce535fe8d56e0d95b829306b289706681ba30..482ebb330308476f644fc4dd22c5ab4fef686247 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -3,25 +3,31 @@
  * @author Aaron Brashears
  * @brief Declaration of the region info and controls floater and panels.
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index da0301394cc5cebc2112ba927ab302440bef5d37..b42b34835d30f53cedec63594756a38b5cf86770 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -2,25 +2,31 @@
  * @file llfloaterreporter.cpp
  * @brief Abuse reports.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -120,9 +126,7 @@ void LLFloaterReporter::processRegionInfo(LLMessageSystem* msg)
 // virtual
 BOOL LLFloaterReporter::postBuild()
 {
-	LLSLURL slurl;
-	LLAgentUI::buildSLURL(slurl);
-	childSetText("abuse_location_edit", slurl.getSLURLString());
+	childSetText("abuse_location_edit", LLAgentUI::buildSLURL());
 
 	enableControls(TRUE);
 
@@ -276,6 +280,7 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
 				{
 					object_owner.append("Unknown");
 				}
+
 				setFromAvatar(mObjectID, object_owner);
 			}
 			else
@@ -320,8 +325,7 @@ void LLFloaterReporter::setFromAvatar(const LLUUID& avatar_id, const std::string
 	mAbuserID = mObjectID = avatar_id;
 	mOwnerName = avatar_name;
 
-	std::string avatar_link =
-	  LLSLURL("agent", mObjectID, "inspect").getSLURLString();
+	std::string avatar_link = LLSLURL::buildCommand("agent", mObjectID, "inspect");
 	childSetText("owner_name", avatar_link);
 	childSetText("object_name", avatar_name);
 	childSetText("abuser_name_edit", avatar_name);
@@ -500,7 +504,7 @@ void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name
 {
 	childSetText("object_name", object_name);
 	std::string owner_link =
-		LLSLURL("agent", owner_id, "inspect").getSLURLString();
+		LLSLURL::buildCommand("agent", owner_id, "inspect");
 	childSetText("owner_name", owner_link);
 	childSetText("abuser_name_edit", owner_name);
 	mAbuserID = owner_id;
@@ -562,7 +566,7 @@ LLSD LLFloaterReporter::gatherReport()
 	mCopyrightWarningSeen = FALSE;
 
 	std::ostringstream summary;
-	if (!LLGridManager::getInstance()->isInProductionGrid())
+	if (!LLViewerLogin::getInstance()->isInProductionGrid())
 	{
 		summary << "Preview ";
 	}
diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h
index 92e842d3180a5e74ffec85367ce18c4df931a802..23784b765079c12f22d18862331c67da6bd5a100 100644
--- a/indra/newview/llfloaterreporter.h
+++ b/indra/newview/llfloaterreporter.h
@@ -3,25 +3,31 @@
  * @author Andrew Meadows
  * @brief Abuse reports.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp
index c0c664496d1e95383ee075d44d76ea83a3a63154..4792d761d879845280627d27899d216105c3000d 100644
--- a/indra/newview/llfloaterscriptlimits.cpp
+++ b/indra/newview/llfloaterscriptlimits.cpp
@@ -3,25 +3,31 @@
  * @author Gabriel Lee
  * @brief Implementation of the region info and controls floater and panels.
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -551,6 +557,8 @@ BOOL LLPanelScriptLimitsRegionMemory::getLandScriptResources()
 
 void LLPanelScriptLimitsRegionMemory::processParcelInfo(const LLParcelData& parcel_data)
 {
+	mParcelId = parcel_data.parcel_id;
+
 	if(!getLandScriptResources())
 	{
 		std::string msg_error = LLTrans::getString("ScriptLimitsRequestError");
@@ -572,7 +580,6 @@ void LLPanelScriptLimitsRegionMemory::setParcelID(const LLUUID& parcel_id)
 			LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this);
 			mParcelId.setNull();
 		}
-		mParcelId = parcel_id;
 		LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this);
 		LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id);
 	}
diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp
index af97fb90e1a1c9f684b3a0d8c808f1b61044a1d9..980b4564975f959f80abdfeccb312bc8f8cc7839 100644
--- a/indra/newview/llfloatersellland.cpp
+++ b/indra/newview/llfloatersellland.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file llfloatersellland.cpp
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -88,6 +94,7 @@ class LLFloaterSellLandUI
 	static void doSellLand(void *userdata);
 	bool onConfirmSale(const LLSD& notification, const LLSD& response);
 	static void doShowObjects(void *userdata);
+	static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response);
 
 	void callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids);
 
@@ -95,7 +102,6 @@ class LLFloaterSellLandUI
 	virtual BOOL postBuild();
 	
 	bool setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel);
-	static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response);
 };
 
 // static
@@ -417,13 +423,11 @@ void LLFloaterSellLandUI::doShowObjects(void *userdata)
 
 	send_parcel_select_objects(parcel->getLocalID(), RT_SELL);
 
-	// we shouldn't pass callback functor since it is registered in LLFunctorRegistration
 	LLNotificationsUtil::add("TransferObjectsHighlighted",
-						LLSD(), LLSD());
+						LLSD(), LLSD(),
+						&LLFloaterSellLandUI::callbackHighlightTransferable);
 }
 
-static LLNotificationFunctorRegistration tr("TransferObjectsHighlighted", &LLFloaterSellLandUI::callbackHighlightTransferable);
-
 // static
 bool LLFloaterSellLandUI::callbackHighlightTransferable(const LLSD& notification, const LLSD& data)
 {
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index a5da861fb0be1b0b9d8b9d857aac9e9dd378dd15..03389e62d71084c9bc89f3a79ce92acf01e7da07 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -2,25 +2,31 @@
  * @file llfloatersnapshot.cpp
  * @brief Snapshot preview window, allowing saving, e-mailing, etc.
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -33,28 +39,33 @@
 // Viewer includes
 #include "llagent.h"
 #include "llagentcamera.h"
-#include "llcallbacklist.h"
-#include "llcriticaldamp.h"
-#include "llui.h"
-#include "llfocusmgr.h"
+#include "llagentui.h"
+#include "llavatarpropertiesprocessor.h"
+#include "llbottomtray.h"
 #include "llbutton.h"
+#include "llcallbacklist.h"
+#include "llcheckboxctrl.h"
 #include "llcombobox.h"
+#include "llcriticaldamp.h"
 #include "lleconomy.h"
+#include "llfloaterpostcard.h"
+#include "llfocusmgr.h"
+#include "lllandmarkactions.h"
+#include "llradiogroup.h"
 #include "llsliderctrl.h"
+#include "llslurl.h"
 #include "llspinctrl.h"
-#include "llviewercontrol.h"
+#include "lltoolfocus.h"
+#include "lltoolmgr.h"
+#include "llui.h"
 #include "lluictrlfactory.h"
-#include "llviewerstats.h"
 #include "llviewercamera.h"
-#include "llviewerwindow.h"
+#include "llviewercontrol.h"
 #include "llviewermenufile.h"	// upload_new_resource()
-#include "llfloaterpostcard.h"
-#include "llcheckboxctrl.h"
-#include "llradiogroup.h"
-#include "lltoolfocus.h"
-#include "lltoolmgr.h"
+#include "llviewerstats.h"
+#include "llviewerwindow.h"
+#include "llweb.h"
 #include "llworld.h"
-#include "llagentui.h"
 
 // Linden library includes
 #include "llfontgl.h"
@@ -108,6 +119,7 @@ class LLSnapshotLivePreview : public LLView
 	enum ESnapshotType
 	{
 		SNAPSHOT_POSTCARD,
+		SNAPSHOT_WEB,
 		SNAPSHOT_TEXTURE,
 		SNAPSHOT_LOCAL
 	};
@@ -156,8 +168,9 @@ class LLSnapshotLivePreview : public LLView
 	void setSnapshotBufferType(LLViewerWindow::ESnapshotType type) { mSnapshotBufferType = type; }
 	void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f);
 	LLFloaterPostcard* savePostcard();
-	void saveTexture();
+	void saveTexture(bool set_as_profile_pic = false);
 	BOOL saveLocal();
+	void saveWeb(std::string url);
 
 	BOOL setThumbnailImageSize() ;
 	void generateThumbnailImage(BOOL force_update = FALSE) ;
@@ -166,6 +179,9 @@ class LLSnapshotLivePreview : public LLView
 
 	// Returns TRUE when snapshot generated, FALSE otherwise.
 	static BOOL onIdle( void* snapshot_preview );
+	
+	// callback for region name resolve
+	void regionNameCallback(std::string url, LLSD body, const std::string& name, S32 x, S32 y, S32 z);
 
 private:
 	LLColor4					mColor;
@@ -287,7 +303,7 @@ F32 LLSnapshotLivePreview::getAspect()
 	F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]);
 	F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight());
 
-	if (!mKeepAspectRatio)//gSavedSettings.getBOOL("KeepAspectForSnapshot"))
+	if (!mKeepAspectRatio)
 	{
 		return image_aspect_ratio;
 	}
@@ -620,20 +636,20 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize()
 	F32 window_aspect_ratio = ((F32)window_width) / ((F32)window_height);
 
 	// UI size for thumbnail
-	S32 max_width = LLFloaterSnapshot::getUIWinWidth() - 20;
-	S32 max_height = 90;
+	LLFloater* floater = LLFloaterReg::getInstance("snapshot");
+	mThumbnailWidth = floater->getChild<LLView>("thumbnail_placeholder")->getRect().getWidth();
+	mThumbnailHeight = floater->getChild<LLView>("thumbnail_placeholder")->getRect().getHeight();
+
 
-	if (window_aspect_ratio > (F32)max_width / max_height)
+	if (window_aspect_ratio > (F32)mThumbnailWidth / mThumbnailHeight)
 	{
 		// image too wide, shrink to width
-		mThumbnailWidth = max_width;
-		mThumbnailHeight = llround((F32)max_width / window_aspect_ratio);
+		mThumbnailHeight = llround((F32)mThumbnailWidth / window_aspect_ratio);
 	}
 	else
 	{
 		// image too tall, shrink to height
-		mThumbnailHeight = max_height;
-		mThumbnailWidth = llround((F32)max_height * window_aspect_ratio);
+		mThumbnailWidth = llround((F32)mThumbnailHeight * window_aspect_ratio);
 	}
 	
 	if(mThumbnailWidth > window_width || mThumbnailHeight > window_height)
@@ -819,10 +835,21 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
 		{
 			// delete any existing image
 			previewp->mFormattedImage = NULL;
+
 			// now create the new one of the appropriate format.
-			// note: postcards hardcoded to use jpeg always.
-			LLFloaterSnapshot::ESnapshotFormat format = previewp->getSnapshotType() == SNAPSHOT_POSTCARD
-				? LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG : previewp->getSnapshotFormat();
+			// note: postcards and web hardcoded to use jpeg always.
+			LLFloaterSnapshot::ESnapshotFormat format;
+			
+			if (previewp->getSnapshotType() == SNAPSHOT_POSTCARD  || 
+				previewp->getSnapshotType() == SNAPSHOT_WEB)
+			{
+				format = LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG;
+			}
+			else
+			{
+				format = previewp->getSnapshotFormat();
+			}
+            			
 			switch(format)
 			{
 			case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG:
@@ -949,13 +976,21 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard()
 	return floater;
 }
 
-void LLSnapshotLivePreview::saveTexture()
+// Callback for asset upload
+void profile_pic_upload_callback(const LLUUID& uuid)
+{
+	LLFloaterSnapshot* floater =  LLFloaterReg::getTypedInstance<LLFloaterSnapshot>("snapshot");
+	floater->setAsProfilePic(uuid);
+}
+
+
+void LLSnapshotLivePreview::saveTexture(bool set_as_profile_pic)
 {
 	// gen a new uuid for this asset
 	LLTransactionID tid;
 	tid.generate();
 	LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
-		
+
 	LLPointer<LLImageJ2C> formatted = new LLImageJ2C;
 	LLPointer<LLImageRaw> scaled = new LLImageRaw(mPreviewImage->getData(),
 												  mPreviewImage->getWidth(),
@@ -966,26 +1001,30 @@ void LLSnapshotLivePreview::saveTexture()
 			
 	if (formatted->encode(scaled, 0.0f))
 	{
+		boost::function<void(const LLUUID& uuid)> callback = NULL;
+
+		if (set_as_profile_pic)
+		{
+			callback = profile_pic_upload_callback;
+		}
+
 		LLVFile::writeFile(formatted->getData(), formatted->getDataSize(), gVFS, new_asset_id, LLAssetType::AT_TEXTURE);
 		std::string pos_string;
 		LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL);
 		std::string who_took_it;
 		LLAgentUI::buildFullname(who_took_it);
-		LLAssetStorage::LLStoreAssetCallback callback = NULL;
 		S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
-		void *userdata = NULL;
 		upload_new_resource(tid,	// tid
 				    LLAssetType::AT_TEXTURE,
 				    "Snapshot : " + pos_string,
 				    "Taken by " + who_took_it + " at " + pos_string,
-				    0,
 				    LLFolderType::FT_SNAPSHOT_CATEGORY,
 				    LLInventoryType::IT_SNAPSHOT,
 				    PERM_ALL,  // Note: Snapshots to inventory is a special case of content upload
 				    PERM_NONE, // that ignores the user's premissions preferences and continues to
 				    PERM_NONE, // always use these fairly permissive hard-coded initial perms. - MG
 				    "Snapshot : " + pos_string,
-				    callback, expected_upload_cost, userdata);
+				    callback, expected_upload_cost);
 		gViewerWindow->playSnapshotAnimAndSound();
 	}
 	else
@@ -1015,6 +1054,81 @@ BOOL LLSnapshotLivePreview::saveLocal()
 	return success;
 }
 
+
+class LLSendWebResponder : public LLHTTPClient::Responder
+{
+public:
+	
+	virtual void error(U32 status, const std::string& reason)
+	{
+		llwarns << status << ": " << reason << llendl;
+		LLNotificationsUtil::add("ShareToWebFailed");
+	}
+	
+	virtual void result(const LLSD& content)
+	{
+		std::string response_url = content["response_url"].asString();
+
+		if (!response_url.empty())
+		{
+			LLWeb::loadURLExternal(response_url);
+		}
+		else
+		{
+			LLNotificationsUtil::add("ShareToWebFailed");
+		}
+	}
+
+};
+
+void LLSnapshotLivePreview::saveWeb(std::string url)
+{
+	if (url.empty())
+	{
+		llwarns << "No share to web url" << llendl;
+		return;
+	}
+
+	LLImageJPEG* jpg = dynamic_cast<LLImageJPEG*>(mFormattedImage.get());
+	if(!jpg)
+	{
+		llwarns << "Formatted image not a JPEG" << llendl;
+		return;
+	}
+	
+/* figure out if there's a better way to serialize */
+	LLSD body;
+	std::vector<U8> binary_image;
+	U8* data = jpg->getData();
+	for (int i = 0; i < jpg->getDataSize(); i++)
+	{
+		binary_image.push_back(data[i]);
+	}
+	
+	body["image"] = binary_image;
+
+	body["description"] = getChild<LLLineEditor>("description")->getText();
+
+	std::string name;
+	LLAgentUI::buildFullname(name);
+
+	body["avatar_name"] = name;
+	
+	LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(gAgentCamera.getCameraPositionGlobal(),
+		boost::bind(&LLSnapshotLivePreview::regionNameCallback, this, url, body, _1, _2, _3, _4));
+	
+	gViewerWindow->playSnapshotAnimAndSound();
+}
+
+
+void LLSnapshotLivePreview::regionNameCallback(std::string url, LLSD body, const std::string& name, S32 x, S32 y, S32 z)
+{
+	body["slurl"] = LLSLURL::buildSLURL(name, x, y, z);
+
+	LLHTTPClient::post(url, body,
+		new LLSendWebResponder());
+}
+
 ///----------------------------------------------------------------------------
 /// Class LLFloaterSnapshot::Impl
 ///----------------------------------------------------------------------------
@@ -1034,9 +1148,6 @@ class LLFloaterSnapshot::Impl
 		mAvatarPauseHandles.clear();
 
 	}
-	static void onClickDiscard(void* data);
-	static void onClickKeep(void* data);
-	static void onCommitSave(LLUICtrl* ctrl, void* data);
 	static void onClickNewSnapshot(void* data);
 	static void onClickAutoSnap(LLUICtrl *ctrl, void* data);
 	//static void onClickAdvanceSnap(LLUICtrl *ctrl, void* data);
@@ -1051,9 +1162,11 @@ class LLFloaterSnapshot::Impl
 	static void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE);
 	static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data);
 	static void onCommitLayerTypes(LLUICtrl* ctrl, void*data);
-	static void onCommitSnapshotType(LLUICtrl* ctrl, void* data);
 	static void onCommitSnapshotFormat(LLUICtrl* ctrl, void* data);
 	static void onCommitCustomResolution(LLUICtrl *ctrl, void* data);
+	static void onCommitSnapshot(LLFloaterSnapshot* view, LLSnapshotLivePreview::ESnapshotType type);
+	static void onCommitProfilePic(LLFloaterSnapshot* view);
+	static void onToggleAdvanced(LLUICtrl *ctrl, void* data);
 	static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ;
 	static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);
 
@@ -1061,10 +1174,8 @@ class LLFloaterSnapshot::Impl
 	static void setResolution(LLFloaterSnapshot* floater, const std::string& comboname);
 	static void updateControls(LLFloaterSnapshot* floater);
 	static void updateLayout(LLFloaterSnapshot* floater);
-	static void updateResolutionTextEntry(LLFloaterSnapshot* floater);
 
 private:
-	static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater);
 	static ESnapshotFormat getFormatIndex(LLFloaterSnapshot* floater);
 	static LLViewerWindow::ESnapshotType getLayerType(LLFloaterSnapshot* floater);
 	static void comboSetCustom(LLFloaterSnapshot *floater, const std::string& comboname);
@@ -1086,22 +1197,6 @@ LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot
 	return previewp;
 }
 
-// static
-LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFloaterSnapshot* floater)
-{
-	LLSnapshotLivePreview::ESnapshotType index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD;
-	LLSD value = floater->childGetValue("snapshot_type_radio");
-	const std::string id = value.asString();
-	if (id == "postcard")
-		index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD;
-	else if (id == "texture")
-		index = LLSnapshotLivePreview::SNAPSHOT_TEXTURE;
-	else if (id == "local")
-		index = LLSnapshotLivePreview::SNAPSHOT_LOCAL;
-	return index;
-}
-
-
 // static
 LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFloaterSnapshot* floater)
 {
@@ -1150,20 +1245,12 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
 {
 	LLSnapshotLivePreview* previewp = getPreviewView(floaterp);
 
-	S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : floaterp->getUIWinHeightShort() - floaterp->getUIWinHeightLong() ;
-
 	if(!gSavedSettings.getBOOL("AdvanceSnapshot")) //set to original window resolution
 	{
 		previewp->mKeepAspectRatio = TRUE;
 
-		floaterp->getChild<LLComboBox>("postcard_size_combo")->setCurrentByIndex(0);
-		gSavedSettings.setS32("SnapshotPostcardLastResolution", 0);
-
-		floaterp->getChild<LLComboBox>("texture_size_combo")->setCurrentByIndex(0);
-		gSavedSettings.setS32("SnapshotTextureLastResolution", 0);
-
-		floaterp->getChild<LLComboBox>("local_size_combo")->setCurrentByIndex(0);
-		gSavedSettings.setS32("SnapshotLocalLastResolution", 0);
+		floaterp->getChild<LLComboBox>("snapshot_size_combo")->setCurrentByIndex(0);
+		gSavedSettings.setS32("SnapshotLastResolution", 0);
 
 		LLSnapshotLivePreview* previewp = getPreviewView(floaterp);
 		previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
@@ -1176,9 +1263,6 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
 		// stop all mouse events at fullscreen preview layer
 		floaterp->getParent()->setMouseOpaque(TRUE);
 		
-		// shrink to smaller layout
-		floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height);
-
 		// can see and interact with fullscreen preview now
 		if (previewp)
 		{
@@ -1207,7 +1291,6 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
 	else // turning off freeze frame mode
 	{
 		floaterp->getParent()->setMouseOpaque(FALSE);
-		floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height);
 		if (previewp)
 		{
 			previewp->setVisible(FALSE);
@@ -1236,127 +1319,27 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
 // static
 void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
 {
-	LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio");
-	snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType"));
-	LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater);
-	ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); //getFormatIndex(floater);	LLViewerWindow::ESnapshotType layer_type = getLayerType(floater);
-	LLViewerWindow::ESnapshotType layer_type = getLayerType(floater);
-
-	floater->childSetVisible("postcard_size_combo", FALSE);
-	floater->childSetVisible("texture_size_combo", FALSE);
-	floater->childSetVisible("local_size_combo", FALSE);
-
-	floater->getChild<LLComboBox>("postcard_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution"));
-	floater->getChild<LLComboBox>("texture_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution"));
-	floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution"));
-	floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat"));
-
-	floater->childSetVisible("upload_btn",			shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE);
-	floater->childSetVisible("send_btn",			shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD);
-	floater->childSetVisible("save_btn",			shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL);
-	floater->childSetEnabled("keep_aspect_check",	shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff);
-	floater->childSetEnabled("layer_types",			shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL);
-
-	BOOL is_advance = gSavedSettings.getBOOL("AdvanceSnapshot");
-	BOOL is_local = shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL;
-	BOOL show_slider = 
-		shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD
-		|| (is_local && shot_format == LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG);
-
-	floater->childSetVisible("more_btn", !is_advance); // the only item hidden in advanced mode
-	floater->childSetVisible("less_btn",				is_advance);
-	floater->childSetVisible("type_label2",				is_advance);
-	floater->childSetVisible("format_label",			is_advance && is_local);
-	floater->childSetVisible("local_format_combo",		is_advance && is_local);
-	floater->childSetVisible("layer_types",				is_advance);
-	floater->childSetVisible("layer_type_label",		is_advance);
-	floater->childSetVisible("snapshot_width",			is_advance);
-	floater->childSetVisible("snapshot_height",			is_advance);
-	floater->childSetVisible("keep_aspect_check",		is_advance);
-	floater->childSetVisible("ui_check",				is_advance);
-	floater->childSetVisible("hud_check",				is_advance);
-	floater->childSetVisible("keep_open_check",			is_advance);
-	floater->childSetVisible("freeze_frame_check",		is_advance);
-	floater->childSetVisible("auto_snapshot_check",		is_advance);
-	floater->childSetVisible("image_quality_slider",	is_advance && show_slider);
-
 	LLSnapshotLivePreview* previewp = getPreviewView(floater);
-	BOOL got_bytes = previewp && previewp->getDataSize() > 0;
-	BOOL got_snap = previewp && previewp->getSnapshotUpToDate();
-
-	floater->childSetEnabled("send_btn",   shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && got_snap && previewp->getDataSize() <= MAX_POSTCARD_DATASIZE);
-	floater->childSetEnabled("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE  && got_snap);
-	floater->childSetEnabled("save_btn",   shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL    && got_snap);
-
-	LLLocale locale(LLLocale::USER_LOCALE);
-	std::string bytes_string;
-	if (got_snap)
-	{
-		LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 );
-	}
-	S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
-	floater->childSetLabelArg("texture", "[AMOUNT]", llformat("%d",upload_cost));
-	floater->childSetLabelArg("upload_btn", "[AMOUNT]", llformat("%d",upload_cost));
-	floater->childSetTextArg("file_size_label", "[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
-	floater->childSetColor("file_size_label", 
-		shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD 
-		&& got_bytes
-		&& previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" ));
-
-	switch(shot_type)
-	{
-	  case LLSnapshotLivePreview::SNAPSHOT_POSTCARD:
-		layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
-		floater->childSetValue("layer_types", "colors");
-		if(is_advance)
-		{			
-			setResolution(floater, "postcard_size_combo");
-		}
-		break;
-	  case LLSnapshotLivePreview::SNAPSHOT_TEXTURE:
-		layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
-		floater->childSetValue("layer_types", "colors");
-		if(is_advance)
-		{
-			setResolution(floater, "texture_size_combo");			
-		}
-		break;
-	  case  LLSnapshotLivePreview::SNAPSHOT_LOCAL:
-		if(is_advance)
-		{
-			setResolution(floater, "local_size_combo");
-		}
-		break;
-	  default:
-		break;
+	if (NULL == previewp)
+	{
+		return;
 	}
 
-	updateResolutionTextEntry(floater);
+	// Disable buttons until Snapshot is ready. EXT-6534
+	BOOL got_snap = previewp->getSnapshotUpToDate();
 
-	if (previewp)
-	{
-		previewp->setSnapshotType(shot_type);
-		previewp->setSnapshotFormat(shot_format);
-		previewp->setSnapshotBufferType(layer_type);
-	}
-}
+	// process Main buttons
+	floater->childSetEnabled("share", got_snap);
+	floater->childSetEnabled("save", got_snap);
+	floater->childSetEnabled("set_profile_pic", got_snap);
 
-// static
-void LLFloaterSnapshot::Impl::updateResolutionTextEntry(LLFloaterSnapshot* floater)
-{
-	LLSpinCtrl* width_spinner = floater->getChild<LLSpinCtrl>("snapshot_width");
-	LLSpinCtrl* height_spinner = floater->getChild<LLSpinCtrl>("snapshot_height");
+	// process Share actions buttons
+	floater->childSetEnabled("share_to_web", got_snap);
+	floater->childSetEnabled("share_to_email", got_snap);
 
-	if(getTypeIndex(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
-	{
-		width_spinner->setAllowEdit(FALSE);
-		height_spinner->setAllowEdit(FALSE);
-	}
-	else
-	{
-		width_spinner->setAllowEdit(TRUE);
-		height_spinner->setAllowEdit(TRUE);
-	}
+	// process Save actions buttons
+	floater->childSetEnabled("save_to_inventory", got_snap);
+	floater->childSetEnabled("save_to_computer", got_snap);
 }
 
 // static
@@ -1369,70 +1352,6 @@ void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp,
 	}
 }
 
-// static
-void LLFloaterSnapshot::Impl::onClickDiscard(void* data)
-{
-	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
-	
-	if (view)
-	{
-		view->closeFloater();
-	}
-}
-
-
-// static
-void LLFloaterSnapshot::Impl::onCommitSave(LLUICtrl* ctrl, void* data)
-{
-	if (ctrl->getValue().asString() == "save as")
-	{
-		gViewerWindow->resetSnapshotLoc();
-	}
-	onClickKeep(data);
-}
-
-// static
-void LLFloaterSnapshot::Impl::onClickKeep(void* data)
-{
-	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
-	LLSnapshotLivePreview* previewp = getPreviewView(view);
-	
-	if (previewp)
-	{
-		if (previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_POSTCARD)
-		{
-			LLFloaterPostcard* floater = previewp->savePostcard();
-			// if still in snapshot mode, put postcard floater in snapshot floaterview
-			// and link it to snapshot floater
-			if (floater && !gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
-			{
-				gFloaterView->removeChild(floater);
-				gSnapshotFloaterView->addChild(floater);
-				view->addDependentFloater(floater, FALSE);
-			}
-		}
-		else if (previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
-		{
-			previewp->saveTexture();
-		}
-		else
-		{
-			previewp->saveLocal();
-		}
-
-		if (gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
-		{
-			view->closeFloater();
-		}
-		else
-		{
-			checkAutoSnapshot(previewp);
-		}
-
-		updateControls(view);
-	}
-}
-
 // static
 void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data)
 {
@@ -1669,10 +1588,8 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
 	}
 
 	// save off all selected resolution values
-	gSavedSettings.setS32("SnapshotPostcardLastResolution", view->getChild<LLComboBox>("postcard_size_combo")->getCurrentIndex());
-	gSavedSettings.setS32("SnapshotTextureLastResolution",  view->getChild<LLComboBox>("texture_size_combo")->getCurrentIndex());
-	gSavedSettings.setS32("SnapshotLocalLastResolution",    view->getChild<LLComboBox>("local_size_combo")->getCurrentIndex());
-
+	gSavedSettings.setS32("SnapshotLastResolution", view->getChild<LLComboBox>("snapshot_size_combo")->getCurrentIndex());
+	
 	std::string sdstring = combobox->getSelectedValue();
 	LLSD sdres;
 	std::stringstream sstream(sdstring);
@@ -1752,17 +1669,130 @@ void LLFloaterSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data)
 }
 
 //static 
-void LLFloaterSnapshot::Impl::onCommitSnapshotType(LLUICtrl* ctrl, void* data)
+void LLFloaterSnapshot::Impl::onToggleAdvanced(LLUICtrl* ctrl, void* data)
 {
-	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;		
-	if (view)
+	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+
+	LLPanel* advanced_panel = view->getChild<LLPanel>("snapshot_advanced");
+
+	if (advanced_panel->getVisible())
 	{
-		gSavedSettings.setS32("LastSnapshotType", getTypeIndex(view));
-		getPreviewView(view)->updateSnapshot(TRUE);
-		updateControls(view);
+		advanced_panel->setVisible(false);
+
+		// shrink floater back to original size
+		view->reshape(view->getRect().getWidth() - advanced_panel->getRect().getWidth(), view->getRect().getHeight());
+
+		view->getChild<LLButton>("hide_advanced")->setVisible(false);
+		view->getChild<LLButton>("show_advanced")->setVisible(true);
+	}
+	else
+	{
+		advanced_panel->setVisible(true);
+		// stretch the floater so it can accommodate the advanced panel
+		view->reshape(view->getRect().getWidth() + advanced_panel->getRect().getWidth(), view->getRect().getHeight());
+
+		view->getChild<LLButton>("hide_advanced")->setVisible(true);
+		view->getChild<LLButton>("show_advanced")->setVisible(false);
 	}
 }
 
+// This object represents a pending request for avatar properties information
+class LLAvatarDataRequest : public LLAvatarPropertiesObserver
+{
+public:
+	LLAvatarDataRequest(const LLUUID& avatar_id, const LLUUID& image_id, LLFloaterSnapshot* floater)
+	:	mAvatarID(avatar_id),
+		mImageID(image_id),
+		mSnapshotFloater(floater)
+
+	{
+	}
+	
+	~LLAvatarDataRequest()
+	{
+		// remove ourselves as an observer
+		LLAvatarPropertiesProcessor::getInstance()->
+		removeObserver(mAvatarID, this);
+	}
+	
+	void processProperties(void* data, EAvatarProcessorType type)
+	{
+		// route the data to the inspector
+		if (data
+			&& type == APT_PROPERTIES)
+		{
+
+			LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
+
+			LLAvatarData new_data(*avatar_data);
+			new_data.image_id = mImageID;
+
+			LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&new_data);
+
+			delete this;
+		}
+	}
+	
+	// Store avatar ID so we can un-register the observer on destruction
+	LLUUID mAvatarID;
+	LLUUID mImageID;
+	LLFloaterSnapshot* mSnapshotFloater;
+};
+
+void LLFloaterSnapshot::Impl::onCommitProfilePic(LLFloaterSnapshot* view)
+{
+	//first save to harddrive
+	LLSnapshotLivePreview* previewp = getPreviewView(view);
+	
+	if(previewp)
+	{
+		previewp->saveTexture(true);
+	}
+}
+
+void LLFloaterSnapshot::Impl::onCommitSnapshot(LLFloaterSnapshot* view, LLSnapshotLivePreview::ESnapshotType type)
+{
+	LLSnapshotLivePreview* previewp = getPreviewView(view);
+	
+	if (previewp)
+	{
+		previewp->setSnapshotType(type);
+
+		if (type == LLSnapshotLivePreview::SNAPSHOT_WEB)
+		{
+			previewp->saveWeb(view->getString("share_to_web_url"));
+		}
+		else if (type == LLSnapshotLivePreview::SNAPSHOT_LOCAL)
+		{
+			previewp->saveLocal();
+		}
+		else if (type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
+		{
+			previewp->saveTexture();
+		}
+		else if (type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD)
+		{
+			LLFloaterPostcard* floater = previewp->savePostcard();
+			// if still in snapshot mode, put postcard floater in snapshot floaterview
+			// and link it to snapshot floater
+			if (floater && !gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
+			{
+				gFloaterView->removeChild(floater);
+				gSnapshotFloaterView->addChild(floater);
+				view->addDependentFloater(floater, FALSE);
+			}
+		}
+
+		if (gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
+		{
+			view->closeFloater();
+		}
+		else
+		{
+			checkAutoSnapshot(previewp);
+		}
+	}
+}
 
 //static 
 void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data)
@@ -1776,8 +1806,6 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data)
 	}
 }
 
-
-
 // Sets the named size combo to "custom" mode.
 // static
 void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname)
@@ -1786,24 +1814,11 @@ void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const s
 
 	combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index
 
-	if(comboname == "postcard_size_combo") 
-	{
-		gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex());
-	}
-	else if(comboname == "texture_size_combo") 
-	{
-		gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex());
-	}
-	else if(comboname == "local_size_combo") 
-	{
-		gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex());
-	}
+	gSavedSettings.setS32("SnapshotLastResolution", combo->getCurrentIndex());
 
 	checkAspectRatio(floater, -1); // -1 means custom
 }
 
-
-
 //static
 BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)
 {
@@ -1944,9 +1959,7 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat
 				previewp->setSize(w,h);
 				checkAutoSnapshot(previewp, FALSE);
 				previewp->updateSnapshot(FALSE, TRUE);
-				comboSetCustom(view, "postcard_size_combo");
-				comboSetCustom(view, "texture_size_combo");
-				comboSetCustom(view, "local_size_combo");
+				comboSetCustom(view, "snapshot_size_combo");
 			}
 		}
 
@@ -1963,7 +1976,7 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat
 
 // Default constructor
 LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key)
-	: LLFloater(key),
+	: LLTransientDockableFloater(NULL, true, key),
 	  impl (*(new Impl))
 {
 	//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_snapshot.xml", FALSE);
@@ -1988,7 +2001,20 @@ LLFloaterSnapshot::~LLFloaterSnapshot()
 
 BOOL LLFloaterSnapshot::postBuild()
 {
-	childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this);
+
+	getChild<LLButton>("share")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_SHARE));
+	getChild<LLButton>("save")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_SAVE));
+	getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_MAIN));
+
+	getChild<LLButton>("share_to_web")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_WEB));
+	getChild<LLButton>("share_to_email")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_POSTCARD));
+	getChild<LLButton>("save_to_inventory")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_TEXTURE));
+	getChild<LLButton>("save_to_computer")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_LOCAL));
+	getChild<LLButton>("set_profile_pic")->setCommitCallback(boost::bind(&Impl::onCommitProfilePic, this));
+
+	childSetCommitCallback("show_advanced", Impl::onToggleAdvanced, this);
+	childSetCommitCallback("hide_advanced", Impl::onToggleAdvanced, this);
+
 	childSetCommitCallback("local_format_combo", Impl::onCommitSnapshotFormat, this);
 	
 	childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this);
@@ -1996,11 +2022,6 @@ BOOL LLFloaterSnapshot::postBuild()
 	childSetAction("more_btn", Impl::onClickMore, this);
 	childSetAction("less_btn", Impl::onClickLess, this);
 
-	childSetAction("upload_btn", Impl::onClickKeep, this);
-	childSetAction("send_btn", Impl::onClickKeep, this);
-	childSetCommitCallback("save_btn", Impl::onCommitSave, this);
-	childSetAction("discard_btn", Impl::onClickDiscard, this);
-
 	childSetCommitCallback("image_quality_slider", Impl::onCommitQuality, this);
 	childSetValue("image_quality_slider", gSavedSettings.getS32("SnapshotQuality"));
 
@@ -2021,7 +2042,6 @@ BOOL LLFloaterSnapshot::postBuild()
 
 	childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this);
 	childSetValue("layer_types", "colors");
-	childSetEnabled("layer_types", FALSE);
 
 	childSetValue("snapshot_width", gSavedSettings.getS32(lastSnapshotWidthName()));
 	childSetValue("snapshot_height", gSavedSettings.getS32(lastSnapshotHeightName()));
@@ -2032,9 +2052,7 @@ BOOL LLFloaterSnapshot::postBuild()
 	childSetValue("auto_snapshot_check", gSavedSettings.getBOOL("AutoSnapshot"));
 	childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this);
 
-	childSetCommitCallback("postcard_size_combo", Impl::onCommitResolution, this);
-	childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this);
-	childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this);
+	childSetCommitCallback("snapshot_size_combo", Impl::onCommitResolution, this);
 
 	// create preview window
 	LLRect full_screen_rect = getRootView()->getRect();
@@ -2055,8 +2073,14 @@ BOOL LLFloaterSnapshot::postBuild()
 	impl.mPreviewHandle = previewp->getHandle();
 	impl.updateControls(this);
 	impl.updateLayout(this);
+
+	//save off the refresh button's rectangle so we can apply offsets with thumbnail resize 
+	mRefreshBtnRect = getChild<LLButton>("new_snapshot_btn")->getRect();
+
+	// make sure we share/hide the general buttons 
+	updateButtons(SNAPSHOT_MAIN);
 	
-	return TRUE;
+	return LLDockableFloater::postBuild();
 }
 
 void LLFloaterSnapshot::draw()
@@ -2069,15 +2093,19 @@ void LLFloaterSnapshot::draw()
 		return;
 	}
 
-	LLFloater::draw();
+	LLDockableFloater::draw();
+
+	LLButton* refresh_btn = getChild<LLButton>("new_snapshot_btn");
+	// revert the refresh button to original intended position
+	LLRect refresh_rect = mRefreshBtnRect;
 
 	if (previewp)
 	{		
 		if(previewp->getThumbnailImage())
 		{
-			LLRect thumbnail_rect = getChild<LLUICtrl>("thumbnail_placeholder")->getRect();
+			LLRect thumbnail_rect = getChild<LLView>("thumbnail_placeholder")->getRect();
 
-			S32 offset_x = (getRect().getWidth() - previewp->getThumbnailWidth()) / 2 ;
+			S32 offset_x = (thumbnail_rect.getWidth() - previewp->getThumbnailWidth()) / 2 + thumbnail_rect.mLeft;
 			S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ;
 
 			glMatrixMode(GL_MODELVIEW);
@@ -2086,8 +2114,14 @@ void LLFloaterSnapshot::draw()
 					previewp->getThumbnailImage(), LLColor4::white);	
 
 			previewp->drawPreviewRect(offset_x, offset_y) ;
+
+			refresh_rect.translate(offset_x - thumbnail_rect.mLeft, offset_y - thumbnail_rect.mBottom);
 		}
 	}
+
+	refresh_btn->setRect(refresh_rect);
+	drawChild(refresh_btn);
+	
 }
 
 void LLFloaterSnapshot::onOpen(const LLSD& key)
@@ -2101,6 +2135,12 @@ void LLFloaterSnapshot::onOpen(const LLSD& key)
 	gSnapshotFloaterView->setEnabled(TRUE);
 	gSnapshotFloaterView->setVisible(TRUE);
 	gSnapshotFloaterView->adjustToFitScreen(this, FALSE);
+
+	LLButton *snapshots = LLBottomTray::getInstance()->getChild<LLButton>("snapshots");
+
+	setDockControl(new LLDockControl(
+		snapshots, this,
+		getDockTongue(), LLDockControl::TOP));
 }
 
 void LLFloaterSnapshot::onClose(bool app_quitting)
@@ -2128,6 +2168,33 @@ void LLFloaterSnapshot::update()
 	}
 }
 
+bool LLFloaterSnapshot::updateButtons(ESnapshotMode mode)
+{
+	childSetVisible("share", mode == SNAPSHOT_MAIN);
+	childSetVisible("save", mode == SNAPSHOT_MAIN);
+	childSetVisible("set_profile_pic", mode == SNAPSHOT_MAIN);
+
+	childSetVisible("share_to_web", mode == SNAPSHOT_SHARE);
+	childSetVisible("share_to_email", mode == SNAPSHOT_SHARE);
+
+	childSetVisible("save_to_inventory", mode == SNAPSHOT_SAVE);
+	childSetVisible("save_to_computer", mode == SNAPSHOT_SAVE);
+
+	childSetVisible("cancel", mode != SNAPSHOT_MAIN);	
+
+	return true;
+}
+
+void LLFloaterSnapshot::setAsProfilePic(const LLUUID& image_id)
+{
+	LLAvatarDataRequest* avatar_data_request = new LLAvatarDataRequest(gAgent.getID(), image_id, this);
+	
+	LLAvatarPropertiesProcessor* processor = 
+		LLAvatarPropertiesProcessor::getInstance();
+	
+	processor->addObserver(gAgent.getID(), avatar_data_request);
+	processor->sendAvatarPropertiesRequest(gAgent.getID());
+}
 
 ///----------------------------------------------------------------------------
 /// Class LLSnapshotFloaterView
diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp
index 41869ac62b5383dafff17898868ff732efe2bcce..84ea353dabe3c9eb0bbd14e9221bf0bd2be31b6c 100644
--- a/indra/newview/llfloatertopobjects.cpp
+++ b/indra/newview/llfloatertopobjects.cpp
@@ -2,25 +2,31 @@
  * @file llfloatertopobjects.cpp
  * @brief Shows top colliders, top scripts, etc.
  *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ * 
+ * Copyright (c) 2005-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h
index a608ca20f16a93754e3b70fc6bc504c24054b3a4..8fb89a3cc58007409eb144169d3d244b82ae69d7 100644
--- a/indra/newview/llfloatertopobjects.h
+++ b/indra/newview/llfloatertopobjects.h
@@ -2,25 +2,31 @@
  * @file llfloatertopobjects.h
  * @brief Shows top colliders or top scripts
  *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ * 
+ * Copyright (c) 2005-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp
index 6e64291240e47322dc7df1de04dde0c00882b017..3db9587797d590b08bb23dbaa88111b9a005b0b1 100644
--- a/indra/newview/llfloatertos.cpp
+++ b/indra/newview/llfloatertos.cpp
@@ -2,25 +2,31 @@
  * @file llfloatertos.cpp
  * @brief Terms of Service Agreement dialog
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -138,6 +144,9 @@ BOOL LLFloaterTOS::postBuild()
 		// Don't use the start_url parameter for this browser instance -- it may finish loading before we get to add our observer.
 		// Store the URL separately and navigate here instead.
 		web_browser->navigateTo( getString( "loading_url" ) );
+		
+		gResponsePtr = LLIamHere::build( this );
+		LLHTTPClient::get( getString( "real_url" ), gResponsePtr );
 	}
 
 	return TRUE;
@@ -154,19 +163,10 @@ void LLFloaterTOS::setSiteIsAlive( bool alive )
 		if ( alive )
 		{
 			// navigate to the "real" page 
-			if(!mRealNavigateBegun && mSiteAlive)
-			{
-				LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
-				if(web_browser)
-				{
-					mRealNavigateBegun = true;
-					web_browser->navigateTo( getString( "real_url" ) );
-				}
-			}
+			loadIfNeeded();
 		}
 		else
 		{
-			LL_INFOS("TOS") << "ToS page: ToS page unavailable!" << LL_ENDL;
 			// normally this is set when navigation to TOS page navigation completes (so you can't accept before TOS loads)
 			// but if the page is unavailable, we need to do this now
 			LLCheckBoxCtrl* tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk");
@@ -175,8 +175,22 @@ void LLFloaterTOS::setSiteIsAlive( bool alive )
 	}
 }
 
+void LLFloaterTOS::loadIfNeeded()
+{
+	if(!mRealNavigateBegun && mSiteAlive)
+	{
+		LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
+		if(web_browser)
+		{
+			mRealNavigateBegun = true;
+			web_browser->navigateTo( getString( "real_url" ) );
+		}
+	}
+}
+
 LLFloaterTOS::~LLFloaterTOS()
 {
+
 	// tell the responder we're not here anymore
 	if ( gResponsePtr )
 		gResponsePtr->setParent( 0 );
@@ -201,7 +215,7 @@ void LLFloaterTOS::updateAgree(LLUICtrl*, void* userdata )
 void LLFloaterTOS::onContinue( void* userdata )
 {
 	LLFloaterTOS* self = (LLFloaterTOS*) userdata;
-	LL_INFOS("TOS") << "User agrees with TOS." << LL_ENDL;
+	llinfos << "User agrees with TOS." << llendl;
 
 	if(self->mReplyPumpName != "")
 	{
@@ -215,7 +229,7 @@ void LLFloaterTOS::onContinue( void* userdata )
 void LLFloaterTOS::onCancel( void* userdata )
 {
 	LLFloaterTOS* self = (LLFloaterTOS*) userdata;
-	LL_INFOS("TOS") << "User disagrees with TOS." << LL_ENDL;
+	llinfos << "User disagrees with TOS." << llendl;
 	LLNotificationsUtil::add("MustAgreeToLogIn", LLSD(), LLSD(), login_alert_done);
 
 	if(self->mReplyPumpName != "")
@@ -240,13 +254,11 @@ void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev
 		if(!mLoadingScreenLoaded)
 		{
 			mLoadingScreenLoaded = true;
-
-			gResponsePtr = LLIamHere::build( this );
-			LLHTTPClient::get( getString( "real_url" ), gResponsePtr );
+			loadIfNeeded();
 		}
 		else if(mRealNavigateBegun)
 		{
-			LL_INFOS("TOS") << "TOS: NAVIGATE COMPLETE" << LL_ENDL;
+			llinfos << "NAVIGATE COMPLETE" << llendl;
 			// enable Agree to TOS radio button now that page has loaded
 			LLCheckBoxCtrl * tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk");
 			tos_agreement->setEnabled( true );
diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h
index 8921d114899bc0dd91199d2677a4759ac32bd365..6ea56408eeaf1b0e39936a53e8587ebcd881b6cf 100644
--- a/indra/newview/llfloatertos.h
+++ b/indra/newview/llfloatertos.h
@@ -2,25 +2,31 @@
  * @file llfloatertos.h
  * @brief Terms of Service Agreement dialog
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -61,6 +67,8 @@ class LLFloaterTOS :
 
 private:
 
+	void			loadIfNeeded();
+	
 	std::string		mMessage;
 	int				mWebBrowserWindowId;
 	bool			mLoadingScreenLoaded;
diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp
index 81a65f5469d416b1de722482b831ec490f512a6d..638c9f1b8c83eeca7c8b913f1a98c6d41f914cdb 100644
--- a/indra/newview/llfloatervoicedevicesettings.cpp
+++ b/indra/newview/llfloatervoicedevicesettings.cpp
@@ -3,25 +3,31 @@
  * @author Richard Nelson
  * @brief Voice communication set-up 
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
  
@@ -58,6 +64,9 @@ LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings()
 	// grab "live" mic volume level
 	mMicVolume = gSavedSettings.getF32("AudioLevelMic");
 
+	// ask for new device enumeration
+	// now do this in onOpen() instead...
+	//gVoiceClient->refreshDeviceLists();
 }
 
 LLPanelVoiceDeviceSettings::~LLPanelVoiceDeviceSettings()
@@ -96,7 +105,7 @@ void LLPanelVoiceDeviceSettings::draw()
 	refresh();
 
 	// let user know that volume indicator is not yet available
-	bool is_in_tuning_mode = LLVoiceClient::getInstance()->inTuningMode();
+	bool is_in_tuning_mode = gVoiceClient->inTuningMode();
 	childSetVisible("wait_text", !is_in_tuning_mode);
 
 	LLPanel::draw();
@@ -104,7 +113,7 @@ void LLPanelVoiceDeviceSettings::draw()
 	if (is_in_tuning_mode)
 	{
 		const S32 num_bars = 5;
-		F32 voice_power = LLVoiceClient::getInstance()->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
+		F32 voice_power = gVoiceClient->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
 		S32 discrete_power = llmin(num_bars, llfloor(voice_power * (F32)num_bars + 0.1f));
 
 		for(S32 power_bar_idx = 0; power_bar_idx < num_bars; power_bar_idx++)
@@ -185,13 +194,13 @@ void LLPanelVoiceDeviceSettings::refresh()
 	LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
 	// set mic volume tuning slider based on last mic volume setting
 	F32 current_volume = (F32)volume_slider->getValue().asReal();
-	LLVoiceClient::getInstance()->tuningSetMicVolume(current_volume);
+	gVoiceClient->tuningSetMicVolume(current_volume);
 
 	// Fill in popup menus
 	mCtrlInputDevices = getChild<LLComboBox>("voice_input_device");
 	mCtrlOutputDevices = getChild<LLComboBox>("voice_output_device");
 
-	if(!LLVoiceClient::getInstance()->deviceSettingsAvailable())
+	if(!gVoiceClient->deviceSettingsAvailable())
 	{
 		// The combo boxes are disabled, since we can't get the device settings from the daemon just now.
 		// Put the currently set default (ONLY) in the box, and select it.
@@ -210,34 +219,19 @@ void LLPanelVoiceDeviceSettings::refresh()
 	}
 	else if (!mDevicesUpdated)
 	{
-		LLVoiceDeviceList::const_iterator iter;
+		LLVoiceClient::deviceList *devices;
+		
+		LLVoiceClient::deviceList::iterator iter;
 		
 		if(mCtrlInputDevices)
 		{
 			mCtrlInputDevices->removeall();
 			mCtrlInputDevices->add( getString("default_text"), ADD_BOTTOM );
 
-			for(iter=LLVoiceClient::getInstance()->getCaptureDevices().begin(); 
-				iter != LLVoiceClient::getInstance()->getCaptureDevices().end();
-				iter++)
+			devices = gVoiceClient->getCaptureDevices();
+			for(iter=devices->begin(); iter != devices->end(); iter++)
 			{
-				// Lets try to localize some system device names. EXT-8375
-				std::string device_name = *iter;
-				LLStringUtil::toLower(device_name); //compare in low case
-				if ("default system device" == device_name)
-				{
-					device_name = getString(device_name);
-				}
-				else if ("no device" == device_name)
-				{
-					device_name = getString(device_name);
-				}
-				else
-				{
-					// restore original value
-					device_name = *iter;
-				}
-				mCtrlInputDevices->add(device_name, ADD_BOTTOM );
+				mCtrlInputDevices->add( *iter, ADD_BOTTOM );
 			}
 
 			if(!mCtrlInputDevices->setSimple(mInputDevice))
@@ -251,26 +245,10 @@ void LLPanelVoiceDeviceSettings::refresh()
 			mCtrlOutputDevices->removeall();
 			mCtrlOutputDevices->add( getString("default_text"), ADD_BOTTOM );
 
-			for(iter= LLVoiceClient::getInstance()->getRenderDevices().begin(); 
-				iter !=  LLVoiceClient::getInstance()->getRenderDevices().end(); iter++)
+			devices = gVoiceClient->getRenderDevices();
+			for(iter=devices->begin(); iter != devices->end(); iter++)
 			{
-				// Lets try to localize some system device names. EXT-8375
-				std::string device_name = *iter;
-				LLStringUtil::toLower(device_name); //compare in low case
-				if ("default system device" == device_name)
-				{
-					device_name = getString(device_name);
-				}
-				else if ("no device" == device_name)
-				{
-					device_name = getString(device_name);
-				}
-				else
-				{
-					// restore original value
-					device_name = *iter;
-				}
-				mCtrlOutputDevices->add(device_name, ADD_BOTTOM );
+				mCtrlOutputDevices->add( *iter, ADD_BOTTOM );
 			}
 
 			if(!mCtrlOutputDevices->setSimple(mOutputDevice))
@@ -290,34 +268,37 @@ void LLPanelVoiceDeviceSettings::initialize()
 	mDevicesUpdated = FALSE;
 
 	// ask for new device enumeration
-	LLVoiceClient::getInstance()->refreshDeviceLists();
+	gVoiceClient->refreshDeviceLists();
 
 	// put voice client in "tuning" mode
-	LLVoiceClient::getInstance()->tuningStart();
+	gVoiceClient->tuningStart();
 	LLVoiceChannel::suspend();
 }
 
 void LLPanelVoiceDeviceSettings::cleanup()
 {
-	LLVoiceClient::getInstance()->tuningStop();
+	if (gVoiceClient)
+	{
+		gVoiceClient->tuningStop();
+	}
 	LLVoiceChannel::resume();
 }
 
 // static
 void LLPanelVoiceDeviceSettings::onCommitInputDevice(LLUICtrl* ctrl, void* user_data)
 {
-	if(LLVoiceClient::getInstance())
+	if(gVoiceClient)
 	{
-		LLVoiceClient::getInstance()->setCaptureDevice(ctrl->getValue().asString());
+		gVoiceClient->setCaptureDevice(ctrl->getValue().asString());
 	}
 }
 
 // static
 void LLPanelVoiceDeviceSettings::onCommitOutputDevice(LLUICtrl* ctrl, void* user_data)
 {
-	if(LLVoiceClient::getInstance())
+	if(gVoiceClient)
 	{
-		LLVoiceClient::getInstance()->setRenderDevice(ctrl->getValue().asString());
+		gVoiceClient->setRenderDevice(ctrl->getValue().asString());
 	}
 }
 
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 942d246dc25643ac1a37964bd8897fbadd677a98..b3223ad4945fdc08e1ce8260860c1669e538834e 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -3,25 +3,31 @@
  * @author James Cook, Tom Yedwab
  * @brief LLFloaterWorldMap class implementation
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -50,7 +56,7 @@
 #include "llinventorymodelbackgroundfetch.h"
 #include "llinventoryobserver.h"
 #include "lllandmarklist.h"
-#include "llsearcheditor.h"
+#include "lllineeditor.h"
 #include "llnotificationsutil.h"
 #include "llregionhandle.h"
 #include "llscrolllistctrl.h"
@@ -200,7 +206,6 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
 	mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL);
 	
 	//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", FALSE);
-	mCommitCallbackRegistrar.add("WMap.Coordinates",	boost::bind(&LLFloaterWorldMap::onCoordinatesCommit, this));
 	mCommitCallbackRegistrar.add("WMap.Location",		boost::bind(&LLFloaterWorldMap::onLocationCommit, this));
 	mCommitCallbackRegistrar.add("WMap.AvatarCombo",	boost::bind(&LLFloaterWorldMap::onAvatarComboCommit, this));
 	mCommitCallbackRegistrar.add("WMap.Landmark",		boost::bind(&LLFloaterWorldMap::onLandmarkComboCommit, this));
@@ -211,8 +216,6 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
 	mCommitCallbackRegistrar.add("WMap.ShowAgent",		boost::bind(&LLFloaterWorldMap::onShowAgentBtn, this));		
 	mCommitCallbackRegistrar.add("WMap.Clear",			boost::bind(&LLFloaterWorldMap::onClearBtn, this));		
 	mCommitCallbackRegistrar.add("WMap.CopySLURL",		boost::bind(&LLFloaterWorldMap::onCopySLURL, this));
-
-	gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterWorldMap::onChangeMaturity, this));
 }
 
 // static
@@ -226,20 +229,30 @@ BOOL LLFloaterWorldMap::postBuild()
 	mPanel = getChild<LLPanel>("objects_mapview");
 
 	LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo");
-	avatar_combo->selectFirstItem();
-	avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) );
-	avatar_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
+	if (avatar_combo)
+	{
+		avatar_combo->selectFirstItem();
+		avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) );
+		avatar_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
+	}
 
-	LLSearchEditor *location_editor = getChild<LLSearchEditor>("location");
-	location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1));
-	location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this));
+	getChild<LLScrollListCtrl>("location")->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1));
+
+	LLLineEditor *location_editor = getChild<LLLineEditor>("location");
+	if (location_editor)
+	{
+		location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this, _1), NULL );
+	}
 	
 	getChild<LLScrollListCtrl>("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));
 
 	LLComboBox *landmark_combo = getChild<LLComboBox>( "landmark combo");
-	landmark_combo->selectFirstItem();
-	landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) );
-	landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
+	if (landmark_combo)
+	{
+		landmark_combo->selectFirstItem();
+		landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) );
+		landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
+	}
 
 	mCurZoomVal = log(LLWorldMapView::sMapScale)/log(2.f);
 	childSetValue("zoom slider", LLWorldMapView::sMapScale);
@@ -248,8 +261,6 @@ BOOL LLFloaterWorldMap::postBuild()
 
 	mZoomTimer.stop();
 
-	onChangeMaturity();
-
 	return TRUE;
 }
 
@@ -331,6 +342,8 @@ void LLFloaterWorldMap::onOpen(const LLSD& key)
 	}
 }
 
+
+
 // static
 void LLFloaterWorldMap::reloadIcons(void*)
 {
@@ -375,6 +388,21 @@ void LLFloaterWorldMap::draw()
 	static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
 	static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white);
 	
+	// Hide/Show Mature Events controls
+	childSetVisible("events_mature_icon", gAgent.canAccessMature());
+	childSetVisible("events_mature_label", gAgent.canAccessMature());
+	childSetVisible("event_mature_chk", gAgent.canAccessMature());
+
+	childSetVisible("events_adult_icon", gAgent.canAccessMature());
+	childSetVisible("events_adult_label", gAgent.canAccessMature());
+	childSetVisible("event_adult_chk", gAgent.canAccessMature());
+	bool adult_enabled = gAgent.canAccessAdult();
+	if (!adult_enabled)
+	{
+		childSetValue("event_adult_chk", FALSE);
+	}
+	childSetEnabled("event_adult_chk", adult_enabled);
+
 	// On orientation island, users don't have a home location yet, so don't
 	// let them teleport "home".  It dumps them in an often-crowed welcome
 	// area (infohub) and they get confused. JC
@@ -433,7 +461,7 @@ void LLFloaterWorldMap::draw()
 	childSetEnabled("Teleport", (BOOL)tracking_status);
 //	childSetEnabled("Clear", (BOOL)tracking_status);
 	childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->isTracking());
-	childSetEnabled("copy_slurl", (mSLURL.isValid()) );
+	childSetEnabled("copy_slurl", (mSLURL.size() > 0) );
 
 	setMouseOpaque(TRUE);
 	getDragHandle()->setMouseOpaque(TRUE);
@@ -462,8 +490,8 @@ void LLFloaterWorldMap::draw()
 	childSetEnabled("telehub_chk", enable);
 	childSetEnabled("land_for_sale_chk", enable);
 	childSetEnabled("event_chk", enable);
-	childSetEnabled("events_mature_chk", enable);
-	childSetEnabled("events_adult_chk", enable);
+	childSetEnabled("event_mature_chk", enable);
+	childSetEnabled("event_adult_chk", enable);
 	
 	LLFloater::draw();
 }
@@ -575,10 +603,6 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
 		S32 world_y = S32(pos_global.mdV[1] / 256);
 		LLWorldMapMessage::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
 		setDefaultBtn("");
-
-		// clicked on a non-region - turn off coord display
-		enableTeleportCoordsDisplay( false );
-
 		return;
 	}
 	if (sim_info->isDown())
@@ -589,10 +613,6 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
 		LLWorldMap::getInstance()->setTrackingInvalid();
 		LLTracker::stopTracking(NULL);
 		setDefaultBtn("");
-
-		// clicked on a down region - turn off coord display
-		enableTeleportCoordsDisplay( false );
-
 		return;
 	}
 
@@ -610,40 +630,9 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
 	LLTracker::trackLocation(pos_global, full_name, tooltip);
 	LLWorldMap::getInstance()->cancelTracking();		// The floater is taking over the tracking
 
-	LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
-	updateTeleportCoordsDisplay( coord_pos );
-
-	// we have a valid region - turn on coord display
-	enableTeleportCoordsDisplay( true );
-
 	setDefaultBtn("Teleport");
 }
 
-// enable/disable teleport destination coordinates 
-void LLFloaterWorldMap::enableTeleportCoordsDisplay( bool enabled )
-{
-	childSetEnabled("teleport_coordinate_x", enabled );
-	childSetEnabled("teleport_coordinate_y", enabled );
-	childSetEnabled("teleport_coordinate_z", enabled );
-}
-
-// update display of teleport destination coordinates - pos is in global coordinates
-void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos )
-{
-	// if we're going to update their value, we should also enable them
-	enableTeleportCoordsDisplay( true );
-
-	// convert global specified position to a local one
-	F32 region_local_x = (F32)fmod( pos.mdV[VX], (F64)REGION_WIDTH_METERS );
-	F32 region_local_y = (F32)fmod( pos.mdV[VY], (F64)REGION_WIDTH_METERS );
-	F32 region_local_z = (F32)fmod( pos.mdV[VZ], (F64)REGION_WIDTH_METERS );
-
-	// write in the values
-	childSetValue("teleport_coordinate_x", region_local_x );
-	childSetValue("teleport_coordinate_y", region_local_y );
-	childSetValue("teleport_coordinate_z", region_local_z );
-}
-
 void LLFloaterWorldMap::updateLocation()
 {
 	bool gotSimName;
@@ -670,12 +659,15 @@ void LLFloaterWorldMap::updateLocation()
 				// Fill out the location field
 				childSetValue("location", agent_sim_name);
 
-				// update the coordinate display with location of avatar in region
-				updateTeleportCoordsDisplay( agentPos );
-
 				// Figure out where user is
+				LLVector3d agentPos = gAgent.getPositionGlobal();
+
+				S32 agent_x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
+				S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
+				S32 agent_z = llround( (F32)agentPos.mdV[VZ] );
+
 				// Set the current SLURL
-				mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal());
+				mSLURL = LLSLURL::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z);
 			}
 		}
 
@@ -702,19 +694,18 @@ void LLFloaterWorldMap::updateLocation()
 		}
 
 		childSetValue("location", sim_name);
-
-		// refresh coordinate display to reflect where user clicked.
-		LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
-		updateTeleportCoordsDisplay( coord_pos );
+		
+		F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
+		F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
 
 		// simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
 		if ( gotSimName )
 		{
-		  mSLURL = LLSLURL(sim_name, pos_global);
+			mSLURL = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ]));
 		}
 		else
 		{	// Empty SLURL will disable the "Copy SLURL to clipboard" button
-			mSLURL = LLSLURL();
+			mSLURL = "";
 		}
 	}
 }
@@ -1021,7 +1012,7 @@ void LLFloaterWorldMap::onComboTextEntry()
 	LLTracker::clearFocus();
 }
 
-void LLFloaterWorldMap::onSearchTextEntry( )
+void LLFloaterWorldMap::onSearchTextEntry( LLLineEditor* ctrl )
 {
 	onComboTextEntry();
 	updateSearchEnabled();
@@ -1178,28 +1169,12 @@ void LLFloaterWorldMap::onLocationCommit()
 	}
 }
 
-void LLFloaterWorldMap::onCoordinatesCommit()
-{
-	if( mIsClosing )
-	{
-		return;
-	}
-
-	S32 x_coord = (S32)childGetValue("teleport_coordinate_x").asReal();
-	S32 y_coord = (S32)childGetValue("teleport_coordinate_y").asReal();
-	S32 z_coord = (S32)childGetValue("teleport_coordinate_z").asReal();
-
-	const std::string region_name = childGetValue("location").asString();
-
-	trackURL( region_name, x_coord, y_coord, z_coord );
-}
-
 void LLFloaterWorldMap::onClearBtn()
 {
 	mTrackedStatus = LLTracker::TRACKING_NOTHING;
 	LLTracker::stopTracking((void *)(intptr_t)TRUE);
 	LLWorldMap::getInstance()->cancelTracking();
-	mSLURL = LLSLURL();					// Clear the SLURL since it's invalid
+	mSLURL = "";					// Clear the SLURL since it's invalid
 	mSetToUserPosition = TRUE;	// Revert back to the current user position
 }
 
@@ -1222,10 +1197,10 @@ void LLFloaterWorldMap::onClickTeleportBtn()
 
 void LLFloaterWorldMap::onCopySLURL()
 {
-	getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL.getSLURLString()));
+	getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL));
 	
 	LLSD args;
-	args["SLURL"] = mSLURL.getSLURLString();
+	args["SLURL"] = mSLURL;
 
 	LLNotificationsUtil::add("CopySLURL", args);
 }
@@ -1254,9 +1229,6 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate)
 	else if(LLWorldMap::getInstance()->isTracking())
 	{
 		pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();;
-
-
-
 	}
 	else
 	{
@@ -1527,27 +1499,3 @@ void LLFloaterWorldMap::onCommitSearchResult()
 
 	onShowTargetBtn();
 }
-
-void LLFloaterWorldMap::onChangeMaturity()
-{
-	bool can_access_mature = gAgent.canAccessMature();
-	bool can_access_adult = gAgent.canAccessAdult();
-
-	childSetVisible("events_mature_icon", can_access_mature);
-	childSetVisible("events_mature_label", can_access_mature);
-	childSetVisible("events_mature_chk", can_access_mature);
-
-	childSetVisible("events_adult_icon", can_access_adult);
-	childSetVisible("events_adult_label", can_access_adult);
-	childSetVisible("events_adult_chk", can_access_adult);
-
-	// disable mature / adult events.
-	if (!can_access_mature)
-	{
-		gSavedSettings.setBOOL("ShowMatureEvents", FALSE);
-	}
-	if (!can_access_adult)
-	{
-		gSavedSettings.setBOOL("ShowAdultEvents", FALSE);
-	}
-}
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index 6327039b7fdb87a8b0a8861f78adaa7dc98fe7ee..00f5e788fb871910ee7ca95beab36c455be15b5c 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -2,25 +2,31 @@
  * @file llfloaterworldmap.h
  * @brief LLFloaterWorldMap class definition
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -37,7 +43,6 @@
 #include "llhudtext.h"
 #include "llmapimagetype.h"
 #include "lltracker.h"
-#include "llslurl.h"
 
 class LLEventInfo;
 class LLFriendObserver;
@@ -106,7 +111,7 @@ class LLFloaterWorldMap : public LLFloater
 
 	// teleport to the tracked item, if there is one
 	void			teleport();
-	void			onChangeMaturity();
+
 protected:	
 	void			onGoHome();
 
@@ -117,7 +122,7 @@ class LLFloaterWorldMap : public LLFloater
 	void		    onAvatarComboCommit();
 
 	void			onComboTextEntry( );
-	void			onSearchTextEntry( );
+	void			onSearchTextEntry( LLLineEditor* ctrl );
 
 	void			onClearBtn();
 	void			onClickTeleportBtn();
@@ -143,7 +148,6 @@ class LLFloaterWorldMap : public LLFloater
 	void			updateSearchEnabled();
 	void			onLocationFocusChanged( LLFocusableElement* ctrl );
 	void		    onLocationCommit();
-	void			onCoordinatesCommit();
 	void		    onCommitSearchResult();
 
 	void			cacheLandmarkPosition();
@@ -155,12 +159,6 @@ class LLFloaterWorldMap : public LLFloater
 	F32						mCurZoomVal;
 	LLFrameTimer			mZoomTimer;
 
-	// update display of teleport destination coordinates - pos is in global coordinates
-	void updateTeleportCoordsDisplay( const LLVector3d& pos );
-
-	// enable/disable teleport destination coordinates 
-	void enableTeleportCoordsDisplay( bool enabled );
-
 	LLDynamicArray<LLUUID>	mLandmarkAssetIDList;
 	LLDynamicArray<LLUUID>	mLandmarkItemIDList;
 
@@ -185,7 +183,7 @@ class LLFloaterWorldMap : public LLFloater
 	LLTracker::ETrackingStatus mTrackedStatus;
 	std::string				mTrackedSimName;
 	std::string				mTrackedAvatarName;
-	LLSLURL  				mSLURL;
+	std::string				mSLURL;
 };
 
 extern LLFloaterWorldMap* gFloaterWorldMap;
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index d71e288ffe925cd7f37781d322d10ba6a503dca1..8d4d6a178a6ca24ae8ec4ced09de83e4f1e9be3f 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -2,25 +2,31 @@
  * @file llfolderview.cpp
  * @brief Implementation of the folder view collection of classes.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -82,10 +88,6 @@ const S32 MIN_ITEM_WIDTH_VISIBLE = LLFolderViewItem::ICON_WIDTH
 			+ /*first few characters*/ 40;
 const S32 MINIMUM_RENAMER_WIDTH = 80;
 
-// *TODO: move in params in xml if necessary. Requires modification of LLFolderView & LLInventoryPanel Params.
-const S32 STATUS_TEXT_HPAD = 6;
-const S32 STATUS_TEXT_VPAD = 8;
-
 enum {
 	SIGNAL_NO_KEYBOARD_FOCUS = 1,
 	SIGNAL_KEYBOARD_FOCUS = 2
@@ -179,7 +181,6 @@ LLFolderView::LLFolderView(const Params& p)
 	mRenameItem( NULL ),
 	mNeedsScroll( FALSE ),
 	mEnableScroll( true ),
-	mUseLabelSuffix(p.use_label_suffix),
 	mPinningSelectedItem(FALSE),
 	mNeedsAutoSelect( FALSE ),
 	mAutoSelectOverride(FALSE),
@@ -245,10 +246,6 @@ LLFolderView::LLFolderView(const Params& p)
 	text_p.font(font);
 	text_p.visible(false);
 	text_p.allow_html(true);
-	text_p.wrap(true); // allow multiline text. See EXT-7564, EXT-7047
-	// set text padding the same as in People panel. EXT-7047, EXT-4837
-	text_p.h_pad(STATUS_TEXT_HPAD);
-	text_p.v_pad(STATUS_TEXT_VPAD);
 	mStatusTextBox = LLUICtrlFactory::create<LLTextBox> (text_p);
 	mStatusTextBox->setFollowsLeft();
 	mStatusTextBox->setFollowsTop();
@@ -849,16 +846,16 @@ void LLFolderView::clearSelection()
 	mSelectThisID.setNull();
 }
 
-std::set<LLUUID> LLFolderView::getSelectionList() const
+BOOL LLFolderView::getSelectionList(std::set<LLUUID> &selection) const
 {
-	std::set<LLUUID> selection;
 	for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); 
 		 item_it != mSelectedItems.end(); 
 		 ++item_it)
 	{
 		selection.insert((*item_it)->getListener()->getUUID());
 	}
-	return selection;
+
+	return (selection.size() != 0);
 }
 
 BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source)
@@ -949,31 +946,12 @@ void LLFolderView::draw()
 		}
 		else
 		{
-			LLStringUtil::format_map_t args;
-			args["[SEARCH_TERM]"] = LLURI::escape(getFilter()->getFilterSubStringOrig());
-			mStatusText = LLTrans::getString(getFilter()->getEmptyLookupMessage(), args);
+			mStatusText = LLTrans::getString(getFilter()->getEmptyLookupMessage());
 			//font->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL,  LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
 		mStatusTextBox->setValue(mStatusText);
 		mStatusTextBox->setVisible( TRUE );
 		
-		// firstly reshape message textbox with current size. This is necessary to
-		// LLTextBox::getTextPixelHeight works properly
-		const LLRect local_rect = getLocalRect();
-		mStatusTextBox->setShape(local_rect);
-
-		// get preferable text height...
-		S32 pixel_height = mStatusTextBox->getTextPixelHeight();
-		bool height_changed = local_rect.getHeight() != pixel_height;
-		if (height_changed)
-		{
-			// ... if it does not match current height, lets rearrange current view.
-			// This will indirectly call ::arrange and reshape of the status textbox.
-			// We should call this method to also notify parent about required rect.
-			// See EXT-7564, EXT-7047.
-			arrangeFromRoot();
-		}
-		
 	}
 
 	LLFolderViewFolder::draw();
@@ -1189,7 +1167,7 @@ void LLFolderView::propertiesSelectedItems( void )
 
 void LLFolderView::changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type)
 {
-	LLFolderBridge *folder_bridge = LLFolderBridge::sSelf.get();
+	LLFolderBridge *folder_bridge = LLFolderBridge::sSelf;
 
 	if (!folder_bridge) return;
 	LLViewerInventoryCategory *cat = folder_bridge->getCategory();
@@ -1438,8 +1416,8 @@ void LLFolderView::startRenamingSelectedItem( void )
 		mRenamer->setVisible( TRUE );
 		// set focus will fail unless item is visible
 		mRenamer->setFocus( TRUE );
-		mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this, _1));
-		mRenamer->setFocusLostCallback(boost::bind(&LLFolderView::onRenamerLost, this, _1));
+		mRenamer->setTopLostCallback(boost::bind(onRenamerLost, _1));
+		mRenamer->setFocusLostCallback(boost::bind(onRenamerLost, _1));
 		gViewerWindow->addPopup(mRenamer);
 	}
 }
@@ -1764,8 +1742,6 @@ BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask )
 
 	mParentPanel->setFocus(TRUE);
 
-	LLEditMenuHandler::gEditMenuHandler = this;
-
 	return LLView::handleMouseDown( x, y, mask );
 }
 
@@ -1862,24 +1838,18 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
 		LLView::child_list_t::const_iterator menu_itor;
 		for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor)
 		{
-			(*menu_itor)->setVisible(FALSE);
-			(*menu_itor)->pushVisible(TRUE);
+			(*menu_itor)->setVisible(TRUE);
 			(*menu_itor)->setEnabled(TRUE);
 		}
 		
 		// Successively filter out invalid options
-
+		selected_items_t::iterator item_itor;
 		U32 flags = FIRST_SELECTED_ITEM;
-		for (selected_items_t::iterator item_itor = mSelectedItems.begin(); 
-			 item_itor != mSelectedItems.end(); 
-			 ++item_itor)
+		for (item_itor = mSelectedItems.begin(); item_itor != mSelectedItems.end(); ++item_itor)
 		{
-			LLFolderViewItem* selected_item = (*item_itor);
-			selected_item->buildContextMenu(*menu, flags);
+			(*item_itor)->buildContextMenu(*menu, flags);
 			flags = 0x0;
 		}
-	   
-		addNoOptions(menu);
 
 		menu->updateParent(LLMenuGL::sMenuContainer);
 		LLMenuGL::showPopup(this, menu, x, y);
@@ -1888,7 +1858,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
 	}
 	else
 	{
-		if (menu && menu->getVisible())
+		if(menu && menu->getVisible())
 		{
 			menu->setVisible(FALSE);
 		}
@@ -1897,37 +1867,6 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
 	return handled;
 }
 
-// Add "--no options--" if the menu is completely blank.
-BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const
-{
-	const std::string nooptions_str = "--no options--";
-	LLView *nooptions_item = NULL;
-	
-	const LLView::child_list_t *list = menu->getChildList();
-	for (LLView::child_list_t::const_iterator itor = list->begin(); 
-		 itor != list->end(); 
-		 ++itor)
-	{
-		LLView *menu_item = (*itor);
-		if (menu_item->getVisible())
-		{
-			return FALSE;
-		}
-		std::string name = menu_item->getName();
-		if (menu_item->getName() == nooptions_str)
-		{
-			nooptions_item = menu_item;
-		}
-	}
-	if (nooptions_item)
-	{
-		nooptions_item->setVisible(TRUE);
-		nooptions_item->setEnabled(FALSE);
-		return TRUE;
-	}
-	return FALSE;
-}
-
 BOOL LLFolderView::handleHover( S32 x, S32 y, MASK mask )
 {
 	return LLView::handleHover( x, y, mask );
@@ -2129,7 +2068,8 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata)
 	}
 
 
-	std::set<LLUUID> selected_items = getSelectionList();
+	std::set<LLUUID> selected_items;
+	getSelectionList(selected_items);
 
 	LLMultiPreview* multi_previewp = NULL;
 	LLMultiProperties* multi_propertiesp = NULL;
@@ -2367,7 +2307,7 @@ void LLFolderView::updateRenamerPosition()
 bool LLFolderView::selectFirstItem()
 {
 	for (folders_t::iterator iter = mFolders.begin();
-		 iter != mFolders.end();++iter)
+		 iter != mFolders.end();)
 	{
 		LLFolderViewFolder* folder = (*iter );
 		if (folder->getVisible())
@@ -2404,7 +2344,7 @@ bool LLFolderView::selectLastItem()
 		}
 	}
 	for (folders_t::reverse_iterator iter = mFolders.rbegin();
-		 iter != mFolders.rend();++iter)
+		 iter != mFolders.rend();)
 	{
 		LLFolderViewFolder* folder = (*iter);
 		if (folder->getVisible())
@@ -2446,9 +2386,9 @@ S32	LLFolderView::notify(const LLSD& info)
 /// Local function definitions
 ///----------------------------------------------------------------------------
 
+//static 
 void LLFolderView::onRenamerLost( LLFocusableElement* renamer)
 {
-	mRenameItem = NULL;
 	LLUICtrl* uictrl = dynamic_cast<LLUICtrl*>(renamer);
 	if (uictrl)
 	{
diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h
index ade30d92661e60b926ccd72cb8e94e304a7ae183..a2ef8c1d12cf7c72d410e5b7558f913e295d2da9 100644
--- a/indra/newview/llfoldervieweventlistener.h
+++ b/indra/newview/llfoldervieweventlistener.h
@@ -1,25 +1,31 @@
 /** 
  * @file llfoldervieweventlistener.h
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 #ifndef LLFOLDERVIEWEVENTLISTENER_H
@@ -31,7 +37,6 @@
 #include "llinventorytype.h"
 #include "llpermissionsflags.h"
 #include "llpointer.h"
-#include "llwearabletype.h"
 
 
 class LLFolderViewItem;
@@ -84,7 +89,6 @@ class LLFolderViewEventListener
 	virtual BOOL hasChildren() const = 0;
 	virtual LLInventoryType::EType getInventoryType() const = 0;
 	virtual void performAction(LLInventoryModel* model, std::string action) = 0;
-	virtual LLWearableType::EType getWearableType() const = 0;
 	
 	// This method should be called when a drag begins. returns TRUE
 	// if the drag can begin, otherwise FALSE.
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 04b690b9030610c333df4935bd4571e3b8e9e2e9..3208218302c3b42d49cff4d158de839f9f739145 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -2,25 +2,31 @@
 * @file llfolderviewitem.cpp
 * @brief Items and folders that can appear in a hierarchical folder view
 *
-* $LicenseInfo:firstyear=2001&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2001&license=viewergpl$
+* 
+* Copyright (c) 2001-2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 #include "llviewerprecompiledheaders.h"
@@ -90,7 +96,6 @@ void LLFolderViewItem::cleanupClass()
 LLFolderViewItem::Params::Params()
 :	icon(),
 	icon_open(),
-	icon_overlay(),
 	root(),
 	listener(),
 	folder_arrow_image("folder_arrow_image"),
@@ -128,7 +133,6 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
 	mCreationDate(p.creation_date),
 	mIcon(p.icon),
 	mIconOpen(p.icon_open),
-	mIconOverlay(p.icon_overlay),
 	mListener(p.listener),
 	mHidden(false),
 	mShowLoadStatus(false)
@@ -283,11 +287,8 @@ void LLFolderViewItem::refreshFromListener()
 			mCreationDate = mListener->getCreationDate();
 			dirtyFilter();
 		}
-		if (mRoot->useLabelSuffix())
-		{
-			mLabelStyle = mListener->getLabelStyle();
-			mLabelSuffix = mListener->getLabelSuffix();
-		}
+		mLabelStyle = mListener->getLabelStyle();
+		mLabelSuffix = mListener->getLabelSuffix();
 	}
 }
 
@@ -386,12 +387,6 @@ void LLFolderViewItem::extendSelectionFromRoot(LLFolderViewItem* selection)
 	getRoot()->extendSelection(selection, NULL, selected_items);
 }
 
-std::set<LLUUID> LLFolderViewItem::getSelectionList() const
-{
-	std::set<LLUUID> selection;
-	return selection;
-}
-
 EInventorySortGroup LLFolderViewItem::getSortGroup()  const
 { 
 	return SG_ITEM; 
@@ -616,7 +611,6 @@ const std::string& LLFolderViewItem::getSearchableLabel() const
 
 LLViewerInventoryItem * LLFolderViewItem::getInventoryItem(void)
 {
-	if (!getListener()) return NULL;
 	return gInventory.getItem(getListener()->getUUID());
 }
 
@@ -842,7 +836,6 @@ void LLFolderViewItem::draw()
 	static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
 	static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE);
 	static LLUIColor sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE);
-	static LLUIColor sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE);
 	static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
 
 	const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
@@ -948,8 +941,7 @@ void LLFolderViewItem::draw()
 		mDragAndDropTarget = FALSE;
 	}
 
-	const LLViewerInventoryItem *item = getInventoryItem();
-	const BOOL highlight_link = mIconOverlay && item && item->getIsLinkType();
+	
 	//--------------------------------------------------------------------------------//
 	// Draw open icon
 	//
@@ -963,10 +955,6 @@ void LLFolderViewItem::draw()
  		mIcon->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1);
  	}
 
-	if (highlight_link)
-	{
-		mIconOverlay->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1);
-	}
 
 	//--------------------------------------------------------------------------------//
 	// Exit if no label to draw
@@ -977,7 +965,6 @@ void LLFolderViewItem::draw()
 	}
 
 	LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor;
-	if (highlight_link) color = sLinkColor;
 	if (in_library) color = sLibraryColor;
 
 	F32 right_x  = 0;
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index f672ffe20f0e6be3c71e34147f09246eaefe7df0..6f069cca17b731bdd166750876857eb9a353d612 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -2,25 +2,31 @@
  * @file llfriendcard.cpp
  * @brief Implementation of classes to process Friends Cards
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -105,11 +111,8 @@ class LLInitialFriendCardsFetch : public LLInventoryFetchDescendentsObserver
 public:
 	typedef boost::function<void()> callback_t;
 
-	LLInitialFriendCardsFetch(const LLUUID& folder_id,
-							  callback_t cb) :
-		LLInventoryFetchDescendentsObserver(folder_id),
-		mCheckFolderCallback(cb)	
-	{}
+	LLInitialFriendCardsFetch(callback_t cb)
+		:	mCheckFolderCallback(cb)	{}
 
 	/* virtual */ void done();
 
@@ -405,9 +408,13 @@ void LLFriendCardsManager::findMatchedFriendCards(const LLUUID& avatarID, LLInve
 void LLFriendCardsManager::fetchAndCheckFolderDescendents(const LLUUID& folder_id,  callback_t cb)
 {
 	// This instance will be deleted in LLInitialFriendCardsFetch::done().
-	LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(folder_id, cb);
-	fetch->startFetch();
-	if(fetch->isFinished())
+	LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(cb);
+
+	uuid_vec_t folders;
+	folders.push_back(folder_id);
+
+	fetch->fetch(folders);
+	if(fetch->isEverythingComplete())
 	{
 		// everything is already here - call done.
 		fetch->done();
diff --git a/indra/newview/llfriendcard.h b/indra/newview/llfriendcard.h
index b7f0bada14cde419ca7c1baa94ce1c9c135e4edc..638a1eca84ce436b95b811025a2d885a37fb6a74 100644
--- a/indra/newview/llfriendcard.h
+++ b/indra/newview/llfriendcard.h
@@ -2,25 +2,31 @@
  * @file llfriendcard.h
  * @brief Definition of classes to process Friends Cards
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index f658287fb1145afd5b9a035cdfd77bf9f0ee6b10..a4342a4bc9a00ada5a3443cecea1abd606698d07 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -2,25 +2,31 @@
  * @file llgesturemgr.cpp
  * @brief Manager for playing gestures on the viewer
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -67,6 +73,7 @@ LLGestureMgr::LLGestureMgr()
 	mActive(),
 	mLoadingCount(0)
 {
+	mRetryIfMissing = true;
 	gInventory.addObserver(this);
 }
 
@@ -93,7 +100,7 @@ void LLGestureMgr::init()
 
 void LLGestureMgr::changed(U32 mask) 
 { 
-	LLInventoryFetchItemsObserver::changed(mask);
+	LLInventoryFetchObserver::changed(mask);
 
 	if (mask & LLInventoryObserver::GESTURE)
 	{
@@ -133,8 +140,6 @@ void LLGestureMgr::activateGesture(const LLUUID& item_id)
 {
 	LLViewerInventoryItem* item = gInventory.getItem(item_id);
 	if (!item) return;
-	if (item->getType() != LLAssetType::AT_GESTURE)
-		return;
 
 	LLUUID asset_id = item->getAssetUUID();
 
@@ -1026,8 +1031,9 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,
 			else
 			{
 				// Watch this item and set gesture name when item exists in inventory
-				self.setFetchID(item_id);
-				self.startFetch();
+				uuid_vec_t ids;
+				ids.push_back(item_id);
+				self.fetch(ids);
 			}
 			self.mActive[item_id] = gesture;
 
@@ -1168,11 +1174,12 @@ void LLGestureMgr::notifyObservers()
 {
 	lldebugs << "LLGestureMgr::notifyObservers" << llendl;
 
-	for(std::vector<LLGestureManagerObserver*>::iterator iter = mObservers.begin(); 
-		iter != mObservers.end(); 
-		++iter)
+	std::vector<LLGestureManagerObserver*> observers = mObservers;
+
+	std::vector<LLGestureManagerObserver*>::iterator it;
+	for (it = observers.begin(); it != observers.end(); ++it)
 	{
-		LLGestureManagerObserver* observer = (*iter);
+		LLGestureManagerObserver* observer = *it;
 		observer->changed();
 	}
 }
diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h
index b9935efeb3c25a009343fbfae61b00e47270887b..081ca983a92d0cb87367e41fb8a701e354aef507 100644
--- a/indra/newview/llgesturemgr.h
+++ b/indra/newview/llgesturemgr.h
@@ -2,25 +2,31 @@
  * @file llgesturemgr.h
  * @brief Manager for playing gestures on the viewer
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -48,7 +54,7 @@ class LLGestureManagerObserver
 	virtual void changed() = 0;
 };
 
-class LLGestureMgr : public LLSingleton<LLGestureMgr>, public LLInventoryFetchItemsObserver
+class LLGestureMgr : public LLSingleton<LLGestureMgr>, public LLInventoryFetchObserver
 {
 public:
 
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index c42b39725239d49da2ef8dd1271fe96d63ea7236..d4eecc8c48c2a61456e2095fb8e4c0e5c630e496 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -2,25 +2,31 @@
  * @file llgroupactions.cpp
  * @brief Group-related actions (join, leave, new, delete, etc)
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -69,13 +75,12 @@ class LLGroupHandler : public LLCommandHandler
 			return false;
 		}
 
+		//*TODO by what to replace showing groups floater?
 		if (tokens[0].asString() == "list")
 		{
 			if (tokens[1].asString() == "show")
 			{
-				LLSD params;
-				params["people_panel_tab_name"] = "groups_panel";
-				LLSideTray::getInstance()->showPanel("panel_people", params);
+				//LLFloaterReg::showInstance("contacts", "groups");
 				return true;
 			}
             return false;
diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h
index c52a25818b76bfc7c2e8a717f23d2c5a43ee6c13..55cae4db0b242760380f692d369a4ed168039abb 100644
--- a/indra/newview/llgroupactions.h
+++ b/indra/newview/llgroupactions.h
@@ -2,25 +2,31 @@
  * @file llgroupactions.h
  * @brief Group-related actions (join, leave, new, delete, etc)
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index 3751a33a484f90eeab7e67254ce74c5e702ea121..8a056f836f215a84d8f7d2cf85b87e51af4cdc95 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -2,25 +2,31 @@
  * @file llgrouplist.cpp
  * @brief List of the groups the agent belongs to.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -33,13 +39,13 @@
 #include "lliconctrl.h"
 #include "llmenugl.h"
 #include "lltextbox.h"
-#include "lltextutil.h"
 #include "lltrans.h"
 
 // newview
 #include "llagent.h"
 #include "llgroupactions.h"
 #include "llfloaterreg.h"
+#include "lltextutil.h"
 #include "llviewercontrol.h"	// for gSavedSettings
 #include "llviewermenu.h"		// for gMenuHolder
 #include "llvoiceclient.h"
@@ -65,10 +71,18 @@ class LLGroupComparator : public LLFlatListView::ItemComparator
 
 static const LLGroupComparator GROUP_COMPARATOR;
 
+LLGroupList::Params::Params()
+: no_groups_msg("no_groups_msg")
+, no_filtered_groups_msg("no_filtered_groups_msg")
+{
+	
+}
 
 LLGroupList::LLGroupList(const Params& p)
-:	LLFlatListViewEx(p)
+:	LLFlatListView(p)
 	, mDirty(true) // to force initial update
+	, mNoFilteredGroupsMsg(p.no_filtered_groups_msg)
+	, mNoGroupsMsg(p.no_groups_msg)
 {
 	// Listen for agent group changes.
 	gAgent.addListener(this, "new group");
@@ -125,15 +139,9 @@ BOOL LLGroupList::handleRightMouseDown(S32 x, S32 y, MASK mask)
 
 void LLGroupList::setNameFilter(const std::string& filter)
 {
-	std::string filter_upper = filter;
-	LLStringUtil::toUpper(filter_upper);
-	if (mNameFilter != filter_upper)
+	if (mNameFilter != filter)
 	{
-		mNameFilter = filter_upper;
-
-		// set no items message depend on filter state
-		updateNoItemsMessage(filter);
-
+		mNameFilter = filter;
 		setDirty();
 	}
 }
@@ -151,6 +159,18 @@ void LLGroupList::refresh()
 	LLUUID				id;
 	bool				have_filter		= !mNameFilter.empty();
 
+	// set no items message depend on filter state & total count of groups
+	if (have_filter)
+	{
+		// groups were filtered
+		setNoItemsCommentText(mNoFilteredGroupsMsg);
+	}
+	else if (0 == count)
+	{
+		// user is not a member of any group
+		setNoItemsCommentText(mNoGroupsMsg);
+	}
+
 	clear();
 
 	for(S32 i = 0; i < count; ++i)
@@ -267,7 +287,7 @@ bool LLGroupList::onContextMenuItemEnable(const LLSD& userdata)
 		return gAgent.getGroupID() != selected_group_id;
 
 	if (userdata.asString() == "call")
-	  return real_group_selected && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+		return real_group_selected && LLVoiceClient::voiceEnabled()&&gVoiceClient->voiceWorking();
 
 	return real_group_selected;
 }
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index 85e45d012b5bcf9dfb7eef6b2fe165b835ff30b8..996553ccf7a4b68ad2ff4068440d2751b10d038f 100644
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -2,25 +2,31 @@
  * @file llgroupmgr.cpp
  * @brief LLGroupMgr class implementation
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -897,15 +903,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data)
 
 			if (member_id.notNull())
 			{
-				if (online_status == "Online")
-				{
-					static std::string localized_online(LLTrans::getString("group_member_status_online"));
-					online_status = localized_online;
-				}
-				else
-				{
-					formatDateString(online_status); // reformat for sorting, e.g. 12/25/2008 -> 2008/12/25
-				}
+				formatDateString(online_status); // reformat for sorting, e.g. 12/25/2008 -> 2008/12/25
 				
 				//llinfos << "Member " << member_id << " has powers " << std::hex << agent_powers << std::dec << llendl;
 				LLGroupMemberData* newdata = new LLGroupMemberData(member_id, 
diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h
index faf0531c10df669e073783068612db6892426bcc..82df631b8c4b05a2401ea2d6bcf0ba3f74eeb5ec 100644
--- a/indra/newview/llgroupmgr.h
+++ b/indra/newview/llgroupmgr.h
@@ -2,25 +2,31 @@
  * @file llgroupmgr.h
  * @brief Manager for aggregating all client knowledge for specific groups
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp
index 6af0ae2b6a14b804075aa74d98cf21d0ec8415d7..2b73ed1dcde567aa8c9b1ace66e715307b2f4227 100644
--- a/indra/newview/llhudobject.cpp
+++ b/indra/newview/llhudobject.cpp
@@ -2,25 +2,31 @@
  * @file llhudobject.cpp
  * @brief LLHUDObject class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 658e9403d874a85666980fe8c7d204e83f992910..3ec8d11fb0cd7c72b5bb092085f2f359494e7276 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -2,25 +2,31 @@
  * @file llimfloater.cpp
  * @brief LLIMFloater class definition
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -47,20 +53,14 @@
 #include "llsyswellwindow.h"
 #include "lltrans.h"
 #include "llchathistory.h"
-#include "llnotifications.h"
 #include "llviewerwindow.h"
 #include "llvoicechannel.h"
 #include "lltransientfloatermgr.h"
 #include "llinventorymodel.h"
 #include "llrootview.h"
-#include "llspeakers.h"
-#include "llsidetray.h"
 
+#include "llspeakers.h"
 
-static const S32 RECT_PADDING_NOT_INIT = -1;
-static const S32 RECT_PADDING_NEED_RECALC = -2;
-
-S32 LLIMFloater::sAllowedRectRightPadding = RECT_PADDING_NOT_INIT;
 
 LLIMFloater::LLIMFloater(const LLUUID& session_id)
   : LLTransientDockableFloater(NULL, true, session_id),
@@ -371,8 +371,6 @@ void LLIMFloater::onSlide()
 //static
 LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
 {
-	closeHiddenIMToasts();
-
 	if (!gIMMgr->hasSession(session_id)) return NULL;
 
 	if(!isChatMultiTab())
@@ -444,44 +442,19 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
 	return floater;
 }
 
-//static
-bool LLIMFloater::resetAllowedRectPadding(const LLSD& newvalue)
-{
-	//reset allowed rect right padding if "SidebarCameraMovement" option 
-	//or sidebar state changed
-	sAllowedRectRightPadding = RECT_PADDING_NEED_RECALC ;
-	return true;
-}
-
 void LLIMFloater::getAllowedRect(LLRect& rect)
 {
-	if (sAllowedRectRightPadding == RECT_PADDING_NOT_INIT) //wasn't initialized
-	{
-		gSavedSettings.getControl("SidebarCameraMovement")->getSignal()->connect(boost::bind(&LLIMFloater::resetAllowedRectPadding, _2));
-
-		LLSideTray*	side_bar = LLSideTray::getInstance();
-		side_bar->getCollapseSignal().connect(boost::bind(&LLIMFloater::resetAllowedRectPadding, _2));
-		sAllowedRectRightPadding = RECT_PADDING_NEED_RECALC;
-	}
-
 	rect = gViewerWindow->getWorldViewRectScaled();
-	if (sAllowedRectRightPadding == RECT_PADDING_NEED_RECALC) //recalc allowed rect right padding
+	static S32 right_padding = 0;
+	if (right_padding == 0)
 	{
 		LLPanel* side_bar_tabs =
 				gViewerWindow->getRootView()->getChild<LLPanel> (
 						"side_bar_tabs");
-		sAllowedRectRightPadding = side_bar_tabs->getRect().getWidth();
+		right_padding = side_bar_tabs->getRect().getWidth();
 		LLTransientFloaterMgr::getInstance()->addControlView(side_bar_tabs);
-
-		if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE)
-		{
-			LLSideTray*	side_bar = LLSideTray::getInstance();
-
-			if (side_bar->getVisible() && !side_bar->getCollapsed())
-				sAllowedRectRightPadding += side_bar->getRect().getWidth();
-		}
 	}
-	rect.mRight -= sAllowedRectRightPadding;
+	rect.mRight -= right_padding;
 }
 
 void LLIMFloater::setDocked(bool docked, bool pop_on_undock)
@@ -526,8 +499,8 @@ void LLIMFloater::setVisible(BOOL visible)
 	{
 		//only if floater was construced and initialized from xml
 		updateMessages();
-		//prevent stealing focus when opening a background IM tab (EXT-5387, checking focus for EXT-6781)
-		if (!isChatMultiTab() || hasFocus())
+		//prevent steal focus when IM opened in multitab mode
+		if (!isChatMultiTab())
 		{
 			mInputEditor->setFocus(TRUE);
 		}
@@ -1110,41 +1083,6 @@ void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info)
 	}
 }
 
-// static
-void LLIMFloater::closeHiddenIMToasts()
-{
-	class IMToastMatcher: public LLNotificationsUI::LLScreenChannel::Matcher
-	{
-	public:
-		bool matches(const LLNotificationPtr notification) const
-		{
-			// "notifytoast" type of notifications is reserved for IM notifications
-			return "notifytoast" == notification->getType();
-		}
-	};
-
-	LLNotificationsUI::LLScreenChannel* channel = LLNotificationsUI::LLChannelManager::getNotificationScreenChannel();
-	if (channel != NULL)
-	{
-		channel->closeHiddenToasts(IMToastMatcher());
-	}
-}
-// static
-void LLIMFloater::confirmLeaveCallCallback(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	const LLSD& payload = notification["payload"];
-	LLUUID session_id = payload["session_id"];
-
-	LLFloater* im_floater = LLFloaterReg::findInstance("impanel", session_id);
-	if (option == 0 && im_floater != NULL)
-	{
-		im_floater->closeFloater();
-	}
-
-	return;
-}
-
 // static
 bool LLIMFloater::isChatMultiTab()
 {
@@ -1194,31 +1132,3 @@ void LLIMFloater::onIMChicletCreated( const LLUUID& session_id )
 	}
 
 }
-
-void	LLIMFloater::onClickCloseBtn()
-{
-
-	LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
-				mSessionID);
-
-	if (session == NULL)
-	{
-		llwarns << "Empty session." << llendl;
-		return;
-	}
-
-	bool is_call_with_chat = session->isGroupSessionType()
-			|| session->isAdHocSessionType() || session->isP2PSessionType();
-
-	LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
-
-	if (is_call_with_chat && voice_channel != NULL && voice_channel->isActive())
-	{
-		LLSD payload;
-		payload["session_id"] = mSessionID;
-		LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback);
-		return;
-	}
-
-	LLFloater::onClickCloseBtn();
-}
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index e604623b1bbf9156161ecfedd3c01928e73a1025..763dd5655ba9c85e122651ece71327a42de9e687 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -2,25 +2,31 @@
  * @file llimfloater.h
  * @brief LLIMFloater class definition
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -44,7 +50,6 @@ class LLInventoryCategory;
  */
 class LLIMFloater : public LLTransientDockableFloater
 {
-	LOG_CLASS(LLIMFloater);
 public:
 	LLIMFloater(const LLUUID& session_id);
 
@@ -115,10 +120,6 @@ class LLIMFloater : public LLTransientDockableFloater
 
 	virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::IM; }
 
-protected:
-	/* virtual */
-	void	onClickCloseBtn();
-
 private:
 	// process focus events to set a currently active session
 	/* virtual */ void onFocusLost();
@@ -147,14 +148,6 @@ class LLIMFloater : public LLTransientDockableFloater
 	// Remove the "User is typing..." indicator.
 	void removeTypingIndicator(const LLIMInfo* im_info = NULL);
 
-	static void closeHiddenIMToasts();
-
-	static bool resetAllowedRectPadding(const LLSD& newvalue);
-	//need to keep this static for performance issues
-	static S32 sAllowedRectRightPadding;
-
-	static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response);
-
 	LLPanelChatControlPanel* mControlPanel;
 	LLUUID mSessionID;
 	S32 mLastMessageIndex;
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 5f7d1a2ffa933704fa52fa6ff80df7f8acbbd457..4bdf5f42dc451f9487eee3d8438534b67ad29df1 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -2,25 +2,31 @@
  * @file llimpanel.cpp
  * @brief LLIMPanel class definition
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -294,7 +300,7 @@ void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data)
 	LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
 	if (floaterp)
 	{
-		LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
+		gVoiceClient->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
 	}
 }
 
@@ -306,7 +312,7 @@ void LLFloaterIMPanel::draw()
 	
 	BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "")
 					  && mSessionInitialized
-					  && LLVoiceClient::getInstance()->voiceEnabled()
+					  && LLVoiceClient::voiceEnabled()
 					  && mCallBackEnabled;
 
 	// hide/show start call and end call buttons
@@ -314,8 +320,8 @@ void LLFloaterIMPanel::draw()
 	if (!voice_channel)
 		return;
 
-	childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
-	childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
+	childSetVisible("end_call_btn", LLVoiceClient::voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
+	childSetVisible("start_call_btn", LLVoiceClient::voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
 	childSetEnabled("start_call_btn", enable_connect);
 	childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty());
 	
@@ -378,11 +384,11 @@ void LLFloaterIMPanel::draw()
 	else
 	{
 		// refresh volume and mute checkbox
-		childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
-		childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID));
+		childSetVisible("speaker_volume", LLVoiceClient::voiceEnabled() && voice_channel->isActive());
+		childSetValue("speaker_volume", gVoiceClient->getUserVolume(mOtherParticipantUUID));
 
 		childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
-		childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
+		childSetVisible("mute_btn", LLVoiceClient::voiceEnabled() && voice_channel->isActive());
 	}
 	LLFloater::draw();
 }
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index f748603bfaabc8dfa5351a4eeea8421fbfedace3..e0f155a6a9a9b51fa0458af61a36fabb3e323a42 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2,25 +2,31 @@
  * @file LLIMMgr.cpp
  * @brief Container for Instant Messaging
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -37,7 +43,6 @@
 #include "llhttpclient.h"
 #include "llsdutil_math.h"
 #include "llstring.h"
-#include "lltextutil.h"
 #include "lltrans.h"
 #include "lluictrlfactory.h"
 
@@ -60,6 +65,7 @@
 #include "llnearbychat.h"
 #include "llspeakers.h" //for LLIMSpeakerMgr
 #include "lltextbox.h"
+#include "lltextutil.h"
 #include "llviewercontrol.h"
 #include "llviewerparcelmgr.h"
 
@@ -251,8 +257,9 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
 
 void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction)
 {
-	std::string you_joined_call = LLTrans::getString("you_joined_call");
-	std::string you_started_call = LLTrans::getString("you_started_call");
+	std::string you = LLTrans::getString("You");
+	std::string started_call = LLTrans::getString("started_call");
+	std::string joined_call = LLTrans::getString("joined_call");
 	std::string other_avatar_name = "";
 
 	std::string message;
@@ -270,15 +277,13 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
 			switch(new_state)
 			{
 			case LLVoiceChannel::STATE_CALL_STARTED :
-				{
-					LLStringUtil::format_map_t string_args;
-					string_args["[NAME]"] = other_avatar_name;
-					message = LLTrans::getString("name_started_call", string_args);
-					LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);				
-					break;
-				}
+				message = other_avatar_name + " " + started_call;
+				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
+				
+				break;
 			case LLVoiceChannel::STATE_CONNECTED :
-				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_joined_call);
+				message = you + " " + joined_call;
+				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
 			default:
 				break;
 			}
@@ -288,10 +293,11 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
 			switch(new_state)
 			{
 			case LLVoiceChannel::STATE_CALL_STARTED :
-				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_started_call);
+				message = you + " " + started_call;
+				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
 				break;
 			case LLVoiceChannel::STATE_CONNECTED :
-				message = LLTrans::getString("answered_call");
+				message = other_avatar_name + " " + joined_call;
 				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
 			default:
 				break;
@@ -306,7 +312,8 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
 			switch(new_state)
 			{
 			case LLVoiceChannel::STATE_CONNECTED :
-				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_joined_call);
+				message = you + " " + joined_call;
+				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
 			default:
 				break;
 			}
@@ -316,7 +323,8 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
 			switch(new_state)
 			{
 			case LLVoiceChannel::STATE_CALL_STARTED :
-				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_started_call);
+				message = you + " " + started_call;
+				LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
 				break;
 			default:
 				break;
@@ -336,13 +344,13 @@ LLIMModel::LLIMSession::~LLIMSession()
 	mSpeakers = NULL;
 
 	// End the text IM session if necessary
-	if(LLVoiceClient::getInstance() && mOtherParticipantID.notNull())
+	if(gVoiceClient && mOtherParticipantID.notNull())
 	{
 		switch(mType)
 		{
 		case IM_NOTHING_SPECIAL:
 		case IM_SESSION_P2P_INVITE:
-			LLVoiceClient::getInstance()->endUserIMSession(mOtherParticipantID);
+			gVoiceClient->endUserIMSession(mOtherParticipantID);
 			break;
 
 		default:
@@ -917,7 +925,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
 	if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
 	{
 		// User is online through the OOW connector, but not with a regular viewer.  Try to send the message via SLVoice.
-		sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
+		sent = gVoiceClient->sendTextMessage(other_participant_id, utf8_text);
 	}
 	
 	if(!sent)
@@ -1016,14 +1024,6 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
 		}
 		else
 		{
-			// IM_SESSION_INVITE means that this is an Ad-hoc incoming chat
-			//		(it can be also Group chat but it is checked above)
-			// In this case mInitialTargetIDs contains Ad-hoc session ID and it should not be added
-			// to Recent People to prevent showing of an item with (???)(???). See EXT-8246.
-			// Concrete participants will be added into this list once they sent message in chat.
-			if (IM_SESSION_INVITE == dialog) return;
-
-			// implemented adding of all participants of an outgoing to Recent People List. See EXT-5694.
 			for(uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();
 				it!=session->mInitialTargetIDs.end();++it)
 			{
@@ -1459,13 +1459,7 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
 	}
 
 	sSession = session;
-
-	static boost::signals2::connection prev_channel_state_changed_connection;
-	// disconnect previously connected callback to avoid have invalid sSession in onVoiceChannelStateChanged()
-	prev_channel_state_changed_connection.disconnect();
-	prev_channel_state_changed_connection =
-		sSession->mVoiceChannel->setStateChangedCallback(boost::bind(LLCallDialogManager::onVoiceChannelStateChanged, _1, _2, _3, _4));
-
+	sSession->mVoiceChannel->setStateChangedCallback(boost::bind(LLCallDialogManager::onVoiceChannelStateChanged, _1, _2, _3, _4));
 	if(sCurrentSessionlName != session->mName)
 	{
 		sPreviousSessionlName = sCurrentSessionlName;
@@ -1719,10 +1713,11 @@ void LLOutgoingCallDialog::show(const LLSD& key)
 			channel_name = LLTextUtil::formatPhoneNumber(channel_name);
 		}
 		childSetTextArg("nearby", "[VOICE_CHANNEL_NAME]", channel_name);
+		childSetTextArg("nearby_P2P_by_other", "[VOICE_CHANNEL_NAME]", mPayload["disconnected_channel_name"].asString());
 
 		// skipping "You will now be reconnected to nearby" in notification when call is ended by disabling voice,
 		// so no reconnection to nearby chat happens (EXT-4397)
-		bool voice_works = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+		bool voice_works = LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
 		std::string reconnect_nearby = voice_works ? LLTrans::getString("reconnect_nearby") : std::string();
 		childSetTextArg("nearby", "[RECONNECT_NEARBY]", reconnect_nearby);
 
@@ -1767,8 +1762,6 @@ void LLOutgoingCallDialog::show(const LLSD& key)
 			getChild<LLTextBox>("leaving")->setVisible(true);
 		}
 		break;
-	// STATE_READY is here to show appropriate text for ad-hoc and group calls when floater is shown(EXT-6893)
-	case LLVoiceChannel::STATE_READY :
 	case LLVoiceChannel::STATE_RINGING :
 		if(show_oldchannel)
 		{
@@ -1849,8 +1842,8 @@ LLCallDialog(payload)
 
 void LLIncomingCallDialog::onLifetimeExpired()
 {
-	std::string session_handle = mPayload["session_handle"].asString();
-	if (LLVoiceClient::getInstance()->isValidChannel(session_handle))
+	// check whether a call is valid or not
+	if (LLVoiceClient::getInstance()->findSession(mPayload["caller_id"].asUUID()))
 	{
 		// restart notification's timer if call is still valid
 		mLifetimeTimer.start();
@@ -1900,6 +1893,8 @@ BOOL LLIncomingCallDialog::postBuild()
 	
 	// check to see if this is an Avaline call
 	bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
+	childSetVisible("Start IM", is_avatar); // no IM for avaline
+
 	if (caller_name == "anonymous")
 	{
 		caller_name = getString("anonymous");
@@ -1931,10 +1926,6 @@ BOOL LLIncomingCallDialog::postBuild()
 		mLifetimeTimer.stop();
 	}
 
-	//it's not possible to connect to existing Ad-Hoc/Group chat through incoming ad-hoc call
-	//and no IM for avaline
-	childSetVisible("Start IM", is_avatar && notify_box_type != "VoiceInviteAdHoc" && notify_box_type != "VoiceInviteGroup");
-
 	setCanDrag(FALSE);
 
 	return TRUE;
@@ -1945,24 +1936,15 @@ void LLIncomingCallDialog::onOpen(const LLSD& key)
 {
 	LLCallDialog::onOpen(key);
 
-	LLStringUtil::format_map_t args;
-	LLGroupData data;
-	// if it's a group call, retrieve group name to use it in question
-	if (gAgent.getGroupData(key["session_id"].asUUID(), data))
-	{
-		args["[GROUP]"] = data.mName;
-	}
 	// tell the user which voice channel they would be leaving
 	LLVoiceChannel *voice = LLVoiceChannel::getCurrentVoiceChannel();
 	if (voice && !voice->getSessionName().empty())
 	{
-		args["[CURRENT_CHAT]"] = voice->getSessionName();
-		childSetText("question", getString(key["question_type"].asString(), args));
+		childSetTextArg("question", "[CURRENT_CHAT]", voice->getSessionName());
 	}
 	else
 	{
-		args["[CURRENT_CHAT]"] = getString("localchat");
-		childSetText("question", getString(key["question_type"].asString(), args));
+		childSetTextArg("question", "[CURRENT_CHAT]", getString("localchat"));
 	}
 }
 
@@ -2080,9 +2062,8 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
 				// send notification message to the corresponding chat 
 				if (mPayload["notify_box_type"].asString() == "VoiceInviteGroup" || mPayload["notify_box_type"].asString() == "VoiceInviteAdHoc")
 				{
-					LLStringUtil::format_map_t string_args;
-					string_args["[NAME]"] = mPayload["caller_name"].asString();
-					std::string message = LLTrans::getString("name_started_call", string_args);
+					std::string started_call = LLTrans::getString("started_call");
+					std::string message = mPayload["caller_name"].asString() + " " + started_call;
 					LLIMModel::getInstance()->addMessageSilently(session_id, SYSTEM_FROM, LLUUID::null, message);
 				}
 			}
@@ -2096,10 +2077,10 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
 	{
 		if (type == IM_SESSION_P2P_INVITE)
 		{
-			if(LLVoiceClient::getInstance())
+			if(gVoiceClient)
 			{
 				std::string s = mPayload["session_handle"].asString();
-				LLVoiceClient::getInstance()->declineInvite(s);
+				gVoiceClient->declineInvite(s);
 			}
 		}
 		else
@@ -2187,8 +2168,11 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
 	{
 		if (type == IM_SESSION_P2P_INVITE)
 		{
-		  std::string s = payload["session_handle"].asString();
-		  LLVoiceClient::getInstance()->declineInvite(s);
+			if(gVoiceClient)
+			{
+				std::string s = payload["session_handle"].asString();
+				gVoiceClient->declineInvite(s);
+			}
 		}
 		else
 		{
@@ -2315,20 +2299,12 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess
 	}
 	else // going to IM session
 	{
-		message = LLTrans::getString(message_name + "-im");
-		message.setArgs(args);
 		if (hasSession(session_id))
 		{
+			message = LLTrans::getString(message_name + "-im");
+			message.setArgs(args);
 			gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString());
 		}
-		// log message to file
-		else
-		{
-			std::string session_name;
-			// since we select user to share item with - his name is already in cache
-			gCacheName->getFullName(args["user_id"], session_name);
-			LLIMModel::instance().logToFile(session_name, SYSTEM_FROM, LLUUID::null, message.getString());
-		}
 	}
 }
 
@@ -2501,8 +2477,6 @@ void LLIMMgr::inviteToSession(
 	}
 
 	std::string notify_box_type;
-	// voice invite question is different from default only for group call (EXT-7118)
-	std::string question_type = "VoiceInviteQuestionDefault";
 
 	BOOL ad_hoc_invite = FALSE;
 	if(type == IM_SESSION_P2P_INVITE)
@@ -2514,7 +2488,6 @@ void LLIMMgr::inviteToSession(
 	{
 		//only really old school groups have voice invitations
 		notify_box_type = "VoiceInviteGroup";
-		question_type = "VoiceInviteQuestionGroup";
 	}
 	else if ( inv_type == INVITATION_TYPE_VOICE )
 	{
@@ -2539,7 +2512,6 @@ void LLIMMgr::inviteToSession(
 	payload["session_handle"] = session_handle;
 	payload["session_uri"] = session_uri;
 	payload["notify_box_type"] = notify_box_type;
-	payload["question_type"] = question_type;
 	
 	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id);
 	if (channelp && channelp->callStarted())
@@ -2767,12 +2739,6 @@ bool LLIMMgr::endCall(const LLUUID& session_id)
 	if (!voice_channel) return false;
 
 	voice_channel->deactivate();
-	LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
-	if (im_session)
-	{
-		// need to update speakers' state
-		im_session->mSpeakers->update(FALSE);
-	}
 	return true;
 }
 
@@ -3112,7 +3078,7 @@ class LLViewerChatterBoxInvitation : public LLHTTPNode
 				return;
 			}
 			
-			if(!LLVoiceClient::getInstance()->voiceEnabled() || !LLVoiceClient::getInstance()->isVoiceWorking())
+			if(!LLVoiceClient::voiceEnabled())
 			{
 				// Don't display voice invites unless the user has voice enabled.
 				return;
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index dfd39cc39ca5136528f01805bdc3638de0ab3a28..ffa8a167974dd38c2dbd7805fa74855d13451caa 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -2,25 +2,31 @@
  * @file LLIMMgr.h
  * @brief Container for Instant Messaging
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index d877d659c19647219262f0946e9214dce7ec3a38..94ea236757281f92285425b032e5e53c0c44b82b 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file llinspectavatar.cpp
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -52,7 +58,6 @@
 #include "llfloaterreg.h"
 #include "llmenubutton.h"
 #include "lltooltip.h"	// positionViewNearMouse()
-#include "lltrans.h"
 #include "lluictrl.h"
 
 #include "llavatariconctrl.h"
@@ -375,11 +380,7 @@ void LLInspectAvatar::requestUpdate()
 void LLInspectAvatar::processAvatarData(LLAvatarData* data)
 {
 	LLStringUtil::format_map_t args;
-	{
-		std::string birth_date = LLTrans::getString("AvatarBirthDateFormat");
-		LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) data->born_on.secondsSinceEpoch()));
-		args["[BORN_ON]"] = birth_date;
-	}
+	args["[BORN_ON]"] = data->born_on;
 	args["[AGE]"] = LLDateUtil::ageFromDate(data->born_on, LLDate::now());
 	args["[SL_PROFILE]"] = data->about_text;
 	args["[RW_PROFILE"] = data->fl_about_text;
@@ -535,7 +536,8 @@ void LLInspectAvatar::toggleSelectedVoice(bool enabled)
 
 void LLInspectAvatar::updateVolumeSlider()
 {
-	bool voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled(mAvatarID);
+
+	bool voice_enabled = gVoiceClient->getVoiceEnabled(mAvatarID);
 
 	// Do not display volume slider and mute button if it 
 	// is ourself or we are not in a voice channel together
@@ -565,7 +567,6 @@ void LLInspectAvatar::updateVolumeSlider()
 		volume_slider->setEnabled( !is_muted );
 
 		F32 volume;
-		
 		if (is_muted)
 		{
 			// it's clearer to display their volume as zero
@@ -574,7 +575,7 @@ void LLInspectAvatar::updateVolumeSlider()
 		else
 		{
 			// actual volume
-			volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID);
+			volume = gVoiceClient->getUserVolume(mAvatarID);
 		}
 		volume_slider->setValue( (F64)volume );
 	}
@@ -603,7 +604,7 @@ void LLInspectAvatar::onClickMuteVolume()
 void LLInspectAvatar::onVolumeChange(const LLSD& data)
 {
 	F32 volume = (F32)data.asReal();
-	LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume);
+	gVoiceClient->setUserVolume(mAvatarID, volume);
 }
 
 void LLInspectAvatar::nameUpdatedCallback(
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp
index 532ffca4be5357a55d175725b844cf62a7490091..91cbbbf43060093ed96b3c6dba6af5c14b1d4e7d 100644
--- a/indra/newview/llinspectobject.cpp
+++ b/indra/newview/llinspectobject.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file llinspectobject.cpp
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -155,7 +161,8 @@ BOOL LLInspectObject::postBuild(void)
 
 	// Hide floater when name links clicked
 	LLTextBox* textbox = getChild<LLTextBox>("object_creator");
-	textbox->setURLClickedCallback(boost::bind(&LLInspectObject::closeFloater, this, false) );
+	textbox->mURLClickSignal.connect(
+		boost::bind(&LLInspectObject::closeFloater, this, false) );
 
 	// Hook up functionality
 	getChild<LLUICtrl>("buy_btn")->setCommitCallback(
@@ -473,7 +480,7 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep)
 		// Objects cannot be created by a group, so use agent URL format
 		LLUUID creator_id = nodep->mPermissions->getCreator();
 		std::string creator_url =
-			LLSLURL("agent", creator_id, "about").getSLURLString();
+			LLSLURL::buildCommand("agent", creator_id, "about");
 		args["[CREATOR]"] = creator_url;
 				
 		// created by one user but owned by another
@@ -483,12 +490,12 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep)
 		if (group_owned)
 		{
 			owner_id = nodep->mPermissions->getGroup();
-			owner_url =	LLSLURL("group", owner_id, "about").getSLURLString();
+			owner_url =	LLSLURL::buildCommand("group", owner_id, "about");
 		}
 		else
 		{
 			owner_id = nodep->mPermissions->getOwner();
-			owner_url =	LLSLURL("agent", owner_id, "about").getSLURLString();
+			owner_url =	LLSLURL::buildCommand("agent", owner_id, "about");
 		}
 		args["[OWNER]"] = owner_url;
 		
diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp
index e956b3b8dec81bf600bef7a8358e23588f457c70..66e4a1bf6602dadb83c3ff2d7f56a74ff1dce826 100644
--- a/indra/newview/llinspectremoteobject.cpp
+++ b/indra/newview/llinspectremoteobject.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file llinspectremoteobject.cpp
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -122,16 +128,7 @@ void LLInspectRemoteObject::onOpen(const LLSD& data)
 	update();
 
 	// Position the inspector relative to the mouse cursor
-	// Similar to how tooltips are positioned
-	// See LLToolTipMgr::createToolTip
-	if (data.has("pos"))
-	{
-		LLUI::positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
-	}
-	else
-	{
-		LLUI::positionViewNearMouse(this);
-	}
+	LLUI::positionViewNearMouse(this);
 }
 
 void LLInspectRemoteObject::onClickMap()
@@ -179,11 +176,11 @@ void LLInspectRemoteObject::update()
 	{
 		if (mGroupOwned)
 		{
-			owner = LLSLURL("group", mOwnerID, "about").getSLURLString();
+			owner = LLSLURL::buildCommand("group", mOwnerID, "about");
 		}
 		else
 		{
-			owner = LLSLURL("agent", mOwnerID, "about").getSLURLString();
+			owner = LLSLURL::buildCommand("agent", mOwnerID, "about");
 		}
 	}
 	else
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index beeac86f949b8d234e3f46ef7a9e365f5eecf4b5..b552b5ac0735e949bdce973a8968852880c016f2 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -2,25 +2,31 @@
  * @file llinventorybridge.cpp
  * @brief Implementation of the Inventory-Folder-View-Bridge classes.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -35,12 +41,12 @@
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
 #include "llavataractions.h"
+#include "llfloatercustomize.h"
 #include "llfloateropenobject.h"
 #include "llfloaterreg.h"
 #include "llfloaterworldmap.h"
 #include "llfriendcard.h"
 #include "llgesturemgr.h"
-#include "llgiveinventory.h"
 #include "llimfloater.h"
 #include "llimview.h"
 #include "llinventoryclipboard.h"
@@ -55,17 +61,15 @@
 #include "llpreviewgesture.h"
 #include "llpreviewtexture.h"
 #include "llselectmgr.h"
-#include "llsidepanelappearance.h"
 #include "llsidetray.h"
 #include "lltrans.h"
 #include "llviewerassettype.h"
-#include "llviewerfoldertype.h"
-#include "llviewermenu.h"
 #include "llviewermessage.h"
 #include "llviewerobjectlist.h"
 #include "llviewerwindow.h"
 #include "llvoavatarself.h"
 #include "llwearablelist.h"
+#include "llpaneloutfitsinventory.h"
 
 typedef std::pair<LLUUID, LLUUID> two_uuids_t;
 typedef std::list<two_uuids_t> two_uuids_list_t;
@@ -97,12 +101,52 @@ void dec_busy_count()
 }
 
 // Function declarations
+void wear_add_inventory_item_on_avatar(LLInventoryItem* item);
 void remove_inventory_category_from_avatar(LLInventoryCategory* category);
 void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id);
 bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*);
 bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response);
 void teleport_via_landmark(const LLUUID& asset_id);
 
+std::string ICON_NAME[ICON_NAME_COUNT] =
+{
+	"Inv_Texture",
+	"Inv_Sound",
+	"Inv_CallingCard",
+	"Inv_CallingCard",
+	"Inv_Landmark",
+	"Inv_Landmark",
+	"Inv_Script",
+	"Inv_Clothing",
+	"Inv_Object",
+	"Inv_Object_Multi",
+	"Inv_Notecard",
+	"Inv_Skin",
+	"Inv_Snapshot",
+
+	"Inv_BodyShape",
+	"Inv_Skin",
+	"Inv_Hair",
+	"Inv_Eye",
+	"Inv_Shirt",
+	"Inv_Pants",
+	"Inv_Shoe",
+	"Inv_Socks",
+	"Inv_Jacket",
+	"Inv_Gloves",
+	"Inv_Undershirt",
+	"Inv_Underpants",
+	"Inv_Skirt",
+	"Inv_Alpha",
+	"Inv_Tattoo",
+
+	"Inv_Animation",
+	"Inv_Gesture",
+
+	"Inv_LinkItem",
+	"Inv_LinkFolder"
+};
+
 // +=================================================+
 // |        LLInvFVBridge                            |
 // +=================================================+
@@ -112,17 +156,14 @@ LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory,
 							 const LLUUID& uuid) :
 	mUUID(uuid), 
 	mRoot(root),
-	mInvType(LLInventoryType::IT_NONE),
-	mIsLink(FALSE)
+	mInvType(LLInventoryType::IT_NONE)
 {
 	mInventoryPanel = inventory->getHandle();
-	const LLInventoryObject* obj = getInventoryObject();
-	mIsLink = obj && obj->getIsLinkType();
 }
 
 const std::string& LLInvFVBridge::getName() const
 {
-	const LLInventoryObject* obj = getInventoryObject();
+	LLInventoryObject* obj = getInventoryObject();
 	if(obj)
 	{
 		return obj->getName();
@@ -138,6 +179,7 @@ const std::string& LLInvFVBridge::getDisplayName() const
 // Folders have full perms
 PermissionMask LLInvFVBridge::getPermissionMask() const
 {
+
 	return PERM_ALL;
 }
 
@@ -157,7 +199,34 @@ time_t LLInvFVBridge::getCreationDate() const
 // Can be destroyed (or moved to trash)
 BOOL LLInvFVBridge::isItemRemovable() const
 {
-	return get_is_item_removable(getInventoryModel(), mUUID);
+	const LLInventoryModel* model = getInventoryModel();
+	if(!model) 
+	{
+		return FALSE;
+	}
+
+	// Can't delete an item that's in the library.
+	if(!model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()))
+	{
+		return FALSE;
+	}
+
+	// Disable delete from COF folder; have users explicitly choose "detach/take off".
+	if (LLAppearanceMgr::instance().getIsProtectedCOFItem(mUUID))
+	{
+		return FALSE;
+	}
+
+	const LLInventoryObject *obj = model->getItem(mUUID);
+	if (obj && obj->getIsLinkType())
+	{
+		return TRUE;
+	}
+	if (get_is_item_worn(mUUID))
+	{
+		return FALSE;
+	}
+	return TRUE;
 }
 
 // Can be moved to another folder
@@ -166,11 +235,6 @@ BOOL LLInvFVBridge::isItemMovable() const
 	return TRUE;
 }
 
-BOOL LLInvFVBridge::isLink() const
-{
-	return mIsLink;
-}
-
 /*virtual*/
 /**
  * @brief Adds this item into clipboard storage
@@ -185,7 +249,9 @@ void LLInvFVBridge::cutToClipboard()
 // *TODO: make sure this does the right thing
 void LLInvFVBridge::showProperties()
 {
-	show_item_profile(mUUID);
+	LLSD key;
+	key["id"] = mUUID;
+	LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
 
 	// Disable old properties floater; this is replaced by the sidepanel.
 	/*
@@ -428,7 +494,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 			}
 		}
 		const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i));
-		if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+		if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
 		{
 			return FALSE;
 		}
@@ -438,8 +504,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 
 void hide_context_entries(LLMenuGL& menu, 
 						  const menuentry_vec_t &entries_to_show,
-						  const menuentry_vec_t &disabled_entries,
-						  BOOL append) // If append is TRUE, then new enabled entries 
+						  const menuentry_vec_t &disabled_entries)
 {
 	const LLView::child_list_t *list = menu.getChildList();
 
@@ -447,15 +512,13 @@ void hide_context_entries(LLMenuGL& menu,
 	// if the first element is a separator, it will not be shown.
 	BOOL is_previous_entry_separator = TRUE;
 
-	for (LLView::child_list_t::const_iterator itor = list->begin(); 
-		 itor != list->end(); 
-		 ++itor)
+	LLView::child_list_t::const_iterator itor;
+	for (itor = list->begin(); itor != list->end(); ++itor)
 	{
-		LLView *menu_item = (*itor);
-		std::string name = menu_item->getName();
+		std::string name = (*itor)->getName();
 
 		// descend into split menus:
-		LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(menu_item);
+		LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(*itor);
 		if ((name == "More") && branchp)
 		{
 			hide_context_entries(*branchp->getBranch(), entries_to_show, disabled_entries);
@@ -476,7 +539,7 @@ void hide_context_entries(LLMenuGL& menu,
 		// between two separators).
 		if (found)
 		{
-			const BOOL is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(menu_item) != NULL);
+			const BOOL is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(*itor) != NULL);
 			if (is_entry_separator && is_previous_entry_separator)
 				found = false;
 			is_previous_entry_separator = is_entry_separator;
@@ -484,27 +547,16 @@ void hide_context_entries(LLMenuGL& menu,
 		
 		if (!found)
 		{
-			if (!menu_item->getLastVisible())
-			{
-				menu_item->setVisible(FALSE);
-			}
-			menu_item->setEnabled(FALSE);
+			(*itor)->setVisible(FALSE);
 		}
 		else
 		{
-			menu_item->setVisible(TRUE);
-			// A bit of a hack so we can remember that some UI element explicitly set this to be visible
-			// so that some other UI element from multi-select doesn't later set this invisible.
-			menu_item->pushVisible(TRUE);
-			if (append)
-			{
-				menu_item->setEnabled(TRUE);
-			}
+			(*itor)->setVisible(TRUE);
 			for (itor2 = disabled_entries.begin(); itor2 != disabled_entries.end(); ++itor2)
 			{
 				if (*itor2 == name)
 				{
-					menu_item->setEnabled(FALSE);
+					(*itor)->setEnabled(FALSE);
 				}
 			}
 		}
@@ -518,6 +570,17 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
 {
 	const LLInventoryObject *obj = getInventoryObject();
 
+	bool is_sidepanel = isInOutfitsSidePanel();
+	if (is_sidepanel)
+	{
+		// Sidepanel includes restricted menu.
+		if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID))
+		{
+			items.push_back(std::string("Remove Link"));
+		}
+		return;
+	}
+
 	if (obj)
 	{
 		if (obj->getIsLinkType())
@@ -578,7 +641,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
 		disabled_items.push_back(std::string("Paste"));
 	}
 
-	if (gSavedSettings.getBOOL("InventoryLinking"))
+	if (gAgent.isGodlike())
 	{
 		items.push_back(std::string("Paste As Link"));
 		if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0)
@@ -609,13 +672,7 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
-		{
-			disabled_items.push_back(std::string("Share"));
-		}
-		
-		addOpenRightClickMenuOption(items);
+		items.push_back(std::string("Open"));
 		items.push_back(std::string("Properties"));
 
 		getClipboardEntries(true, items, disabled_items, flags);
@@ -650,7 +707,7 @@ void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items,
 	const LLInventoryObject *obj = getInventoryObject();
 
 	// Don't allow delete as a direct option from COF folder.
-	if (obj && obj->getIsLinkType() && isCOFFolder() && get_is_item_worn(mUUID))
+	if (obj && obj->getIsLinkType() && isCOFFolder())
 	{
 		return;
 	}
@@ -671,17 +728,6 @@ void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items,
 	}
 }
 
-void LLInvFVBridge::addOpenRightClickMenuOption(menuentry_vec_t &items)
-{
-	const LLInventoryObject *obj = getInventoryObject();
-	const BOOL is_link = (obj && obj->getIsLinkType());
-
-	if (is_link)
-		items.push_back(std::string("Open Original"));
-	else
-		items.push_back(std::string("Open"));
-}
-
 // *TODO: remove this
 BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
 {
@@ -789,7 +835,21 @@ void LLInvFVBridge::changeItemParent(LLInventoryModel* model,
 									 const LLUUID& new_parent_id,
 									 BOOL restamp)
 {
-	change_item_parent(model, item, new_parent_id, restamp);
+	if (item->getParentUUID() != new_parent_id)
+	{
+		LLInventoryModel::update_list_t update;
+		LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
+		update.push_back(old_folder);
+		LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+		update.push_back(new_folder);
+		gInventory.accountForUpdate(update);
+
+		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+		new_item->setParent(new_parent_id);
+		new_item->updateParentOnServer(restamp);
+		model->updateItem(new_item);
+		model->notifyObservers();
+	}
 }
 
 // static
@@ -798,7 +858,24 @@ void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model,
 										 const LLUUID& new_parent_id,
 										 BOOL restamp)
 {
-	change_category_parent(model, cat, new_parent_id, restamp);
+	// Can't move a folder into a child of itself.
+	if (model->isObjectDescendentOf(new_parent_id, cat->getUUID()))
+	{
+		return;
+	}
+
+	LLInventoryModel::update_list_t update;
+	LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
+	update.push_back(old_folder);
+	LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+	update.push_back(new_folder);
+	model->accountForUpdate(update);
+	
+	LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
+	new_cat->setParent(new_parent_id);
+	new_cat->updateParentOnServer(restamp);
+	model->updateCategory(new_cat);
+	model->notifyObservers();
 }
 
 LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
@@ -849,7 +926,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLItemBridge(inventory, root, uuid);
+			new_listener = new LLScriptBridge(inventory, root, uuid);
 			break;
 
 		case LLAssetType::AT_OBJECT:
@@ -898,7 +975,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (LLWearableType::EType)flags);
+			new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (EWearableType)flags);
 			break;
 		case LLAssetType::AT_CATEGORY:
 			if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
@@ -944,25 +1021,14 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid)
 	}
 }
 
-BOOL LLInvFVBridge::canShare() const
+bool LLInvFVBridge::isInOutfitsSidePanel() const
 {
-	if (!isAgentInventory()) return FALSE;
-
-	const LLInventoryModel* model = getInventoryModel();
-	if (!model) return FALSE;
-
-	const LLViewerInventoryItem *item = model->getItem(mUUID);
-	if (item)
-	{
-		if (!LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item)) 
-			return FALSE;
-		return (BOOL)LLGiveInventory::isInventoryGiveAcceptable(item);
-	}
-
-	// Categories can be given.
-	if (model->getCategory(mUUID)) return TRUE;
-
-	return FALSE;
+	LLInventoryPanel *my_panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLPanelOutfitsInventory *outfit_panel =
+		dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory"));
+	if (!outfit_panel)
+		return false;
+	return outfit_panel->isTabPanel(my_panel);
 }
 
 // +=================================================+
@@ -996,7 +1062,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
 		gotoItem();
 	}
 
-	if ("open" == action || "open_original" == action)
+	if ("open" == action)
 	{
 		openItem();
 		return;
@@ -1067,7 +1133,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
 void LLItemBridge::selectItem()
 {
 	LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
-	if(item && !item->isFinished())
+	if(item && !item->isComplete())
 	{
 		item->fetchFromServer();
 	}
@@ -1140,22 +1206,25 @@ void LLItemBridge::gotoItem()
 
 LLUIImagePtr LLItemBridge::getIcon() const
 {
-	LLInventoryObject *obj = getInventoryObject();
-	if (obj) 
-	{
-		return LLInventoryIcon::getIcon(obj->getType(),
-										LLInventoryType::IT_NONE,
-										mIsLink);
-	}
-	
-	return LLInventoryIcon::getIcon(LLInventoryIcon::ICONNAME_OBJECT);
+	return LLUI::getUIImage(ICON_NAME[OBJECT_ICON_NAME]);
 }
 
 PermissionMask LLItemBridge::getPermissionMask() const
 {
 	LLViewerInventoryItem* item = getItem();
 	PermissionMask perm_mask = 0;
-	if (item) perm_mask = item->getPermissionMask();
+	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;
+
+	}
 	return perm_mask;
 }
 
@@ -1183,18 +1252,18 @@ void LLItemBridge::buildDisplayName(LLInventoryItem* item, std::string& name)
 LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const
 {
 	U8 font = LLFontGL::NORMAL;
-	const LLViewerInventoryItem* item = getItem();
 
 	if (get_is_item_worn(mUUID))
 	{
 		// llinfos << "BOLD" << llendl;
 		font |= LLFontGL::BOLD;
 	}
-	else if(item && item->getIsLinkType())
+
+	const LLViewerInventoryItem* item = getItem();
+	if (item && item->getIsLinkType())
 	{
 		font |= LLFontGL::ITALIC;
 	}
-
 	return (LLFontGL::StyleFlags)font;
 }
 
@@ -1300,65 +1369,13 @@ BOOL LLItemBridge::removeItem()
 	{
 		return FALSE;
 	}
-
-	
 	// move it to the trash
 	LLPreview::hide(mUUID, TRUE);
 	LLInventoryModel* model = getInventoryModel();
 	if(!model) return FALSE;
-	const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
-	LLViewerInventoryItem* item = getItem();
-	if (!item) return FALSE;
-
-	// Already in trash
-	if (model->isObjectDescendentOf(mUUID, trash_id)) return FALSE;
-
-	LLNotification::Params params("ConfirmItemDeleteHasLinks");
-	params.functor.function(boost::bind(&LLItemBridge::confirmRemoveItem, this, _1, _2));
-	
-	// Check if this item has any links.  If generic inventory linking is enabled,
-	// we can't do this check because we may have items in a folder somewhere that is
-	// not yet in memory, so we don't want false negatives.  (If disabled, then we 
-	// know we only have links in the Outfits folder which we explicitly fetch.)
-	if (!gSavedSettings.getBOOL("InventoryLinking"))
-	{
-		if (!item->getIsLinkType())
-		{
-			LLInventoryModel::cat_array_t cat_array;
-			LLInventoryModel::item_array_t item_array;
-			LLLinkedItemIDMatches is_linked_item_match(mUUID);
-			gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
-											cat_array,
-											item_array,
-											LLInventoryModel::INCLUDE_TRASH,
-											is_linked_item_match);
-
-			const U32 num_links = cat_array.size() + item_array.size();
-			if (num_links > 0)
-			{
-				// Warn if the user is will break any links when deleting this item.
-				LLNotifications::instance().add(params);
-				return FALSE;
-			}
-		}
-	}
-	
-	LLNotifications::instance().forceResponse(params, 0);
-	return TRUE;
-}
-
-BOOL LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (option != 0) return FALSE;
-
-	LLInventoryModel* model = getInventoryModel();
-	if (!model) return FALSE;
-
+	const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
 	LLViewerInventoryItem* item = getItem();
-	if (!item) return FALSE;
 
-	const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
 	// if item is not already in trash
 	if(item && !model->isObjectDescendentOf(mUUID, trash_id))
 	{
@@ -1367,7 +1384,11 @@ BOOL LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& respo
 		// delete was successful
 		return TRUE;
 	}
-	return FALSE;
+	else
+	{
+		// tried to delete already item in trash (should purge?)
+		return FALSE;
+	}
 }
 
 BOOL LLItemBridge::isItemCopyable() const
@@ -1387,11 +1408,17 @@ BOOL LLItemBridge::isItemCopyable() const
 			return FALSE;
 		}
 
-		// All items can be copied in god mode since you can
-		// at least paste-as-link the item, though you 
-		// still may not be able paste the item.
-		return TRUE;
-		// return (item->getPermissions().allowCopyBy(gAgent.getID()));
+		if (gAgent.isGodlike())
+		{
+			// All items can be copied in god mode since you can
+			// at least paste-as-link the item, though you 
+			// still may not be able paste the item.
+			return TRUE;
+		}
+		else
+		{
+			return (item->getPermissions().allowCopyBy(gAgent.getID()));
+		}
 	}
 	return FALSE;
 }
@@ -1441,7 +1468,7 @@ bool LLItemBridge::isRemoveAction(std::string action) const
 // |        LLFolderBridge                           |
 // +=================================================+
 
-LLHandle<LLFolderBridge> LLFolderBridge::sSelf;
+LLFolderBridge* LLFolderBridge::sSelf=NULL;
 
 // Can be moved to another folder
 BOOL LLFolderBridge::isItemMovable() const
@@ -1479,7 +1506,26 @@ class LLIsItemRemovable : public LLFolderViewFunctor
 // Can be destroyed (or moved to trash)
 BOOL LLFolderBridge::isItemRemovable() const
 {
-	if (!get_is_category_removable(getInventoryModel(), mUUID))
+	LLInventoryModel* model = getInventoryModel();
+	if(!model)
+	{
+		return FALSE;
+	}
+
+	if(!model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()))
+	{
+		return FALSE;
+	}
+
+	if (!isAgentAvatarValid()) return FALSE;
+
+	LLInventoryCategory* category = model->getCategory(mUUID);
+	if(!category)
+	{
+		return FALSE;
+	}
+
+	if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
 	{
 		return FALSE;
 	}
@@ -1495,7 +1541,6 @@ BOOL LLFolderBridge::isItemRemovable() const
 			return FALSE;
 		}
 	}
-
 	return TRUE;
 }
 
@@ -1514,11 +1559,6 @@ BOOL LLFolderBridge::isUpToDate() const
 
 BOOL LLFolderBridge::isItemCopyable() const
 {
-	if (gSavedSettings.getBOOL("InventoryLinking"))
-	{
-		// Can copy folders to paste-as-link, but not for straight paste.
-		return TRUE;
-	}
 	return FALSE;
 }
 
@@ -1621,70 +1661,84 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const
 BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 											BOOL drop)
 {
+	// This should never happen, but if an inventory item is incorrectly parented,
+	// the UI will get confused and pass in a NULL.
+	if(!inv_cat) return FALSE;
 
 	LLInventoryModel* model = getInventoryModel();
+	if(!model) return FALSE;
 
-	if (!inv_cat) return FALSE; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL
-	if (!model) return FALSE;
 	if (!isAgentAvatarValid()) return FALSE;
-	if (!isAgentInventory()) return FALSE; // cannot drag categories into library
 
+	// cannot drag categories into library
+	if(!isAgentInventory())
+	{
+		return FALSE;
+	}
 
 	// check to make sure source is agent inventory, and is represented there.
 	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
-	const BOOL is_agent_inventory = (model->getCategory(inv_cat->getUUID()) != NULL)
+	BOOL is_agent_inventory = (model->getCategory(inv_cat->getUUID()) != NULL)
 		&& (LLToolDragAndDrop::SOURCE_AGENT == source);
 
 	BOOL accept = FALSE;
-	if (is_agent_inventory)
+	S32 i;
+	LLInventoryModel::cat_array_t	descendent_categories;
+	LLInventoryModel::item_array_t	descendent_items;
+	if(is_agent_inventory)
 	{
-		const LLUUID &cat_id = inv_cat->getUUID();
-		const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false);
-		const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
-		
-		const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
-		const BOOL move_is_into_outfit = getCategory() && (getCategory()->getPreferredType() == LLFolderType::FT_OUTFIT);
-		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+		const LLUUID& cat_id = inv_cat->getUUID();
 
-		//--------------------------------------------------------------------------------
-		// Determine if folder can be moved.
-		//
+		// Is the destination the trash?
+		const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+		BOOL move_is_into_trash = (mUUID == trash_id)
+			|| model->isObjectDescendentOf(mUUID, trash_id);
+		BOOL is_movable = (!LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()));
+		const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+		BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+		BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+		if (move_is_into_current_outfit || move_is_into_outfit)
+		{
+			// BAP - restrictions?
+			is_movable = true;
+		}
 
-		BOOL is_movable = TRUE;
-		if (LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()))
-			is_movable = FALSE;
-		if (move_is_into_outfit)
-			is_movable = FALSE;
 		if (mUUID == gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE))
-			is_movable = FALSE;
-		LLInventoryModel::cat_array_t descendent_categories;
-		LLInventoryModel::item_array_t descendent_items;
-		gInventory.collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
-		for (S32 i=0; i < descendent_categories.count(); ++i)
 		{
-			LLInventoryCategory* category = descendent_categories[i];
-			if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
-			{
-				// Can't move "special folders" (e.g. Textures Folder).
-				is_movable = FALSE;
-				break;
-			}
+			is_movable = FALSE; // It's generally movable but not into Favorites folder. EXT-1604
 		}
-		if (move_is_into_trash)
+
+		if( is_movable )
 		{
-			for (S32 i=0; i < descendent_items.count(); ++i)
+			gInventory.collectDescendents( cat_id, descendent_categories, descendent_items, FALSE );
+
+			for( i = 0; i < descendent_categories.count(); i++ )
 			{
-				LLInventoryItem* item = descendent_items[i];
-				if (get_is_item_worn(item->getUUID()))
+				LLInventoryCategory* category = descendent_categories[i];
+				if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
 				{
+					// ...can't move "special folders" like Textures
 					is_movable = FALSE;
-					break; // It's generally movable, but not into the trash.
+					break;
 				}
 			}
-		}
 
-		// 
-		//--------------------------------------------------------------------------------
+			if( is_movable )
+			{
+				if( move_is_into_trash )
+				{
+					for( i = 0; i < descendent_items.count(); i++ )
+					{
+						LLInventoryItem* item = descendent_items[i];
+						if (get_is_item_worn(item->getUUID()))
+						{
+							is_movable = FALSE;
+							break; // It's generally movable, but not into the trash!
+						}
+					}
+				}
+			}
+		}
 
 		accept = is_movable
 			&& (mUUID != cat_id)								// Can't move a folder into itself
@@ -1695,7 +1749,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 			// Look for any gestures and deactivate them
 			if (move_is_into_trash)
 			{
-				for (S32 i=0; i < descendent_items.count(); i++)
+				for (i = 0; i < descendent_items.count(); i++)
 				{
 					LLInventoryItem* item = descendent_items[i];
 					if (item->getType() == LLAssetType::AT_GESTURE
@@ -1736,13 +1790,11 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 					else
 					{
 						LLPointer<LLInventoryCallback> cb = NULL;
-						const std::string empty_description = "";
 						link_inventory_item(
 							gAgent.getID(),
 							inv_cat->getUUID(),
 							mUUID,
 							inv_cat->getName(),
-							empty_description,
 							LLAssetType::AT_LINK_FOLDER,
 							cb);
 					}
@@ -1881,17 +1933,13 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 }
 
 //Used by LLFolderBridge as callback for directory recursion.
-class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver
+class LLRightClickInventoryFetchObserver : public LLInventoryFetchObserver
 {
 public:
-	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) :
-		LLInventoryFetchItemsObserver(ids),
+	LLRightClickInventoryFetchObserver() :
 		mCopyItems(false)
 	{ };
-	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids,
-									   const LLUUID& cat_id, 
-									   bool copy_items) :
-		LLInventoryFetchItemsObserver(ids),
+	LLRightClickInventoryFetchObserver(const LLUUID& cat_id, bool copy_items) :
 		mCatID(cat_id),
 		mCopyItems(copy_items)
 	{ };
@@ -1915,11 +1963,7 @@ class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver
 class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
 {
 public:
-	LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids,
-												  bool copy_items) : 
-		LLInventoryFetchDescendentsObserver(ids),
-		mCopyItems(copy_items) 
-	{}
+	LLRightClickInventoryFetchDescendentsObserver(bool copy_items) : mCopyItems(copy_items) {}
 	~LLRightClickInventoryFetchDescendentsObserver() {}
 	virtual void done();
 protected:
@@ -1962,14 +2006,14 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 	}
 #endif
 
+	LLRightClickInventoryFetchObserver* outfit;
+	outfit = new LLRightClickInventoryFetchObserver(mComplete.front(), mCopyItems);
 	uuid_vec_t ids;
 	for(S32 i = 0; i < count; ++i)
 	{
 		ids.push_back(item_array.get(i)->getUUID());
 	}
 
-	LLRightClickInventoryFetchObserver* outfit = new LLRightClickInventoryFetchObserver(ids, mComplete.front(), mCopyItems);
-
 	// clean up, and remove this as an observer since the call to the
 	// outfit could notify observers and throw us into an infinite
 	// loop.
@@ -1982,10 +2026,10 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 	inc_busy_count();
 
 	// do the fetch
-	outfit->startFetch();
+	outfit->fetch(ids);
 	outfit->done();				//Not interested in waiting and this will be right 99% of the time.
 //Uncomment the following code for laggy Inventory UI.
-/*	if(outfit->isFinished())
+/*	if(outfit->isEverythingComplete())
 	{
 	// everything is already here - call done.
 	outfit->done();
@@ -2056,7 +2100,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
 				    mContentsCount)
 				{
 					gInventory.removeObserver(this);
-					LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, FALSE);
+					LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, TRUE);
 					delete this;
 				}
 			}
@@ -2184,7 +2228,13 @@ void LLFolderBridge::determineFolderType()
 
 BOOL LLFolderBridge::isItemRenameable() const
 {
-	return get_is_category_renameable(getInventoryModel(), mUUID);
+	LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)getCategory();
+	if(cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType())
+	   && (cat->getOwnerID() == gAgent.getID()))
+	{
+		return TRUE;
+	}
+	return FALSE;
 }
 
 void LLFolderBridge::restoreItem()
@@ -2224,22 +2274,42 @@ LLUIImagePtr LLFolderBridge::getIcon() const
 	return getIcon(preferred_type);
 }
 
-// static
 LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
 {
-	return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, FALSE));
+	// we only have one folder image now
+	if (preferred_type == LLFolderType::FT_OUTFIT)
+	{
+		return LLUI::getUIImage("Inv_LookFolderClosed");
+	}
+	return LLUI::getUIImage("Inv_FolderClosed");
 }
 
 LLUIImagePtr LLFolderBridge::getOpenIcon() const
 {
-	return LLUI::getUIImage(LLViewerFolderType::lookupIconName(getPreferredType(), TRUE));
-
+	if (getPreferredType() == LLFolderType::FT_OUTFIT)
+	{
+		return LLUI::getUIImage("Inv_LookFolderOpen");
+	}
+	return LLUI::getUIImage("Inv_FolderOpen");
 }
 
 BOOL LLFolderBridge::renameItem(const std::string& new_name)
 {
-	rename_category(getInventoryModel(), mUUID, new_name);
+	if(!isItemRenameable())
+		return FALSE;
+	LLInventoryModel* model = getInventoryModel();
+	if(!model)
+		return FALSE;
+	LLViewerInventoryCategory* cat = getCategory();
+	if(cat && (cat->getName() != new_name))
+	{
+		LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
+		new_cat->rename(new_name);
+		new_cat->updateServer(FALSE);
+		model->updateCategory(new_cat);
 
+		model->notifyObservers();
+	}
 	// return FALSE because we either notified observers (& therefore
 	// rebuilt) or we didn't update.
 	return FALSE;
@@ -2293,7 +2363,36 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re
 	{
 		// move it to the trash
 		LLPreview::hide(mUUID);
-		remove_category(getInventoryModel(), mUUID);
+		LLInventoryModel* model = getInventoryModel();
+		if(!model) return FALSE;
+		
+		const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+		
+		// Look for any gestures and deactivate them
+		LLInventoryModel::cat_array_t	descendent_categories;
+		LLInventoryModel::item_array_t	descendent_items;
+		gInventory.collectDescendents( mUUID, descendent_categories, descendent_items, FALSE );
+		
+		for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin();
+			 iter != descendent_items.end();
+			 ++iter)
+		{
+			const LLViewerInventoryItem* item = (*iter);
+			const LLUUID& item_id = item->getUUID();
+			if (item->getType() == LLAssetType::AT_GESTURE
+				&& LLGestureMgr::instance().isGestureActive(item_id))
+			{
+				LLGestureMgr::instance().deactivateGesture(item_id);
+			}
+		}
+		
+		// go ahead and do the normal remove if no 'last calling
+		// cards' are being removed.
+		LLViewerInventoryCategory* cat = getCategory();
+		if(cat)
+		{
+			LLInvFVBridge::changeCategoryParent(model, cat, trash_id, TRUE);
+		}
 		return TRUE;
 	}
 	return FALSE;
@@ -2356,40 +2455,37 @@ void LLFolderBridge::pasteLinkFromClipboard()
 			 ++iter)
 		{
 			const LLUUID &object_id = (*iter);
+#if SUPPORT_ENSEMBLES
 			if (LLInventoryCategory *cat = model->getCategory(object_id))
 			{
-				const std::string empty_description = "";
 				link_inventory_item(
 					gAgent.getID(),
 					cat->getUUID(),
 					parent_id,
 					cat->getName(),
-					empty_description,
 					LLAssetType::AT_LINK_FOLDER,
 					LLPointer<LLInventoryCallback>(NULL));
 			}
-			else if (LLInventoryItem *item = model->getItem(object_id))
-			{
-				link_inventory_item(
-					gAgent.getID(),
-					item->getLinkedUUID(),
-					parent_id,
-					item->getName(),
-					item->getDescription(),
-					LLAssetType::AT_LINK,
-					LLPointer<LLInventoryCallback>(NULL));
-			}
+			else
+#endif
+				if (LLInventoryItem *item = model->getItem(object_id))
+				{
+					link_inventory_item(
+						gAgent.getID(),
+						item->getLinkedUUID(),
+						parent_id,
+						item->getName(),
+						LLAssetType::AT_LINK,
+						LLPointer<LLInventoryCallback>(NULL));
+				}
 		}
 	}
 }
 
 void LLFolderBridge::staticFolderOptionsMenu()
 {
-	LLFolderBridge* selfp = sSelf.get();
-	if (selfp)
-	{
-		selfp->folderOptionsMenu();
-	}
+	if (!sSelf) return;
+	sSelf->folderOptionsMenu();
 }
 
 void LLFolderBridge::folderOptionsMenu()
@@ -2402,19 +2498,23 @@ void LLFolderBridge::folderOptionsMenu()
 	const LLInventoryCategory* category = model->getCategory(mUUID);
 	if(!category) return;
 
-	const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
-	if (trash_id == mUUID) return;
-	if (isItemInTrash()) return;
-	if (!isAgentInventory()) return;
-
 	LLFolderType::EType type = category->getPreferredType();
 	const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
 	// BAP change once we're no longer treating regular categories as ensembles.
 	const bool is_ensemble = (type == LLFolderType::FT_NONE ||
 							  LLFolderType::lookupIsEnsembleType(type));
 
+	// calling card related functionality for folders.
+
+	const bool is_sidepanel = isInOutfitsSidePanel();
+	if (is_sidepanel)
+	{
+		mItems.push_back("Rename");
+		addDeleteContextMenuOptions(mItems, disabled_items);
+	}
+
 	// Only enable calling-card related options for non-system folders.
-	if (!is_system_folder)
+	if (!is_sidepanel && !is_system_folder)
 	{
 		LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
 		if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
@@ -2443,7 +2543,10 @@ void LLFolderBridge::folderOptionsMenu()
 		checkFolderForContentsOfType(model, is_object) ||
 		checkFolderForContentsOfType(model, is_gesture) )
 	{
-		mItems.push_back(std::string("Folder Wearables Separator"));
+		if (!is_sidepanel)
+		{
+			mItems.push_back(std::string("Folder Wearables Separator"));
+		}
 
 		// Only enable add/replace outfit for non-system folders.
 		if (!is_system_folder)
@@ -2460,21 +2563,17 @@ void LLFolderBridge::folderOptionsMenu()
 			mItems.push_back(std::string("Wear As Ensemble"));
 		}
 		mItems.push_back(std::string("Remove From Outfit"));
-		if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID))
+		if (!areAnyContentsWorn(model))
 		{
 			disabled_items.push_back(std::string("Remove From Outfit"));
 		}
 		mItems.push_back(std::string("Outfit Separator"));
 	}
-	LLMenuGL* menup = dynamic_cast<LLMenuGL*>(mMenu.get());
-	if (menup)
-	{
-		hide_context_entries(*menup, mItems, disabled_items, TRUE);
+	hide_context_entries(*mMenu, mItems, disabled_items);
 
-		// Reposition the menu, in case we're adding items to an existing menu.
-		menup->needsArrange();
-		menup->arrangeAndClear();
-	}
+	// Reposition the menu, in case we're adding items to an existing menu.
+	mMenu->needsArrange();
+	mMenu->arrangeAndClear();
 }
 
 BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type)
@@ -2489,16 +2588,45 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv
 	return ((item_array.count() > 0) ? TRUE : FALSE );
 }
 
-// Flags unused
-void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+class LLFindWorn : public LLInventoryCollectFunctor
 {
-	mItems.clear();
-	mDisabledItems.clear();
-
-	lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
-
-//	menuentry_vec_t disabled_items;
-	LLInventoryModel* model = getInventoryModel();
+public:
+	LLFindWorn() {}
+	virtual ~LLFindWorn() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item)
+	{
+		if (item && get_is_item_worn(item->getUUID()))
+		{
+			return TRUE;
+		}
+		return FALSE;
+	}
+};
+
+BOOL LLFolderBridge::areAnyContentsWorn(LLInventoryModel* model) const
+{
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t item_array;
+	LLFindWorn is_worn;
+	model->collectDescendentsIf(mUUID,
+								cat_array,
+								item_array,
+								LLInventoryModel::EXCLUDE_TRASH,
+								is_worn);
+	return (item_array.size() > 0);
+}
+
+// Flags unused
+void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+	mItems.clear();
+	mDisabledItems.clear();
+
+	lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
+
+//	menuentry_vec_t disabled_items;
+	LLInventoryModel* model = getInventoryModel();
 	if(!model) return;
 	const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
 	const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
@@ -2507,19 +2635,8 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	{
 		// This is the lost+found folder.
 		mItems.push_back(std::string("Empty Lost And Found"));
-
-		mDisabledItems.push_back(std::string("New Folder"));
-		mDisabledItems.push_back(std::string("New Script"));
-		mDisabledItems.push_back(std::string("New Note"));
-		mDisabledItems.push_back(std::string("New Gesture"));
-		mDisabledItems.push_back(std::string("New Clothes"));
-		mDisabledItems.push_back(std::string("New Body Parts"));
 	}
 
-	// clear out old menu and folder pointers
-	mMenu.markDead();
-	sSelf.markDead();
-
 	if(trash_id == mUUID)
 	{
 		// This is the trash.
@@ -2547,9 +2664,9 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 			mItems.push_back(std::string("New Clothes"));
 			mItems.push_back(std::string("New Body Parts"));
 
-#if SUPPORT_ENSEMBLES
-			// Changing folder types is an unfinished unsupported feature
+			// Changing folder types is just a debug feature; this is fairly unsupported
 			// and can lead to unexpected behavior if enabled.
+#if !LL_RELEASE_FOR_DOWNLOAD
 			mItems.push_back(std::string("Change Type"));
 			const LLViewerInventoryCategory *cat = getCategory();
 			if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
@@ -2595,45 +2712,44 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		{
 			mWearables=TRUE;
 		}
-	}
 
-	// Preemptively disable system folder removal if more than one item selected.
-	if ((flags & FIRST_SELECTED_ITEM) == 0)
-	{
-		mDisabledItems.push_back(std::string("Delete System Folder"));
-	}
+		mMenu = &menu;
+		sSelf = this;
+		LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE);
 
-	mItems.push_back(std::string("Share"));
-	if (!canShare())
-	{
-		mDisabledItems.push_back(std::string("Share"));
+		uuid_vec_t folders;
+		LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
+		if (category)
+		{
+			folders.push_back(category->getUUID());
+		}
+		fetch->fetch(folders);
+		inc_busy_count();
+		if(fetch->isEverythingComplete())
+		{
+			// everything is already here - call done.
+			fetch->done();
+		}
+		else
+		{
+			// it's all on it's way - add an observer, and the inventory
+			// will call done for us when everything is here.
+			gInventory.addObserver(fetch);
+		}
 	}
-
-	hide_context_entries(menu, mItems, mDisabledItems);
-
-	// Add menu items that are dependent on the contents of the folder.
-	uuid_vec_t folders;
-	LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
-	if (category)
+	else
 	{
-		folders.push_back(category->getUUID());
+		mItems.push_back(std::string("--no options--"));
+		mDisabledItems.push_back(std::string("--no options--"));
 	}
 
-	mMenu = menu.getHandle();
-	sSelf = getHandle();
-	LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE);
-	fetch->startFetch();
-	inc_busy_count();
-	if(fetch->isFinished())
-	{
-		// everything is already here - call done.
-		fetch->done();
-	}
-	else
+	// Preemptively disable system folder removal if more than one item selected.
+	if ((flags & FIRST_SELECTED_ITEM) == 0)
 	{
-		// it's all on its way - add an observer, and the inventory will call done for us when everything is here.
-		gInventory.addObserver(fetch);
+		mDisabledItems.push_back(std::string("Delete System Folder"));
 	}
+	
+	hide_context_entries(menu, mItems, mDisabledItems);
 }
 
 BOOL LLFolderBridge::hasChildren() const
@@ -2724,75 +2840,90 @@ void LLFolderBridge::createNewCategory(void* user_data)
 
 void LLFolderBridge::createNewShirt(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHIRT);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHIRT);
 }
 
 void LLFolderBridge::createNewPants(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_PANTS);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_PANTS);
 }
 
 void LLFolderBridge::createNewShoes(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHOES);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHOES);
 }
 
 void LLFolderBridge::createNewSocks(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SOCKS);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SOCKS);
 }
 
 void LLFolderBridge::createNewJacket(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_JACKET);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_JACKET);
 }
 
 void LLFolderBridge::createNewSkirt(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIRT);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIRT);
 }
 
 void LLFolderBridge::createNewGloves(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_GLOVES);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_GLOVES);
 }
 
 void LLFolderBridge::createNewUndershirt(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERSHIRT);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERSHIRT);
 }
 
 void LLFolderBridge::createNewUnderpants(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERPANTS);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERPANTS);
 }
 
 void LLFolderBridge::createNewShape(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHAPE);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHAPE);
 }
 
 void LLFolderBridge::createNewSkin(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIN);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIN);
 }
 
 void LLFolderBridge::createNewHair(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_HAIR);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_HAIR);
 }
 
 void LLFolderBridge::createNewEyes(void* user_data)
 {
-	LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_EYES);
+	LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_EYES);
 }
 
 // static
-void LLFolderBridge::createWearable(LLFolderBridge* bridge, LLWearableType::EType type)
+void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type)
 {
 	if(!bridge) return;
 	LLUUID parent_id = bridge->getUUID();
-	LLAgentWearables::createWearable(type, false, parent_id);
+	createWearable(parent_id, type);
+}
+
+// Separate function so can be called by global menu as well as right-click
+// menu.
+// static
+void LLFolderBridge::createWearable(const LLUUID &parent_id, EWearableType type)
+{
+	LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
+	LLAssetType::EType asset_type = wearable->getAssetType();
+	LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE;
+	create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
+						  parent_id, wearable->getTransactionID(), wearable->getName(),
+						  wearable->getDescription(), asset_type, inv_type, wearable->getType(),
+						  wearable->getPermissions().getMaskNextOwner(),
+						  LLPointer<LLInventoryCallback>(NULL));
 }
 
 void LLFolderBridge::modifyOutfit(BOOL append)
@@ -2845,16 +2976,18 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
 	return false;
 }
 
-// This is used both for testing whether an item can be dropped
-// into the folder, as well as performing the actual drop, depending
-// if drop == TRUE.
 BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 										BOOL drop)
 {
 	LLInventoryModel* model = getInventoryModel();
-
 	if(!model || !inv_item) return FALSE;
-	if(!isAgentInventory()) return FALSE; // cannot drag into library
+
+	// cannot drag into library
+	if(!isAgentInventory())
+	{
+		return FALSE;
+	}
+
 	if (!isAgentAvatarValid()) return FALSE;
 
 	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
@@ -2862,23 +2995,8 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 	LLViewerObject* object = NULL;
 	if(LLToolDragAndDrop::SOURCE_AGENT == source)
 	{
-		const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false);
-		const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
-		const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false);
-
-		const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
-		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
-		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
-		const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
-		const BOOL folder_allows_reorder = (mUUID == favorites_id);
-
-		//--------------------------------------------------------------------------------
-		// Determine if item can be moved.
-		//
-
 		BOOL is_movable = TRUE;
-
-		switch (inv_item->getActualType())
+		switch( inv_item->getActualType() )
 		{
 			case LLAssetType::AT_CATEGORY:
 				is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
@@ -2886,50 +3004,41 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			default:
 				break;
 		}
+
+		const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+		const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
+		const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+		const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
+
 		// Can't explicitly drag things out of the COF.
 		if (move_is_outof_current_outfit)
 		{
 			is_movable = FALSE;
 		}
-		if (move_is_into_trash)
+		
+		if(is_movable && move_is_into_trash)
 		{
-			is_movable &= inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID());
+			is_movable = inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID());
 		}
-		if (is_movable)
+
+		if ( is_movable )
 		{
 			// Don't allow creating duplicates in the Calling Card/Friends
 			// subfolders, see bug EXT-1599. Check is item direct descendent
 			// of target folder and forbid item's movement if it so.
 			// Note: isItemDirectDescendentOfCategory checks if
 			// passed category is in the Calling Card/Friends folder
-			is_movable &= !LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(inv_item, getCategory());
-		}
-
-		// 
-		//--------------------------------------------------------------------------------
-		
-		//--------------------------------------------------------------------------------
-		// Determine if item can be moved & dropped
-		//
-
-		accept = TRUE;
-
-		if (!is_movable) 
-			accept = FALSE;
-		if ((mUUID == inv_item->getParentUUID()) && !folder_allows_reorder)
-			accept = FALSE;
-		if (move_is_into_current_outfit || move_is_into_outfit)
-		{
-			if ((inv_item->getInventoryType() != LLInventoryType::IT_WEARABLE) &&
-				(inv_item->getInventoryType() != LLInventoryType::IT_GESTURE) &&
-				(inv_item->getInventoryType() != LLInventoryType::IT_OBJECT))
-				accept = FALSE;
-		}
-		if (move_is_into_current_outfit && get_is_item_worn(inv_item->getUUID()))
-		{
-			accept = FALSE;
+			is_movable = ! LLFriendCardsManager::instance()
+				.isObjDirectDescendentOfCategory (inv_item, getCategory());
 		}
 
+		const LLUUID& favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+		const BOOL folder_allows_reorder = (mUUID == favorites_id);
+	   
+		// we can move item inside a folder only if this folder is Favorites. See EXT-719
+		accept = is_movable && ((mUUID != inv_item->getParentUUID()) || folder_allows_reorder);
 		if(accept && drop)
 		{
 			if (inv_item->getType() == LLAssetType::AT_GESTURE
@@ -2937,8 +3046,10 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			{
 				LLGestureMgr::instance().deactivateGesture(inv_item->getUUID());
 			}
-			// If an item is being dragged between windows, unselect everything in the active window 
-			// so that we don't follow the selection to its new location (which is very annoying).
+			// If an item is being dragged between windows, unselect
+			// everything in the active window so that we don't follow
+			// the selection to its new location (which is very
+			// annoying).
 			LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
 			if (active_panel)
 			{
@@ -2949,12 +3060,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 				}
 			}
 
-			//--------------------------------------------------------------------------------
-			// Destination folder logic
-			// 
-
-			// REORDER
-			// (only reorder the item)
+			// if dragging from/into favorites folder only reorder items
 			if ((mUUID == inv_item->getParentUUID()) && folder_allows_reorder)
 			{
 				LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
@@ -2966,10 +3072,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 					gInventory.rearrangeFavoriteLandmarks(srcItemId, destItemId);
 				}
 			}
-
-			// FAVORITES folder
-			// (copy the item)
-			else if (favorites_id == mUUID)
+			else if (favorites_id == mUUID) // if target is the favorites folder we use copy
 			{
 				// use callback to rearrange favorite landmarks after adding
 				// to have new one placed before target (on which it was dropped). See EXT-4312.
@@ -2989,50 +3092,37 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 					std::string(),
 					cb);
 			}
-			// CURRENT OUTFIT or OUTFIT folder
-			// (link the item)
 			else if (move_is_into_current_outfit || move_is_into_outfit)
 			{
-				if ((inv_item->getInventoryType() == LLInventoryType::IT_WEARABLE) || 
-					(inv_item->getInventoryType() == LLInventoryType::IT_GESTURE) || 
-					(inv_item->getInventoryType() == LLInventoryType::IT_OBJECT))
+				// BAP - should skip if dup.
+				if (move_is_into_current_outfit)
 				{
-					// BAP - should skip if dup.
-					if (move_is_into_current_outfit)
-					{
-						LLAppearanceMgr::instance().wearItemOnAvatar(inv_item->getUUID(), true, true);
-					}
-					else
-					{
-						LLPointer<LLInventoryCallback> cb = NULL;
-						link_inventory_item(
-							gAgent.getID(),
-							inv_item->getLinkedUUID(),
-							mUUID,
-							inv_item->getName(),
-							inv_item->getDescription(),
-							LLAssetType::AT_LINK,
-							cb);
-					}
+					LLAppearanceMgr::instance().addCOFItemLink(inv_item);
+				}
+				else
+				{
+					LLPointer<LLInventoryCallback> cb = NULL;
+					link_inventory_item(
+						gAgent.getID(),
+						inv_item->getLinkedUUID(),
+						mUUID,
+						inv_item->getName(),
+						LLAssetType::AT_LINK,
+						cb);
 				}
 			}
-			// NORMAL or TRASH folder
-			// (move the item, restamp if into trash)
 			else
 			{
+				// restamp if the move is into the trash.
 				LLInvFVBridge::changeItemParent(
 					model,
 					(LLViewerInventoryItem*)inv_item,
 					mUUID,
 					move_is_into_trash);
 			}
-
-			// 
-			//--------------------------------------------------------------------------------
-
 		}
 	}
-	else if (LLToolDragAndDrop::SOURCE_WORLD == source)
+	else if(LLToolDragAndDrop::SOURCE_WORLD == source)
 	{
 		// Make sure the object exists. If we allowed dragging from
 		// anonymous objects, it would be possible to bypass
@@ -3050,7 +3140,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		BOOL is_move = FALSE;
 		if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
 			&& perm.allowTransferTo(gAgent.getID())))
-			// || gAgent.isGodlike())
+//		   || gAgent.isGodlike())
 
 		{
 			accept = TRUE;
@@ -3077,9 +3167,6 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			}
 			else
 			{
-				// store dad inventory item to select added one later. See EXT-4347
-				set_dad_inventory_item(inv_item, mUUID);
-
 				LLNotification::Params params("MoveInventoryFromObject");
 				params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv));
 				LLNotifications::instance().forceResponse(params, 0);
@@ -3099,7 +3186,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 	else if(LLToolDragAndDrop::SOURCE_LIBRARY == source)
 	{
 		LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item;
-		if(item && item->isFinished())
+		if(item && item->isComplete())
 		{
 			accept = TRUE;
 			if(drop)
@@ -3121,13 +3208,22 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 	return accept;
 }
 
+// +=================================================+
+// |        LLScriptBridge (DEPRECTED)               |
+// +=================================================+
+
+LLUIImagePtr LLScriptBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
+}
+
 // +=================================================+
 // |        LLTextureBridge                          |
 // +=================================================+
 
 LLUIImagePtr LLTextureBridge::getIcon() const
 {
-	return LLInventoryIcon::getIcon(LLAssetType::AT_TEXTURE, mInvType);
+	return get_item_icon(LLAssetType::AT_TEXTURE, mInvType, 0, FALSE);
 }
 
 void LLTextureBridge::openItem()
@@ -3167,13 +3263,7 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
-		{
-			disabled_items.push_back(std::string("Share"));
-		}
-
-		addOpenRightClickMenuOption(items);
+		items.push_back(std::string("Open"));
 		items.push_back(std::string("Properties"));
 
 		getClipboardEntries(true, items, disabled_items, flags);
@@ -3207,14 +3297,32 @@ void LLTextureBridge::performAction(LLInventoryModel* model, std::string action)
 // |        LLSoundBridge                            |
 // +=================================================+
 
+LLUIImagePtr LLSoundBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_SOUND, LLInventoryType::IT_SOUND, 0, FALSE);
+}
+
 void LLSoundBridge::openItem()
 {
-	const LLViewerInventoryItem* item = getItem();
+	LLViewerInventoryItem* item = getItem();
+
 	if (item)
 	{
 		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
 	}
+/*
+// Changed this back to the way it USED to work:
+// only open the preview dialog through the contextual right-click menu
+// double-click just plays the sound
+
+LLViewerInventoryItem* item = getItem();
+if(item)
+{
+openSoundPreview((void*)this);
+//send_uuid_sound_trigger(item->getAssetUUID(), 1.0);
 }
+*/
+		}
 
 void LLSoundBridge::previewItem()
 {
@@ -3243,11 +3351,6 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
-		{
-			disabled_items.push_back(std::string("Share"));
-		}
 		items.push_back(std::string("Sound Open"));
 		items.push_back(std::string("Properties"));
 
@@ -3279,7 +3382,7 @@ LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory,
 
 LLUIImagePtr LLLandmarkBridge::getIcon() const
 {
-	return LLInventoryIcon::getIcon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE);
+	return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE);
 }
 
 void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
@@ -3294,11 +3397,6 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
-		{
-			disabled_items.push_back(std::string("Share"));
-		}
 		items.push_back(std::string("Landmark Open"));
 		items.push_back(std::string("Properties"));
 
@@ -3471,7 +3569,7 @@ LLUIImagePtr LLCallingCardBridge::getIcon() const
 	{
 		online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID());
 	}
-	return LLInventoryIcon::getIcon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE);
+	return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE);
 }
 
 std::string LLCallingCardBridge::getLabelSuffix() const
@@ -3516,12 +3614,7 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
-		{
-			disabled_items.push_back(std::string("Share"));
-		}
-		addOpenRightClickMenuOption(items);
+		items.push_back(std::string("Open"));
 		items.push_back(std::string("Properties"));
 
 		getClipboardEntries(true, items, disabled_items, flags);
@@ -3583,7 +3676,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
 					rv = TRUE;
 					if(drop)
 					{
-						LLGiveInventory::doGiveInventoryItem(item->getCreatorUUID(),
+						LLToolDragAndDrop::giveInventory(item->getCreatorUUID(),
 														 (LLInventoryItem*)cargo_data);
 					}
 				}
@@ -3604,7 +3697,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
 					rv = TRUE;
 					if(drop)
 					{
-						LLGiveInventory::doGiveInventoryCategory(
+						LLToolDragAndDrop::giveInventoryCategory(
 							item->getCreatorUUID(),
 							inv_cat);
 					}
@@ -3629,19 +3722,39 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
 // |        LLNotecardBridge                         |
 // +=================================================+
 
+LLUIImagePtr LLNotecardBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, 0, FALSE);
+}
+
 void LLNotecardBridge::openItem()
 {
 	LLViewerInventoryItem* item = getItem();
+
 	if (item)
 	{
 		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
 	}
+
+/*
+  LLViewerInventoryItem* item = getItem();
+  if (item)
+  {
+  LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+  }
+*/
 }
 
+
 // +=================================================+
 // |        LLGestureBridge                          |
 // +=================================================+
 
+LLUIImagePtr LLGestureBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, 0, FALSE);
+}
+
 LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
 {
 	if( LLGestureMgr::instance().isGestureActive(mUUID) )
@@ -3771,15 +3884,14 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
+		bool is_sidepanel = isInOutfitsSidePanel();
+
+		if (!is_sidepanel)
 		{
-			disabled_items.push_back(std::string("Share"));
+			items.push_back(std::string("Open"));
+			items.push_back(std::string("Properties"));
 		}
 
-		addOpenRightClickMenuOption(items);
-		items.push_back(std::string("Properties"));
-
 		getClipboardEntries(true, items, disabled_items, flags);
 
 		items.push_back(std::string("Gesture Separator"));
@@ -3813,6 +3925,11 @@ void LLGestureBridge::playGesture(const LLUUID& item_id)
 // |        LLAnimationBridge                        |
 // +=================================================+
 
+LLUIImagePtr LLAnimationBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_ANIMATION, LLInventoryType::IT_ANIMATION, 0, FALSE);
+}
+
 void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 {
 	menuentry_vec_t items;
@@ -3825,11 +3942,6 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
-		{
-			disabled_items.push_back(std::string("Share"));
-		}
 		items.push_back(std::string("Animation Open"));
 		items.push_back(std::string("Properties"));
 
@@ -3897,16 +4009,17 @@ LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory,
 							   const LLUUID& uuid, 
 							   LLInventoryType::EType type, 
 							   U32 flags) :
-	LLItemBridge(inventory, root, uuid)
+	LLItemBridge(inventory, root, uuid), 
+	mInvType(type)
 {
 	mAttachPt = (flags & 0xff); // low bye of inventory flags
+
 	mIsMultiObject = ( flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ?  TRUE: FALSE;
-	mInvType = type;
 }
 
 LLUIImagePtr LLObjectBridge::getIcon() const
 {
-	return LLInventoryIcon::getIcon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject);
+	return get_item_icon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject );
 }
 
 LLInventoryObject* LLObjectBridge::getObject() const
@@ -3932,7 +4045,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action)
 		{
 			rez_attachment(item, NULL);
 		}
-		else if(item && item->isFinished())
+		else if(item && item->isComplete())
 		{
 			// must be in library. copy it to our inventory and put it on.
 			LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0);
@@ -3970,9 +4083,39 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action)
 
 void LLObjectBridge::openItem()
 {
-	// object double-click action is to wear/unwear object
-	performAction(getInventoryModel(),
-		      get_is_item_worn(mUUID) ? "detach" : "attach");
+	LLViewerInventoryItem* item = getItem();
+
+	if (item)
+	{
+		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+	}
+
+	LLSD key;
+	key["id"] = mUUID;
+	LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
+
+	// Disable old properties floater; this is replaced by the sidepanel.
+	/*
+	  LLFloaterReg::showInstance("properties", mUUID);
+	*/
+}
+
+LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const
+{
+	U8 font = LLFontGL::NORMAL;
+
+	if(get_is_item_worn( mUUID ) )
+	{
+		font |= LLFontGL::BOLD;
+	}
+
+	LLInventoryItem* item = getItem();
+	if (item && item->getIsLinkType())
+	{
+		font |= LLFontGL::ITALIC;
+	}
+
+	return (LLFontGL::StyleFlags)font;
 }
 
 std::string LLObjectBridge::getLabelSuffix() const
@@ -4013,12 +4156,13 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 
 	payload["attachment_point"] = attach_pt;
 
-	if (!gSavedSettings.getBOOL("MultipleAttachments") &&
-		(attachment && attachment->getNumObjects() > 0))
+#if !ENABLE_MULTIATTACHMENTS
+	if (attachment && attachment->getNumObjects() > 0)
 	{
 		LLNotificationsUtil::add("ReplaceAttachment", LLSD(), payload, confirm_replace_attachment_rez);
 	}
 	else
+#endif
 	{
 		LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0/*YES*/);
 	}
@@ -4041,10 +4185,6 @@ bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& respon
 
 		if (itemp)
 		{
-			U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
-			if (gSavedSettings.getBOOL("MultipleAttachments"))
-				attachment_pt |= ATTACHMENT_ADD;
-
 			LLMessageSystem* msg = gMessageSystem;
 			msg->newMessageFast(_PREHASH_RezSingleAttachmentFromInv);
 			msg->nextBlockFast(_PREHASH_AgentData);
@@ -4053,6 +4193,10 @@ bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& respon
 			msg->nextBlockFast(_PREHASH_ObjectData);
 			msg->addUUIDFast(_PREHASH_ItemID, itemp->getUUID());
 			msg->addUUIDFast(_PREHASH_OwnerID, itemp->getPermissions().getOwner());
+			U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
+#if ENABLE_MULTIATTACHMENTS
+			attachment_pt |= ATTACHMENT_ADD;
+#endif
 			msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt);
 			pack_permissions_slam(msg, itemp->getFlags(), itemp->getPermissions());
 			msg->addStringFast(_PREHASH_Name, itemp->getName());
@@ -4074,14 +4218,13 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	else
 	{
-		items.push_back(std::string("Share"));
-		if (!canShare())
+		bool is_sidepanel = isInOutfitsSidePanel();
+
+		if (!is_sidepanel)
 		{
-			disabled_items.push_back(std::string("Share"));
+			items.push_back(std::string("Properties"));
 		}
 
-		items.push_back(std::string("Properties"));
-
 		getClipboardEntries(true, items, disabled_items, flags);
 
 		LLObjectBridge::sContextMenuItemID = mUUID;
@@ -4093,13 +4236,13 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 
 			if( get_is_item_worn( mUUID ) )
 			{
-				items.push_back(std::string("Wearable And Object Separator"));
+				items.push_back(std::string("Attach Separator"));
 				items.push_back(std::string("Detach From Yourself"));
 			}
 			else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder())
 			{
-				items.push_back(std::string("Wearable And Object Separator"));
-				items.push_back(std::string("Wearable And Object Wear"));
+				items.push_back(std::string("Attach Separator"));
+				items.push_back(std::string("Object Wear"));
 				items.push_back(std::string("Attach To"));
 				items.push_back(std::string("Attach To HUD"));
 				// commented out for DEV-32347
@@ -4107,7 +4250,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 
 				if (!gAgentAvatarp->canAttachMoreObjects())
 				{
-					disabled_items.push_back(std::string("Wearable And Object Wear"));
+					disabled_items.push_back(std::string("Object Wear"));
 					disabled_items.push_back(std::string("Attach To"));
 					disabled_items.push_back(std::string("Attach To HUD"));
 				}
@@ -4136,7 +4279,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 						}
 						LLSD cbparams;
 						cbparams["index"] = curiter->first;
-						cbparams["label"] = p.name;
+						cbparams["label"] = attachment->getName();
 						p.on_click.function_name = "Inventory.AttachObject";
 						p.on_click.parameter = LLSD(attachment->getName());
 						p.on_enable.function_name = "Attachment.Label";
@@ -4191,6 +4334,11 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
 // |        LLLSLTextBridge                          |
 // +=================================================+
 
+LLUIImagePtr LLLSLTextBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
+}
+
 void LLLSLTextBridge::openItem()
 {
 	LLViewerInventoryItem* item = getItem();
@@ -4210,12 +4358,39 @@ LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory,
 								   const LLUUID& uuid, 
 								   LLAssetType::EType asset_type, 
 								   LLInventoryType::EType inv_type, 
-								   LLWearableType::EType  wearable_type) :
+								   EWearableType  wearable_type) :
 	LLItemBridge(inventory, root, uuid),
 	mAssetType( asset_type ),
+	mInvType(inv_type),
 	mWearableType(wearable_type)
 {
-	mInvType = inv_type;
+}
+
+// *NOTE: hack to get from avatar inventory to avatar
+void wear_inventory_item_on_avatar( LLInventoryItem* item )
+{
+	if(item)
+	{
+		lldebugs << "wear_inventory_item_on_avatar( " << item->getName()
+				 << " )" << llendl;
+
+		LLAppearanceMgr::instance().addCOFItemLink(item);
+	}
+}
+
+void wear_add_inventory_item_on_avatar( LLInventoryItem* item )
+{
+	if(item)
+	{
+		lldebugs << "wear_add_inventory_item_on_avatar( " << item->getName()
+				 << " )" << llendl;
+
+		LLWearableList::instance().getAsset(item->getAssetUUID(),
+											item->getName(),
+											item->getType(),
+											LLWearableBridge::onWearAddOnAvatarArrived,
+											new LLUUID(item->getUUID()));
+	}
 }
 
 void remove_inventory_category_from_avatar( LLInventoryCategory* category )
@@ -4225,13 +4400,15 @@ void remove_inventory_category_from_avatar( LLInventoryCategory* category )
 			 << " )" << llendl;
 
 
-	if (gAgentCamera.cameraCustomizeAvatar())
+	if( gFloaterCustomize )
 	{
-		// switching to outfit editor should automagically save any currently edited wearable
-		LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit"));
+		gFloaterCustomize->askToSaveIfDirty(
+			boost::bind(remove_inventory_category_from_avatar_step2, _1, category->getUUID()));
+	}
+	else
+	{
+		remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() );
 	}
-
-	remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() );
 }
 
 struct OnRemoveStruct
@@ -4290,7 +4467,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_
 				if (item->getType() == LLAssetType::AT_BODYPART)
 					continue;
 				if (gAgent.isTeen() && item->isWearableType() &&
-					(item->getWearableType() == LLWearableType::WT_UNDERPANTS || item->getWearableType() == LLWearableType::WT_UNDERSHIRT))
+					(item->getWearableType() == WT_UNDERPANTS || item->getWearableType() == WT_UNDERSHIRT))
 					continue;
 				if (get_is_item_worn(item->getUUID()))
 				{
@@ -4368,7 +4545,7 @@ std::string LLWearableBridge::getLabelSuffix() const
 
 LLUIImagePtr LLWearableBridge::getIcon() const
 {
-	return LLInventoryIcon::getIcon(mAssetType, mInvType, mWearableType, FALSE);
+	return get_item_icon(mAssetType, mInvType, mWearableType, FALSE);
 }
 
 // virtual
@@ -4429,27 +4606,25 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		{
 			can_open = FALSE;
 		}
-		items.push_back(std::string("Share"));
-		if (!canShare())
-		{
-			disabled_items.push_back(std::string("Share"));
-		}
+
+		bool is_sidepanel = isInOutfitsSidePanel();
 		
-		if (can_open)
+		if (can_open && !is_sidepanel)
 		{
-			addOpenRightClickMenuOption(items);
+			items.push_back(std::string("Open"));
 		}
-		else
+
+		if (!is_sidepanel)
 		{
-			disabled_items.push_back(std::string("Open"));
-			disabled_items.push_back(std::string("Open Original"));
+			items.push_back(std::string("Properties"));
 		}
 
-		items.push_back(std::string("Properties"));
-
 		getClipboardEntries(true, items, disabled_items, flags);
 
-		items.push_back(std::string("Wearable And Object Separator"));
+		if (!is_sidepanel)
+		{
+			items.push_back(std::string("Wearable Separator"));
+		}
 
 		items.push_back(std::string("Wearable Edit"));
 
@@ -4460,7 +4635,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		// Don't allow items to be worn if their baseobj is in the trash.
 		if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder())
 		{
-			disabled_items.push_back(std::string("Wearable And Object Wear"));
+			disabled_items.push_back(std::string("Wearable Wear"));
 			disabled_items.push_back(std::string("Wearable Add"));
 			disabled_items.push_back(std::string("Wearable Edit"));
 		}
@@ -4476,15 +4651,14 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 				case LLAssetType::AT_BODYPART:
 					if (get_is_item_worn(item->getUUID()))
 					{
-						disabled_items.push_back(std::string("Wearable And Object Wear"));
+						disabled_items.push_back(std::string("Wearable Wear"));
 						disabled_items.push_back(std::string("Wearable Add"));
 					}
 					else
 					{
-						items.push_back(std::string("Wearable And Object Wear"));
+						items.push_back(std::string("Wearable Wear"));
 						items.push_back(std::string("Wearable Add"));
 						disabled_items.push_back(std::string("Take Off"));
-						disabled_items.push_back(std::string("Wearable Edit"));
 					}
 					break;
 				default:
@@ -4504,7 +4678,7 @@ BOOL LLWearableBridge::canWearOnAvatar(void* user_data)
 	if(!self->isAgentInventory())
 	{
 		LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
-		if(!item || !item->isFinished()) return FALSE;
+		if(!item || !item->isComplete()) return FALSE;
 	}
 	return (!get_is_item_worn(self->mUUID));
 }
@@ -4520,23 +4694,63 @@ void LLWearableBridge::onWearOnAvatar(void* user_data)
 
 void LLWearableBridge::wearOnAvatar()
 {
-	// TODO: investigate wearables may not be loaded at this point EXT-8231
+	// Don't wear anything until initial wearables are loaded, can
+	// destroy clothing items.
+	if (!gAgentWearables.areWearablesLoaded())
+	{
+		LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
+		return;
+	}
 
 	LLViewerInventoryItem* item = getItem();
 	if(item)
 	{
-		LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, true);
+		if(!isAgentInventory())
+		{
+			LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+			copy_inventory_item(
+				gAgent.getID(),
+				item->getPermissions().getOwner(),
+				item->getUUID(),
+				LLUUID::null,
+				std::string(),
+				cb);
+		}
+		else
+		{
+			wear_inventory_item_on_avatar(item);
+		}
 	}
 }
 
 void LLWearableBridge::wearAddOnAvatar()
 {
-	// TODO: investigate wearables may not be loaded at this point EXT-8231
+	// Don't wear anything until initial wearables are loaded, can
+	// destroy clothing items.
+	if (!gAgentWearables.areWearablesLoaded())
+	{
+		LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
+		return;
+	}
 
 	LLViewerInventoryItem* item = getItem();
 	if(item)
 	{
-		LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, false);
+		if(!isAgentInventory())
+		{
+			LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+			copy_inventory_item(
+				gAgent.getID(),
+				item->getPermissions().getOwner(),
+				item->getUUID(),
+				LLUUID::null,
+				std::string(),
+				cb);
+		}
+		else
+		{
+			wear_add_inventory_item_on_avatar(item);
+		}
 	}
 }
 
@@ -4613,7 +4827,20 @@ void LLWearableBridge::onEditOnAvatar(void* user_data)
 
 void LLWearableBridge::editOnAvatar()
 {
-	LLAgentWearables::editWearable(mUUID);
+	LLUUID linked_id = gInventory.getLinkedItemID(mUUID);
+	const LLWearable* wearable = gAgentWearables.getWearableFromItemID(linked_id);
+	if( wearable )
+	{
+		// Set the tab to the right wearable.
+		if (gFloaterCustomize)
+			gFloaterCustomize->setCurrentWearableType( wearable->getType() );
+
+		if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() )
+		{
+			// Start Avatar Customization
+			gAgentCamera.changeCameraToCustomizeAvatar();
+		}
+	}
 }
 
 // static
@@ -4657,10 +4884,10 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
 	{
 		if( get_is_item_worn( item_id ) )
 		{
-			LLWearableType::EType type = wearable->getType();
+			EWearableType type = wearable->getType();
 
-			if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES ) ) //&&
-				//!((!gAgent.isTeen()) && ( type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT )) )
+			if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&&
+				//!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) )
 			{
 				bool do_remove_all = false;
 				U32 index = gAgentWearables.getWearableIndex(wearable);
@@ -4680,25 +4907,23 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
 void LLWearableBridge::removeAllClothesFromAvatar()
 {
 	// Remove COF links.
-	for (S32 itype = LLWearableType::WT_SHAPE; itype < LLWearableType::WT_COUNT; ++itype)
+	for (S32 itype = WT_SHAPE; itype < WT_COUNT; ++itype)
 	{
-		if (itype == LLWearableType::WT_SHAPE || itype == LLWearableType::WT_SKIN || itype == LLWearableType::WT_HAIR || itype == LLWearableType::WT_EYES)
+		if (itype == WT_SHAPE || itype == WT_SKIN || itype == WT_HAIR || itype == WT_EYES)
 			continue;
 
-		for (S32 index = gAgentWearables.getWearableCount(itype)-1; index >= 0 ; --index)
-		{
-			LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(
-				gAgentWearables.getWearableInventoryItem((LLWearableType::EType)itype, index));
-			if (!item)
-				continue;
-			const LLUUID &item_id = item->getUUID();
-			const LLWearable *wearable = gAgentWearables.getWearableFromItemID(item_id);
-			if (!wearable)
-				continue;
-	
-			// Find and remove this item from the COF.
-			LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
-		}
+		// MULTI-WEARABLES: fixed to index 0
+		LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(
+			gAgentWearables.getWearableInventoryItem((EWearableType)itype, 0));
+		if (!item)
+			continue;
+		const LLUUID &item_id = gInventory.getLinkedItemID(item->getUUID());
+		const LLWearable *wearable = gAgentWearables.getWearableFromItemID(item_id);
+		if (!wearable)
+			continue;
+
+		// Find and remove this item from the COF.
+		LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
 	}
 	gInventory.notifyObservers();
 
@@ -4732,9 +4957,18 @@ void LLWearableBridge::removeFromAvatar()
 // |        LLLinkItemBridge                         |
 // +=================================================+
 // For broken item links
-
 std::string LLLinkItemBridge::sPrefix("Link: ");
+LLUIImagePtr LLLinkItemBridge::getIcon() const
+{
+	if (LLViewerInventoryItem *item = getItem())
+	{
+		U32 attachment_point = (item->getFlags() & 0xff); // low byte of inventory flags
+		bool is_multi =  LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags();
 
+		return get_item_icon(item->getActualType(), item->getInventoryType(), attachment_point, is_multi);
+	}
+	return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE);
+}
 void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 {
 	// *TODO: Translate
@@ -4764,24 +4998,16 @@ void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 std::string LLLinkFolderBridge::sPrefix("Link: ");
 LLUIImagePtr LLLinkFolderBridge::getIcon() const
 {
-	LLFolderType::EType folder_type = LLFolderType::FT_NONE;
-	const LLInventoryObject *obj = getInventoryObject();
-	if (obj)
+	LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
+	if (LLViewerInventoryItem *item = getItem())
 	{
-		LLViewerInventoryCategory* cat = NULL;
-		LLInventoryModel* model = getInventoryModel();
-		if(model)
+		if (const LLViewerInventoryCategory* cat = item->getLinkedCategory())
 		{
-			cat = (LLViewerInventoryCategory*)model->getCategory(obj->getLinkedUUID());
-			if (cat)
-			{
-				folder_type = cat->getPreferredType();
-			}
+			preferred_type = cat->getPreferredType();
 		}
 	}
-	return LLFolderBridge::getIcon(folder_type);
+	return LLFolderBridge::getIcon(preferred_type);
 }
-
 void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 {
 	// *TODO: Translate
@@ -4846,13 +5072,9 @@ const LLUUID &LLLinkFolderBridge::getFolderID() const
 
 // static
 void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type,
-								   const LLUUID& uuid,
-								   LLInventoryModel* model)
+								   const LLUUID& uuid,LLInventoryModel* model)
 {
-	// Perform indirection in case of link.
-	const LLUUID& linked_uuid = gInventory.getLinkedItemID(uuid);
-
-	LLInvFVBridgeAction* action = createAction(asset_type,linked_uuid,model);
+	LLInvFVBridgeAction* action = createAction(asset_type,uuid,model);
 	if(action)
 	{
 		action->doIt();
@@ -4965,8 +5187,7 @@ class LLCallingCardBridgeAction: public LLInvFVBridgeAction
 
 };
 
-class LLNotecardBridgeAction
-: public LLInvFVBridgeAction
+class LLNotecardBridgeAction: public LLInvFVBridgeAction
 {
 	friend class LLInvFVBridgeAction;
 public:
@@ -5061,7 +5282,41 @@ class LLWearableBridgeAction: public LLInvFVBridgeAction
 public:
 	virtual void doIt()
 	{
-		wearOnAvatar();
+		if(isItemInTrash())
+		{
+			LLNotificationsUtil::add("CannotWearTrash");
+		}
+		else if(isAgentInventory())
+		{
+			if(!get_is_item_worn(mUUID))
+			{
+				wearOnAvatar();
+			}
+		}
+		else
+		{
+			// must be in the inventory library. copy it to our inventory
+			// and put it on right away.
+			LLViewerInventoryItem* item = getItem();
+			if(item && item->isComplete())
+			{
+				LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+				copy_inventory_item(
+					gAgent.getID(),
+					item->getPermissions().getOwner(),
+					item->getUUID(),
+					LLUUID::null,
+					std::string(),
+					cb);
+			}
+			else if(item)
+			{
+				// *TODO: We should fetch the item details, and then do
+				// the operation above.
+				LLNotificationsUtil::add("CannotWearInfoNotComplete");
+			}
+		}
+		LLInvFVBridgeAction::doIt();
 	}
 	virtual ~LLWearableBridgeAction(){}
 protected:
@@ -5089,12 +5344,32 @@ BOOL LLWearableBridgeAction::isAgentInventory() const
 
 void LLWearableBridgeAction::wearOnAvatar()
 {
-	// TODO: investigate wearables may not be loaded at this point EXT-8231
+	// Don't wear anything until initial wearables are loaded, can
+	// destroy clothing items.
+	if (!gAgentWearables.areWearablesLoaded())
+	{
+		LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
+		return;
+	}
 
 	LLViewerInventoryItem* item = getItem();
 	if(item)
 	{
-		LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, true);
+		if(!isAgentInventory())
+		{
+			LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+			copy_inventory_item(
+				gAgent.getID(),
+				item->getPermissions().getOwner(),
+				item->getUUID(),
+				LLUUID::null,
+				std::string(),
+				cb);
+		}
+		else
+		{
+			wear_inventory_item_on_avatar(item);
+		}
 	}
 }
 
@@ -5145,67 +5420,3 @@ LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_
 /**                    Bridge Actions
  **
  ********************************************************************************/
-
-/************************************************************************/
-/* Recent Inventory Panel related classes                               */
-/************************************************************************/
-void LLRecentItemsFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
-{
-	LLFolderBridge::buildContextMenu(menu, flags);
-
-	menuentry_vec_t disabled_items, items = getMenuItems();
-
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Body Parts")), items.end());
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Clothes")), items.end());
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Note")), items.end());
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Gesture")), items.end());
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Script")), items.end());
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Folder")), items.end());
-
-	hide_context_entries(menu, items, disabled_items);
-}
-
-LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge(
-	LLAssetType::EType asset_type,
-	LLAssetType::EType actual_asset_type,
-	LLInventoryType::EType inv_type,
-	LLInventoryPanel* inventory,
-	LLFolderView* root,
-	const LLUUID& uuid,
-	U32 flags /*= 0x00*/ ) const
-{
-	LLInvFVBridge* new_listener = NULL;
-	switch(asset_type)
-	{
-	case LLAssetType::AT_CATEGORY:
-		if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
-		{
-			// *TODO: Create a link folder handler instead if it is necessary
-			new_listener = LLInventoryFVBridgeBuilder::createBridge(
-				asset_type,
-				actual_asset_type,
-				inv_type,
-				inventory,
-				root,
-				uuid,
-				flags);
-			break;
-		}
-		new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid);
-		break;
-	default:
-		new_listener = LLInventoryFVBridgeBuilder::createBridge(
-			asset_type,
-			actual_asset_type,
-			inv_type,
-			inventory,
-			root,
-			uuid,
-			flags);
-	}
-	return new_listener;
-
-}
-
-
-// EOF
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 6ddd77284a0f6804036dbe0429c193663c5711e3..e7b3785a48b8e2019d5b79c9d1fbc4c7497276c7 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -2,25 +2,31 @@
  * @file llinventorybridge.h
  * @brief Implementation of the Inventory-Folder-View-Bridge classes.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -68,25 +74,21 @@ class LLInvFVBridge : public LLFolderViewEventListener
 									   U32 flags = 0x00);
 	virtual ~LLInvFVBridge() {}
 
-	BOOL canShare() const;
-
-	//--------------------------------------------------------------------
-	// LLInvFVBridge functionality
-	//--------------------------------------------------------------------
 	virtual const LLUUID& getUUID() const { return mUUID; }
-	virtual void clearDisplayName() {}
+
 	virtual void restoreItem() {}
 	virtual void restoreToWorld() {}
 
-	//--------------------------------------------------------------------
-	// Inherited LLFolderViewEventListener functions
-	//--------------------------------------------------------------------
+	// LLFolderViewEventListener functions
 	virtual const std::string& getName() const;
 	virtual const std::string& getDisplayName() const;
 	virtual PermissionMask getPermissionMask() const;
 	virtual LLFolderType::EType getPreferredType() const;
 	virtual time_t getCreationDate() const;
-	virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
+	virtual LLFontGL::StyleFlags getLabelStyle() const
+	{
+		return LLFontGL::NORMAL;
+	}
 	virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
 	virtual void openItem() {}
 	virtual void closeItem() {}
@@ -97,7 +99,7 @@ class LLInvFVBridge : public LLFolderViewEventListener
 	virtual BOOL isItemRemovable() const;
 	virtual BOOL isItemMovable() const;
 	virtual BOOL isItemInTrash() const;
-	virtual BOOL isLink() const;
+
 	//virtual BOOL removeItem() = 0;
 	virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch);
 	virtual void move(LLFolderViewEventListener* new_parent_bridge) {}
@@ -116,7 +118,12 @@ class LLInvFVBridge : public LLFolderViewEventListener
 							EDragAndDropType cargo_type,
 							void* cargo_data) { return FALSE; }
 	virtual LLInventoryType::EType getInventoryType() const { return mInvType; }
-	virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; }
+
+	// LLInvFVBridge functionality
+	virtual void clearDisplayName() {}
+
+	// Allow context menus to be customized for side panel.
+	bool isInOutfitsSidePanel() const;
 
 	//--------------------------------------------------------------------
 	// Convenience functions for adding various common menu options.
@@ -126,7 +133,7 @@ class LLInvFVBridge : public LLFolderViewEventListener
 											menuentry_vec_t &disabled_items);
 	virtual void addDeleteContextMenuOptions(menuentry_vec_t &items,
 											 menuentry_vec_t &disabled_items);
-	virtual void addOpenRightClickMenuOption(menuentry_vec_t &items);
+
 protected:
 	LLInvFVBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid);
 
@@ -137,7 +144,7 @@ class LLInvFVBridge : public LLFolderViewEventListener
 	BOOL isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory?
 
 	BOOL isAgentInventory() const; // false if lost or in the inventory library
-	BOOL isCOFFolder() const; // true if COF or descendent of
+	BOOL isCOFFolder() const; // true if COF or descendent of.
 	virtual BOOL isItemPermissive() const;
 	static void changeItemParent(LLInventoryModel* model,
 								 LLViewerInventoryItem* item,
@@ -153,12 +160,11 @@ class LLInvFVBridge : public LLFolderViewEventListener
 	LLFolderView* mRoot;
 	const LLUUID mUUID;	// item id
 	LLInventoryType::EType mInvType;
-	BOOL mIsLink;
 	void purgeItem(LLInventoryModel *model, const LLUUID &uuid);
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInvFVBridgeBuilder
+// Class LLInvFVBridge
 //
 // This class intended to build Folder View Bridge via LLInvFVBridge::createBridge.
 // It can be overridden with another way of creation necessary Inventory-Folder-View-Bridge.
@@ -176,6 +182,49 @@ class LLInventoryFVBridgeBuilder
 										U32 flags = 0x00) const;
 };
 
+// Used by LLItemBridge::getIcon
+enum EInventoryIcon
+{
+	TEXTURE_ICON_NAME,
+	SOUND_ICON_NAME,
+	CALLINGCARD_ONLINE_ICON_NAME,
+	CALLINGCARD_OFFLINE_ICON_NAME,
+	LANDMARK_ICON_NAME,
+	LANDMARK_VISITED_ICON_NAME,
+	SCRIPT_ICON_NAME,
+	CLOTHING_ICON_NAME,
+	OBJECT_ICON_NAME,
+	OBJECT_MULTI_ICON_NAME,
+	NOTECARD_ICON_NAME,
+	BODYPART_ICON_NAME,
+	SNAPSHOT_ICON_NAME,
+
+	BODYPART_SHAPE_ICON_NAME,
+	BODYPART_SKIN_ICON_NAME,
+	BODYPART_HAIR_ICON_NAME,
+	BODYPART_EYES_ICON_NAME,
+	CLOTHING_SHIRT_ICON_NAME,
+	CLOTHING_PANTS_ICON_NAME,
+	CLOTHING_SHOES_ICON_NAME,
+	CLOTHING_SOCKS_ICON_NAME,
+	CLOTHING_JACKET_ICON_NAME,
+	CLOTHING_GLOVES_ICON_NAME,
+	CLOTHING_UNDERSHIRT_ICON_NAME,
+	CLOTHING_UNDERPANTS_ICON_NAME,
+	CLOTHING_SKIRT_ICON_NAME,
+	CLOTHING_ALPHA_ICON_NAME,
+	CLOTHING_TATTOO_ICON_NAME,
+	
+	ANIMATION_ICON_NAME,
+	GESTURE_ICON_NAME,
+
+	LINKITEM_ICON_NAME,
+	LINKFOLDER_ICON_NAME,
+
+	ICON_NAME_COUNT
+};
+extern std::string ICON_NAME[ICON_NAME_COUNT];
+
 class LLItemBridge : public LLInvFVBridge
 {
 public:
@@ -185,6 +234,7 @@ class LLItemBridge : public LLInvFVBridge
 		LLInvFVBridge(inventory, root, uuid) {}
 
 	virtual void performAction(LLInventoryModel* model, std::string action);
+
 	virtual void selectItem();
 	virtual void restoreItem();
 	virtual void restoreToWorld();
@@ -203,32 +253,28 @@ class LLItemBridge : public LLInvFVBridge
 	virtual BOOL hasChildren() const { return FALSE; }
 	virtual BOOL isUpToDate() const { return TRUE; }
 
-	/*virtual*/ void clearDisplayName() { mDisplayName.clear(); }
+	// override for LLInvFVBridge
+	virtual void clearDisplayName() { mDisplayName.clear(); }
 
 	LLViewerInventoryItem* getItem() const;
+	
 	bool isAddAction(std::string action) const;
 	bool isRemoveAction(std::string action) const;
+
 protected:
-	BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response);
 	virtual BOOL isItemPermissive() const;
 	static void buildDisplayName(LLInventoryItem* item, std::string& name);
-
 	mutable std::string mDisplayName;
 };
 
 class LLFolderBridge : public LLInvFVBridge
 {
+	friend class LLInvFVBridge;
 public:
-	LLFolderBridge(LLInventoryPanel* inventory, 
-				   LLFolderView* root,
-				   const LLUUID& uuid) :
-		LLInvFVBridge(inventory, root, uuid),
-		mCallingCards(FALSE),
-		mWearables(FALSE)
-	{}
-	BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop);
-	BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop);
-
+	BOOL dragItemIntoFolder(LLInventoryItem* inv_item,
+							BOOL drop);
+	BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category,
+								BOOL drop);
 	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void openItem();
 	virtual void closeItem();
@@ -263,17 +309,24 @@ class LLFolderBridge : public LLInvFVBridge
 	virtual BOOL isClipboardPasteableAsLink() const;
 	virtual BOOL copyToClipboard() const;
 	
-	static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
+	static void createWearable(LLFolderBridge* bridge, EWearableType type);
+	static void createWearable(const LLUUID &parent_folder_id, EWearableType type);
 
 	LLViewerInventoryCategory* getCategory() const;
-	LLHandle<LLFolderBridge> getHandle() { mHandle.bind(this); return mHandle; }
 
 protected:
-	//--------------------------------------------------------------------
-	// Menu callbacks
-	//--------------------------------------------------------------------
+	LLFolderBridge(LLInventoryPanel* inventory, 
+				   LLFolderView* root,
+				   const LLUUID& uuid) :
+		LLInvFVBridge(inventory, root, uuid),
+		mCallingCards(FALSE),
+		mWearables(FALSE),
+		mMenu(NULL) {}
+
+	// menu callbacks
 	static void pasteClipboard(void* user_data);
 	static void createNewCategory(void* user_data);
+
 	static void createNewShirt(void* user_data);
 	static void createNewPants(void* user_data);
 	static void createNewShoes(void* user_data);
@@ -289,83 +342,97 @@ class LLFolderBridge : public LLInvFVBridge
 	static void createNewEyes(void* user_data);
 
 	BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck);
+	BOOL areAnyContentsWorn(LLInventoryModel* model) const;
 
 	void modifyOutfit(BOOL append);
 	void determineFolderType();
 
-	menuentry_vec_t getMenuItems() { return mItems; } // returns a copy of current menu items
-
-
-	//--------------------------------------------------------------------
-	// Messy hacks for handling folder options
-	//--------------------------------------------------------------------
 public:
-	static LLHandle<LLFolderBridge> sSelf;
+	static LLFolderBridge* sSelf;
 	static void staticFolderOptionsMenu();
 	void folderOptionsMenu();
-
 private:
-	BOOL				mCallingCards;
-	BOOL				mWearables;
-	LLHandle<LLView>	mMenu;
-	menuentry_vec_t		mItems;
-	menuentry_vec_t		mDisabledItems;
-	LLRootHandle<LLFolderBridge> mHandle;
+	BOOL			mCallingCards;
+	BOOL			mWearables;
+	LLMenuGL*		mMenu;
+	menuentry_vec_t mItems;
+	menuentry_vec_t mDisabledItems;
+};
+
+// DEPRECATED
+class LLScriptBridge : public LLItemBridge
+{
+	friend class LLInvFVBridge;
+public:
+	LLUIImagePtr getIcon() const;
+
+protected:
+	LLScriptBridge(LLInventoryPanel* inventory, 
+				   LLFolderView* root,
+				   const LLUUID& uuid ) :
+		LLItemBridge(inventory, root, uuid) {}
 };
 
 class LLTextureBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
-	LLTextureBridge(LLInventoryPanel* inventory, 
-					LLFolderView* root,
-					const LLUUID& uuid, 
-					LLInventoryType::EType type) :
-		LLItemBridge(inventory, root, uuid)
-	{
-		mInvType = type;
-	}
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual void performAction(LLInventoryModel* model, std::string action);
+
+protected:
+	LLTextureBridge(LLInventoryPanel* inventory, 
+					LLFolderView* root,
+					const LLUUID& uuid, 
+					LLInventoryType::EType type) :
+		LLItemBridge(inventory, root, uuid),
+		mInvType(type) 
+	{}
 	bool canSaveTexture(void);
+	LLInventoryType::EType mInvType;
 };
 
 class LLSoundBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
- 	LLSoundBridge(LLInventoryPanel* inventory, 
-				  LLFolderView* root,
-				  const LLUUID& uuid) :
-		LLItemBridge(inventory, root, uuid) {}
+	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 	virtual void previewItem();
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	static void openSoundPreview(void*);
+
+protected:
+	LLSoundBridge(LLInventoryPanel* inventory, 
+				  LLFolderView* root,
+				  const LLUUID& uuid) :
+		LLItemBridge(inventory, root, uuid) {}
 };
 
 class LLLandmarkBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
- 	LLLandmarkBridge(LLInventoryPanel* inventory, 
-					 LLFolderView* root,
-					 const LLUUID& uuid, 
-					 U32 flags = 0x00);
 	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
+
+protected:
+	LLLandmarkBridge(LLInventoryPanel* inventory, 
+					 LLFolderView* root,
+					 const LLUUID& uuid, 
+					 U32 flags = 0x00);
 protected:
 	BOOL mVisited;
 };
 
 class LLCallingCardBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
-	LLCallingCardBridge(LLInventoryPanel* inventory, 
-						LLFolderView* folder,
-						const LLUUID& uuid );
-	~LLCallingCardBridge();
 	virtual std::string getLabelSuffix() const;
 	//virtual const std::string& getDisplayName() const;
 	virtual LLUIImagePtr getIcon() const;
@@ -376,97 +443,121 @@ class LLCallingCardBridge : public LLItemBridge
 							EDragAndDropType cargo_type,
 							void* cargo_data);
 	void refreshFolderViewItem();
+protected:
+	LLCallingCardBridge(LLInventoryPanel* inventory, 
+						LLFolderView* folder,
+						const LLUUID& uuid );
+	~LLCallingCardBridge();
 protected:
 	LLCallingCardObserver* mObserver;
 };
 
+
 class LLNotecardBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
+	virtual LLUIImagePtr getIcon() const;
+	virtual void openItem();
+protected:
 	LLNotecardBridge(LLInventoryPanel* inventory, 
 					 LLFolderView* root,
 					 const LLUUID& uuid) :
 		LLItemBridge(inventory, root, uuid) {}
-	virtual void openItem();
 };
 
 class LLGestureBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
-	LLGestureBridge(LLInventoryPanel* inventory, 
-					LLFolderView* root,
-					const LLUUID& uuid) :
-		LLItemBridge(inventory, root, uuid) {}
+	virtual LLUIImagePtr getIcon() const;
+
 	// Only suffix for gesture items, not task items, because only
 	// gestures in your inventory can be active.
 	virtual LLFontGL::StyleFlags getLabelStyle() const;
 	virtual std::string getLabelSuffix() const;
+
 	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void openItem();
 	virtual BOOL removeItem();
+
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+
 	static void playGesture(const LLUUID& item_id);
+
+protected:
+	LLGestureBridge(LLInventoryPanel* inventory, 
+					LLFolderView* root,
+					const LLUUID& uuid)
+	:	LLItemBridge(inventory, root, uuid) {}
 };
 
 class LLAnimationBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
+	virtual void performAction(LLInventoryModel* model, std::string action);
+	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+
+	virtual LLUIImagePtr getIcon() const;
+	virtual void openItem();
+
+protected:
 	LLAnimationBridge(LLInventoryPanel* inventory, 
 					  LLFolderView* root, 
 					  const LLUUID& uuid) :
 		LLItemBridge(inventory, root, uuid) {}
-	virtual void performAction(LLInventoryModel* model, std::string action);
-	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-	virtual void openItem();
 };
 
 class LLObjectBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
-	LLObjectBridge(LLInventoryPanel* inventory, 
-				   LLFolderView* root, 
-				   const LLUUID& uuid, 
-				   LLInventoryType::EType type, 
-				   U32 flags);
 	virtual LLUIImagePtr	getIcon() const;
 	virtual void			performAction(LLInventoryModel* model, std::string action);
 	virtual void			openItem();
+	virtual LLFontGL::StyleFlags getLabelStyle() const;
 	virtual std::string getLabelSuffix() const;
 	virtual void			buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual BOOL renameItem(const std::string& new_name);
+
 	LLInventoryObject* getObject() const;
 protected:
-	static LLUUID sContextMenuItemID;  // Only valid while the context menu is open.
+	LLObjectBridge(LLInventoryPanel* inventory, 
+				   LLFolderView* root, 
+				   const LLUUID& uuid, 
+				   LLInventoryType::EType type, 
+				   U32 flags);
+protected:
+	static LLUUID	sContextMenuItemID;  // Only valid while the context menu is open.
+	LLInventoryType::EType mInvType;
 	U32 mAttachPt;
 	BOOL mIsMultiObject;
 };
 
 class LLLSLTextBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
+	virtual LLUIImagePtr getIcon() const;
+	virtual void openItem();
+protected:
 	LLLSLTextBridge(LLInventoryPanel* inventory, 
 					LLFolderView* root, 
 					const LLUUID& uuid ) :
 		LLItemBridge(inventory, root, uuid) {}
-	virtual void openItem();
 };
 
 class LLWearableBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
-	LLWearableBridge(LLInventoryPanel* inventory, 
-					 LLFolderView* root, 
-					 const LLUUID& uuid, 
-					 LLAssetType::EType asset_type, 
-					 LLInventoryType::EType inv_type, 
-					 LLWearableType::EType wearable_type);
 	virtual LLUIImagePtr getIcon() const;
 	virtual void	performAction(LLInventoryModel* model, std::string action);
 	virtual void	openItem();
 	virtual void	buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual std::string getLabelSuffix() const;
 	virtual BOOL renameItem(const std::string& new_name);
-	virtual LLWearableType::EType getWearableType() const { return mWearableType; }
 
 	static void		onWearOnAvatar( void* userdata );	// Access to wearOnAvatar() from menu
 	static BOOL		canWearOnAvatar( void* userdata );
@@ -486,38 +577,52 @@ class LLWearableBridge : public LLItemBridge
 	static void 	removeItemFromAvatar(LLViewerInventoryItem *item);
 	static void 	removeAllClothesFromAvatar();
 	void			removeFromAvatar();
+
+protected:
+	LLWearableBridge(LLInventoryPanel* inventory, 
+					 LLFolderView* root, 
+					 const LLUUID& uuid, 
+					 LLAssetType::EType asset_type, 
+					 LLInventoryType::EType inv_type, 
+					 EWearableType wearable_type);
 protected:
 	LLAssetType::EType mAssetType;
-	LLWearableType::EType  mWearableType;
+	LLInventoryType::EType mInvType;
+	EWearableType  mWearableType;
 };
 
 class LLLinkItemBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
+	virtual const std::string& getPrefix() { return sPrefix; }
+	virtual LLUIImagePtr getIcon() const;
+	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+protected:
 	LLLinkItemBridge(LLInventoryPanel* inventory, 
 					 LLFolderView* root,
 					 const LLUUID& uuid) :
 		LLItemBridge(inventory, root, uuid) {}
-	virtual const std::string& getPrefix() { return sPrefix; }
-	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 protected:
 	static std::string sPrefix;
 };
 
 class LLLinkFolderBridge : public LLItemBridge
 {
+	friend class LLInvFVBridge;
 public:
-	LLLinkFolderBridge(LLInventoryPanel* inventory, 
-					   LLFolderView* root,
-					   const LLUUID& uuid) :
-		LLItemBridge(inventory, root, uuid) {}
 	virtual const std::string& getPrefix() { return sPrefix; }
 	virtual LLUIImagePtr getIcon() const;
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void gotoItem();
 protected:
+	LLLinkFolderBridge(LLInventoryPanel* inventory, 
+					   LLFolderView* root,
+					   const LLUUID& uuid) :
+		LLItemBridge(inventory, root, uuid) {}
 	const LLUUID &getFolderID() const;
+protected:
 	static std::string sPrefix;
 };
 
@@ -551,41 +656,8 @@ class LLInvFVBridgeAction
 	LLInventoryModel* mModel;
 };
 
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Recent Inventory Panel related classes
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-// Overridden version of the Inventory-Folder-View-Bridge for Folders
-class LLRecentItemsFolderBridge : public LLFolderBridge
-{
-public:
-	// Creates context menu for Folders related to Recent Inventory Panel.
-	// Uses base logic and than removes from visible items "New..." menu items.
-	LLRecentItemsFolderBridge(LLInventoryType::EType type,
-							  LLInventoryPanel* inventory,
-							  LLFolderView* root,
-							  const LLUUID& uuid) :
-		LLFolderBridge(inventory, root, uuid)
-	{
-		mInvType = type;
-	}
-	/*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
-};
-
-// Bridge builder to create Inventory-Folder-View-Bridge for Recent Inventory Panel
-class LLRecentInventoryBridgeBuilder : public LLInventoryFVBridgeBuilder
-{
-public:
-	// Overrides FolderBridge for Recent Inventory Panel.
-	// It use base functionality for bridges other than FolderBridge.
-	virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
-		LLAssetType::EType actual_asset_type,
-		LLInventoryType::EType inv_type,
-		LLInventoryPanel* inventory,
-		LLFolderView* root,
-		const LLUUID& uuid,
-		U32 flags = 0x00) const;
-};
+void wear_inventory_item_on_avatar(LLInventoryItem* item);
 
 void rez_attachment(LLViewerInventoryItem* item, 
 					LLViewerJointAttachment* attachment);
@@ -599,12 +671,8 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 									  void* user_data = NULL);
 
 // Utility function to hide all entries except those in the list
-// Can be called multiple times on the same menu (e.g. if multiple items
-// are selected).  If "append" is false, then only common enabled items
-// are set as enabled.
 void hide_context_entries(LLMenuGL& menu, 
 						  const menuentry_vec_t &entries_to_show, 
-						  const menuentry_vec_t &disabled_entries,
-						  BOOL append = FALSE);
+						  const menuentry_vec_t &disabled_entries);
 
 #endif // LL_LLINVENTORYBRIDGE_H
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index ef4774a06d684985cca6e5083105e4b581215668..1a488175ac93ef1c3c5d0f0a0a6bd0b3c2cdd83d 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -3,25 +3,31 @@
 * @brief Support for filtering your inventory to only display a subset of the
 * available items.
 *
-* $LicenseInfo:firstyear=2005&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2005&license=viewergpl$
+* 
+* Copyright (c) 2005-2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 #include "llviewerprecompiledheaders.h"
@@ -35,7 +41,6 @@
 #include "llinventorymodelbackgroundfetch.h"
 #include "llviewercontrol.h"
 #include "llfolderview.h"
-#include "llinventorybridge.h"
 
 // linden library includes
 #include "lltrans.h"
@@ -43,15 +48,13 @@
 LLInventoryFilter::FilterOps::FilterOps() :
 	mFilterObjectTypes(0xffffffffffffffffULL),
 	mFilterCategoryTypes(0xffffffffffffffffULL),
-	mFilterWearableTypes(0xffffffffffffffffULL),
 	mMinDate(time_min()),
 	mMaxDate(time_max()),
 	mHoursAgo(0),
 	mShowFolderState(SHOW_NON_EMPTY_FOLDERS),
 	mPermissions(PERM_NONE),
 	mFilterTypes(FILTERTYPE_OBJECT),
-	mFilterUUID(LLUUID::null),
-	mFilterLinks(FILTERLINK_INCLUDE_LINKS)
+	mFilterUUID(LLUUID::null)
 {
 }
 
@@ -94,25 +97,23 @@ BOOL LLInventoryFilter::check(const LLFolderViewItem* item)
 		return TRUE;
 	}
 
+	const LLFolderViewEventListener* listener = item->getListener();
 	mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos;
 
 	const BOOL passed_filtertype = checkAgainstFilterType(item);
-	const BOOL passed_permissions = checkAgainstPermissions(item);
-	const BOOL passed_filterlink = checkAgainstFilterLinks(item);
-	const BOOL passed = (passed_filtertype &&
-						 passed_permissions &&
-						 passed_filterlink &&
-						 (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos));
+	const BOOL passed = passed_filtertype &&
+		(mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos) &&
+		((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions);
 
 	return passed;
 }
 
-BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const
+BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item)
 {
 	const LLFolderViewEventListener* listener = item->getListener();
 	if (!listener) return FALSE;
 
-	LLInventoryType::EType object_type = listener->getInventoryType();
+	const LLInventoryType::EType object_type = listener->getInventoryType();
 	const LLUUID object_id = listener->getUUID();
 	const LLInventoryObject *object = gInventory.getObject(object_id);
 
@@ -127,15 +128,15 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) con
 		if (object_type == LLInventoryType::IT_NONE)
 		{
 			if (object && object->getIsLinkType())
-			{
 				return FALSE;
-			}
 		}
 		else if ((1LL << object_type & mFilterOps.mFilterObjectTypes) == U64(0))
 		{
 			return FALSE;
 		}
 	}
+	//
+	////////////////////////////////////////////////////////////////////////////////
 	
 	
 	////////////////////////////////////////////////////////////////////////////////
@@ -159,6 +160,8 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) con
 		if ((1LL << cat->getPreferredType() & mFilterOps.mFilterCategoryTypes) == U64(0))
 			return FALSE;
 	}
+	//
+	////////////////////////////////////////////////////////////////////////////////
 
 
 	////////////////////////////////////////////////////////////////////////////////
@@ -171,6 +174,8 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) con
 		if (object->getLinkedUUID() != mFilterOps.mFilterUUID)
 			return FALSE;
 	}
+	//
+	////////////////////////////////////////////////////////////////////////////////
 
 
 	////////////////////////////////////////////////////////////////////////////////
@@ -192,55 +197,12 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) con
 			listener->getCreationDate() > mFilterOps.mMaxDate)
 			return FALSE;
 	}
-
+	//
 	////////////////////////////////////////////////////////////////////////////////
-	// FILTERTYPE_WEARABLE
-	// Pass if this item is a wearable of the appropriate type
-	if (filterTypes & FILTERTYPE_WEARABLE)
-	{
-		LLWearableType::EType type = listener->getWearableType();
-		if ((0x1LL << type & mFilterOps.mFilterWearableTypes) == 0)
-		{
-			return FALSE;
-		}
-	}
 
 	return TRUE;
 }
 
-BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const
-{
-	const LLFolderViewEventListener* listener = item->getListener();
-	if (!listener) return FALSE;
-
-	PermissionMask perm = listener->getPermissionMask();
-	const LLInvFVBridge *bridge = dynamic_cast<const LLInvFVBridge *>(item->getListener());
-	if (bridge && bridge->isLink())
-	{
-		const LLUUID& linked_uuid = gInventory.getLinkedItemID(bridge->getUUID());
-		const LLViewerInventoryItem *linked_item = gInventory.getItem(linked_uuid);
-		if (linked_item)
-			perm = linked_item->getPermissionMask();
-	}
-	return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
-}
-
-BOOL LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const
-{
-	const LLFolderViewEventListener* listener = item->getListener();
-	if (!listener) return TRUE;
-
-	const LLUUID object_id = listener->getUUID();
-	const LLInventoryObject *object = gInventory.getObject(object_id);
-	if (!object) return TRUE;
-
-	const BOOL is_link = object->getIsLinkType();
-	if (is_link && (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS))
-		return FALSE;
-	if (!is_link && (mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS))
-		return FALSE;
-	return TRUE;
-}
 
 const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const
 {
@@ -256,10 +218,7 @@ std::string::size_type LLInventoryFilter::getStringMatchOffset() const
 BOOL LLInventoryFilter::isNotDefault() const
 {
 	return mFilterOps.mFilterObjectTypes != mDefaultFilterOps.mFilterObjectTypes 
-		|| mFilterOps.mFilterCategoryTypes != mDefaultFilterOps.mFilterCategoryTypes 
-		|| mFilterOps.mFilterWearableTypes != mDefaultFilterOps.mFilterWearableTypes 
 		|| mFilterOps.mFilterTypes != FILTERTYPE_OBJECT
-		|| mFilterOps.mFilterLinks != FILTERLINK_INCLUDE_LINKS
 		|| mFilterSubString.size() 
 		|| mFilterOps.mPermissions != mDefaultFilterOps.mPermissions
 		|| mFilterOps.mMinDate != mDefaultFilterOps.mMinDate 
@@ -270,10 +229,7 @@ BOOL LLInventoryFilter::isNotDefault() const
 BOOL LLInventoryFilter::isActive() const
 {
 	return mFilterOps.mFilterObjectTypes != 0xffffffffffffffffULL
-		|| mFilterOps.mFilterCategoryTypes != 0xffffffffffffffffULL
-		|| mFilterOps.mFilterWearableTypes != 0xffffffffffffffffULL
 		|| mFilterOps.mFilterTypes != FILTERTYPE_OBJECT
-		|| mFilterOps.mFilterLinks != FILTERLINK_INCLUDE_LINKS
 		|| mFilterSubString.size() 
 		|| mFilterOps.mPermissions != PERM_NONE 
 		|| mFilterOps.mMinDate != time_min()
@@ -346,35 +302,7 @@ void LLInventoryFilter::setFilterCategoryTypes(U64 types)
 			setModified(FILTER_MORE_RESTRICTIVE);
 		}
 	}
-	mFilterOps.mFilterTypes |= FILTERTYPE_OBJECT;
-}
-
-void LLInventoryFilter::setFilterWearableTypes(U64 types)
-{
-	if (mFilterOps.mFilterWearableTypes != types)
-	{
-		// keep current items only if no type bits getting turned off
-		BOOL fewer_bits_set = (mFilterOps.mFilterWearableTypes & ~types);
-		BOOL more_bits_set = (~mFilterOps.mFilterWearableTypes & types);
-
-		mFilterOps.mFilterWearableTypes = types;
-		if (more_bits_set && fewer_bits_set)
-		{
-			// neither less or more restrive, both simultaneously
-			// so we need to filter from scratch
-			setModified(FILTER_RESTART);
-		}
-		else if (more_bits_set)
-		{
-			// target is only one of all requested types so more type bits == less restrictive
-			setModified(FILTER_LESS_RESTRICTIVE);
-		}
-		else if (fewer_bits_set)
-		{
-			setModified(FILTER_MORE_RESTRICTIVE);
-		}
-	}
-	mFilterOps.mFilterTypes |= FILTERTYPE_WEARABLE;
+	mFilterOps.mFilterTypes |= FILTERTYPE_CATEGORY;
 }
 
 void LLInventoryFilter::setFilterUUID(const LLUUID& object_id)
@@ -401,10 +329,9 @@ void LLInventoryFilter::setFilterSubString(const std::string& string)
 		// appending new characters
 		const BOOL more_restrictive = mFilterSubString.size() < string.size() && !string.substr(0, mFilterSubString.size()).compare(mFilterSubString);
 
-		mFilterSubStringOrig = string;
-		LLStringUtil::trimHead(mFilterSubStringOrig);
-		mFilterSubString = mFilterSubStringOrig;
+		mFilterSubString = string;
 		LLStringUtil::toUpper(mFilterSubString);
+		LLStringUtil::trimHead(mFilterSubString);
 		if (less_restrictive)
 		{
 			setModified(FILTER_LESS_RESTRICTIVE);
@@ -425,11 +352,6 @@ void LLInventoryFilter::setFilterSubString(const std::string& string)
 			mFilterOps.mFilterUUID == LLUUID::null;
 			setModified(FILTER_RESTART);
 		}
-
-		// Cancel out filter links once the search string is modified
-		{
-			mFilterOps.mFilterLinks = FILTERLINK_INCLUDE_LINKS;
-		}
 	}
 }
 
@@ -528,19 +450,6 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
 	mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
 }
 
-void LLInventoryFilter::setFilterLinks(U64 filter_links)
-{
-	if (mFilterOps.mFilterLinks != filter_links)
-	{
-		if (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS ||
-			mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS)
-			setModified(FILTER_MORE_RESTRICTIVE);
-		else
-			setModified(FILTER_LESS_RESTRICTIVE);
-	}
-	mFilterOps.mFilterLinks = filter_links;
-}
-
 void LLInventoryFilter::setShowFolderState(EFolderShow state)
 {
 	if (mFilterOps.mShowFolderState != state)
@@ -916,10 +825,6 @@ U32 LLInventoryFilter::getHoursAgo() const
 { 
 	return mFilterOps.mHoursAgo; 
 }
-U64 LLInventoryFilter::getFilterLinks() const
-{
-	return mFilterOps.mFilterLinks;
-}
 LLInventoryFilter::EFolderShow LLInventoryFilter::getShowFolderState() const
 { 
 	return mFilterOps.mShowFolderState; 
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index e814cf012e22bd8340627615db6faa59f36f2d54..8487588404c4d5dbe8af6b20c212f5b829b9d164 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1,26 +1,32 @@
 /** 
- * @file llinventoryfunctions.cpp
+ * @file llfloaterinventory.cpp
  * @brief Implementation of the inventory view and associated stuff.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -46,7 +52,7 @@
 #include "llappearancemgr.h"
 #include "llappviewer.h"
 //#include "llfirstuse.h"
-#include "llfloaterinventory.h"
+#include "llfloatercustomize.h"
 #include "llfocusmgr.h"
 #include "llfolderview.h"
 #include "llgesturemgr.h"
@@ -58,7 +64,6 @@
 #include "llinventorypanel.h"
 #include "lllineeditor.h"
 #include "llmenugl.h"
-#include "llpanelmaininventory.h"
 #include "llpreviewanim.h"
 #include "llpreviewgesture.h"
 #include "llpreviewnotecard.h"
@@ -69,8 +74,6 @@
 #include "llscrollbar.h"
 #include "llscrollcontainer.h"
 #include "llselectmgr.h"
-#include "llsidetray.h"
-#include "llsidepanelinventory.h"
 #include "lltabcontainer.h"
 #include "lltooldraganddrop.h"
 #include "lluictrlfactory.h"
@@ -84,406 +87,45 @@
 BOOL LLInventoryState::sWearNewClothing = FALSE;
 LLUUID LLInventoryState::sWearNewClothingTransactionID;
 
-// Generates a string containing the path to the item specified by
-// item_id.
-void append_path(const LLUUID& id, std::string& path)
-{
-	std::string temp;
-	const LLInventoryObject* obj = gInventory.getObject(id);
-	LLUUID parent_id;
-	if(obj) parent_id = obj->getParentUUID();
-	std::string forward_slash("/");
-	while(obj)
-	{
-		obj = gInventory.getCategory(parent_id);
-		if(obj)
-		{
-			temp.assign(forward_slash + obj->getName() + temp);
-			parent_id = obj->getParentUUID();
-		}
-	}
-	path.append(temp);
-}
-
-void change_item_parent(LLInventoryModel* model,
-						LLViewerInventoryItem* item,
-						const LLUUID& new_parent_id,
-						BOOL restamp)
-{
-	if (item->getParentUUID() != new_parent_id)
-	{
-		LLInventoryModel::update_list_t update;
-		LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
-		update.push_back(old_folder);
-		LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
-		update.push_back(new_folder);
-		gInventory.accountForUpdate(update);
-
-		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
-		new_item->setParent(new_parent_id);
-		new_item->updateParentOnServer(restamp);
-		model->updateItem(new_item);
-		model->notifyObservers();
-	}
-}
-
-void change_category_parent(LLInventoryModel* model,
-	LLViewerInventoryCategory* cat,
-	const LLUUID& new_parent_id,
-	BOOL restamp)
-{
-	if (!model || !cat)
-	{
-		return;
-	}
-
-	// Can't move a folder into a child of itself.
-	if (model->isObjectDescendentOf(new_parent_id, cat->getUUID()))
-	{
-		return;
-	}
-
-	LLInventoryModel::update_list_t update;
-	LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
-	update.push_back(old_folder);
-	LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
-	update.push_back(new_folder);
-	model->accountForUpdate(update);
-
-	LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
-	new_cat->setParent(new_parent_id);
-	new_cat->updateParentOnServer(restamp);
-	model->updateCategory(new_cat);
-	model->notifyObservers();
-}
-
-void remove_category(LLInventoryModel* model, const LLUUID& cat_id)
-{
-	if (!model || !get_is_category_removable(model, cat_id))
-	{
-		return;
-	}
-
-	// Look for any gestures and deactivate them
-	LLInventoryModel::cat_array_t	descendent_categories;
-	LLInventoryModel::item_array_t	descendent_items;
-	gInventory.collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
-
-	for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin();
-		 iter != descendent_items.end();
-		 ++iter)
-	{
-		const LLViewerInventoryItem* item = (*iter);
-		const LLUUID& item_id = item->getUUID();
-		if (item->getType() == LLAssetType::AT_GESTURE
-			&& LLGestureMgr::instance().isGestureActive(item_id))
-		{
-			LLGestureMgr::instance().deactivateGesture(item_id);
-		}
-	}
-
-	LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
-	if (cat)
-	{
-		const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
-		change_category_parent(model, cat, trash_id, TRUE);
-	}
-}
-
-void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name)
-{
-	LLViewerInventoryCategory* cat;
-
-	if (!model ||
-		!get_is_category_renameable(model, cat_id) ||
-		(cat = model->getCategory(cat_id)) == NULL ||
-		cat->getName() == new_name)
-	{
-		return;
-	}
-
-	LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
-	new_cat->rename(new_name);
-	new_cat->updateServer(FALSE);
-	model->updateCategory(new_cat);
-
-	model->notifyObservers();
-}
-
-BOOL get_is_item_worn(const LLUUID& id)
-{
-	const LLViewerInventoryItem* item = gInventory.getItem(id);
-	if (!item)
-		return FALSE;
-	
-	switch(item->getType())
-	{
-		case LLAssetType::AT_OBJECT:
-		{
-			if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
-				return TRUE;
-			break;
-		}
-		case LLAssetType::AT_BODYPART:
-		case LLAssetType::AT_CLOTHING:
-			if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
-				return TRUE;
-			break;
-		case LLAssetType::AT_GESTURE:
-			if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID()))
-				return TRUE;
-			break;
-		default:
-			break;
-	}
-	return FALSE;
-}
-
-BOOL get_can_item_be_worn(const LLUUID& id)
-{
-	const LLViewerInventoryItem* item = gInventory.getItem(id);
-	if (!item)
-		return FALSE;
-
-	if (LLAppearanceMgr::isLinkInCOF(item->getLinkedUUID()))
-	{
-		// an item having links in COF (i.e. a worn item)
-		return FALSE;
-	}
-
-	if (gInventory.isObjectDescendentOf(id, LLAppearanceMgr::instance().getCOF()))
-	{
-		// a non-link object in COF (should not normally happen)
-		return FALSE;
-	}
-	
-	switch(item->getType())
-	{
-		case LLAssetType::AT_OBJECT:
-		{
-			if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
-			{
-				// Already being worn
-				return FALSE;
-			}
-			else
-			{
-				// Not being worn yet.
-				return TRUE;
-			}
-			break;
-		}
-		case LLAssetType::AT_BODYPART:
-		case LLAssetType::AT_CLOTHING:
-			if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
-			{
-				// Already being worn
-				return FALSE;
-			}
-			else
-			{
-				// Not being worn yet.
-				return TRUE;
-			}
-			break;
-		default:
-			break;
-	}
-	return FALSE;
-}
-
-BOOL get_is_item_removable(const LLInventoryModel* model, const LLUUID& id)
-{
-	if (!model)
-	{
-		return FALSE;
-	}
-
-	// Can't delete an item that's in the library.
-	if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID()))
-	{
-		return FALSE;
-	}
-
-	// Disable delete from COF folder; have users explicitly choose "detach/take off",
-	// unless the item is not worn but in the COF (i.e. is bugged).
-	if (LLAppearanceMgr::instance().getIsProtectedCOFItem(id))
-	{
-		if (get_is_item_worn(id))
-		{
-			return FALSE;
-		}
-	}
-
-	const LLInventoryObject *obj = model->getItem(id);
-	if (obj && obj->getIsLinkType())
-	{
-		return TRUE;
-	}
-	if (get_is_item_worn(id))
-	{
-		return FALSE;
-	}
-	return TRUE;
-}
-
-BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id)
-{
-	// NOTE: This function doesn't check the folder's children.
-	// See LLFolderBridge::isItemRemovable for a function that does
-	// consider the children.
-
-	if (!model)
-	{
-		return FALSE;
-	}
-
-	if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID()))
-	{
-		return FALSE;
-	}
-
-	if (!isAgentAvatarValid()) return FALSE;
-
-	const LLInventoryCategory* category = model->getCategory(id);
-	if (!category)
-	{
-		return FALSE;
-	}
-
-	const LLFolderType::EType folder_type = category->getPreferredType();
-	
-	if (LLFolderType::lookupIsProtectedType(folder_type))
-	{
-		return FALSE;
-	}
-
-	// Can't delete the outfit that is currently being worn.
-	if (folder_type == LLFolderType::FT_OUTFIT)
-	{
-		const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink();
-		if (base_outfit_link && (category == base_outfit_link->getLinkedCategory()))
-		{
-			return FALSE;
-		}
-	}
-
-	return TRUE;
-}
-
-BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id)
-{
-	if (!model)
-	{
-		return FALSE;
-	}
-
-	LLViewerInventoryCategory* cat = model->getCategory(id);
-
-	if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()) &&
-		cat->getOwnerID() == gAgent.getID())
-	{
-		return TRUE;
-	}
-	return FALSE;
-}
-
-void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id)
-{
-	LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD().with("id", item_uuid).with("object", object_id));
-}
-
-void show_item_profile(const LLUUID& item_uuid)
-{
-	LLUUID linked_uuid = gInventory.getLinkedItemID(item_uuid);
-	LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD().with("id", linked_uuid));
-}
-
-void show_item_original(const LLUUID& item_uuid)
-{
-	//sidetray inventory panel
-	LLSidepanelInventory *sidepanel_inventory =
-		dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
-
-	bool reset_inventory_filter = !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory");
-
-	LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel();
-	if (!active_panel) 
-	{
-		//this may happen when there is no floatera and other panel is active in inventory tab
-
-		if	(sidepanel_inventory)
-		{
-			sidepanel_inventory->showInventoryPanel();
-		}
-	}
-	
-	active_panel = LLInventoryPanel::getActiveInventoryPanel();
-	if (!active_panel) 
-	{
-		return;
-	}
-	active_panel->setSelection(gInventory.getLinkedItemID(item_uuid), TAKE_FOCUS_NO);
-	
-	if(reset_inventory_filter)
-	{
-		//inventory floater
-		bool floater_inventory_visible = false;
-
-		LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
-		for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
-		{
-			LLFloaterInventory* floater_inventory = dynamic_cast<LLFloaterInventory*>(*iter);
-			if (floater_inventory)
-			{
-				LLPanelMainInventory* main_inventory = floater_inventory->getMainInventoryPanel();
-
-				main_inventory->onFilterEdit("");
-
-				if(floater_inventory->getVisible())
-				{
-					floater_inventory_visible = true;
-				}
-			}
-		}
-		if(sidepanel_inventory && !floater_inventory_visible)
-		{
-			LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel();
-
-			main_inventory->onFilterEdit("");
-		}
-	}
-}
 
 ///----------------------------------------------------------------------------
 /// LLInventoryCollectFunctor implementations
 ///----------------------------------------------------------------------------
 
 // static
-bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(const LLInventoryItem* item)
+bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* item)
 {
 	if (!item)
 		return false;
 
+	bool allowed = false;
+
 	switch(item->getType())
 	{
 		case LLAssetType::AT_CALLINGCARD:
-			return false;
+			// not allowed
 			break;
+			
 		case LLAssetType::AT_OBJECT:
 			if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
-				return true;
+			{
+				allowed = true;
+			}
 			break;
+			
 		case LLAssetType::AT_BODYPART:
 		case LLAssetType::AT_CLOTHING:
 			if(!gAgentWearables.isWearingItem(item->getUUID()))
-				return true;
+			{
+				allowed = true;
+			}
 			break;
 		default:
-			return true;
+			allowed = true;
 			break;
 	}
-	return false;
+	
+	return allowed;
 }
 
 bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
@@ -513,19 +155,6 @@ bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
 	return TRUE;
 }
 
-bool LLIsOfAssetType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if(mType == LLAssetType::AT_CATEGORY)
-	{
-		if(cat) return TRUE;
-	}
-	if(item)
-	{
-		if(item->getActualType() == mType) return TRUE;
-	}
-	return FALSE;
-}
-
 bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
 {
 	if(mType == LLAssetType::AT_CATEGORY)
@@ -651,66 +280,6 @@ bool LLFindWearables::operator()(LLInventoryCategory* cat,
 	return FALSE;
 }
 
-LLFindWearablesEx::LLFindWearablesEx(bool is_worn, bool include_body_parts)
-:	mIsWorn(is_worn)
-,	mIncludeBodyParts(include_body_parts)
-{}
-
-bool LLFindWearablesEx::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
-	if (!vitem) return false;
-
-	// Skip non-wearables.
-	if (!vitem->isWearableType() && vitem->getType() != LLAssetType::AT_OBJECT)
-	{
-		return false;
-	}
-
-	// Skip body parts if requested.
-	if (!mIncludeBodyParts && vitem->getType() == LLAssetType::AT_BODYPART)
-	{
-		return false;
-	}
-
-	return (bool) get_is_item_worn(item->getUUID()) == mIsWorn;
-}
-
-bool LLFindWearablesOfType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if (!item) return false;
-	if (item->getType() != LLAssetType::AT_CLOTHING &&
-		item->getType() != LLAssetType::AT_BODYPART)
-	{
-		return false;
-	}
-
-	LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
-	if (!vitem || vitem->getWearableType() != mWearableType) return false;
-
-	return true;
-}
-
-void LLFindWearablesOfType::setType(LLWearableType::EType type)
-{
-	mWearableType = type;
-}
-
-bool LLFindNonRemovableObjects::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if (item)
-	{
-		return !get_is_item_removable(&gInventory, item->getUUID());
-	}
-	if (cat)
-	{
-		return !get_is_category_removable(&gInventory, cat->getUUID());
-	}
-
-	llwarns << "Not a category and not an item?" << llendl;
-	return false;
-}
-
 ///----------------------------------------------------------------------------
 /// LLAssetIDMatches 
 ///----------------------------------------------------------------------------
@@ -837,3 +406,179 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder)
 		folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
 	}
 }
+
+static void assign_clothing_bodypart_icon(EInventoryIcon &idx, U32 attachment_point)
+{
+	const EWearableType wearable_type = EWearableType(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & attachment_point);
+	switch(wearable_type)
+	{
+		case WT_SHAPE:
+			idx = BODYPART_SHAPE_ICON_NAME;
+			break;
+		case WT_SKIN:
+			idx = BODYPART_SKIN_ICON_NAME;
+			break;
+		case WT_HAIR:
+			idx = BODYPART_HAIR_ICON_NAME;
+			break;
+		case WT_EYES:
+			idx = BODYPART_EYES_ICON_NAME;
+			break;
+		case WT_SHIRT:
+			idx = CLOTHING_SHIRT_ICON_NAME;
+			break;
+		case WT_PANTS:
+			idx = CLOTHING_PANTS_ICON_NAME;
+			break;
+		case WT_SHOES:
+			idx = CLOTHING_SHOES_ICON_NAME;
+			break;
+		case WT_SOCKS:
+			idx = CLOTHING_SOCKS_ICON_NAME;
+			break;
+		case WT_JACKET:
+			idx = CLOTHING_JACKET_ICON_NAME;
+			break;
+		case WT_GLOVES:
+			idx = CLOTHING_GLOVES_ICON_NAME;
+			break;
+		case WT_UNDERSHIRT:
+			idx = CLOTHING_UNDERSHIRT_ICON_NAME;
+			break;
+		case WT_UNDERPANTS:
+			idx = CLOTHING_UNDERPANTS_ICON_NAME;
+			break;
+		case WT_SKIRT:
+			idx = CLOTHING_SKIRT_ICON_NAME;
+			break;
+		case WT_ALPHA:
+			idx = CLOTHING_ALPHA_ICON_NAME;
+			break;
+		case WT_TATTOO:
+			idx = CLOTHING_TATTOO_ICON_NAME;
+			break;
+		default:
+			break;
+	}
+}
+										  
+
+const std::string& get_item_icon_name(LLAssetType::EType asset_type,
+							 LLInventoryType::EType inventory_type,
+							 U32 attachment_point,
+							 BOOL item_is_multi )
+{
+	EInventoryIcon idx = OBJECT_ICON_NAME;
+	if ( item_is_multi )
+	{
+		idx = OBJECT_MULTI_ICON_NAME;
+	}
+	
+	switch(asset_type)
+	{
+	case LLAssetType::AT_TEXTURE:
+		if(LLInventoryType::IT_SNAPSHOT == inventory_type)
+		{
+			idx = SNAPSHOT_ICON_NAME;
+		}
+		else
+		{
+			idx = TEXTURE_ICON_NAME;
+		}
+		break;
+
+	case LLAssetType::AT_SOUND:
+		idx = SOUND_ICON_NAME;
+		break;
+	case LLAssetType::AT_CALLINGCARD:
+		if(attachment_point!= 0)
+		{
+			idx = CALLINGCARD_ONLINE_ICON_NAME;
+		}
+		else
+		{
+			idx = CALLINGCARD_OFFLINE_ICON_NAME;
+		}
+		break;
+	case LLAssetType::AT_LANDMARK:
+		if(attachment_point!= 0)
+		{
+			idx = LANDMARK_VISITED_ICON_NAME;
+		}
+		else
+		{
+			idx = LANDMARK_ICON_NAME;
+		}
+		break;
+	case LLAssetType::AT_SCRIPT:
+	case LLAssetType::AT_LSL_TEXT:
+	case LLAssetType::AT_LSL_BYTECODE:
+		idx = SCRIPT_ICON_NAME;
+		break;
+	case LLAssetType::AT_CLOTHING:
+		idx = CLOTHING_ICON_NAME;
+		assign_clothing_bodypart_icon(idx, attachment_point);
+		break;
+	case LLAssetType::AT_BODYPART:
+		idx = BODYPART_ICON_NAME;
+		assign_clothing_bodypart_icon(idx, attachment_point);
+		break;
+	case LLAssetType::AT_NOTECARD:
+		idx = NOTECARD_ICON_NAME;
+		break;
+	case LLAssetType::AT_ANIMATION:
+		idx = ANIMATION_ICON_NAME;
+		break;
+	case LLAssetType::AT_GESTURE:
+		idx = GESTURE_ICON_NAME;
+		break;
+	case LLAssetType::AT_LINK:
+		idx = LINKITEM_ICON_NAME;
+		break;
+	case LLAssetType::AT_LINK_FOLDER:
+		idx = LINKFOLDER_ICON_NAME;
+		break;
+	default:
+		break;
+	}
+	
+	return ICON_NAME[idx];
+}
+
+LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
+							 LLInventoryType::EType inventory_type,
+							 U32 attachment_point,
+							 BOOL item_is_multi)
+{
+	const std::string& icon_name = get_item_icon_name(asset_type, inventory_type, attachment_point, item_is_multi );
+	return LLUI::getUIImage(icon_name);
+}
+
+BOOL get_is_item_worn(const LLUUID& id)
+{
+	const LLViewerInventoryItem* item = gInventory.getItem(id);
+	if (!item)
+		return FALSE;
+	
+	switch(item->getType())
+	{
+		case LLAssetType::AT_OBJECT:
+		{
+			if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
+				return TRUE;
+			break;
+		}
+		case LLAssetType::AT_BODYPART:
+		case LLAssetType::AT_CLOTHING:
+			if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
+				return TRUE;
+			break;
+		case LLAssetType::AT_GESTURE:
+			if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID()))
+				return TRUE;
+			break;
+		default:
+			break;
+	}
+	return FALSE;
+}
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 853bf45c5eeb77d66f54cd57076e4ffb5dc7019b..e3cd988e39c07ff35723f8d538830d499a8880b6 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -3,25 +3,31 @@
  * @brief Miscellaneous inventory-related functions and classes
  * class definition
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,49 +38,6 @@
 #include "llfolderview.h"
 #include "llfolderviewitem.h"
 
-/********************************************************************************
- **                                                                            **
- **                    MISCELLANEOUS GLOBAL FUNCTIONS
- **/
-
-// Is this item or its baseitem is worn, attached, etc...
-BOOL get_is_item_worn(const LLUUID& id);
-
-// Could this item be worn (correct type + not already being worn)
-BOOL get_can_item_be_worn(const LLUUID& id);
-
-BOOL get_is_item_removable(const LLInventoryModel* model, const LLUUID& id);
-
-BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id);
-
-BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id);
-
-void show_item_profile(const LLUUID& item_uuid);
-void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id);
-
-void show_item_original(const LLUUID& item_uuid);
-
-void change_item_parent(LLInventoryModel* model,
-									 LLViewerInventoryItem* item,
-									 const LLUUID& new_parent_id,
-									 BOOL restamp);
-
-void change_category_parent(LLInventoryModel* model,
-	LLViewerInventoryCategory* cat,
-	const LLUUID& new_parent_id,
-	BOOL restamp);
-
-void remove_category(LLInventoryModel* model, const LLUUID& cat_id);
-
-void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name);
-
-// Generates a string containing the path to the item specified by item_id.
-void append_path(const LLUUID& id, std::string& path);
-
-/**                    Miscellaneous global functions
- **                                                                            **
- *******************************************************************************/
-
 /********************************************************************************
  **                                                                            **
  **                    INVENTORY COLLECTOR FUNCTIONS
@@ -95,7 +58,7 @@ class LLInventoryCollectFunctor
 	virtual ~LLInventoryCollectFunctor(){};
 	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0;
 
-	static bool itemTransferCommonlyAllowed(const LLInventoryItem* item);
+	static bool itemTransferCommonlyAllowed(LLInventoryItem* item);
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -168,25 +131,6 @@ class LLIsNotType : public LLInventoryCollectFunctor
 	LLAssetType::EType mType;
 };
 
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLIsOfAssetType
-//
-// Implementation of a LLInventoryCollectFunctor which returns TRUE if
-// the item or category is of asset type passed in during construction.
-// Link types are treated as links, not as the types they point to.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLIsOfAssetType : public LLInventoryCollectFunctor
-{
-public:
-	LLIsOfAssetType(LLAssetType::EType type) : mType(type) {}
-	virtual ~LLIsOfAssetType() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	LLAssetType::EType mType;
-};
-
 class LLIsTypeWithPermissions : public LLInventoryCollectFunctor
 {
 public:
@@ -283,61 +227,6 @@ class LLFindCOFValidItems : public LLInventoryCollectFunctor
 	
 };
 
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLFindByMask
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLFindByMask : public LLInventoryCollectFunctor
-{
-public:
-	LLFindByMask(U64 mask)
-		: mFilterMask(mask)
-	{}
-
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-	{
-		if(item && (mFilterMask & (1LL << item->getInventoryType())) )
-		{
-			return true;
-		}
-
-		return false;
-	}
-
-private:
-	U64 mFilterMask;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLFindNonLinksByMask
-//
-//
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLFindNonLinksByMask : public LLInventoryCollectFunctor
-{
-public:
-	LLFindNonLinksByMask(U64 mask)
-		: mFilterMask(mask)
-	{}
-
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-	{
-		if(item && !item->getIsLinkType() && (mFilterMask & (1LL << item->getInventoryType())) )
-		{
-			return true;
-		}
-
-		return false;
-	}
-
-	void setFilterMask(U64 mask)
-	{
-		mFilterMask = mask;
-	}
-
-private:
-	U64 mFilterMask;
-};
-
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLFindWearables
 //
@@ -352,67 +241,6 @@ class LLFindWearables : public LLInventoryCollectFunctor
 							LLInventoryItem* item);
 };
 
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLFindWearablesEx
-//
-// Collects wearables based on given criteria.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLFindWearablesEx : public LLInventoryCollectFunctor
-{
-public:
-	LLFindWearablesEx(bool is_worn, bool include_body_parts = true);
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
-private:
-	bool mIncludeBodyParts;
-	bool mIsWorn;
-};
-
-//Inventory collect functor collecting wearables of a specific wearable type
-class LLFindWearablesOfType : public LLInventoryCollectFunctor
-{
-public:
-	LLFindWearablesOfType(LLWearableType::EType type) : mWearableType(type) {}
-	virtual ~LLFindWearablesOfType() {}
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
-	void setType(LLWearableType::EType type);
-
-private:
-	LLWearableType::EType mWearableType;
-};
-
-/** Filter out wearables-links */
-class LLFindActualWearablesOfType : public LLFindWearablesOfType
-{
-public:
-	LLFindActualWearablesOfType(LLWearableType::EType type) : LLFindWearablesOfType(type) {}
-	virtual ~LLFindActualWearablesOfType() {}
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-	{
-		if (item && item->getIsLinkType()) return false;
-		return LLFindWearablesOfType::operator()(cat, item);
-	}
-};
-
-/* Filters out items of a particular asset type */
-class LLIsTypeActual : public LLIsType
-{
-public:
-	LLIsTypeActual(LLAssetType::EType type) : LLIsType(type) {}
-	virtual ~LLIsTypeActual() {}
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-	{
-		if (item && item->getIsLinkType()) return false;
-		return LLIsType::operator()(cat, item);
-	}
-};
-
-// Collect non-removable folders and items.
-class LLFindNonRemovableObjects : public LLInventoryCollectFunctor
-{
-public:
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
-};
-
 /**                    Inventory Collector Functions
  **                                                                            **
  *******************************************************************************/
@@ -469,6 +297,19 @@ class LLOpenFoldersWithSelection : public LLFolderViewFunctor
 	virtual void doItem(LLFolderViewItem* item);
 };
 
+const std::string& get_item_icon_name(LLAssetType::EType asset_type,
+									  LLInventoryType::EType inventory_type,
+									  U32 attachment_point, 
+									  BOOL item_is_multi );
+
+LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
+						   LLInventoryType::EType inventory_type,
+						   U32 attachment_point, 
+						   BOOL item_is_multi );
+
+// Is this item or its baseitem is worn, attached, etc...
+BOOL get_is_item_worn(const LLUUID& id);
+
 #endif // LL_LLINVENTORYFUNCTIONS_H
 
 
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 08229d3a50d00a4bfab48bad8043e23495b194c6..6452ae82f8d4ef18bedba1298d837d58e56575dd 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -2,25 +2,31 @@
  * @file llinventorymodel.cpp
  * @brief Implementation of the inventory model used to track agent inventory.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -29,7 +35,6 @@
 
 #include "llagent.h"
 #include "llagentwearables.h"
-#include "llappearancemgr.h"
 #include "llinventorypanel.h"
 #include "llinventorybridge.h"
 #include "llinventoryfunctions.h"
@@ -288,30 +293,6 @@ void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id,
 	items = get_ptr_in_map(mParentChildItemTree, cat_id);
 }
 
-LLMD5 LLInventoryModel::hashDirectDescendentNames(const LLUUID& cat_id) const
-{
-	LLInventoryModel::cat_array_t* cat_array;
-	LLInventoryModel::item_array_t* item_array;
-	getDirectDescendentsOf(cat_id,cat_array,item_array);
-	LLMD5 item_name_hash;
-	if (!item_array)
-	{
-		item_name_hash.finalize();
-		return item_name_hash;
-	}
-	for (LLInventoryModel::item_array_t::const_iterator iter = item_array->begin();
-		 iter != item_array->end();
-		 iter++)
-	{
-		const LLViewerInventoryItem *item = (*iter);
-		if (!item)
-			continue;
-		item_name_hash.update(item->getName());
-	}
-	item_name_hash.finalize();
-	return item_name_hash;
-}
-
 // SJB: Added version to lock the arrays to catch potential logic bugs
 void LLInventoryModel::lockDirectDescendentArrays(const LLUUID& cat_id,
 												  cat_array_t*& categories,
@@ -338,18 +319,30 @@ void LLInventoryModel::unlockDirectDescendentArrays(const LLUUID& cat_id)
 // specifies 'type' as what it defaults to containing. The category is
 // not necessarily only for that type. *NOTE: This will create a new
 // inventory category on the fly if one does not exist.
-const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type, 
-													   bool create_folder, 
-													   bool find_in_library)
+const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType t, bool create_folder, bool find_in_library)
+{
+	const LLUUID &rv = findCatUUID(t, find_in_library);
+	if(rv.isNull() && isInventoryUsable() && (create_folder && !find_in_library))
+	{
+		const LLUUID &root_id = gInventory.getRootFolderID();
+		if(root_id.notNull())
+		{
+			return createNewCategory(root_id, t, LLStringUtil::null);
+		}
+	}
+	return rv;
+}
+
+// Internal method which looks for a category with the specified
+// preferred type. Returns LLUUID::null if not found.
+const LLUUID &LLInventoryModel::findCatUUID(LLFolderType::EType preferred_type, bool find_in_library) const
 {
-	LLUUID rv = LLUUID::null;
-	
 	const LLUUID &root_id = (find_in_library) ? gInventory.getLibraryRootFolderID() : gInventory.getRootFolderID();
 	if(LLFolderType::FT_ROOT_INVENTORY == preferred_type)
 	{
-		rv = root_id;
+		return root_id;
 	}
-	else if (root_id.notNull())
+	if(root_id.notNull())
 	{
 		cat_array_t* cats = NULL;
 		cats = get_ptr_in_map(mParentChildCategoryTree, root_id);
@@ -360,21 +353,12 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe
 			{
 				if(cats->get(i)->getPreferredType() == preferred_type)
 				{
-					rv = cats->get(i)->getUUID();
-					break;
+					return cats->get(i)->getUUID();
 				}
 			}
 		}
 	}
-	
-	if(rv.isNull() && isInventoryUsable() && (create_folder && !find_in_library))
-	{
-		if(root_id.notNull())
-		{
-			return createNewCategory(root_id, preferred_type, LLStringUtil::null);
-		}
-	}
-	return rv;
+	return LLUUID::null;
 }
 
 // Convenience function to create a new category. You could call
@@ -585,11 +569,6 @@ const LLUUID& LLInventoryModel::getLinkedItemID(const LLUUID& object_id) const
 	return item->getLinkedUUID();
 }
 
-LLViewerInventoryItem* LLInventoryModel::getLinkedItem(const LLUUID& object_id) const
-{
-	return object_id.notNull() ? getItem(getLinkedItemID(object_id)) : NULL;
-}
-
 LLInventoryModel::item_array_t LLInventoryModel::collectLinkedItems(const LLUUID& id,
 																	const LLUUID& start_folder_id)
 {
@@ -604,6 +583,27 @@ LLInventoryModel::item_array_t LLInventoryModel::collectLinkedItems(const LLUUID
 	return items;
 }
 
+// Generates a string containing the path to the item specified by
+// item_id.
+void LLInventoryModel::appendPath(const LLUUID& id, std::string& path) const
+{
+	std::string temp;
+	const LLInventoryObject* obj = getObject(id);
+	LLUUID parent_id;
+	if(obj) parent_id = obj->getParentUUID();
+	std::string forward_slash("/");
+	while(obj)
+	{
+		obj = getCategory(parent_id);
+		if(obj)
+		{
+			temp.assign(forward_slash + obj->getName() + temp);
+			parent_id = obj->getParentUUID();
+		}
+	}
+	path.append(temp);
+}
+
 bool LLInventoryModel::isInventoryUsable() const
 {
 	bool result = false;
@@ -739,20 +739,8 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item)
 			// Valid UUID; set the item UUID and rename it
 			new_item->setCreator(id);
 			std::string avatar_name;
-
-			if (gCacheName->getFullName(id, avatar_name))
-			{
-				new_item->rename(avatar_name);
-				mask |= LLInventoryObserver::LABEL;
-			}
-			else
-			{
-				// Fetch the current name
-				gCacheName->get(id, FALSE,
-					boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(),
-					_1, _2, _3));
-			}
-
+			// Fetch the currect name
+			gCacheName->get(id, FALSE, boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(), _1, _2, _3));
 		}
 	}
 	else if (new_item->getType() == LLAssetType::AT_GESTURE)
@@ -1036,6 +1024,98 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
 	}
 }
 
+void LLInventoryModel::deleteFromServer(LLDynamicArray<LLUUID>& category_ids,
+										LLDynamicArray<LLUUID>& item_ids)
+{
+	// Store off tre UUIDS of parents which are being deleted (thus no
+	// need to increment) and the parents which are being modified. We
+	// have to increment the version of the parent with each message
+	// sent upstream since the dataserver will increment each unique
+	// parent per update message.
+	std::set<LLUUID> ignore_parents;
+	update_map_t inc_parents;
+
+	S32 i;
+	S32 count = category_ids.count();
+	BOOL start_new_message = TRUE;
+	LLMessageSystem* msg = gMessageSystem;
+	LLPointer<LLViewerInventoryCategory> cat;
+	for(i = 0; i < count; i++)
+	{
+		if(start_new_message)
+		{
+			start_new_message = FALSE;
+			msg->newMessageFast(_PREHASH_RemoveInventoryObjects);
+			msg->nextBlockFast(_PREHASH_AgentData);
+			msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+			msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+		}
+		LLUUID cat_id = category_ids.get(i);
+
+		msg->nextBlockFast(_PREHASH_FolderData);
+		msg->addUUIDFast(_PREHASH_FolderID, cat_id);
+		cat = getCategory(cat_id);
+		ignore_parents.insert(cat_id);
+		addChangedMask(LLInventoryObserver::REMOVE | LLInventoryObserver::STRUCTURE, cat_id);
+		if(cat.notNull() && (ignore_parents.find(cat->getParentUUID())==ignore_parents.end()))
+		{
+			--inc_parents[cat->getParentUUID()];
+		}
+		if(msg->isSendFullFast(_PREHASH_FolderData))
+		{
+			start_new_message = TRUE;
+			msg->nextBlockFast(_PREHASH_ItemData);
+			msg->addUUIDFast(_PREHASH_ItemID, LLUUID::null);
+			gAgent.sendReliableMessage();
+			accountForUpdate(inc_parents);
+			inc_parents.clear();
+		}
+	}
+
+	count = item_ids.count();
+	std::set<LLUUID>::iterator not_ignored = ignore_parents.end();
+	LLPointer<LLViewerInventoryItem> item;
+	if((0 == count) && (!start_new_message))
+	{
+		msg->nextBlockFast(_PREHASH_ItemData);
+		msg->addUUIDFast(_PREHASH_ItemID, LLUUID::null);
+	}
+	for(i = 0; i < count; i++)
+	{
+		if(start_new_message)
+		{
+			start_new_message = FALSE;
+			msg->newMessageFast(_PREHASH_RemoveInventoryObjects);
+			msg->nextBlockFast(_PREHASH_AgentData);
+			msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+			msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+			msg->nextBlockFast(_PREHASH_FolderData);
+			msg->addUUIDFast(_PREHASH_FolderID, LLUUID::null);
+		}
+		LLUUID item_id = item_ids.get(i);
+		msg->nextBlockFast(_PREHASH_ItemData);
+		msg->addUUIDFast(_PREHASH_ItemID, item_id);
+		item = getItem(item_id);
+		addChangedMask(LLInventoryObserver::REMOVE | LLInventoryObserver::STRUCTURE, item_id);
+		if(item.notNull() && (ignore_parents.find(item->getParentUUID()) == not_ignored))
+		{
+			--inc_parents[item->getParentUUID()];
+		}
+		if(msg->isSendFullFast(_PREHASH_ItemData))
+		{
+			start_new_message = TRUE;
+			gAgent.sendReliableMessage();
+			accountForUpdate(inc_parents);
+			inc_parents.clear();
+		}
+	}
+	if(!start_new_message)
+	{
+		gAgent.sendReliableMessage();
+		accountForUpdate(inc_parents);
+	}
+}
+
 // Add/remove an observer. If the observer is destroyed, be sure to
 // remove it.
 void LLInventoryModel::addObserver(LLInventoryObserver* observer)
@@ -1126,7 +1206,29 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
 	}
 }
 
-// If we get back a normal response, handle it here
+// This method to prepares a set of mock inventory which provides
+// minimal functionality before the actual arrival of inventory.
+/*
+void LLInventoryModel::mock(const LLUUID& root_id)
+{
+	llinfos << "LLInventoryModel::mock() " << root_id << llendl;
+	if(root_id.isNull())
+	{
+		llwarns << "Not a valid root id" << llendl;
+		return;
+	}
+	LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(
+		root_id,
+		LLUUID::null,
+		LLAssetType::AT_CATEGORY,
+		LLFolderType::lookupNewCategoryName(LLFolderType::FT_ROOT_INVENTORY),
+		gAgent.getID());
+	addCategory(cat);
+	gInventory.buildParentChildMap();
+}
+*/
+
+//If we get back a normal response, handle it here
 void  LLInventoryModel::fetchInventoryResponder::result(const LLSD& content)
 {	
 	start_new_inventory_observer();
@@ -1199,7 +1301,7 @@ void LLInventoryModel::fetchInventoryResponder::error(U32 status, const std::str
 	gInventory.notifyObservers("fetchinventory");
 }
 
-bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const
+bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id)
 {
 	if(folder_id.isNull()) 
 	{
@@ -1227,6 +1329,7 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const
 	return cat->fetch();
 }
 
+
 void LLInventoryModel::cache(
 	const LLUUID& parent_folder_id,
 	const LLUUID& agent_id)
@@ -1272,9 +1375,6 @@ void LLInventoryModel::addCategory(LLViewerInventoryCategory* category)
 	//llinfos << "LLInventoryModel::addCategory()" << llendl;
 	if(category)
 	{
-		// try to localize default names first. See EXT-8319, EXT-7051.
-		category->localizeName();
-
 		// Insert category uniquely into the map
 		mCategoryMap[category->getUUID()] = category; // LLPointer will deref and delete the old one
 		//mInventory[category->getUUID()] = category;
@@ -1283,6 +1383,8 @@ void LLInventoryModel::addCategory(LLViewerInventoryCategory* category)
 
 void LLInventoryModel::addItem(LLViewerInventoryItem* item)
 {
+	//llinfos << "LLInventoryModel::addItem()" << llendl;
+
 	llassert(item);
 	if(item)
 	{
@@ -1681,17 +1783,6 @@ bool LLInventoryModel::loadSkeleton(
 			}
 		}
 
-		// Invalidate all categories that failed fetching descendents for whatever
-		// reason (e.g. one of the descendents was a broken link).
-		for (cat_set_t::iterator invalid_cat_it = invalid_categories.begin();
-			 invalid_cat_it != invalid_categories.end();
-			 invalid_cat_it++)
-		{
-			LLViewerInventoryCategory* cat = (*invalid_cat_it).get();
-			cat->setVersion(NO_VERSION);
-			llinfos << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << llendl;
-		}
-
 		// At this point, we need to set the known descendents for each
 		// category which successfully cached so that we do not
 		// needlessly fetch descendents for categories which we have.
@@ -1714,6 +1805,17 @@ bool LLInventoryModel::loadSkeleton(
 			}
 		}
 
+		// Invalidate all categories that failed fetching descendents for whatever
+		// reason (e.g. one of the descendents was a broken link).
+		for (cat_set_t::iterator invalid_cat_it = invalid_categories.begin();
+			 invalid_cat_it != invalid_categories.end();
+			 invalid_cat_it++)
+		{
+			LLViewerInventoryCategory* cat = (*invalid_cat_it).get();
+			cat->setVersion(NO_VERSION);
+			llinfos << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << llendl;
+		}
+
 		if(remove_inventory_file)
 		{
 			// clean up the gunzipped file.
@@ -1735,6 +1837,88 @@ bool LLInventoryModel::loadSkeleton(
 	return rv;
 }
 
+bool LLInventoryModel::loadMeat(const LLSD& options, const LLUUID& owner_id)
+{
+	llinfos << "importing inventory for " << owner_id << llendl;
+	bool rv = true;
+	for(LLSD::array_const_iterator it = options.beginArray(),
+		end = options.endArray(); it != end; ++it)
+	{
+		LLSD name = (*it)["name"];
+		LLSD item_id = (*it)["item_id"];
+		LLSD parent_id = (*it)["parent_id"];
+		LLSD asset_type = (*it)["type"];
+		LLSD data_id = (*it)["data_id"];
+		if(name.isDefined() 
+			&& item_id.isDefined()
+			&& parent_id.isDefined()
+			&& asset_type.isDefined()
+			&& data_id.isDefined())
+		{
+			LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem;
+			item->rename(name.asString());
+			item->setUUID(item_id.asUUID());
+			item->setParent(parent_id.asUUID());
+			LLAssetType::EType type = (LLAssetType::EType)asset_type.asInteger();
+            item->setType(type);
+
+			LLSD llsd_inv_type = (*it)["inv_type"];
+			if(llsd_inv_type.isDefined())
+            {
+				LLInventoryType::EType inv_type = (LLInventoryType::EType)llsd_inv_type.asInteger();
+                item->setInventoryType(inv_type);
+            }
+
+            if(LLAssetType::AT_CALLINGCARD == type)
+            {
+                LLPermissions perm;
+				perm.init(data_id.asUUID(), owner_id, LLUUID::null, LLUUID::null);
+                item->setPermissions(perm);
+            }
+            else
+            {
+				LLPermissions default_perm;
+				default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null);
+				LLSD llsd_perm_mask = (*it)["perm_mask"];
+				if(llsd_perm_mask.isDefined())
+                {
+					PermissionMask perm_mask = llsd_perm_mask.asInteger();
+					default_perm.initMasks(
+						perm_mask, perm_mask, perm_mask, perm_mask, perm_mask);
+				}
+				else
+				{
+					default_perm.initMasks(
+						PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE);
+				}
+				item->setPermissions(default_perm);
+				item->setAssetUUID(data_id.asUUID());
+            }
+
+			LLSD flags = (*it)["flags"];
+			if(flags.isDefined())
+            {
+				// Not sure how well LLSD.asInteger() maps to 
+				// unsigned long - using strtoul()
+				item->setFlags(strtoul(flags.asString().c_str(), NULL, 0));
+            }
+
+			LLSD time = (*it)["time"];
+			if(time.isDefined())
+            {
+				item->setCreationDate(time.asInteger());
+            }
+            addItem(item);
+		}
+		else
+		{
+			llwarns << "Unable to import near " << name.asString() << llendl;
+            rv = false;
+		}
+	}
+	return rv;
+}
+
 // This is a brute force method to rebuild the entire parent-child
 // relations. The overall operation has O(NlogN) performance, which
 // should be sufficient for our needs. 
@@ -2002,6 +2186,73 @@ bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const
 	return (mID > rhs.mID);
 }
 
+// Given the current state of the inventory items, figure out the
+// clone information. *FIX: This is sub-optimal, since we can insert
+// this information snurgically, but this makes sure the implementation
+// works before we worry about optimization.
+//void LLInventoryModel::recalculateCloneInformation()
+//{
+//	//dumpInventory();
+//
+//	// This implements a 'multi-map' like structure to keep track of
+//	// how many clones we find.
+//	typedef LLDynamicArray<LLViewerInventoryItem*> viewer_item_array_t;
+//	typedef std::map<LLUUIDAndName, viewer_item_array_t*> clone_map_t;
+//	clone_map_t clone_map;
+//	LLUUIDAndName id_and_name;
+//	viewer_item_array_t* clones = NULL;
+//	LLViewerInventoryItem* item = NULL;
+//	for(item = (LLViewerInventoryItem*)mItemMap.getFirstData();
+//		item != NULL;
+//		item = (LLViewerInventoryItem*)mItemMap.getNextData())
+//	{
+//		if(item->getType() == LLAssetType::AT_CALLINGCARD)
+//		{
+//			// if it's a calling card, we key off of the creator id, not
+//			// the asset id.
+//			id_and_name.mID = item->getCreatorUUID();
+//		}
+//		else
+//		{
+//			// if it's not a calling card, we key clones from the
+//			// asset id.
+//			id_and_name.mID = item->getAssetUUID();
+//		}
+//		if(id_and_name.mID == LLUUID::null)
+//		{
+//			continue;
+//		}
+//		id_and_name.mName = item->getName();
+//		if(clone_map.checkData(id_and_name))
+//		{
+//			clones = clone_map.getData(id_and_name);
+//		}
+//		else
+//		{
+//			clones = new viewer_item_array_t;
+//			clone_map.addData(id_and_name, clones);
+//		}
+//		clones->put(item);
+//	}
+//
+//	S32 count = 0;
+//	for(clones = clone_map.getFirstData();
+//		clones != NULL;
+//		clones = clone_map.getNextData())
+//	{
+//		count = clones->count();
+//		for(S32 i = 0; i < count; i++)
+//		{
+//			item = clones->get(i);
+//			item->setCloneCount(count - 1);
+//			//clones[i] = NULL;
+//		}
+//		delete clones;
+//	}
+//	clone_map.removeAllData();
+//	//dumpInventory();
+//}
+
 // static
 bool LLInventoryModel::loadFromFile(const std::string& filename,
 									LLInventoryModel::cat_array_t& categories,
@@ -2468,9 +2719,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
 	}
 	LLUUID tid;
 	msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TransactionID, tid);
-#ifndef LL_RELEASE_FOR_DOWNLOAD
 	llinfos << "Bulk inventory: " << tid << llendl;
-#endif
 
 	update_map_t update;
 	cat_array_t folders;
@@ -2591,7 +2840,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
 		{
 			LLViewerInventoryItem* wearable_item;
 			wearable_item = gInventory.getItem(wearable_ids[i]);
-			LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true);
+			wear_inventory_item_on_avatar(wearable_item);
 		}
 	}
 
@@ -2849,10 +3098,6 @@ static LLInventoryModel::item_array_t::iterator find_item_iter_by_uuid(LLInvento
 }
 
 // static
-// * @param[in, out] items - vector with items to be updated. It should be sorted in a right way
-// * before calling this method.
-// * @param src_item_id - LLUUID of inventory item to be moved in new position
-// * @param dest_item_id - LLUUID of inventory item before which source item should be placed.
 void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id)
 {
 	LLInventoryModel::item_array_t::iterator it_src = find_item_iter_by_uuid(items, src_item_id);
@@ -2868,7 +3113,6 @@ void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, c
 	items.insert(it_dest, src_item);
 }
 
-//* @param[in] items vector of items in order to be saved.
 void LLInventoryModel::saveItemsOrder(const LLInventoryModel::item_array_t& items)
 {
 	int sortField = 0;
@@ -2912,8 +3156,6 @@ static void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& i
 	std::sort(items.begin(), items.end(), sort_functor);
 }
 
-// * @param source_item_id - LLUUID of the source item to be moved into new position
-// * @param target_item_id - LLUUID of the target item before which source item should be placed.
 void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id)
 {
 	LLInventoryModel::cat_array_t cats;
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index f6728fd5758f812730837d3c9e06f8693d1ae7db..b7c1b573970269a4a073d1264dd37caf44a97fa2 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -2,25 +2,31 @@
  * @file llinventorymodel.h
  * @brief LLInventoryModel class header file
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -35,7 +41,6 @@
 #include "lluuid.h"
 #include "llpermissionsflags.h"
 #include "llstring.h"
-#include "llmd5.h"
 #include <map>
 #include <set>
 #include <string>
@@ -53,15 +58,17 @@ class LLMessageSystem;
 class LLInventoryCollectFunctor;
 
 
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// LLInventoryModel
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLInventoryModel
 //
-// Represents a collection of inventory, and provides efficient ways to access 
-// that information.
-//   NOTE: This class could in theory be used for any place where you need 
-//   inventory, though it optimizes for time efficiency - not space efficiency, 
-//   probably making it inappropriate for use on tasks.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// This class represents a collection of inventory, and provides
+// efficient ways to access that information. This class could in
+// theory be used for any place where you need inventory, though it
+// optimizes for time efficiency - not space efficiency, probably
+// making it inappropriate for use on tasks.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
 class LLInventoryModel
 {
 public:
@@ -77,132 +84,79 @@ class LLInventoryModel
 	typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t;
 	typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;
 	typedef std::set<LLUUID> changed_items_t;
-
+	
+	// construction & destruction
+	LLInventoryModel();
+	~LLInventoryModel();
+	
+	void cleanupInventory();
+	
 	class fetchInventoryResponder : public LLHTTPClient::Responder
 	{
 	public:
 		fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
 		void result(const LLSD& content);			
+		
 		void error(U32 status, const std::string& reason);
+
+	public:
+		typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;
 	protected:
 		LLSD mRequestSD;
 	};
 
-/********************************************************************************
- **                                                                            **
- **                    INITIALIZATION/SETUP
- **/
-
-	//--------------------------------------------------------------------
-	// Constructors / Destructors
-	//--------------------------------------------------------------------
-public:
-	LLInventoryModel();
-	~LLInventoryModel();
-	void cleanupInventory();
-protected:
-	void empty(); // empty the entire contents
-
-	//--------------------------------------------------------------------
-	// Initialization
-	//--------------------------------------------------------------------
-public:
-	// The inventory model usage is sensitive to the initial construction of the model
-	bool isInventoryUsable() const;
-private:
-	bool mIsAgentInvUsable; // used to handle an invalid inventory state
+	//
+	// Accessors
+	//
 
-	//--------------------------------------------------------------------
-	// Root Folders
-	//--------------------------------------------------------------------
-public:
-	// The following are set during login with data from the server
-	void setRootFolderID(const LLUUID& id);
-	void setLibraryOwnerID(const LLUUID& id);
-	void setLibraryRootFolderID(const LLUUID& id);
+	// Check if one object has a parent chain up to the category specified by UUID.
+	BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const;
 
-	const LLUUID &getRootFolderID() const;
-	const LLUUID &getLibraryOwnerID() const;
-	const LLUUID &getLibraryRootFolderID() const;
-private:
-	LLUUID mRootFolderID;
-	LLUUID mLibraryRootFolderID;
-	LLUUID mLibraryOwnerID;	
-	
-	//--------------------------------------------------------------------
-	// Structure
-	//--------------------------------------------------------------------
-public:
-	// Methods to load up inventory skeleton & meat. These are used
-	// during authentication. Returns true if everything parsed.
-	bool loadSkeleton(const LLSD& options, const LLUUID& owner_id);
-	void buildParentChildMap(); // brute force method to rebuild the entire parent-child relations
-	// Call on logout to save a terse representation.
-	void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id);
-private:
-	// Information for tracking the actual inventory. We index this
-	// information in a lot of different ways so we can access
-	// the inventory using several different identifiers.
-	// mInventory member data is the 'master' list of inventory, and
-	// mCategoryMap and mItemMap store uuid->object mappings. 
-	typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t;
-	typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t;
-	cat_map_t mCategoryMap;
-	item_map_t mItemMap;
-	// This last set of indices is used to map parents to children.
-	typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
-	typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
-	parent_cat_map_t mParentChildCategoryTree;
-	parent_item_map_t mParentChildItemTree;
+	// Get whatever special folder this object is a child of, if any.
+	const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
 
-	//--------------------------------------------------------------------
-	// Login
-	//--------------------------------------------------------------------
-public:
-	static BOOL getIsFirstTimeInViewer2();
-private:
-	static BOOL sFirstTimeInViewer2;
-	const static S32 sCurrentInvCacheVersion; // expected inventory cache version
+	// Get the object by id. Returns NULL if not found.
+	// * WARNING: use the pointer returned for read operations - do
+	// not modify the object values in place or you will break stuff.
+	LLInventoryObject* getObject(const LLUUID& id) const;
 
-/**                    Initialization/Setup
- **                                                                            **
- *******************************************************************************/
+	// Get the item by id. Returns NULL if not found.
+	// * WARNING: use the pointer for read operations - use the
+	// updateItem() method to actually modify values.
+	LLViewerInventoryItem* getItem(const LLUUID& id) const;
 
-/********************************************************************************
- **                                                                            **
- **                    ACCESSORS
- **/
+	// Get the category by id. Returns NULL if not found.
+	// * WARNING: use the pointer for read operations - use the
+	// updateCategory() method to actually modify values.
+	LLViewerInventoryCategory* getCategory(const LLUUID& id) const;
 
-	//--------------------------------------------------------------------
-	// Descendents
-	//--------------------------------------------------------------------
-public:
-	// Make sure we have the descendents in the structure.  Returns true
-	// if a fetch was performed.
-	bool fetchDescendentsOf(const LLUUID& folder_id) const;
+	// Return the number of items or categories
+	S32 getItemCount() const;
+	S32 getCategoryCount() const;
 
 	// Return the direct descendents of the id provided.Set passed
 	// in values to NULL if the call fails.
-	//    NOTE: The array provided points straight into the guts of
-	//    this object, and should only be used for read operations, since
-	//    modifications may invalidate the internal state of the inventory.
+	// *WARNING: The array provided points straight into the guts of
+	// this object, and should only be used for read operations, since
+	// modifications may invalidate the internal state of the
+	// inventory.
 	void getDirectDescendentsOf(const LLUUID& cat_id,
 								cat_array_t*& categories,
 								item_array_t*& items) const;
-
-	// Compute a hash of direct descendent names (for detecting child name changes)
-	LLMD5 hashDirectDescendentNames(const LLUUID& cat_id) const;
+	
+	// SJB: Added version to lock the arrays to catch potential logic bugs
+	void lockDirectDescendentArrays(const LLUUID& cat_id,
+									cat_array_t*& categories,
+									item_array_t*& items);
+	void unlockDirectDescendentArrays(const LLUUID& cat_id);
 	
 	// Starting with the object specified, add its descendents to the
 	// array provided, but do not add the inventory object specified
-	// by id. There is no guaranteed order. 
-	//    NOTE: Neither array will be erased before adding objects to it. 
-	//    Do not store a copy of the pointers collected - use them, and 
-	//    collect them again later if you need to reference the same objects.
-	enum { 
-		EXCLUDE_TRASH = FALSE, 
-		INCLUDE_TRASH = TRUE 
-	};
+	// by id. There is no guaranteed order. Neither array will be
+	// erased before adding objects to it. Do not store a copy of the
+	// pointers collected - use them, and collect them again later if
+	// you need to reference the same objects.
+	enum { EXCLUDE_TRASH = FALSE, INCLUDE_TRASH = TRUE };
 	void collectDescendents(const LLUUID& id,
 							cat_array_t& categories,
 							item_array_t& items,
@@ -218,163 +172,156 @@ class LLInventoryModel
 	// Assumes item_id is itself not a linked item.
 	item_array_t collectLinkedItems(const LLUUID& item_id,
 									const LLUUID& start_folder_id = LLUUID::null);
-	
-
-	// Check if one object has a parent chain up to the category specified by UUID.
-	BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const;
-
-	//--------------------------------------------------------------------
-	// Find
-	//--------------------------------------------------------------------
-public:
-	// Returns the uuid of the category that specifies 'type' as what it 
-	// defaults to containing. The category is not necessarily only for that type. 
-	//    NOTE: If create_folder is true, this will create a new inventory category 
-	//    on the fly if one does not exist. *NOTE: if find_in_library is true it 
-	//    will search in the user's library folder instead of "My Inventory"
-	const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type, 
-										 bool create_folder = true, 
-										 bool find_in_library = false);
-	
-	// Get whatever special folder this object is a child of, if any.
-	const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
-
-	// Get the object by id. Returns NULL if not found.
-	//   NOTE: Use the pointer returned for read operations - do
-	//   not modify the object values in place or you will break stuff.
-	LLInventoryObject* getObject(const LLUUID& id) const;
-
-	// Get the item by id. Returns NULL if not found.
-	//    NOTE: Use the pointer for read operations - use the
-	//    updateItem() method to actually modify values.
-	LLViewerInventoryItem* getItem(const LLUUID& id) const;
-
-	// Get the category by id. Returns NULL if not found.
-	//    NOTE: Use the pointer for read operations - use the
-	//    updateCategory() method to actually modify values.
-	LLViewerInventoryCategory* getCategory(const LLUUID& id) const;
 
-	// Get the inventoryID or item that this item points to, else just return object_id
+	// Get the inventoryID that this item points to, else just return item_id
 	const LLUUID& getLinkedItemID(const LLUUID& object_id) const;
-	LLViewerInventoryItem* getLinkedItem(const LLUUID& object_id) const;
-private:
-	mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups	
-
-	//--------------------------------------------------------------------
-	// Count
-	//--------------------------------------------------------------------
-public:
-	// Return the number of items or categories
-	S32 getItemCount() const;
-	S32 getCategoryCount() const;
 
-/**                    Accessors
- **                                                                            **
- *******************************************************************************/
+	// The inventory model usage is sensitive to the initial construction of the 
+	// model. 
+	bool isInventoryUsable() const;
 
-/********************************************************************************
- **                                                                            **
- **                    MUTATORS
- **/
+	//
+	// Mutators
+	//
 
-public:
-	// Change an existing item with a matching item_id or add the item
+	// Calling this method with an inventory item will either change
+	// an existing item with a matching item_id, or will add the item
 	// to the current inventory. Returns the change mask generated by
 	// the update. No notification will be sent to observers. This
 	// method will only generate network traffic if the item had to be
 	// reparented.
-	//    NOTE: In usage, you will want to perform cache accounting
-	//    operations in LLInventoryModel::accountForUpdate() or
-	//    LLViewerInventoryItem::updateServer() before calling this method.
+	// *NOTE: In usage, you will want to perform cache accounting
+	// operations in LLInventoryModel::accountForUpdate() or
+	// LLViewerInventoryItem::updateServer() before calling this
+	// method.
 	U32 updateItem(const LLViewerInventoryItem* item);
 
-	// Change an existing item with the matching id or add
+	// Calling this method with an inventory category will either
+	// change an existing item with the matching id, or it will add
 	// the category. No notifcation will be sent to observers. This
 	// method will only generate network traffic if the item had to be
 	// reparented.
-	//    NOTE: In usage, you will want to perform cache accounting
-	//    operations in accountForUpdate() or LLViewerInventoryCategory::
-	//    updateServer() before calling this method.
+	// *NOTE: In usage, you will want to perform cache accounting
+	// operations in LLInventoryModel::accountForUpdate() or
+	// LLViewerInventoryCategory::updateServer() before calling this
+	// method.
 	void updateCategory(const LLViewerInventoryCategory* cat);
 
-	// Move the specified object id to the specified category and
-	// update the internal structures. No cache accounting,
+	// This method will move the specified object id to the specified
+	// category, update the internal structures. No cache accounting,
 	// observer notification, or server update is performed.
 	void moveObject(const LLUUID& object_id, const LLUUID& cat_id);
 
-	//--------------------------------------------------------------------
-	// Delete
-	//--------------------------------------------------------------------
-public:
-	// Delete a particular inventory object by ID. Will purge one
-	// object from the internal data structures, maintaining a
+	// delete a particular inventory object by ID. This will purge one
+	// object from the internal data structures maintaining a
 	// consistent internal state. No cache accounting, observer
-	// notification, or server update is performed.
+	// notification, or server update is performed.  Purges linked items.
 	void deleteObject(const LLUUID& id);
-	void removeItem(const LLUUID& item_id);
 	
-	// Delete a particular inventory object by ID, and delete it from
-	// the server. Also updates linked items.
+	// delete a particular inventory object by ID, and delete it from
+	// the server.  Also updates linked items.
 	void purgeObject(const LLUUID& id);
+	void updateLinkedObjectsFromPurge(const LLUUID& baseobj_id);
 
-	// Collects and purges the descendants of the id
+	// This is a method which collects the descendants of the id
 	// provided. If the category is not found, no action is
 	// taken. This method goes through the long winded process of
 	// removing server representation of folders and items while doing
 	// cache accounting in a fairly efficient manner. This method does
 	// not notify observers (though maybe it should...)
 	void purgeDescendentsOf(const LLUUID& id);
-protected:
-	void updateLinkedObjectsFromPurge(const LLUUID& baseobj_id);
-	
-	//--------------------------------------------------------------------
-	// Reorder
-	//--------------------------------------------------------------------
-public:
-	// Changes items order by insertion of the item identified by src_item_id
-	// before the item identified by dest_item_id. Both items must exist in items array.
-	// Sorting is stored after method is finished. Only src_item_id is moved before dest_item_id.
-	static void updateItemsOrder(LLInventoryModel::item_array_t& items, 
-								 const LLUUID& src_item_id, 
-								 const LLUUID& dest_item_id);
-
-	// Saves current order of the passed items using inventory item sort field.
-	// Resets 'items' sort fields and saves them on server.
-	// Is used to save order for Favorites folder.
-	void saveItemsOrder(const LLInventoryModel::item_array_t& items);
 
-	// Rearranges Landmarks inside Favorites folder.
-	// Moves source landmark before target one.
-	void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
+	// This method optimally removes the referenced categories and
+	// items from the current agent's inventory in the database. It
+	// performs all of the during deletion. The local representation
+	// is not removed.
+	void deleteFromServer(LLDynamicArray<LLUUID>& category_ids,
+						  LLDynamicArray<LLUUID>& item_ids);
 
-	//--------------------------------------------------------------------
-	// Creation
-	//--------------------------------------------------------------------
-public:
-	// Returns the UUID of the new category. If you want to use the default 
-	// name based on type, pass in a NULL to the 'name' parameter.
+	// Add/remove an observer. If the observer is destroyed, be sure
+	// to remove it.
+	void addObserver(LLInventoryObserver* observer);
+	void removeObserver(LLInventoryObserver* observer);
+	BOOL containsObserver(LLInventoryObserver* observer) const;
+
+	//
+	// Misc Methods 
+	//
+
+	// findCategoryUUIDForType() returns the uuid of the category that
+	// specifies 'type' as what it defaults to containing. The
+	// category is not necessarily only for that type. *NOTE: If create_folder is true, this
+	// will create a new inventory category on the fly if one does not exist. *NOTE: if find_in_library is
+	// true it will search in the user's library folder instead of "My Inventory"
+	// SDK: Added flag to specify whether the folder should be created if not found.  This fixes the horrible
+	// multiple trash can bug.
+	const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder = true, bool find_in_library = false);
+
+	// This gets called by the idle loop.  It only updates if new
+	// state is detected.  Call notifyObservers() manually to update
+	// regardless of whether state change has been indicated.
+	void idleNotifyObservers();
+
+	// Call this method to explicitly update everyone on a new state.
+	// The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328]
+	void notifyObservers(const std::string service_name="");
+
+	// This allows outsiders to tell the inventory if something has
+	// been changed 'under the hood', but outside the control of the
+	// inventory. For example, if we grant someone modify permissions,
+	// then that changes the data structures for LLAvatarTracker, but
+	// potentially affects inventory observers. This API makes sure
+	// that the next notify will include that notification.
+	void addChangedMask(U32 mask, const LLUUID& referent);
+
+	const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }
+
+	// This method to prepares a set of mock inventory which provides
+	// minimal functionality before the actual arrival of inventory.
+	//void mock(const LLUUID& root_id);
+
+	// Make sure we have the descendents in the structure.  Returns true
+	// if a fetch was performed.
+	bool fetchDescendentsOf(const LLUUID& folder_id);
+
+	// call this method to request the inventory.
+	//void requestFromServer(const LLUUID& agent_id);
+
+	// call this method on logout to save a terse representation
+	void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id);
+
+	// Generates a string containing the path to the item specified by
+	// item_id.
+	void appendPath(const LLUUID& id, std::string& path) const;
+
+	// message handling functionality
+	static void registerCallbacks(LLMessageSystem* msg);
+
+	// Convenience function to create a new category. You could call
+	// updateCatgory() with a newly generated UUID category, but this
+	// version will take care of details like what the name should be
+	// based on preferred type. Returns the UUID of the new
+	// category. If you want to use the default name based on type,
+	// pass in a NULL to the 'name parameter.
 	LLUUID createNewCategory(const LLUUID& parent_id,
 							 LLFolderType::EType preferred_type,
 							 const std::string& name);
-protected:
-	// Internal methods that add inventory and make sure that all of
-	// the internal data structures are consistent. These methods
-	// should be passed pointers of newly created objects, and the
-	// instance will take over the memory management from there.
-	void addCategory(LLViewerInventoryCategory* category);
-	void addItem(LLViewerInventoryItem* item);
-	
-/**                    Mutators
- **                                                                            **
- *******************************************************************************/
 
-/********************************************************************************
- **                                                                            **
- **                    CATEGORY ACCOUNTING
- **/
+	// methods to load up inventory skeleton & meat. These are used
+	// during authentication. return true if everything parsed.
+	bool loadSkeleton(const LLSD& options, const LLUUID& owner_id);
+	bool loadMeat(const LLSD& options, const LLUUID& owner_id);
+
+	// This is a brute force method to rebuild the entire parent-child
+	// relations.
+	void buildParentChildMap();
 
-public:
-	// Represents the number of items added or removed from a category.
+	//
+	// Category accounting.
+	//
+
+	// This structure represents the number of items added or removed
+	// from a category.
 	struct LLCategoryUpdate
 	{
 		LLCategoryUpdate() : mDescendentDelta(0) {}
@@ -386,7 +333,8 @@ class LLInventoryModel
 	};
 	typedef std::vector<LLCategoryUpdate> update_list_t;
 
-	// This exists to make it easier to account for deltas in a map.
+	// This structure eixts to make it easier to account for deltas in
+	// a map.
 	struct LLInitializedS32
 	{
 		LLInitializedS32() : mValue(0) {}
@@ -397,89 +345,102 @@ class LLInventoryModel
 	};
 	typedef std::map<LLUUID, LLInitializedS32> update_map_t;
 
-	// Call when there are category updates.  Call them *before* the 
-	// actual update so the method can do descendent accounting correctly.
+	// Call these methods when there are category updates, but call
+	// them *before* the actual update so the method can do descendent
+	// accounting correctly.
 	void accountForUpdate(const LLCategoryUpdate& update) const;
 	void accountForUpdate(const update_list_t& updates);
 	void accountForUpdate(const update_map_t& updates);
 
-	// Return (yes/no/maybe) child status of category children.
+	// Return child status of category children. yes/no/maybe
 	EHasChildren categoryHasChildren(const LLUUID& cat_id) const;
 
-	// Returns true iff category version is known and theoretical
+	// returns true iff category version is known and theoretical
 	// descendents == actual descendents.
 	bool isCategoryComplete(const LLUUID& cat_id) const;
 	
-/**                    Category Accounting
- **                                                                            **
- *******************************************************************************/
+	// callbacks
+	// Trigger a notification and empty the folder type (FT_TRASH or FT_LOST_AND_FOUND) if confirmed
+	void emptyFolderType(const std::string notification, LLFolderType::EType folder_type);
+	bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type);
 
-/********************************************************************************
- **                                                                            **
- **                    NOTIFICATIONS
- **/
+	// Utility Functions
+	void removeItem(const LLUUID& item_id);
+	
+	// Data about the agent's root folder and root library folder
+	// are stored here, rather than in LLAgent where it used to be, because
+	// gInventory is a singleton and represents the agent's inventory.
+	// The "library" is actually the inventory of a special agent,
+	// usually Alexandria Linden.
+	const LLUUID &getRootFolderID() const;
+	const LLUUID &getLibraryOwnerID() const;
+	const LLUUID &getLibraryRootFolderID() const;
 
-public:
-	// Called by the idle loop.  Only updates if new state is detected.  Call 
-	// notifyObservers() manually to update regardless of whether state change 
-	// has been indicated.
-	void idleNotifyObservers();
+	// These are set during login with data from the server
+	void setRootFolderID(const LLUUID& id);
+	void setLibraryOwnerID(const LLUUID& id);
+	void setLibraryRootFolderID(const LLUUID& id);
 
-	// Call to explicitly update everyone on a new state.  The optional argument
-	// 'service_name' is used by Agent Inventory Service [DEV-20328]
-	void notifyObservers(const std::string service_name="");
 
-	// Allows outsiders to tell the inventory if something has
-	// been changed 'under the hood', but outside the control of the
-	// inventory. The next notify will include that notification.
-	void addChangedMask(U32 mask, const LLUUID& referent);
-	const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }
+	/**
+	 * Changes items order by insertion of the item identified by src_item_id
+	 * BEFORE the item identified by dest_item_id. Both items must exist in items array.
+	 *
+	 * Sorting is stored after method is finished. Only src_item_id is moved before dest_item_id.
+	 *
+	 * @param[in, out] items - vector with items to be updated. It should be sorted in a right way
+	 * before calling this method.
+	 * @param src_item_id - LLUUID of inventory item to be moved in new position
+	 * @param dest_item_id - LLUUID of inventory item before which source item should be placed.
+	 */
+	static void updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id);
+
+	/**
+	 * Saves current order of the passed items using inventory item sort field.
+	 *
+	 * It reset items' sort fields and saves them on server.
+	 * Is used to save order for Favorites folder.
+	 *
+	 * @param[in] items vector of items in order to be saved.
+	 */
+	void saveItemsOrder(const LLInventoryModel::item_array_t& items);
+
+	/**
+	 * Rearranges Landmarks inside Favorites folder.
+	 * Moves source landmark before target one.
+	 *
+	 * @param source_item_id - LLUUID of the source item to be moved into new position
+	 * @param target_item_id - LLUUID of the target item before which source item should be placed.
+	 */
+	void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
+
 protected:
-	// Updates all linked items pointing to this id.
-	void addChangedMaskForLinks(const LLUUID& object_id, U32 mask);
-private:
-	// Flag set when notifyObservers is being called, to look for bugs
-	// where it's called recursively.
-	BOOL mIsNotifyObservers;
-	// Variables used to track what has changed since the last notify.
-	U32 mModifyMask;
-	changed_items_t mChangedItemIDs;
-	
-	//--------------------------------------------------------------------
-	// Observers
-	//--------------------------------------------------------------------
-public:
-	// If the observer is destroyed, be sure to remove it.
-	void addObserver(LLInventoryObserver* observer);
-	void removeObserver(LLInventoryObserver* observer);
-	BOOL containsObserver(LLInventoryObserver* observer) const;
-private:
-	typedef std::set<LLInventoryObserver*> observer_list_t;
-	observer_list_t mObservers;
-	
-/**                    Notifications
- **                                                                            **
- *******************************************************************************/
 
+	// Internal methods which add inventory and make sure that all of
+	// the internal data structures are consistent. These methods
+	// should be passed pointers of newly created objects, and the
+	// instance will take over the memory management from there.
+	void addCategory(LLViewerInventoryCategory* category);
+	void addItem(LLViewerInventoryItem* item);
 
-/********************************************************************************
- **                                                                            **
- **                    MISCELLANEOUS
- **/
+	// ! DEPRECRATE ! Remove this and add it into findCategoryUUIDForType,
+	// since that's the only function that uses this.  It's too confusing 
+	// having both methods.
+	// 
+	// Internal method which looks for a category with the specified
+	// preferred type. Returns LLUUID::null if not found
+ 	const LLUUID &findCatUUID(LLFolderType::EType preferred_type, bool find_in_library = false) const;
 
-	//--------------------------------------------------------------------
-	// Callbacks
-	//--------------------------------------------------------------------
-public:
-	// Trigger a notification and empty the folder type (FT_TRASH or FT_LOST_AND_FOUND) if confirmed
-	void emptyFolderType(const std::string notification, LLFolderType::EType folder_type);
-	bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type);
-	static void registerCallbacks(LLMessageSystem* msg);
+	// Empty the entire contents
+	void empty();
 
-	//--------------------------------------------------------------------
-	// File I/O
-	//--------------------------------------------------------------------
-protected:
+	// Given the current state of the inventory items, figure out the
+	// clone information. *FIX: This is sub-optimal, since we can
+	// insert this information snurgically, but this makes sure the
+	// implementation works before we worry about optimization.
+	//void recalculateCloneInformation();
+
+	// file import/export.
 	static bool loadFromFile(const std::string& filename,
 							 cat_array_t& categories,
 							 item_array_t& items,
@@ -488,46 +449,86 @@ class LLInventoryModel
 						   const cat_array_t& categories,
 						   const item_array_t& items); 
 
-	//--------------------------------------------------------------------
-	// Message handling functionality
-	//--------------------------------------------------------------------
-public:
+	// message handling functionality
+	//static void processUseCachedInventory(LLMessageSystem* msg, void**);
 	static void processUpdateCreateInventoryItem(LLMessageSystem* msg, void**);
 	static void processRemoveInventoryItem(LLMessageSystem* msg, void**);
 	static void processUpdateInventoryFolder(LLMessageSystem* msg, void**);
 	static void processRemoveInventoryFolder(LLMessageSystem* msg, void**);
+	//static void processExchangeCallingcard(LLMessageSystem* msg, void**);
+	//static void processAddCallingcard(LLMessageSystem* msg, void**);
+	//static void processDeclineCallingcard(LLMessageSystem* msg, void**);
 	static void processSaveAssetIntoInventory(LLMessageSystem* msg, void**);
 	static void processBulkUpdateInventory(LLMessageSystem* msg, void**);
 	static void processInventoryDescendents(LLMessageSystem* msg, void**);
 	static void processMoveInventoryItem(LLMessageSystem* msg, void**);
 	static void processFetchInventoryReply(LLMessageSystem* msg, void**);
-protected:
+	
 	bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting);
 
-	//--------------------------------------------------------------------
-	// Locks
-	//--------------------------------------------------------------------
-public:
-	void lockDirectDescendentArrays(const LLUUID& cat_id,
-									cat_array_t*& categories,
-									item_array_t*& items);
-	void unlockDirectDescendentArrays(const LLUUID& cat_id);
+	// Updates all linked items pointing to this id.
+	void addChangedMaskForLinks(const LLUUID& object_id, U32 mask);
+
 protected:
 	cat_array_t* getUnlockedCatArray(const LLUUID& id);
 	item_array_t* getUnlockedItemArray(const LLUUID& id);
+	
 private:
+	// Variables used to track what has changed since the last notify.
+	U32 mModifyMask;
+	changed_items_t mChangedItemIDs;
+
 	std::map<LLUUID, bool> mCategoryLock;
 	std::map<LLUUID, bool> mItemLock;
 	
-	//--------------------------------------------------------------------
-	// Debugging
-	//--------------------------------------------------------------------
+	// cache recent lookups
+	mutable LLPointer<LLViewerInventoryItem> mLastItem;
+
+	// This last set of indices is used to map parents to children.
+	typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
+	typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
+	parent_cat_map_t mParentChildCategoryTree;
+	parent_item_map_t mParentChildItemTree;
+
+	typedef std::set<LLInventoryObserver*> observer_list_t;
+	observer_list_t mObservers;
+
+	// Agent inventory folder information.
+	LLUUID mRootFolderID;
+	LLUUID mLibraryRootFolderID;
+	LLUUID mLibraryOwnerID;
+
+	// Expected inventory cache version
+	const static S32 sCurrentInvCacheVersion;
+	
+	// This flag is used to handle an invalid inventory state.
+	bool mIsAgentInvUsable;
+
+private:
+	// Information for tracking the actual inventory. We index this
+	// information in a lot of different ways so we can access
+	// the inventory using several different identifiers.
+	// mInventory member data is the 'master' list of inventory, and
+	// mCategoryMap and mItemMap store uuid->object mappings. 
+	typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t;
+	typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t;
+	//inv_map_t mInventory;
+	cat_map_t mCategoryMap;
+	item_map_t mItemMap;
+
+	// Flag set when notifyObservers is being called, to look for bugs
+	// where it's called recursively.
+	BOOL mIsNotifyObservers;
 public:
+	// *NOTE: DEBUG functionality
 	void dumpInventory() const;
 
-/**                    Miscellaneous
- **                                                                            **
- *******************************************************************************/
+	////////////////////////////////////////////////////////////////////////////////
+	// Login status
+public:
+	static BOOL getIsFirstTimeInViewer2();
+private:
+	static BOOL sFirstTimeInViewer2;
 };
 
 // a special inventory model for the agent
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index eab8f187a70d7f9901122d3686a2b98e04efdef3..cfbc2c3e058a5e6affbf576125f85985b47f7cd1 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -2,48 +2,70 @@
  * @file llinventorymodel.cpp
  * @brief Implementation of the inventory model used to track agent inventory.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 #include "llinventorymodelbackgroundfetch.h"
 
+// Seraph clean this up
 #include "llagent.h"
-#include "llappviewer.h"
-#include "llcallbacklist.h"
 #include "llinventorypanel.h"
 #include "llviewercontrol.h"
 #include "llviewermessage.h"
-#include "llviewerregion.h"
 #include "llviewerwindow.h"
+#include "llappviewer.h"
+#include "llviewerregion.h"
+#include "llcallbacklist.h"
 
 const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f;
 const S32 MAX_FETCH_RETRIES = 10;
 
+// RN: for some reason, using std::queue in the header file confuses the compiler which thinks it's an xmlrpc_queue
+static std::deque<LLUUID> sFetchQueue;
+bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id)
+{
+	for (std::deque<LLUUID>::iterator it = sFetchQueue.begin();
+		 it != sFetchQueue.end(); ++it)
+	{
+		const LLUUID& fetch_id = *it;
+		if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
+			return false;
+	}
+	return true;
+}
+
+
 LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() :
 	mBackgroundFetchActive(FALSE),
 	mAllFoldersFetched(FALSE),
-	mRecursiveInventoryFetchStarted(FALSE),
-	mRecursiveLibraryFetchStarted(FALSE),
+	mInventoryFetchStarted(FALSE),
+	mLibraryFetchStarted(FALSE),
 	mNumFetchRetries(0),
 	mMinTimeBetweenFetches(0.3f),
 	mMaxTimeBetweenFetches(10.f),
@@ -56,88 +78,86 @@ LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
 {
 }
 
-bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const
+bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete()
 {
-	return mFetchQueue.empty() && mBulkFetchCount<=0;
+	return sFetchQueue.empty() && mBulkFetchCount<=0;
 }
 
-bool LLInventoryModelBackgroundFetch::libraryFetchStarted() const
+bool LLInventoryModelBackgroundFetch::libraryFetchStarted()
 {
-	return mRecursiveLibraryFetchStarted;
+	return mLibraryFetchStarted;
 }
 
-bool LLInventoryModelBackgroundFetch::libraryFetchCompleted() const
+bool LLInventoryModelBackgroundFetch::libraryFetchCompleted()
 {
 	return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID());
 }
 
-bool LLInventoryModelBackgroundFetch::libraryFetchInProgress() const
+bool LLInventoryModelBackgroundFetch::libraryFetchInProgress()
 {
 	return libraryFetchStarted() && !libraryFetchCompleted();
 }
 	
-bool LLInventoryModelBackgroundFetch::inventoryFetchStarted() const
+bool LLInventoryModelBackgroundFetch::inventoryFetchStarted()
 {
-	return mRecursiveInventoryFetchStarted;
+	return mInventoryFetchStarted;
 }
 
-bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted() const
+bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted()
 {
 	return inventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID());
 }
 
-bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress() const
+bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress()
 {
 	return inventoryFetchStarted() && !inventoryFetchCompleted();
 }
 
-bool LLInventoryModelBackgroundFetch::isEverythingFetched() const
+bool LLInventoryModelBackgroundFetch::isEverythingFetched()
 {
 	return mAllFoldersFetched;
 }
 
-BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive() const
+BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive()
 {
 	return mBackgroundFetchActive;
 }
 
-void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive)
+void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id)
 {
 	if (!mAllFoldersFetched)
 	{
-		LL_DEBUGS("InventoryFetch") << "Start fetching category: " << cat_id << ", recursive: " << recursive << LL_ENDL;
-
 		mBackgroundFetchActive = TRUE;
 		if (cat_id.isNull())
 		{
-			if (!mRecursiveInventoryFetchStarted)
+			if (!mInventoryFetchStarted)
 			{
-				mRecursiveInventoryFetchStarted |= recursive;
-				mFetchQueue.push_back(FetchQueueInfo(gInventory.getRootFolderID(), recursive));
+				mInventoryFetchStarted = TRUE;
+				sFetchQueue.push_back(gInventory.getRootFolderID());
 				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
 			}
-			if (!mRecursiveLibraryFetchStarted)
+			if (!mLibraryFetchStarted)
 			{
-				mRecursiveLibraryFetchStarted |= recursive;
-				mFetchQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursive));
+				mLibraryFetchStarted = TRUE;
+				sFetchQueue.push_back(gInventory.getLibraryRootFolderID());
 				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
 			}
 		}
 		else
 		{
-			// Specific folder requests go to front of queue.
-			if (mFetchQueue.empty() || mFetchQueue.front().mCatUUID != cat_id)
+			// specific folder requests go to front of queue
+			if (sFetchQueue.empty() || sFetchQueue.front() != cat_id)
 			{
-				mFetchQueue.push_front(FetchQueueInfo(cat_id, recursive));
+				sFetchQueue.push_front(cat_id);
 				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
 			}
 			if (cat_id == gInventory.getLibraryRootFolderID())
 			{
-				mRecursiveLibraryFetchStarted |= recursive;
+				mLibraryFetchStarted = TRUE;
 			}
 			if (cat_id == gInventory.getRootFolderID())
 			{
-				mRecursiveInventoryFetchStarted |= recursive;
+				mInventoryFetchStarted = TRUE;
 			}
 		}
 	}
@@ -146,7 +166,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive
 void LLInventoryModelBackgroundFetch::findLostItems()
 {
 	mBackgroundFetchActive = TRUE;
-    mFetchQueue.push_back(FetchQueueInfo(LLUUID::null, TRUE));
+    sFetchQueue.push_back(LLUUID::null);
     gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
 }
 
@@ -163,8 +183,8 @@ void LLInventoryModelBackgroundFetch::stopBackgroundFetch()
 
 void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
 {
-	if (mRecursiveInventoryFetchStarted &&
-		mRecursiveLibraryFetchStarted)
+	if (mInventoryFetchStarted &&
+		mLibraryFetchStarted)
 	{
 		mAllFoldersFetched = TRUE;
 	}
@@ -180,7 +200,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 {
 	if (mBackgroundFetchActive && gAgent.getRegion())
 	{
-		// If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
+		//If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
 		std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");   
 		if (!url.empty()) 
 		{
@@ -188,13 +208,9 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 			return;
 		}
 		
-#if 1
-		//--------------------------------------------------------------------------------
-		// DEPRECATED OLD CODE
-		//
-
-		// No more categories to fetch, stop fetch process.
-		if (mFetchQueue.empty())
+		//DEPRECATED OLD CODE FOLLOWS.
+		// no more categories to fetch, stop fetch process
+		if (sFetchQueue.empty())
 		{
 			llinfos << "Inventory fetch completed" << llendl;
 
@@ -206,42 +222,41 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 		F32 slow_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.5f);
 		if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() > slow_fetch_time)
 		{
-			// Double timeouts on failure.
+			// double timeouts on failure
 			mMinTimeBetweenFetches = llmin(mMinTimeBetweenFetches * 2.f, 10.f);
 			mMaxTimeBetweenFetches = llmin(mMaxTimeBetweenFetches * 2.f, 120.f);
 			llinfos << "Inventory fetch times grown to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
-			// fetch is no longer considered "timely" although we will wait for full time-out.
+			// fetch is no longer considered "timely" although we will wait for full time-out
 			mTimelyFetchPending = FALSE;
 		}
 
 		while(1)
 		{
-			if (mFetchQueue.empty())
+			if (sFetchQueue.empty())
 			{
 				break;
 			}
 
 			if(gDisconnected)
 			{
-				// Just bail if we are disconnected.
+				// just bail if we are disconnected.
 				break;
 			}
 
-			const FetchQueueInfo info = mFetchQueue.front();
-			LLViewerInventoryCategory* cat = gInventory.getCategory(info.mCatUUID);
+			LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
 
-			// Category has been deleted, remove from queue.
+			// category has been deleted, remove from queue.
 			if (!cat)
 			{
-				mFetchQueue.pop_front();
+				sFetchQueue.pop_front();
 				continue;
 			}
 			
 			if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && 
 				LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
 			{
-				// Category exists but has no children yet, fetch the descendants
-				// for now, just request every time and rely on retry timer to throttle.
+				// category exists but has no children yet, fetch the descendants
+				// for now, just request every time and rely on retry timer to throttle
 				if (cat->fetch())
 				{
 					mFetchTimer.reset();
@@ -255,13 +270,13 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 					break;
 				}
 			}
-			// Do I have all my children?
-			else if (gInventory.isCategoryComplete(info.mCatUUID))
+			// do I have all my children?
+			else if (gInventory.isCategoryComplete(sFetchQueue.front()))
 			{
-				// Finished with this category, remove from queue.
-				mFetchQueue.pop_front();
+				// finished with this category, remove from queue
+				sFetchQueue.pop_front();
 
-				// Add all children to queue.
+				// add all children to queue
 				LLInventoryModel::cat_array_t* categories;
 				LLInventoryModel::item_array_t* items;
 				gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
@@ -269,13 +284,13 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 					 it != categories->end();
 					 ++it)
 				{
-					mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(),info.mRecursive));
+					sFetchQueue.push_back((*it)->getUUID());
 				}
 
-				// We received a response in less than the fast time.
+				// we received a response in less than the fast time
 				if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time)
 				{
-					// Shrink timeouts based on success.
+					// shrink timeouts based on success
 					mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f);
 					mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f);
 					//llinfos << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
@@ -286,28 +301,24 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 			}
 			else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
 			{
-				// Received first packet, but our num descendants does not match db's num descendants
-				// so try again later.
-				mFetchQueue.pop_front();
+				// received first packet, but our num descendants does not match db's num descendants
+				// so try again later
+				LLUUID fetch_id = sFetchQueue.front();
+				sFetchQueue.pop_front();
 
 				if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
 				{
 					// push on back of queue
-					mFetchQueue.push_back(info);
+					sFetchQueue.push_back(fetch_id);
 				}
 				mTimelyFetchPending = FALSE;
 				mFetchTimer.reset();
 				break;
 			}
 
-			// Not enough time has elapsed to do a new fetch
+			// not enough time has elapsed to do a new fetch
 			break;
 		}
-
-		//
-		// DEPRECATED OLD CODE
-		//--------------------------------------------------------------------------------
-#endif
 	}
 }
 
@@ -323,25 +334,20 @@ void LLInventoryModelBackgroundFetch::incrBulkFetch(S16 fetching)
 
 class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
 {
-public:
-	LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd, uuid_vec_t recursive_cats) : 
-		mRequestSD(request_sd),
-		mRecursiveCatUUIDs(recursive_cats)
-	{};
-	//LLInventoryModelFetchDescendentsResponder() {};
-	void result(const LLSD& content);
-	void error(U32 status, const std::string& reason);
-protected:
-	BOOL getIsRecursive(const LLUUID& cat_id) const;
-private:
-	LLSD mRequestSD;
-	uuid_vec_t mRecursiveCatUUIDs; // hack for storing away which cat fetches are recursive
+	public:
+		LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
+		//LLInventoryModelFetchDescendentsResponder() {};
+		void result(const LLSD& content);
+		void error(U32 status, const std::string& reason);
+	public:
+		typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;
+	protected:
+		LLSD mRequestSD;
 };
 
-// If we get back a normal response, handle it here.
-void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
+//If we get back a normal response, handle it here
+void  LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
 {
-	LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance();
 	if (content.has("folders"))	
 	{
 
@@ -406,12 +412,11 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
 			{	
 				LLSD category = *category_it;
 				tcategory->fromLLSD(category); 
-				
-				const BOOL recursive = getIsRecursive(tcategory->getUUID());
-				
-				if (recursive)
+							
+				if (LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted() ||
+					LLInventoryModelBackgroundFetch::instance().libraryFetchStarted())
 				{
-					fetcher->mFetchQueue.push_back(LLInventoryModelBackgroundFetch::FetchQueueInfo(tcategory->getUUID(), recursive));
+					sFetchQueue.push_back(tcategory->getUUID());
 				}
 				else if ( !gInventory.isCategoryComplete(tcategory->getUUID()) )
 				{
@@ -430,7 +435,7 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
 				gInventory.updateItem(titem);
 			}
 
-			// Set version and descendentcount according to message.
+			// set version and descendentcount according to message.
 			LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id);
 			if(cat)
 			{
@@ -450,34 +455,32 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
 		{	
 			LLSD folder_sd = *folder_it;
 			
-			// These folders failed on the dataserver.  We probably don't want to retry them.
+			//These folders failed on the dataserver.  We probably don't want to retry them.
 			llinfos << "Folder " << folder_sd["folder_id"].asString() 
 					<< "Error: " << folder_sd["error"].asString() << llendl;
 		}
 	}
 
-	fetcher->incrBulkFetch(-1);
+	LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
 	
-	if (fetcher->isBulkFetchProcessingComplete())
+	if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
 	{
 		llinfos << "Inventory fetch completed" << llendl;
-		fetcher->setAllFoldersFetched();
+		LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
 	}
 	
 	gInventory.notifyObservers("fetchDescendents");
 }
 
-// If we get back an error (not found, etc...), handle it here.
+//If we get back an error (not found, etc...), handle it here
 void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason)
 {
-	LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance();
-
 	llinfos << "LLInventoryModelFetchDescendentsResponder::error "
 		<< status << ": " << reason << llendl;
 						
-	fetcher->incrBulkFetch(-1);
+	LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
 
-	if (status==499) // timed out
+	if (status==499)		//timed out.  Let's be awesome!
 	{
 		for(LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
 			folder_it != mRequestSD["folders"].endArray();
@@ -485,31 +488,24 @@ void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::str
 		{	
 			LLSD folder_sd = *folder_it;
 			LLUUID folder_id = folder_sd["folder_id"];
-			const BOOL recursive = getIsRecursive(folder_id);
-			fetcher->mFetchQueue.push_front(LLInventoryModelBackgroundFetch::FetchQueueInfo(folder_id, recursive));
+			sFetchQueue.push_front(folder_id);
 		}
 	}
 	else
 	{
-		if (fetcher->isBulkFetchProcessingComplete())
+		if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
 		{
-			fetcher->setAllFoldersFetched();
+			LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
 		}
 	}
 	gInventory.notifyObservers("fetchDescendents");
 }
 
-BOOL LLInventoryModelFetchDescendentsResponder::getIsRecursive(const LLUUID& cat_id) const
-{
-	return (std::find(mRecursiveCatUUIDs.begin(),mRecursiveCatUUIDs.end(), cat_id) != mRecursiveCatUUIDs.end());
-}
-
-// Bundle up a bunch of requests to send all at once.
-// static   
+//static   Bundle up a bunch of requests to send all at once.
 void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 {
 	//Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
-	//If there are items in mFetchQueue, we want to check the time since the last bulkFetch was 
+	//If there are items in sFetchQueue, we want to check the time since the last bulkFetch was 
 	//sent.  If it exceeds our retry time, go ahead and fire off another batch.  
 	//Stopbackgroundfetch will be run from the Responder instead of here.  
 
@@ -524,7 +520,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 		(mBulkFetchCount > max_concurrent_fetches) ||
 		(mFetchTimer.getElapsedTimeF32() < mMinTimeBetweenFetches))
 	{
-		return; // just bail if we are disconnected
+		return; // just bail if we are disconnected.
 	}	
 
 	U32 folder_count=0;
@@ -532,16 +528,11 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 
 	U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1;
 
-	uuid_vec_t recursive_cats;
-
 	LLSD body;
 	LLSD body_lib;
-
-	while (!(mFetchQueue.empty()) && (folder_count < max_batch_size))
+	while (!(sFetchQueue.empty()) && (folder_count < max_batch_size))
 	{
-		const FetchQueueInfo& fetch_info = mFetchQueue.front();
-		const LLUUID &cat_id = fetch_info.mCatUUID;
-        if (cat_id.isNull()) //DEV-17797
+        if (sFetchQueue.front().isNull()) //DEV-17797
         {
 			LLSD folder_sd;
 			folder_sd["folder_id"]		= LLUUID::null.asString();
@@ -554,7 +545,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
         }
         else
         {
-		    const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+		    LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
 		
 		    if (cat)
 		    {
@@ -573,9 +564,9 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 					    body["folders"].append(folder_sd);
 				    folder_count++;
 			    }
-				// May already have this folder, but append child folders to list.
-			    if (fetch_info.mRecursive)
-			    {	
+			    if (mInventoryFetchStarted || mLibraryFetchStarted)
+			    {	//Already have this folder but append child folders to list.
+				    // add all children to queue
 					LLInventoryModel::cat_array_t* categories;
 					LLInventoryModel::item_array_t* items;
 					gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
@@ -583,15 +574,12 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 						 it != categories->end();
 						 ++it)
 					{
-						mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive));
+						sFetchQueue.push_back((*it)->getUUID());
 				    }
 			    }
 		    }
         }
-		if (fetch_info.mRecursive)
-			recursive_cats.push_back(cat_id);
-
-		mFetchQueue.pop_front();
+		sFetchQueue.pop_front();
 	}
 		
 	if (folder_count > 0)
@@ -599,15 +587,12 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 		mBulkFetchCount++;
 		if (body["folders"].size())
 		{
-			LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body, recursive_cats);
-			LLHTTPClient::post(url, body, fetcher, 300.0);
+			LLHTTPClient::post(url, body, new LLInventoryModelFetchDescendentsResponder(body),300.0);
 		}
 		if (body_lib["folders"].size())
 		{
 			std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
-			
-			LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body_lib, recursive_cats);
-			LLHTTPClient::post(url_lib, body_lib, fetcher, 300.0);
+			LLHTTPClient::post(url_lib, body_lib, new LLInventoryModelFetchDescendentsResponder(body_lib),300.0);
 		}
 		mFetchTimer.reset();
 	}
@@ -616,17 +601,3 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 		setAllFoldersFetched();
 	}
 }
-
-bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const
-{
-	for (fetch_queue_t::const_iterator it = mFetchQueue.begin();
-		 it != mFetchQueue.end(); ++it)
-	{
-		const LLUUID& fetch_id = (*it).mCatUUID;
-		if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
-			return false;
-	}
-	return true;
-}
-
-
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index c35c785ceb34dfb7f6f424353aef4517d1a443ef..94606fae236100b8656109a3fa224fc865b932e5 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -2,80 +2,108 @@
  * @file llinventorymodelbackgroundfetch.h
  * @brief LLInventoryModelBackgroundFetch class header file
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #ifndef LL_LLINVENTORYMODELBACKGROUNDFETCH_H
 #define LL_LLINVENTORYMODELBACKGROUNDFETCH_H
 
-#include "llsingleton.h"
+// Seraph clean this up
+#include "llassettype.h"
+#include "llfoldertype.h"
+#include "lldarray.h"
+#include "llframetimer.h"
+#include "llhttpclient.h"
 #include "lluuid.h"
+#include "llpermissionsflags.h"
+#include "llstring.h"
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+// Seraph clean this up
+class LLInventoryObserver;
+class LLInventoryObject;
+class LLInventoryItem;
+class LLInventoryCategory;
+class LLViewerInventoryItem;
+class LLViewerInventoryCategory;
+class LLViewerInventoryItem;
+class LLViewerInventoryCategory;
+class LLMessageSystem;
+class LLInventoryCollectFunctor;
+
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInventoryModelBackgroundFetch
 //
-// This class handles background fetches, which are fetches of
-// inventory folder.  Fetches can be recursive or not.
+// This class handles background fetch.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackgroundFetch>
 {
-	friend class LLInventoryModelFetchDescendentsResponder;
-
 public:
 	LLInventoryModelBackgroundFetch();
 	~LLInventoryModelBackgroundFetch();
 
 	// Start and stop background breadth-first fetching of inventory contents.
-	// This gets triggered when performing a filter-search.
-	void start(const LLUUID& cat_id = LLUUID::null, BOOL recursive = TRUE);
+	// This gets triggered when performing a filter-search
+	void start(const LLUUID& cat_id = LLUUID::null);
+	BOOL backgroundFetchActive();
+	bool isEverythingFetched();
+	void incrBulkFetch(S16 fetching);
+	void stopBackgroundFetch(); // stop fetch process
+	bool isBulkFetchProcessingComplete();
 
-	BOOL backgroundFetchActive() const;
-	bool isEverythingFetched() const; // completing the fetch once per session should be sufficient
+	// Add categories to a list to be fetched in bulk.
+	void bulkFetch(std::string url);
 
-	bool libraryFetchStarted() const;
-	bool libraryFetchCompleted() const;
-	bool libraryFetchInProgress() const;
+	bool libraryFetchStarted();
+	bool libraryFetchCompleted();
+	bool libraryFetchInProgress();
 	
-	bool inventoryFetchStarted() const;
-	bool inventoryFetchCompleted() const;
-	bool inventoryFetchInProgress() const;
+	bool inventoryFetchStarted();
+	bool inventoryFetchCompleted();
+	bool inventoryFetchInProgress();
+    void findLostItems();
 
-    void findLostItems();	
-protected:
-	void incrBulkFetch(S16 fetching);
-	bool isBulkFetchProcessingComplete() const;
-	void bulkFetch(std::string url);
+	void setAllFoldersFetched();
 
-	void backgroundFetch();
 	static void backgroundFetchCB(void*); // background fetch idle function
-	void stopBackgroundFetch(); // stop fetch process
-
-	void setAllFoldersFetched();
-	bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const;
+	void backgroundFetch();
+	
 private:
- 	BOOL mRecursiveInventoryFetchStarted;
-	BOOL mRecursiveLibraryFetchStarted;
+ 	BOOL mInventoryFetchStarted;
+	BOOL mLibraryFetchStarted;
 	BOOL mAllFoldersFetched;
 
+	// completing the fetch once per session should be sufficient
 	BOOL mBackgroundFetchActive;
 	S16 mBulkFetchCount;
 	BOOL mTimelyFetchPending;
@@ -85,17 +113,6 @@ class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackg
 	F32 mMinTimeBetweenFetches;
 	F32 mMaxTimeBetweenFetches;
 
-	struct FetchQueueInfo
-	{
-		FetchQueueInfo(const LLUUID& id, BOOL recursive) :
-			mCatUUID(id), mRecursive(recursive)
-		{
-		}
-		LLUUID mCatUUID;
-		BOOL mRecursive;
-	};
-	typedef std::deque<FetchQueueInfo> fetch_queue_t;
-	fetch_queue_t mFetchQueue;
 };
 
 #endif // LL_LLINVENTORYMODELBACKGROUNDFETCH_H
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 91ff8c7867c4d9e5519a4e5ae15bcbd458d50418..83e1bbd5a09b1cd2949e6834018def5b3091dee6 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -2,25 +2,31 @@
  * @file llinventoryobserver.cpp
  * @brief Implementation of the inventory observers used to track agent inventory.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -56,9 +62,6 @@
 #include "llsdutil.h"
 #include <deque>
 
-const F32 LLInventoryFetchItemsObserver::FETCH_TIMER_EXPIRY = 60.0f;
-
-
 LLInventoryObserver::LLInventoryObserver()
 {
 }
@@ -68,51 +71,21 @@ LLInventoryObserver::~LLInventoryObserver()
 {
 }
 
-LLInventoryFetchObserver::LLInventoryFetchObserver(const LLUUID& id)
-{
-	mIDs.clear();
-	if (id != LLUUID::null)
-	{
-		setFetchID(id);
-	}
-}
-
-LLInventoryFetchObserver::LLInventoryFetchObserver(const uuid_vec_t& ids)
-{
-	setFetchIDs(ids);
-}
-
-BOOL LLInventoryFetchObserver::isFinished() const
-{
-	return mIncomplete.empty();
-}
-
-void LLInventoryFetchObserver::setFetchIDs(const uuid_vec_t& ids)
-{
-	mIDs = ids;
-}
-void LLInventoryFetchObserver::setFetchID(const LLUUID& id)
-{
-	mIDs.clear();
-	mIDs.push_back(id);
-}
-
-
 void LLInventoryCompletionObserver::changed(U32 mask)
 {
 	// scan through the incomplete items and move or erase them as
 	// appropriate.
-	if (!mIncomplete.empty())
+	if(!mIncomplete.empty())
 	{
-		for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
+		for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
 		{
-			const LLViewerInventoryItem* item = gInventory.getItem(*it);
-			if (!item)
+			LLViewerInventoryItem* item = gInventory.getItem(*it);
+			if(!item)
 			{
 				it = mIncomplete.erase(it);
 				continue;
 			}
-			if (item->isFinished())
+			if(item->isComplete())
 			{
 				mComplete.push_back(*it);
 				it = mIncomplete.erase(it);
@@ -120,7 +93,7 @@ void LLInventoryCompletionObserver::changed(U32 mask)
 			}
 			++it;
 		}
-		if (mIncomplete.empty())
+		if(mIncomplete.empty())
 		{
 			done();
 		}
@@ -129,79 +102,69 @@ void LLInventoryCompletionObserver::changed(U32 mask)
 
 void LLInventoryCompletionObserver::watchItem(const LLUUID& id)
 {
-	if (id.notNull())
+	if(id.notNull())
 	{
 		mIncomplete.push_back(id);
 	}
 }
 
-LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id) :
-	LLInventoryFetchObserver(item_id)
+LLInventoryFetchObserver::LLInventoryFetchObserver(bool retry_if_missing) :
+	mRetryIfMissing(retry_if_missing)
 {
-	mIDs.clear();
-	mIDs.push_back(item_id);
 }
 
-LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids) :
-	LLInventoryFetchObserver(item_ids)
+void LLInventoryFetchObserver::changed(U32 mask)
 {
-}
-
-void LLInventoryFetchItemsObserver::changed(U32 mask)
-{
-	lldebugs << this << " remaining incomplete " << mIncomplete.size()
-			 << " complete " << mComplete.size()
-			 << " wait period " << mFetchingPeriod.getRemainingTimeF32()
-			 << llendl;
-
 	// scan through the incomplete items and move or erase them as
 	// appropriate.
-	if (!mIncomplete.empty())
+	if(!mIncomplete.empty())
 	{
-
-		// Have we exceeded max wait time?
-		bool timeout_expired = mFetchingPeriod.hasExpired();
-
-		for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
+		for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
 		{
-			const LLUUID& item_id = (*it);
-			LLViewerInventoryItem* item = gInventory.getItem(item_id);
-			if (item && item->isFinished())
-			{
-				mComplete.push_back(item_id);
-				it = mIncomplete.erase(it);
-			}
-			else
+			LLViewerInventoryItem* item = gInventory.getItem(*it);
+			if(!item)
 			{
-				if (timeout_expired)
+				if (mRetryIfMissing)
 				{
-					// Just concede that this item hasn't arrived in reasonable time and continue on.
-					llwarns << "Fetcher timed out when fetching inventory item UUID: " << item_id << LL_ENDL;
-					it = mIncomplete.erase(it);
+					// BAP changed to skip these items, so we should keep retrying until they arrive.
+					// Did not make this the default behavior because of uncertainty about impact -
+					// could cause some observers that currently complete to wait forever.
+					++it;
 				}
 				else
 				{
-					// Keep trying.
-					++it;
+					// BUG: This can cause done() to get called prematurely below.
+					// This happens with the LLGestureInventoryFetchObserver that
+					// loads gestures at startup. JC
+					it = mIncomplete.erase(it);
 				}
+				continue;
 			}
+			if(item->isComplete())
+			{
+				mComplete.push_back(*it);
+				it = mIncomplete.erase(it);
+				continue;
+			}
+			++it;
+		}
+		if(mIncomplete.empty())
+		{
+			done();
 		}
-
 	}
+	//llinfos << "LLInventoryFetchObserver::changed() mComplete size " << mComplete.size() << llendl;
+	//llinfos << "LLInventoryFetchObserver::changed() mIncomplete size " << mIncomplete.size() << llendl;
+}
 
-	if (mIncomplete.empty())
-	{
-		lldebugs << this << " done at remaining incomplete "
-				 << mIncomplete.size() << " complete " << mComplete.size() << llendl;
-		done();
-	}
-	//llinfos << "LLInventoryFetchItemsObserver::changed() mComplete size " << mComplete.size() << llendl;
-	//llinfos << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << llendl;
+bool LLInventoryFetchObserver::isEverythingComplete() const
+{
+	return mIncomplete.empty();
 }
 
 void fetch_items_from_llsd(const LLSD& items_llsd)
 {
-	if (!items_llsd.size() || gDisconnected) return;
+	if (!items_llsd.size()) return;
 	LLSD body;
 	body[0]["cap_name"] = "FetchInventory";
 	body[1]["cap_name"] = "FetchLib";
@@ -221,11 +184,6 @@ void fetch_items_from_llsd(const LLSD& items_llsd)
 		
 	for (S32 i=0; i<body.size(); i++)
 	{
-		if(!gAgent.getRegion())
-		{
-			llwarns<<"Agent's region is null"<<llendl;
-			break;
-		}
 		if (0 >= body[i].size()) continue;
 		std::string url = gAgent.getRegion()->getCapability(body[i]["cap_name"].asString());
 
@@ -241,7 +199,7 @@ void fetch_items_from_llsd(const LLSD& items_llsd)
 		for (S32 j=0; j<body[i]["items"].size(); j++)
 		{
 			LLSD item_entry = body[i]["items"][j];
-			if (start_new_message)
+			if(start_new_message)
 			{
 				start_new_message = FALSE;
 				msg->newMessageFast(_PREHASH_FetchInventory);
@@ -252,29 +210,29 @@ void fetch_items_from_llsd(const LLSD& items_llsd)
 			msg->nextBlockFast(_PREHASH_InventoryData);
 			msg->addUUIDFast(_PREHASH_OwnerID, item_entry["owner_id"].asUUID());
 			msg->addUUIDFast(_PREHASH_ItemID, item_entry["item_id"].asUUID());
-			if (msg->isSendFull(NULL))
+			if(msg->isSendFull(NULL))
 			{
 				start_new_message = TRUE;
 				gAgent.sendReliableMessage();
 			}
 		}
-		if (!start_new_message)
+		if(!start_new_message)
 		{
 			gAgent.sendReliableMessage();
 		}
 	}
 }
 
-void LLInventoryFetchItemsObserver::startFetch()
+void LLInventoryFetchObserver::fetch(const uuid_vec_t& ids)
 {
 	LLUUID owner_id;
 	LLSD items_llsd;
-	for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
+	for(uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); ++it)
 	{
 		LLViewerInventoryItem* item = gInventory.getItem(*it);
-		if (item)
+		if(item)
 		{
-			if (item->isFinished())
+			if(item->isComplete())
 			{
 				// It's complete, so put it on the complete container.
 				mComplete.push_back(*it);
@@ -290,16 +248,7 @@ void LLInventoryFetchItemsObserver::startFetch()
 			// assume it's agent inventory.
 			owner_id = gAgent.getID();
 		}
-
-		// Ignore categories since they're not items.  We
-		// could also just add this to mComplete but not sure what the
-		// side-effects would be, so ignoring to be safe.
-		LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
-		if (cat)
-		{
-			continue;
-		}
-
+		
 		// It's incomplete, so put it on the incomplete container, and
 		// pack this on the message.
 		mIncomplete.push_back(*it);
@@ -310,35 +259,21 @@ void LLInventoryFetchItemsObserver::startFetch()
 		item_entry["item_id"] = (*it);
 		items_llsd.append(item_entry);
 	}
-
-	mFetchingPeriod.reset();
-	mFetchingPeriod.setTimerExpirySec(FETCH_TIMER_EXPIRY);
-
 	fetch_items_from_llsd(items_llsd);
 }
 
-LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const LLUUID& cat_id) :
-	LLInventoryFetchObserver(cat_id)
-{
-}
-
-LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids) :
-	LLInventoryFetchObserver(cat_ids)
-{
-}
-
 // virtual
 void LLInventoryFetchDescendentsObserver::changed(U32 mask)
 {
-	for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();)
+	for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();)
 	{
-		const LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
-		if (!cat)
+		LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
+		if(!cat)
 		{
 			it = mIncomplete.erase(it);
 			continue;
 		}
-		if (isCategoryComplete(cat))
+		if(isComplete(cat))
 		{
 			mComplete.push_back(*it);
 			it = mIncomplete.erase(it);
@@ -346,19 +281,19 @@ void LLInventoryFetchDescendentsObserver::changed(U32 mask)
 		}
 		++it;
 	}
-	if (mIncomplete.empty())
+	if(mIncomplete.empty())
 	{
 		done();
 	}
 }
 
-void LLInventoryFetchDescendentsObserver::startFetch()
+void LLInventoryFetchDescendentsObserver::fetch(const uuid_vec_t& ids)
 {
-	for (uuid_vec_t::const_iterator it = mIDs.begin(); it != mIDs.end(); ++it)
+	for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
 	{
 		LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
-		if (!cat) continue;
-		if (!isCategoryComplete(cat))
+		if(!cat) continue;
+		if(!isComplete(cat))
 		{
 			cat->fetch();		//blindly fetch it without seeing if anything else is fetching it.
 			mIncomplete.push_back(*it);	//Add to list of things being downloaded for this observer.
@@ -370,35 +305,40 @@ void LLInventoryFetchDescendentsObserver::startFetch()
 	}
 }
 
-BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInventoryCategory* cat) const
+bool LLInventoryFetchDescendentsObserver::isEverythingComplete() const
+{
+	return mIncomplete.empty();
+}
+
+bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory* cat)
 {
 	const S32 version = cat->getVersion();
 	const S32 expected_num_descendents = cat->getDescendentCount();
 	if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) ||
 		(expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN))
 	{
-		return FALSE;
+		return false;
 	}
 	// it might be complete - check known descendents against
 	// currently available.
 	LLInventoryModel::cat_array_t* cats;
 	LLInventoryModel::item_array_t* items;
 	gInventory.getDirectDescendentsOf(cat->getUUID(), cats, items);
-	if (!cats || !items)
+	if(!cats || !items)
 	{
 		llwarns << "Category '" << cat->getName() << "' descendents corrupted, fetch failed." << llendl;
 		// NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
 		// that the cat just doesn't have any items or subfolders).
 		// Unrecoverable, so just return done so that this observer can be cleared
 		// from memory.
-		return TRUE;
+		return true;
 	}
 	const S32 current_num_known_descendents = cats->count() + items->count();
 	
 	// Got the number of descendents that we were expecting, so we're done.
 	if (current_num_known_descendents == expected_num_descendents)
 	{
-		return TRUE;
+		return true;
 	}
 
 	// Error condition, but recoverable.  This happens if something was added to the
@@ -407,62 +347,125 @@ BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven
 	if (current_num_known_descendents >= expected_num_descendents)
 	{
 		llwarns << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << llendl;
-		const_cast<LLViewerInventoryCategory *>(cat)->setDescendentCount(current_num_known_descendents);
-		return TRUE;
+		cat->setDescendentCount(current_num_known_descendents);
+		return true;
 	}
-	return FALSE;
+	return false;
 }
 
-LLInventoryFetchComboObserver::LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids,
-															 const uuid_vec_t& item_ids)
+void LLInventoryFetchComboObserver::changed(U32 mask)
 {
-	mFetchDescendents = new LLInventoryFetchDescendentsObserver(folder_ids);
-
-	uuid_vec_t pruned_item_ids;
-	for (uuid_vec_t::const_iterator item_iter = item_ids.begin();
-		 item_iter != item_ids.end();
-		 ++item_iter)
+	if(!mIncompleteItems.empty())
 	{
-		const LLUUID& item_id = (*item_iter);
-		const LLViewerInventoryItem* item = gInventory.getItem(item_id);
-		if (item && std::find(folder_ids.begin(), folder_ids.end(), item->getParentUUID()) == folder_ids.end())
+		for(uuid_vec_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); )
 		{
-			continue;
+			LLViewerInventoryItem* item = gInventory.getItem(*it);
+			if(!item)
+			{
+				it = mIncompleteItems.erase(it);
+				continue;
+			}
+			if(item->isComplete())
+			{	
+				mCompleteItems.push_back(*it);
+				it = mIncompleteItems.erase(it);
+				continue;
+			}
+			++it;
 		}
-		pruned_item_ids.push_back(item_id);
 	}
-
-	mFetchItems = new LLInventoryFetchItemsObserver(pruned_item_ids);
-	mFetchDescendents = new LLInventoryFetchDescendentsObserver(folder_ids);
-}
-
-LLInventoryFetchComboObserver::~LLInventoryFetchComboObserver()
-{
-	mFetchItems->done();
-	mFetchDescendents->done();
-	delete mFetchItems;
-	delete mFetchDescendents;
-}
-
-void LLInventoryFetchComboObserver::changed(U32 mask)
-{
-	mFetchItems->changed(mask);
-	mFetchDescendents->changed(mask);
-	if (mFetchItems->isFinished() && mFetchDescendents->isFinished())
+	if(!mIncompleteFolders.empty())
+	{
+		for(uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();)
+		{
+			LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
+			if(!cat)
+			{
+				it = mIncompleteFolders.erase(it);
+				continue;
+			}
+			if(gInventory.isCategoryComplete(*it))
+			{
+				mCompleteFolders.push_back(*it);
+				it = mIncompleteFolders.erase(it);
+				continue;
+			}
+			++it;
+		}
+	}
+	if(!mDone && mIncompleteItems.empty() && mIncompleteFolders.empty())
 	{
+		mDone = true;
 		done();
 	}
 }
 
-void LLInventoryFetchComboObserver::startFetch()
+void LLInventoryFetchComboObserver::fetch(
+	const uuid_vec_t& folder_ids,
+	const uuid_vec_t& item_ids)
 {
-	mFetchItems->startFetch();
-	mFetchDescendents->startFetch();
+	lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl;
+	for(uuid_vec_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit)
+	{
+		LLViewerInventoryCategory* cat = gInventory.getCategory(*fit);
+		if(!cat) continue;
+		if(!gInventory.isCategoryComplete(*fit))
+		{
+			cat->fetch();
+			lldebugs << "fetching folder " << *fit <<llendl;
+			mIncompleteFolders.push_back(*fit);
+		}
+		else
+		{
+			mCompleteFolders.push_back(*fit);
+			lldebugs << "completing folder " << *fit <<llendl;
+		}
+	}
+
+	// Now for the items - we fetch everything which is not a direct
+	// descendent of an incomplete folder because the item will show
+	// up in an inventory descendents message soon enough so we do not
+	// have to fetch it individually.
+	LLSD items_llsd;
+	LLUUID owner_id;
+	for(uuid_vec_t::const_iterator iit = item_ids.begin(); iit != item_ids.end(); ++iit)
+	{
+		LLViewerInventoryItem* item = gInventory.getItem(*iit);
+		if(!item)
+		{
+			lldebugs << "uanble to find item " << *iit << llendl;
+			continue;
+		}
+		if(item->isComplete())
+		{
+			// It's complete, so put it on the complete container.
+			mCompleteItems.push_back(*iit);
+			lldebugs << "completing item " << *iit << llendl;
+			continue;
+		}
+		else
+		{
+			mIncompleteItems.push_back(*iit);
+			owner_id = item->getPermissions().getOwner();
+		}
+		if(std::find(mIncompleteFolders.begin(), mIncompleteFolders.end(), item->getParentUUID()) == mIncompleteFolders.end())
+		{
+			LLSD item_entry;
+			item_entry["owner_id"] = owner_id;
+			item_entry["item_id"] = (*iit);
+			items_llsd.append(item_entry);
+		}
+		else
+		{
+			lldebugs << "not worrying about " << *iit << llendl;
+		}
+	}
+	fetch_items_from_llsd(items_llsd);
 }
 
 void LLInventoryExistenceObserver::watchItem(const LLUUID& id)
 {
-	if (id.notNull())
+	if(id.notNull())
 	{
 		mMIA.push_back(id);
 	}
@@ -472,12 +475,12 @@ void LLInventoryExistenceObserver::changed(U32 mask)
 {
 	// scan through the incomplete items and move or erase them as
 	// appropriate.
-	if (!mMIA.empty())
+	if(!mMIA.empty())
 	{
-		for (uuid_vec_t::iterator it = mMIA.begin(); it < mMIA.end(); )
+		for(uuid_vec_t::iterator it = mMIA.begin(); it < mMIA.end(); )
 		{
 			LLViewerInventoryItem* item = gInventory.getItem(*it);
-			if (!item)
+			if(!item)
 			{
 				++it;
 				continue;
@@ -485,85 +488,16 @@ void LLInventoryExistenceObserver::changed(U32 mask)
 			mExist.push_back(*it);
 			it = mMIA.erase(it);
 		}
-		if (mMIA.empty())
+		if(mMIA.empty())
 		{
 			done();
 		}
 	}
 }
 
-void LLInventoryAddItemByAssetObserver::changed(U32 mask)
-{
-	if(!(mask & LLInventoryObserver::ADD))
-	{
-		return;
-	}
-
-	// nothing is watched
-	if (mWatchedAssets.size() == 0)
-	{
-		return;
-	}
-
-	LLMessageSystem* msg = gMessageSystem;
-	if (!(msg->getMessageName() && (0 == strcmp(msg->getMessageName(), "UpdateCreateInventoryItem"))))
-	{
-		// this is not our message
-		return; // to prevent a crash. EXT-7921;
-	}
-
-	LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem;
-	S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
-	for(S32 i = 0; i < num_blocks; ++i)
-	{
-		item->unpackMessage(msg, _PREHASH_InventoryData, i);
-		const LLUUID& asset_uuid = item->getAssetUUID();
-		if (item->getUUID().notNull() && asset_uuid.notNull())
-		{
-			if (isAssetWatched(asset_uuid))
-			{
-				LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL;
-				mAddedItems.push_back(item->getUUID());
-			}
-		}
-	}
-
-	if (mAddedItems.size() == mWatchedAssets.size())
-	{
-		done();
-		LL_DEBUGS("Inventory_Move") << "All watched items are added & processed." << LL_ENDL;
-		mAddedItems.clear();
-
-		// Unable to clean watched items here due to somebody can require to check them in current frame.
-		// set dirty state to clean them while next watch cycle.
-		mIsDirty = true;
-	}
-}
-
-void LLInventoryAddItemByAssetObserver::watchAsset(const LLUUID& asset_id)
-{
-	if(asset_id.notNull())
-	{
-		if (mIsDirty)
-		{
-			LL_DEBUGS("Inventory_Move") << "Watched items are dirty. Clean them." << LL_ENDL;
-			mWatchedAssets.clear();
-			mIsDirty = false;
-		}
-
-		mWatchedAssets.push_back(asset_id);
-		onAssetAdded(asset_id);
-	}
-}
-
-bool LLInventoryAddItemByAssetObserver::isAssetWatched( const LLUUID& asset_id )
-{
-	return std::find(mWatchedAssets.begin(), mWatchedAssets.end(), asset_id) != mWatchedAssets.end();
-}
-
 void LLInventoryAddedObserver::changed(U32 mask)
 {
-	if (!(mask & LLInventoryObserver::ADD))
+	if(!(mask & LLInventoryObserver::ADD))
 	{
 		return;
 	}
@@ -595,7 +529,7 @@ void LLInventoryAddedObserver::changed(U32 mask)
 
 	LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
 	S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
-	for (S32 i = 0; i < num_blocks; ++i)
+	for(S32 i = 0; i < num_blocks; ++i)
 	{
 		titem->unpackMessage(msg, _PREHASH_InventoryData, i);
 		if (!(titem->getUUID().isNull()))
@@ -610,25 +544,26 @@ void LLInventoryAddedObserver::changed(U32 mask)
 	}
 }
 
-LLInventoryTransactionObserver::LLInventoryTransactionObserver(const LLTransactionID& transaction_id) :
+LLInventoryTransactionObserver::LLInventoryTransactionObserver(
+	const LLTransactionID& transaction_id) :
 	mTransactionID(transaction_id)
 {
 }
 
 void LLInventoryTransactionObserver::changed(U32 mask)
 {
-	if (mask & LLInventoryObserver::ADD)
+	if(mask & LLInventoryObserver::ADD)
 	{
 		// This could be it - see if we are processing a bulk update
 		LLMessageSystem* msg = gMessageSystem;
-		if (msg->getMessageName()
+		if(msg->getMessageName()
 		   && (0 == strcmp(msg->getMessageName(), "BulkUpdateInventory")))
 		{
 			// we have a match for the message - now check the
 			// transaction id.
 			LLUUID id;
 			msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TransactionID, id);
-			if (id == mTransactionID)
+			if(id == mTransactionID)
 			{
 				// woo hoo, we found it
 				uuid_vec_t folders;
@@ -636,19 +571,19 @@ void LLInventoryTransactionObserver::changed(U32 mask)
 				S32 count;
 				count = msg->getNumberOfBlocksFast(_PREHASH_FolderData);
 				S32 i;
-				for (i = 0; i < count; ++i)
+				for(i = 0; i < count; ++i)
 				{
 					msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_FolderID, id, i);
-					if (id.notNull())
+					if(id.notNull())
 					{
 						folders.push_back(id);
 					}
 				}
 				count = msg->getNumberOfBlocksFast(_PREHASH_ItemData);
-				for (i = 0; i < count; ++i)
+				for(i = 0; i < count; ++i)
 				{
 					msg->getUUIDFast(_PREHASH_ItemData, _PREHASH_ItemID, id, i);
-					if (id.notNull())
+					if(id.notNull())
 					{
 						items.push_back(id);
 					}
@@ -660,139 +595,3 @@ void LLInventoryTransactionObserver::changed(U32 mask)
 		}
 	}
 }
-
-void LLInventoryCategoriesObserver::changed(U32 mask)
-{
-	if (!mCategoryMap.size())
-		return;
-
-	for (category_map_t::iterator iter = mCategoryMap.begin();
-		 iter != mCategoryMap.end();
-		 ++iter)
-	{
-		const LLUUID& cat_id = (*iter).first;
-
-		LLViewerInventoryCategory* category = gInventory.getCategory(cat_id);
-		if (!category)
-			continue;
-
-		const S32 version = category->getVersion();
-		const S32 expected_num_descendents = category->getDescendentCount();
-		if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) ||
-			(expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN))
-		{
-			continue;
-		}
-
-		// Check number of known descendents to find out whether it has changed.
-		LLInventoryModel::cat_array_t* cats;
-		LLInventoryModel::item_array_t* items;
-		gInventory.getDirectDescendentsOf(cat_id, cats, items);
-		if (!cats || !items)
-		{
-			llwarns << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << llendl;
-			// NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
-			// that the cat just doesn't have any items or subfolders).
-			// Unrecoverable, so just skip this category.
-
-			llassert(cats != NULL && items != NULL);
-
-			continue;
-		}
-		
-		const S32 current_num_known_descendents = cats->count() + items->count();
-
-		LLCategoryData& cat_data = (*iter).second;
-
-		bool cat_changed = false;
-
-		// If category version or descendents count has changed
-		// update category data in mCategoryMap
-		if (version != cat_data.mVersion || current_num_known_descendents != cat_data.mDescendentsCount)
-		{
-			cat_data.mVersion = version;
-			cat_data.mDescendentsCount = current_num_known_descendents;
-			cat_changed = true;
-		}
-
-		// If any item names have changed, update the name hash 
-		// Only need to check if (a) name hash has not previously been
-		// computed, or (b) a name has changed.
-		if (!cat_data.mIsNameHashInitialized || (mask & LLInventoryObserver::LABEL))
-		{
-			LLMD5 item_name_hash = gInventory.hashDirectDescendentNames(cat_id);
-			if (cat_data.mItemNameHash != item_name_hash)
-			{
-				cat_data.mIsNameHashInitialized = true;
-				cat_data.mItemNameHash = item_name_hash;
-				cat_changed = true;
-			}
-		}
-
-		// If anything has changed above, fire the callback.
-		if (cat_changed)
-			cat_data.mCallback();
-	}
-}
-
-bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t cb)
-{
-	S32 version = LLViewerInventoryCategory::VERSION_UNKNOWN;
-	S32 current_num_known_descendents = LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN;
-	bool can_be_added = true;
-
-	LLViewerInventoryCategory* category = gInventory.getCategory(cat_id);
-	// If category could not be retrieved it might mean that
-	// inventory is unusable at the moment so the category is
-	// stored with VERSION_UNKNOWN and DESCENDENT_COUNT_UNKNOWN,
-	// it may be updated later.
-	if (category)
-	{
-		// Inventory category version is used to find out if some changes
-		// to a category have been made.
-		version = category->getVersion();
-
-		LLInventoryModel::cat_array_t* cats;
-		LLInventoryModel::item_array_t* items;
-		gInventory.getDirectDescendentsOf(cat_id, cats, items);
-		if (!cats || !items)
-		{
-			llwarns << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << llendl;
-			// NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
-			// that the cat just doesn't have any items or subfolders).
-			// Unrecoverable, so just return "false" meaning that the category can't be observed.
-			can_be_added = false;
-
-			llassert(cats != NULL && items != NULL);
-		}
-		else
-		{
-			current_num_known_descendents = cats->count() + items->count();
-		}
-	}
-
-	if (can_be_added)
-	{
-		mCategoryMap.insert(category_map_value_t(
-								cat_id,LLCategoryData(cat_id, cb, version, current_num_known_descendents)));
-	}
-
-	return can_be_added;
-}
-
-void LLInventoryCategoriesObserver::removeCategory(const LLUUID& cat_id)
-{
-	mCategoryMap.erase(cat_id);
-}
-
-LLInventoryCategoriesObserver::LLCategoryData::LLCategoryData(
-	const LLUUID& cat_id, callback_t cb, S32 version, S32 num_descendents)
-	
-	: mCatID(cat_id)
-	, mCallback(cb)
-	, mVersion(version)
-	, mDescendentsCount(num_descendents)
-	, mIsNameHashInitialized(false)
-{
-	mItemNameHash.finalize();
-}
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h
index f2a2049a51f7e86cb95f062d74a8dbd26699a2fc..ba70552ebcf307bd19842601a99f328e226cf2a0 100644
--- a/indra/newview/llinventoryobserver.h
+++ b/indra/newview/llinventoryobserver.h
@@ -2,25 +2,31 @@
  * @file llinventoryobserver.h
  * @brief LLInventoryObserver class header file
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -28,7 +34,6 @@
 #define LL_LLINVENTORYOBSERVERS_H
 
 #include "lluuid.h"
-#include "llmd5.h"
 #include <string>
 #include <vector>
 
@@ -40,6 +45,7 @@ class LLViewerInventoryCategory;
 //   A simple abstract base class that can relay messages when the inventory 
 //   changes.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 class LLInventoryObserver
 {
 public:
@@ -54,7 +60,7 @@ class LLInventoryObserver
 		ADD 			= 4,	// Something added
 		REMOVE 			= 8,	// Something deleted
 		STRUCTURE 		= 16,	// Structural change (e.g. item or folder moved)
-		CALLING_CARD	= 32,	// Calling card change (e.g. online, grant status, cancel)
+		CALLING_CARD 	= 32,	// Calling card change (e.g. online, grant status, cancel)
 		GESTURE 		= 64,
 		REBUILD 		= 128, 	// Item UI changed (e.g. item type different)
 		SORT 			= 256, 	// Folder needs to be resorted.
@@ -67,104 +73,120 @@ class LLInventoryObserver
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryFetchObserver
+// Class LLInventoryCompletionObserver
 //
-//   Abstract class to handle fetching items, folders, etc.
+//   Base class for doing something when when all observed items are locally 
+//   complete.  Implements the changed() method of LLInventoryObserver 
+//   and declares a new method named done() which is called when all watched items 
+//   have complete information in the inventory model.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLInventoryFetchObserver : public LLInventoryObserver
+
+class LLInventoryCompletionObserver : public LLInventoryObserver
 {
 public:
-	LLInventoryFetchObserver(const LLUUID& id = LLUUID::null); // single item
-	LLInventoryFetchObserver(const uuid_vec_t& ids); // multiple items
-	void setFetchID(const LLUUID& id);
-	void setFetchIDs(const uuid_vec_t& ids);
+	LLInventoryCompletionObserver() {}
+	virtual void changed(U32 mask);
 
-	BOOL isFinished() const;
+	void watchItem(const LLUUID& id);
 
-	virtual void startFetch() = 0;
-	virtual void changed(U32 mask) = 0;
-	virtual void done() {};
 protected:
+	virtual void done() = 0;
+
 	uuid_vec_t mComplete;
 	uuid_vec_t mIncomplete;
-	uuid_vec_t mIDs;
 };
 
+
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryFetchItemsObserver
+// Class LLInventoryFetchObserver
 //
-//   Fetches inventory items, calls done() when all inventory has arrived. 
+// This class is much like the LLInventoryCompletionObserver, except
+// that it handles all the the fetching necessary. Override the done()
+// method to do the thing you want.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLInventoryFetchItemsObserver : public LLInventoryFetchObserver
+
+class LLInventoryFetchObserver : public LLInventoryObserver
 {
 public:
-	LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null); 
-	LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids); 
-
-	/*virtual*/ void startFetch();
-	/*virtual*/ void changed(U32 mask);
-private:
-	LLTimer mFetchingPeriod;
-
-	/**
-	 * Period of waiting a notification when requested items get added into inventory.
-	 */
-	static const F32 FETCH_TIMER_EXPIRY;
+	LLInventoryFetchObserver(bool retry_if_missing = false);
+	virtual void changed(U32 mask);
+
+	bool isEverythingComplete() const;
+	void fetch(const uuid_vec_t& ids);
+	virtual void done() {};
+
+protected:
+	bool mRetryIfMissing;
+	uuid_vec_t mComplete;
+	uuid_vec_t mIncomplete;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInventoryFetchDescendentsObserver
 //
-//   Fetches children of a category/folder, calls done() when all 
-//   inventory has arrived. 
+// This class is much like the LLInventoryCompletionObserver, except
+// that it handles fetching based on category. Override the done()
+// method to do the thing you want.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLInventoryFetchDescendentsObserver : public LLInventoryFetchObserver
+class LLInventoryFetchDescendentsObserver : public LLInventoryObserver
 {
 public:
-	LLInventoryFetchDescendentsObserver(const LLUUID& cat_id = LLUUID::null);
-	LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids);
+	LLInventoryFetchDescendentsObserver() {}
+	virtual void changed(U32 mask);
+
+	void fetch(const uuid_vec_t& ids);
+	bool isEverythingComplete() const;
+	virtual void done() = 0;
 
-	/*virtual*/ void startFetch();
-	/*virtual*/ void changed(U32 mask);
 protected:
-	BOOL isCategoryComplete(const LLViewerInventoryCategory* cat) const;
+	bool isComplete(LLViewerInventoryCategory* cat);
+	uuid_vec_t mIncomplete;
+	uuid_vec_t mComplete;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInventoryFetchComboObserver
 //
-//   Does an appropriate combination of fetch descendents and
-//   item fetches based on completion of categories and items. This is optimized
-//   to not fetch item_ids that are descendents of any of the folder_ids.
+// This class does an appropriate combination of fetch descendents and
+// item fetches based on completion of categories and items. Much like
+// the fetch and fetch descendents, this will call done() when everything
+// has arrived.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLInventoryFetchComboObserver : public LLInventoryObserver
 {
 public:
-	LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids,
-								  const uuid_vec_t& item_ids);
-	~LLInventoryFetchComboObserver();
-	/*virtual*/ void changed(U32 mask);
-	void startFetch();
+	LLInventoryFetchComboObserver() : mDone(false) {}
+	virtual void changed(U32 mask);
+
+	void fetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids);
 
 	virtual void done() = 0;
+
 protected:
-	LLInventoryFetchItemsObserver *mFetchItems;
-	LLInventoryFetchDescendentsObserver *mFetchDescendents;
+	bool mDone;
+	uuid_vec_t mCompleteFolders;
+	uuid_vec_t mIncompleteFolders;
+	uuid_vec_t mCompleteItems;
+	uuid_vec_t mIncompleteItems;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInventoryExistenceObserver
 //
-//   Used as a base class for doing something when all the
-//   observed item ids exist in the inventory somewhere.
+// This class is used as a base class for doing somethign when all the
+// observed item ids exist in the inventory somewhere. You can derive
+// a class from this class and implement the done() method to do
+// something useful.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 class LLInventoryExistenceObserver : public LLInventoryObserver
 {
 public:
 	LLInventoryExistenceObserver() {}
-	/*virtual*/ void changed(U32 mask);
+	virtual void changed(U32 mask);
 
 	void watchItem(const LLUUID& id);
+
 protected:
 	virtual void done() = 0;
 	uuid_vec_t mExist;
@@ -172,46 +194,20 @@ class LLInventoryExistenceObserver : public LLInventoryObserver
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryMovedObserver
+// Class LLInventoryAddedObserver
 //
-// This class is used as a base class for doing something when all the
-// item for observed asset ids were added into the inventory.
+// This class is used as a base class for doing something when 
+// a new item arrives in inventory.
+// It does not watch for a certain UUID, rather it acts when anything is added
 // Derive a class from this class and implement the done() method to do
 // something useful.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-class LLInventoryAddItemByAssetObserver : public LLInventoryObserver
-{
-public:
-	LLInventoryAddItemByAssetObserver() : mIsDirty(false) {}
-	virtual void changed(U32 mask);
-
-	void watchAsset(const LLUUID& asset_id);
-	bool isAssetWatched(const LLUUID& asset_id);
-
-protected:
-	virtual void onAssetAdded(const LLUUID& asset_id) {}
-	virtual void done() = 0;
-
-	typedef std::vector<LLUUID> item_ref_t;
-	item_ref_t mAddedItems;
-	item_ref_t mWatchedAssets;
-
-private:
-	bool mIsDirty;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryAddedObserver
-//
-//   Base class for doing something when a new item arrives in inventory.
-//   It does not watch for a certain UUID, rather it acts when anything is added
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLInventoryAddedObserver : public LLInventoryObserver
 {
 public:
 	LLInventoryAddedObserver() : mAdded() {}
-	/*virtual*/ void changed(U32 mask);
+	virtual void changed(U32 mask);
 
 protected:
 	virtual void done() = 0;
@@ -222,15 +218,18 @@ class LLInventoryAddedObserver : public LLInventoryObserver
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInventoryTransactionObserver
 //
-//   Base class for doing something when an inventory transaction completes.
-//   NOTE: This class is not quite complete. Avoid using unless you fix up its
-//   functionality gaps.
+// Class which can be used as a base class for doing something when an
+// inventory transaction completes.
+//
+// *NOTE: This class is not quite complete. Avoid using unless you fix up it's
+// functionality gaps.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 class LLInventoryTransactionObserver : public LLInventoryObserver
 {
 public:
 	LLInventoryTransactionObserver(const LLTransactionID& transaction_id);
-	/*virtual*/ void changed(U32 mask);
+	virtual void changed(U32 mask);
 
 protected:
 	virtual void done(const uuid_vec_t& folders, const uuid_vec_t& items) = 0;
@@ -238,71 +237,6 @@ class LLInventoryTransactionObserver : public LLInventoryObserver
 	LLTransactionID mTransactionID;
 };
 
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryCompletionObserver
-//
-//   Base class for doing something when when all observed items are locally 
-//   complete.  Implements the changed() method of LLInventoryObserver 
-//   and declares a new method named done() which is called when all watched items 
-//   have complete information in the inventory model.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLInventoryCompletionObserver : public LLInventoryObserver
-{
-public:
-	LLInventoryCompletionObserver() {}
-	/*virtual*/ void changed(U32 mask);
-
-	void watchItem(const LLUUID& id);
-
-protected:
-	virtual void done() = 0;
-
-	uuid_vec_t mComplete;
-	uuid_vec_t mIncomplete;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryCategoriesObserver
-//
-// This class is used for monitoring a list of inventory categories
-// and firing a callback when there are changes in any of them.
-// Categories are identified by their UUIDs.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLInventoryCategoriesObserver : public LLInventoryObserver
-{
-public:
-	typedef boost::function<void()> callback_t;
-
-	LLInventoryCategoriesObserver() {};
-	virtual void changed(U32 mask);
-
-	/**
-	 * Add cat_id to the list of observed categories with a
-	 * callback fired on category being changed.
-	 *
-	 * @return "true" if category was added, "false" if it could
-	 * not be found.
-	 */
-	bool addCategory(const LLUUID& cat_id, callback_t cb);
-	void removeCategory(const LLUUID& cat_id);
-
-protected:
-	struct LLCategoryData
-	{
-		LLCategoryData(const LLUUID& cat_id, callback_t cb, S32 version, S32 num_descendents);
-
-		callback_t	mCallback;
-		S32			mVersion;
-		S32			mDescendentsCount;
-		LLMD5		mItemNameHash;
-		bool		mIsNameHashInitialized;
-		LLUUID		mCatID;
-	};
-
-	typedef	std::map<LLUUID, LLCategoryData>	category_map_t;
-	typedef category_map_t::value_type			category_map_value_t;
-
-	category_map_t				mCategoryMap;
-};
 
 #endif // LL_LLINVENTORYOBSERVERS_H
+
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index cb6a1fafe57a2d5e0e2bf6faf26d61011b572ef2..c6c2d23a4b499b8e596ab22770d8ab58f342593b 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -2,25 +2,31 @@
  * @file llinventorypanel.cpp
  * @brief Implementation of the inventory panel and associated stuff.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,7 +38,6 @@
 #include "llagent.h"
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
-#include "llavataractions.h"
 #include "llfloaterinventory.h"
 #include "llfloaterreg.h"
 #include "llimfloater.h"
@@ -43,7 +48,6 @@
 #include "llsidepanelinventory.h"
 #include "llsidetray.h"
 #include "llscrollcontainer.h"
-#include "llviewerattachmenu.h"
 #include "llviewerfoldertype.h"
 #include "llvoavatarself.h"
 
@@ -81,7 +85,6 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
 	mSortOrderSetting(p.sort_order_setting),
 	mInventory(p.inventory),
 	mAllowMultiSelect(p.allow_multi_select),
-	mShowItemLinkOverlays(p.show_item_link_overlays),
 	mViewsInitialized(false),
 	mStartFolderString(p.start_folder),	
 	mBuildDefaultHierarchy(true),
@@ -96,7 +99,6 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
 	mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLInventoryPanel::doCreate, this, _2));
 	mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&LLInventoryPanel::attachObject, this, _2));
 	mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this));
-	mCommitCallbackRegistrar.add("Inventory.Share",  boost::bind(&LLAvatarActions::shareWithAvatars));
 	
 	if (mStartFolderString != "")
 	{
@@ -104,7 +106,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
 	}
 }
 
-void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
+BOOL LLInventoryPanel::postBuild()
 {
 	LLMemType mt(LLMemType::MTYPE_INVENTORY_POST_BUILD);
 
@@ -122,7 +124,6 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 		p.rect = folder_rect;
 		p.parent_panel = this;
 		p.tool_tip = p.name;
-		p.use_label_suffix = params.use_label_suffix;
 		mFolderRoot = LLUICtrlFactory::create<LLFolderView>(p);
 		mFolderRoot->setAllowMultiSelect(mAllowMultiSelect);
 	}
@@ -169,6 +170,8 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 		setSortOrder(gSavedSettings.getU32(DEFAULT_SORT_ORDER));
 	}
 	mFolderRoot->setSortOrder(getFilter()->getSortOrder());
+
+	return TRUE;
 }
 
 LLInventoryPanel::~LLInventoryPanel()
@@ -182,8 +185,6 @@ LLInventoryPanel::~LLInventoryPanel()
 		}
 	}
 
-	gIdleCallbacks.deleteFunction(onIdle, this);
-
 	// LLView destructor will take care of the sub-views.
 	mInventory->removeObserver(mInventoryObserver);
 	delete mInventoryObserver;
@@ -219,11 +220,6 @@ void LLInventoryPanel::setFilterPermMask(PermissionMask filter_perm_mask)
 	getFilter()->setFilterPermissions(filter_perm_mask);
 }
 
-void LLInventoryPanel::setFilterWearableTypes(U64 types)
-{
-	getFilter()->setFilterWearableTypes(types);
-}
-
 void LLInventoryPanel::setFilterSubString(const std::string& string)
 {
 	getFilter()->setFilterSubString(string);
@@ -250,11 +246,6 @@ void LLInventoryPanel::setHoursAgo(U32 hours)
 	getFilter()->setHoursAgo(hours);
 }
 
-void LLInventoryPanel::setFilterLinks(U64 filter_links)
-{
-	getFilter()->setFilterLinks(filter_links);
-}
-
 void LLInventoryPanel::setShowFolderState(LLInventoryFilter::EFolderShow show)
 {
 	getFilter()->setShowFolderState(show);
@@ -523,10 +514,6 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 				params.name = new_listener->getDisplayName();
 				params.icon = new_listener->getIcon();
 				params.icon_open = new_listener->getOpenIcon();
-				if (mShowItemLinkOverlays) // if false, then links show up just like normal items
-				{
-					params.icon_overlay = LLUI::getUIImage("Inv_Link");
-				}
 				params.root = mFolderRoot;
 				params.listener = new_listener;
 				params.tool_tip = params.name;
@@ -565,10 +552,6 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 				params.name = new_listener->getDisplayName();
 				params.icon = new_listener->getIcon();
 				params.icon_open = new_listener->getOpenIcon();
-				if (mShowItemLinkOverlays) // if false, then links show up just like normal items
-				{
-					params.icon_overlay = LLUI::getUIImage("Inv_Link");
-				}
 				params.creation_date = new_listener->getCreationDate();
 				params.root = mFolderRoot;
 				params.listener = new_listener;
@@ -686,8 +669,7 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 
 	// If folder view is empty the (x, y) point won't be in its rect
 	// so the handler must be called explicitly.
-	// but only if was not handled before. See EXT-6746.
-	if (!handled && !mFolderRoot->hasVisibleChildren())
+	if (!mFolderRoot->hasVisibleChildren())
 	{
 		handled = mFolderRoot->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
 	}
@@ -775,6 +757,7 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it
 			fv->startRenamingSelectedItem();
 		}
 	}
+	// Seraph - Put determineFolderType in here for ensemble typing?
 }
 
 void LLInventoryPanel::doToSelected(const LLSD& userdata)
@@ -784,12 +767,13 @@ void LLInventoryPanel::doToSelected(const LLSD& userdata)
 
 void LLInventoryPanel::doCreate(const LLSD& userdata)
 {
-	menu_create_inventory_item(mFolderRoot, LLFolderBridge::sSelf.get(), userdata);
+	menu_create_inventory_item(mFolderRoot, LLFolderBridge::sSelf, userdata);
 }
 
 bool LLInventoryPanel::beginIMSession()
 {
-	std::set<LLUUID> selected_items = mFolderRoot->getSelectionList();
+	std::set<LLUUID> selected_items;
+	mFolderRoot->getSelectionList(selected_items);
 
 	std::string name;
 	static int session_num = 1;
@@ -886,19 +870,49 @@ bool LLInventoryPanel::beginIMSession()
 
 bool LLInventoryPanel::attachObject(const LLSD& userdata)
 {
-	// Copy selected item UUIDs to a vector.
-	std::set<LLUUID> selected_items = mFolderRoot->getSelectionList();
-	uuid_vec_t items;
+	std::set<LLUUID> selected_items;
+	mFolderRoot->getSelectionList(selected_items);
+
+	std::string joint_name = userdata.asString();
+	LLViewerJointAttachment* attachmentp = NULL;
+	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+		 iter != gAgentAvatarp->mAttachmentPoints.end(); )
+	{
+		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+		LLViewerJointAttachment* attachment = curiter->second;
+		if (attachment->getName() == joint_name)
+		{
+			attachmentp = attachment;
+			break;
+		}
+	}
+	if (attachmentp == NULL)
+	{
+		return true;
+	}
+
 	for (std::set<LLUUID>::const_iterator set_iter = selected_items.begin(); 
 		 set_iter != selected_items.end(); 
 		 ++set_iter)
 	{
-		items.push_back(*set_iter);
+		const LLUUID &id = *set_iter;
+		LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(id);
+		if(item && gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID()))
+		{
+			rez_attachment(item, attachmentp);
+		}
+		else if(item && item->isComplete())
+		{
+			// must be in library. copy it to our inventory and put it on.
+			LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(attachmentp);
+			copy_inventory_item(gAgent.getID(),
+								item->getPermissions().getOwner(),
+								item->getUUID(),
+								LLUUID::null,
+								std::string(),
+								cb);
+		}
 	}
-
-	// Attach selected items.
-	LLViewerAttachMenu::attachObjects(items, userdata.asString());
-
 	gFocusMgr.setKeyboardFocus(NULL);
 
 	return true;
@@ -984,30 +998,3 @@ BOOL LLInventoryPanel::getIsHiddenFolderType(LLFolderType::EType folder_type) co
 {
 	return (std::find(mHiddenFolderTypes.begin(), mHiddenFolderTypes.end(), folder_type) != mHiddenFolderTypes.end());
 }
-
-
-/************************************************************************/
-/* Recent Inventory Panel related class                                 */
-/************************************************************************/
-class LLInventoryRecentItemsPanel;
-static LLDefaultChildRegistry::Register<LLInventoryRecentItemsPanel> t_recent_inventory_panel("recent_inventory_panel");
-
-static const LLRecentInventoryBridgeBuilder RECENT_ITEMS_BUILDER;
-class LLInventoryRecentItemsPanel : public LLInventoryPanel
-{
-public:
-	struct Params :	public LLInitParam::Block<Params, LLInventoryPanel::Params>
-	{};
-
-protected:
-	LLInventoryRecentItemsPanel (const Params&);
-	friend class LLUICtrlFactory;
-};
-
-LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params)
-: LLInventoryPanel(params)
-{
-	// replace bridge builder to have necessary View bridges.
-	mInvFVBridgeBuilder = &RECENT_ITEMS_BUILDER;
-}
-
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index f8aaae8fabb7715267232b1abde79ff4f7e13ed0..160a3d6f23b9e676dd007d50cd0f6043da35f76d 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -3,25 +3,31 @@
  * @brief LLInventoryPanel
  * class definition
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -78,19 +84,15 @@ class LLInventoryPanel : public LLPanel
 		Optional<std::string>				sort_order_setting;
 		Optional<LLInventoryModel*>			inventory;
 		Optional<bool>						allow_multi_select;
-		Optional<bool>						show_item_link_overlays;
 		Optional<Filter>					filter;
 		Optional<std::string>               start_folder;
-		Optional<bool>						use_label_suffix;
 
 		Params()
 		:	sort_order_setting("sort_order_setting"),
 			inventory("", &gInventory),
 			allow_multi_select("allow_multi_select", true),
-			show_item_link_overlays("show_item_link_overlays", false),
 			filter("filter"),
-			start_folder("start_folder"),
-			use_label_suffix("use_label_suffix", true)
+			start_folder("start_folder")
 		{}
 	};
 
@@ -99,7 +101,6 @@ class LLInventoryPanel : public LLPanel
 	//--------------------------------------------------------------------
 protected:
 	LLInventoryPanel(const Params&);
-	void initFromParams(const Params&);
 	friend class LLUICtrlFactory;
 public:
 	virtual ~LLInventoryPanel();
@@ -107,6 +108,8 @@ class LLInventoryPanel : public LLPanel
 public:
 	LLInventoryModel* getModel() { return mInventory; }
 
+	BOOL postBuild();
+
 	// LLView methods
 	void draw();
 	BOOL handleHover(S32 x, S32 y, MASK mask);
@@ -133,14 +136,12 @@ class LLInventoryPanel : public LLPanel
 	U32 getFilterObjectTypes() const { return mFolderRoot->getFilterObjectTypes(); }
 	void setFilterPermMask(PermissionMask filter_perm_mask);
 	U32 getFilterPermMask() const { return mFolderRoot->getFilterPermissions(); }
-	void setFilterWearableTypes(U64 filter);
 	void setFilterSubString(const std::string& string);
 	const std::string getFilterSubString() { return mFolderRoot->getFilterSubString(); }
 	void setSinceLogoff(BOOL sl);
 	void setHoursAgo(U32 hours);
 	BOOL getSinceLogoff();
-	void setFilterLinks(U64 filter_links);
-
+	
 	void setShowFolderState(LLInventoryFilter::EFolderShow show);
 	LLInventoryFilter::EFolderShow getShowFolderState();
 	void setAllowMultiSelect(BOOL allow) { mFolderRoot->setAllowMultiSelect(allow); }
@@ -175,7 +176,6 @@ class LLInventoryPanel : public LLPanel
 	LLInventoryModel*			mInventory;
 	LLInventoryObserver*		mInventoryObserver;
 	BOOL 						mAllowMultiSelect;
-	BOOL 						mShowItemLinkOverlays; // Shows link graphic over inventory item icons
 
 	LLFolderView*				mFolderRoot;
 	LLScrollContainer*			mScroller;
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index f2aec20611a1e51407b6051bf73c046827cc3cba..7336efb62a25c5e3fbb7f8c38bf3636b2203a529 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -2,25 +2,31 @@
 * @file lllandmarkactions.cpp
 * @brief LLLandmarkActions class implementation
 *
-* $LicenseInfo:firstyear=2001&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2001&license=viewergpl$
+* 
+* Copyright (c) 2001-2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 
@@ -293,7 +299,7 @@ void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slur
 	bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
 	if (gotSimName)
 	{
-	  std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+		std::string slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
 		cb(slurl);
 
 		return;
@@ -345,7 +351,7 @@ void LLLandmarkActions::onRegionResponseSLURL(slurl_callback_t cb,
 	bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
 	if (gotSimName)
 	{
-	  slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+		slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
 	}
 	else
 	{
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index d714cae872de955a119a0c14f163170dd7204bc8..4e0be81f622bc445d8cc429e9151dd6572bbf724 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -2,25 +2,31 @@
  * @file lllocationinputctrl.cpp
  * @brief Combobox-like location input control
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,7 +38,6 @@
 // common includes
 #include "llbutton.h"
 #include "llfocusmgr.h"
-#include "llhelp.h"
 #include "llmenugl.h"
 #include "llparcel.h"
 #include "llstring.h"
@@ -172,7 +177,6 @@ static LLDefaultChildRegistry::Register<LLLocationInputCtrl> r("location_input")
 LLLocationInputCtrl::Params::Params()
 :	icon_maturity_general("icon_maturity_general"),
 	icon_maturity_adult("icon_maturity_adult"),
-	icon_maturity_moderate("icon_maturity_moderate"),
 	add_landmark_image_enabled("add_landmark_image_enabled"),
 	add_landmark_image_disabled("add_landmark_image_disabled"),
 	add_landmark_image_hover("add_landmark_image_hover"),
@@ -182,15 +186,14 @@ LLLocationInputCtrl::Params::Params()
 	add_landmark_button("add_landmark_button"),
 	for_sale_button("for_sale_button"),
 	info_button("info_button"),
-	maturity_button("maturity_button"),
+	maturity_icon("maturity_icon"),
 	voice_icon("voice_icon"),
 	fly_icon("fly_icon"),
 	push_icon("push_icon"),
 	build_icon("build_icon"),
 	scripts_icon("scripts_icon"),
 	damage_icon("damage_icon"),
-	damage_text("damage_text"),
-	maturity_help_topic("maturity_help_topic")
+	damage_text("damage_text")
 {
 }
 
@@ -205,9 +208,7 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
 	mLandmarkImageOn(NULL),
 	mLandmarkImageOff(NULL),
 	mIconMaturityGeneral(NULL),
-	mIconMaturityAdult(NULL),
-	mIconMaturityModerate(NULL),
-	mMaturityHelpTopic(p.maturity_help_topic)
+	mIconMaturityAdult(NULL)
 {
 	// Lets replace default LLLineEditor with LLLocationLineEditor
 	// to make needed escaping while copying and cutting url
@@ -225,7 +226,7 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
 	params.rect(text_entry_rect);
 	params.default_text(LLStringUtil::null);
 	params.max_length_bytes(p.max_chars);
-	params.keystroke_callback(boost::bind(&LLLocationInputCtrl::onTextEntry, this, _1));
+	params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1));
 	params.commit_on_focus_lost(false);
 	params.follows.flags(FOLLOWS_ALL);
 	mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params);
@@ -275,15 +276,10 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
 	{
 		mIconMaturityAdult = p.icon_maturity_adult;
 	}
-	if(p.icon_maturity_moderate())
-	{
-		mIconMaturityModerate = p.icon_maturity_moderate;
-	}
 
-	LLButton::Params maturity_button = p.maturity_button;
-	mMaturityButton = LLUICtrlFactory::create<LLButton>(maturity_button);
-	addChild(mMaturityButton);
-	mMaturityButton->setClickedCallback(boost::bind(&LLLocationInputCtrl::onMaturityButtonClicked, this));
+	LLIconCtrl::Params maturity_icon = p.maturity_icon;
+	mMaturityIcon = LLUICtrlFactory::create<LLIconCtrl>(maturity_icon);
+	addChild(mMaturityIcon);
 
 	LLButton::Params for_sale_button = p.for_sale_button;
 	for_sale_button.tool_tip = LLTrans::getString("LocationCtrlForSaleTooltip");
@@ -478,16 +474,13 @@ void LLLocationInputCtrl::onTextEntry(LLLineEditor* line_editor)
 	KEY key = gKeyboard->currentKey();
 	MASK mask = gKeyboard->currentMask(TRUE);
 
-	// Typing? (moving cursor should not affect showing the list)
-	bool typing = mask != MASK_CONTROL && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END;
-	bool pasting = mask == MASK_CONTROL && key == 'V';
-
 	if (line_editor->getText().empty())
 	{
 		prearrangeList(); // resets filter
 		hideList();
 	}
-	else if (typing || pasting)
+	// Typing? (moving cursor should not affect showing the list)
+	else if (mask != MASK_CONTROL && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END)
 	{
 		prearrangeList(line_editor->getText());
 		if (mList->getItemCount() != 0)
@@ -583,7 +576,7 @@ void LLLocationInputCtrl::reshape(S32 width, S32 height, BOOL called_from_parent
 
 	if (isHumanReadableLocationVisible)
 	{
-		refreshMaturityButton();
+		refreshMaturityIcon();
 	}
 }
 
@@ -620,11 +613,6 @@ void LLLocationInputCtrl::onAgentParcelChange()
 	refresh();
 }
 
-void LLLocationInputCtrl::onMaturityButtonClicked()
-{
-	LLUI::sHelpImpl->showTopic(mMaturityHelpTopic);
-}
-
 void LLLocationInputCtrl::onLandmarkLoaded(LLLandmark* lm)
 {
 	(void) lm;
@@ -680,8 +668,9 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)
 				value["item_type"] = TELEPORT_HISTORY;
 				value["global_pos"] = result->mGlobalPos.getValue();
 				std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
-				//TODO*: add Surl to teleportitem or parse region name from title
-				value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString();
+				//TODO*: add slurl to teleportitem or parse region name from title
+				value["tooltip"] = LLSLURL::buildSLURLfromPosGlobal(region_name,
+						result->mGlobalPos,	false);
 				add(result->getTitle(), value); 
 			}
 			result = std::find_if(result + 1, th_items.end(), boost::bind(
@@ -747,7 +736,7 @@ void LLLocationInputCtrl::refreshLocation()
 	setText(location_name);
 	isHumanReadableLocationVisible = true;
 
-	refreshMaturityButton();
+	refreshMaturityIcon();
 }
 
 // returns new right edge
@@ -863,54 +852,37 @@ void LLLocationInputCtrl::refreshHealth()
 	}
 }
 
-void LLLocationInputCtrl::refreshMaturityButton()
+void LLLocationInputCtrl::refreshMaturityIcon()
 {
 	// Updating maturity rating icon.
 	LLViewerRegion* region = gAgent.getRegion();
 	if (!region)
 		return;
 
-	bool button_visible = true;
-	LLPointer<LLUIImage> rating_image = NULL;
-	std::string rating_tooltip;
-
 	U8 sim_access = region->getSimAccess();
 	switch(sim_access)
 	{
 	case SIM_ACCESS_PG:
-		rating_image = mIconMaturityGeneral;
-		rating_tooltip = LLTrans::getString("LocationCtrlGeneralIconTooltip");
+		mMaturityIcon->setValue(mIconMaturityGeneral->getName());
+		mMaturityIcon->setVisible(TRUE);
 		break;
 
 	case SIM_ACCESS_ADULT:
-		rating_image = mIconMaturityAdult;
-		rating_tooltip = LLTrans::getString("LocationCtrlAdultIconTooltip");
-		break;
-
-	case SIM_ACCESS_MATURE:
-		rating_image = mIconMaturityModerate;
-		rating_tooltip = LLTrans::getString("LocationCtrlModerateIconTooltip");
+		mMaturityIcon->setValue(mIconMaturityAdult->getName());
+		mMaturityIcon->setVisible(TRUE);
 		break;
 
 	default:
-		button_visible = false;
-		break;
+		mMaturityIcon->setVisible(FALSE);
 	}
 
-	mMaturityButton->setVisible(button_visible);
-	mMaturityButton->setToolTip(rating_tooltip);
-	if(rating_image)
+	if (mMaturityIcon->getVisible())
 	{
-		mMaturityButton->setImageUnselected(rating_image);
-		mMaturityButton->setImagePressed(rating_image);
-	}
-	if (mMaturityButton->getVisible())
-	{
-		positionMaturityButton();
+		positionMaturityIcon();
 	}
 }
 
-void LLLocationInputCtrl::positionMaturityButton()
+void LLLocationInputCtrl::positionMaturityIcon()
 {
 	const LLFontGL* font = mTextEntry->getFont();
 	if (!font)
@@ -922,11 +894,11 @@ void LLLocationInputCtrl::positionMaturityButton()
 	// Calculate the right edge of rendered text + a whitespace.
 	left_pad = left_pad + font->getWidth(mTextEntry->getText()) + font->getWidth(" ");
 
-	LLRect rect = mMaturityButton->getRect();
-	mMaturityButton->setRect(rect.setOriginAndSize(left_pad, rect.mBottom, rect.getWidth(), rect.getHeight()));
+	LLRect rect = mMaturityIcon->getRect();
+	mMaturityIcon->setRect(rect.setOriginAndSize(left_pad, rect.mBottom, rect.getWidth(), rect.getHeight()));
 
 	// Hide icon if it text area is not width enough to display it, show otherwise.
-	mMaturityButton->setVisible(rect.mRight < mTextEntry->getRect().getWidth() - right_pad);
+	mMaturityIcon->setVisible(rect.mRight < mTextEntry->getRect().getWidth() - right_pad);
 }
 
 void LLLocationInputCtrl::rebuildLocationHistory(const std::string& filter)
@@ -963,12 +935,7 @@ void LLLocationInputCtrl::focusTextEntry()
 	// if the "select_on_focus" parameter is true it places the cursor
 	// at the beginning (after selecting text), thus screwing up updateSelection().
 	if (mTextEntry)
-	{
 		gFocusMgr.setKeyboardFocus(mTextEntry);
-
-		// Enable the text entry to handle accelerator keys (EXT-8104).
-		LLEditMenuHandler::gEditMenuHandler = mTextEntry;
-	}
 }
 
 void LLLocationInputCtrl::enableAddLandmarkButton(bool val)
@@ -1044,12 +1011,10 @@ void LLLocationInputCtrl::changeLocationPresentation()
 	if(!mTextEntry->hasSelection() && text == mHumanReadableLocation)
 	{
 		//needs unescaped one
-		LLSLURL slurl;
-		LLAgentUI::buildSLURL(slurl, false);
-		mTextEntry->setText(LLURI::unescape(slurl.getSLURLString()));
+		mTextEntry->setText(LLAgentUI::buildSLURL(false));
 		mTextEntry->selectAll();
 
-		mMaturityButton->setVisible(FALSE);
+		mMaturityIcon->setVisible(FALSE);
 
 		isHumanReadableLocationVisible = false;
 	}
diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp
index 48be2516115fb94c25bfd765c0372f6161547992..e3817eecc45571de5414a16d1bc1c3b5d6c7a3b1 100644
--- a/indra/newview/llloginhandler.cpp
+++ b/indra/newview/llloginhandler.cpp
@@ -3,25 +3,31 @@
  * @brief Handles filling in the login panel information from a SLURL
  * such as secondlife:///app/login?first=Bob&last=Dobbs
  *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 #include "llviewerprecompiledheaders.h"
@@ -29,14 +35,13 @@
 #include "llloginhandler.h"
 
 // viewer includes
-#include "llsecapi.h"
 #include "lllogininstance.h"        // to check if logged in yet
 #include "llpanellogin.h"			// save_password_to_disk()
 #include "llstartup.h"				// getStartupState()
-#include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llviewercontrol.h"		// gSavedSettings
 #include "llviewernetwork.h"		// EGridInfo
-#include "llviewerwindow.h"                    // getWindow()
+#include "llviewerwindow.h"			// getWindow()
 
 // library includes
 #include "llmd5.h"
@@ -55,33 +60,109 @@ bool LLLoginHandler::parseDirectLogin(std::string url)
 	LLURI uri(url);
 	parse(uri.queryMap());
 
-	// NOTE: Need to add direct login as per identity evolution
-	return true;
+	if (/*mWebLoginKey.isNull() ||*/
+		mFirstName.empty() ||
+		mLastName.empty())
+	{
+		return false;
+	}
+	else
+	{
+		return true;
+	}
 }
 
+
 void LLLoginHandler::parse(const LLSD& queryMap)
 {
+	//mWebLoginKey = queryMap["web_login_key"].asUUID();
+	mFirstName = queryMap["first_name"].asString();
+	mLastName = queryMap["last_name"].asString();
 	
-	if (queryMap.has("grid"))
+	EGridInfo grid_choice = GRID_INFO_NONE;
+	if (queryMap["grid"].asString() == "aditi")
 	{
-	  LLGridManager::getInstance()->setGridChoice(queryMap["grid"].asString());
+		grid_choice = GRID_INFO_ADITI;
 	}
-	
-	
-	std::string startLocation = queryMap["location"].asString();
-	
-	if (startLocation == "specify")
+	else if (queryMap["grid"].asString() == "agni")
+	{
+		grid_choice = GRID_INFO_AGNI;
+	}
+	else if (queryMap["grid"].asString() == "siva")
+	{
+		grid_choice = GRID_INFO_SIVA;
+	}
+	else if (queryMap["grid"].asString() == "damballah")
+	{
+		grid_choice = GRID_INFO_DAMBALLAH;
+	}
+	else if (queryMap["grid"].asString() == "durga")
+	{
+		grid_choice = GRID_INFO_DURGA;
+	}
+	else if (queryMap["grid"].asString() == "shakti")
+	{
+		grid_choice = GRID_INFO_SHAKTI;
+	}
+	else if (queryMap["grid"].asString() == "soma")
+	{
+		grid_choice = GRID_INFO_SOMA;
+	}
+	else if (queryMap["grid"].asString() == "ganga")
+	{
+		grid_choice = GRID_INFO_GANGA;
+	}
+	else if (queryMap["grid"].asString() == "vaak")
+	{
+		grid_choice = GRID_INFO_VAAK;
+	}
+	else if (queryMap["grid"].asString() == "uma")
+	{
+		grid_choice = GRID_INFO_UMA;
+	}
+	else if (queryMap["grid"].asString() == "mohini")
 	{
-	  LLStartUp::setStartSLURL(LLSLURL(LLGridManager::getInstance()->getGridLoginID(),
-					   queryMap["region"].asString()));
+		grid_choice = GRID_INFO_MOHINI;
 	}
-	else if (startLocation == "home")
+	else if (queryMap["grid"].asString() == "yami")
 	{
-	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+		grid_choice = GRID_INFO_YAMI;
 	}
-	else if (startLocation == "last")
+	else if (queryMap["grid"].asString() == "nandi")
 	{
-	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+		grid_choice = GRID_INFO_NANDI;
+	}
+	else if (queryMap["grid"].asString() == "mitra")
+	{
+		grid_choice = GRID_INFO_MITRA;
+	}
+	else if (queryMap["grid"].asString() == "radha")
+	{
+		grid_choice = GRID_INFO_RADHA;
+	}
+	else if (queryMap["grid"].asString() == "ravi")
+	{
+		grid_choice = GRID_INFO_RAVI;
+	}
+	else if (queryMap["grid"].asString() == "aruna")
+	{
+		grid_choice = GRID_INFO_ARUNA;
+	}
+
+	if(grid_choice != GRID_INFO_NONE)
+	{
+		LLViewerLogin::getInstance()->setGridChoice(grid_choice);
+	}
+
+	std::string startLocation = queryMap["location"].asString();
+
+	if (startLocation == "specify")
+	{
+		LLURLSimString::setString(queryMap["region"].asString());
+	}
+	else if (!startLocation.empty()) // "last" or "home" or ??? (let LLURLSimString figure it out)
+	{
+		LLURLSimString::setString(startLocation);
 	}
 }
 
@@ -139,65 +220,40 @@ bool LLLoginHandler::handle(const LLSD& tokens,
 		return true;
 	}
 	
-	if  (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)  //on splash page         
-	{
-	  // as the login page may change from grid to grid, as well as
-	  // things like username/password/etc, we simply refresh the
-	  // login page to make sure everything is set up correctly
-	  LLPanelLogin::loadLoginPage();
-	  LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
-	}
-	return true;
-}
-
-
+	std::string password = query_map["password"].asString();
 
-//  Initialize the credentials                                                                                              
-// If the passed in URL contains login info, parse                                                                          
-// that into a credential and web login key.  Otherwise                                                                     
-// check the command line.  If the command line                                                                             
-// does not contain any login creds, load the last saved                                                                    
-// ones from the protected credential store.                                                                                
-// This always returns with a credential structure set in the                                                               
-// login handler                                                                                                            
-LLPointer<LLCredential> LLLoginHandler::initializeLoginInfo()                                         
-{                                                                                                                           
-	LLPointer<LLCredential> result = NULL;                                                                               
-	// so try to load it from the UserLoginInfo                                                                          
-	result = loadSavedUserLoginInfo();                                                                                   
-	if (result.isNull())                                                                                                 
-	{                                                                                                                    
-		result =  gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());                       
-	}                                                                                                                    
-	
-	return result;                                                                                                       
-} 
+	if (!password.empty())
+	{
+		gSavedSettings.setBOOL("RememberPassword", TRUE);
 
+		if (password.substr(0,3) != "$1$")
+		{
+			LLMD5 pass((unsigned char*)password.c_str());
+			char md5pass[33];		/* Flawfinder: ignore */
+			pass.hex_digest(md5pass);
+			std::string hashed_password = ll_safe_string(md5pass, 32);
+			LLStartUp::savePasswordToDisk(hashed_password);
+		}
+	}
+			
 
-LLPointer<LLCredential> LLLoginHandler::loadSavedUserLoginInfo()
-{
-  // load the saved user login info into a LLCredential.
-  // perhaps this should be moved.
-	LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
-	if (cmd_line_login.size() == 3) 
+	if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)  //on splash page
 	{
-	
-		LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
-		char md5pass[33];               /* Flawfinder: ignore */
-		pass.hex_digest(md5pass);
-		LLSD identifier = LLSD::emptyMap();
-		identifier["type"] = "agent";
-		identifier["first_name"] = cmd_line_login[0];
-		identifier["last_name"] = cmd_line_login[1];
-		
-		LLSD authenticator = LLSD::emptyMap();
-		authenticator["type"] = "hash";
-		authenticator["algorithm"] = "md5";
-		authenticator["secret"] = md5pass;
-		// yuck, we'll fix this with mani's changes.
-		gSavedSettings.setBOOL("AutoLogin", TRUE);
-		return gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), 
-													   identifier, authenticator);
-	}
-	return NULL;
+		if (!mFirstName.empty() || !mLastName.empty())
+		{
+			// Fill in the name, and maybe the password
+			LLPanelLogin::setFields(mFirstName, mLastName, password);
+		}
+
+		//if (mWebLoginKey.isNull())
+		//{
+		//	LLPanelLogin::loadLoginPage();
+		//}
+		//else
+		//{
+		//	LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+		//}
+		LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+	}
+	return true;
 }
diff --git a/indra/newview/llloginhandler.h b/indra/newview/llloginhandler.h
index 1f2eacd094e1c7e27d0efaf021b5659581dd1503..ac4648761b2a447c27bee3e142819059f8bd603e 100644
--- a/indra/newview/llloginhandler.h
+++ b/indra/newview/llloginhandler.h
@@ -3,32 +3,37 @@
  * @brief Handles filling in the login panel information from a SLURL
  * such as secondlife:///app/login?first=Bob&last=Dobbs
  *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 #ifndef LLLOGINHANDLER_H
 #define LLLOGINHANDLER_H
 
 #include "llcommandhandler.h"
-#include "llsecapi.h"
 
 class LLLoginHandler : public LLCommandHandler
 {
@@ -41,15 +46,19 @@ class LLLoginHandler : public LLCommandHandler
 	// secondlife:///app/login?first=Bob&last=Dobbs
 	bool parseDirectLogin(std::string url);
 
+	std::string getFirstName() const { return mFirstName; }
+	std::string getLastName() const { return mLastName; }
+
 	// Web-based login unsupported
 	//LLUUID getWebLoginKey() const { return mWebLoginKey; }
 
-	LLPointer<LLCredential> loadSavedUserLoginInfo();  
-	LLPointer<LLCredential> initializeLoginInfo();
-
 private:
 	void parse(const LLSD& queryMap);
 
+private:
+	std::string mFirstName;
+	std::string mLastName;
+	//LLUUID mWebLoginKey;
 };
 
 extern LLLoginHandler gLoginHandler;
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index 7b2f5984a778899df811cdc064c61efb71b47ecd..24c72c65cede0f674b90b49dcd93a42354d0532e 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -2,25 +2,31 @@
  * @file lllogininstance.cpp
  * @brief Viewer's host for a login connection.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -42,17 +48,13 @@
 // newview
 #include "llviewernetwork.h"
 #include "llviewercontrol.h"
-#include "llslurl.h"
-#include "llstartup.h"
+#include "llurlsimstring.h"
 #include "llfloaterreg.h"
 #include "llnotifications.h"
 #include "llwindow.h"
 #if LL_LINUX || LL_SOLARIS
 #include "lltrans.h"
 #endif
-#include "llsecapi.h"
-#include "llstartup.h"
-#include "llmachineid.h"
 
 static const char * const TOS_REPLY_PUMP = "lllogininstance_tos_callback";
 static const char * const TOS_LISTENER_NAME = "lllogininstance_tos";
@@ -81,14 +83,14 @@ LLLoginInstance::~LLLoginInstance()
 {
 }
 
-void LLLoginInstance::connect(LLPointer<LLCredential> credentials)
+void LLLoginInstance::connect(const LLSD& credentials)
 {
 	std::vector<std::string> uris;
-	LLGridManager::getInstance()->getLoginURIs(uris);
+	LLViewerLogin::getInstance()->getLoginURIs(uris);
 	connect(uris.front(), credentials);
 }
 
-void LLLoginInstance::connect(const std::string& uri, LLPointer<LLCredential> credentials)
+void LLLoginInstance::connect(const std::string& uri, const LLSD& credentials)
 {
 	mAttemptComplete = false; // Reset attempt complete at this point!
 	constructAuthParams(credentials);
@@ -100,7 +102,7 @@ void LLLoginInstance::reconnect()
 	// Sort of like connect, only using the pre-existing
 	// request params.
 	std::vector<std::string> uris;
-	LLGridManager::getInstance()->getLoginURIs(uris);
+	LLViewerLogin::getInstance()->getLoginURIs(uris);
 	mLoginModule->connect(uris.front(), mRequestData);
 }
 
@@ -116,7 +118,7 @@ LLSD LLLoginInstance::getResponse()
 	return mResponseData; 
 }
 
-void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credential)
+void LLLoginInstance::constructAuthParams(const LLSD& credentials)
 {
 	// Set up auth request options.
 //#define LL_MINIMIAL_REQUESTED_OPTIONS
@@ -143,11 +145,8 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
 	requested_options.append("adult_compliant"); 
 	//requested_options.append("inventory-targets");
 	requested_options.append("buddy-list");
-	requested_options.append("newuser-config");
 	requested_options.append("ui-config");
 #endif
-	requested_options.append("map-server-url");	
-	requested_options.append("voice-config");
 	requested_options.append("tutorial_setting");
 	requested_options.append("login-flags");
 	requested_options.append("global-textures");
@@ -156,28 +155,26 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
 		gSavedSettings.setBOOL("UseDebugMenus", TRUE);
 		requested_options.append("god-connect");
 	}
-	
+
+	char hashed_mac_string[MD5HEX_STR_SIZE];		/* Flawfinder: ignore */
+	LLMD5 hashed_mac;
+	hashed_mac.update( gMACAddress, MAC_ADDRESS_BYTES );
+	hashed_mac.finalize();
+	hashed_mac.hex_digest(hashed_mac_string);
+
+	// prepend "$1$" to the password to indicate its the md5'd version.
+	std::string dpasswd("$1$");
+	dpasswd.append(credentials["passwd"].asString());
+
 	// (re)initialize the request params with creds.
-	LLSD request_params = user_credential->getLoginParams();
-
-	char hashed_unique_id_string[MD5HEX_STR_SIZE];		/* Flawfinder: ignore */
-	LLMD5 hashed_unique_id;
-	unsigned char unique_id[MAC_ADDRESS_BYTES];
-	if(LLUUID::getNodeID(unique_id) == 0) {
-		if(LLMachineID::getUniqueID(unique_id, sizeof(unique_id)) == 0) {
-			llerrs << "Failed to get an id; cannot uniquely identify this machine." << llendl;
-		}
-	}
-	hashed_unique_id.update(unique_id, MAC_ADDRESS_BYTES);
-	hashed_unique_id.finalize();
-	hashed_unique_id.hex_digest(hashed_unique_id_string);
-	
+	LLSD request_params(credentials);
+	request_params["passwd"] = dpasswd;
 	request_params["start"] = construct_start_string();
 	request_params["skipoptional"] = mSkipOptionalUpdate;
 	request_params["agree_to_tos"] = false; // Always false here. Set true in 
 	request_params["read_critical"] = false; // handleTOSResponse
 	request_params["last_exec_event"] = mLastExecEvent;
-	request_params["mac"] = hashed_unique_id_string;
+	request_params["mac"] = hashed_mac_string;
 	request_params["version"] = gCurrentVersion; // Includes channel name
 	request_params["channel"] = gSavedSettings.getString("VersionChannelName");
 	request_params["id0"] = mSerialNumber;
@@ -250,15 +247,6 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
 			LLSD data(LLSD::emptyMap());
 			data["message"] = message_response;
 			data["reply_pump"] = TOS_REPLY_PUMP;
-			if(response.has("error_code"))
-			{
-				data["error_code"] = response["error_code"];
-			}
-			if(response.has("certificate"))
-			{
-				data["certificate"] = response["certificate"];
-			}
-			
 			LLFloaterReg::showInstance("message_critical", data);
 			LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
 				.listen(TOS_LISTENER_NAME,
@@ -364,18 +352,20 @@ void LLLoginInstance::updateApp(bool mandatory, const std::string& auth_msg)
 	payload["mandatory"] = mandatory;
 
 /*
- We're constructing one of the following 9 strings here:
+ We're constructing one of the following 6 strings here:
 	 "DownloadWindowsMandatory"
 	 "DownloadWindowsReleaseForDownload"
 	 "DownloadWindows"
 	 "DownloadMacMandatory"
 	 "DownloadMacReleaseForDownload"
 	 "DownloadMac"
-	 "DownloadLinuxMandatory"
-	 "DownloadLinuxReleaseForDownload"
-	 "DownloadLinux"
  
  I've called them out explicitly in this comment so that they can be grepped for.
+ 
+ Also, we assume that if we're not Windows we're Mac. If we ever intend to support 
+ Linux with autoupdate, this should be an explicit #elif LL_DARWIN, but 
+ we'd rather deliver the wrong message than no message, so until Linux is supported
+ we'll leave it alone.
  */
 	std::string notification_name = "Download";
 	
@@ -464,31 +454,20 @@ bool LLLoginInstance::updateDialogCallback(const LLSD& notification, const LLSD&
 std::string construct_start_string()
 {
 	std::string start;
-	LLSLURL start_slurl = LLStartUp::getStartSLURL();
-	switch(start_slurl.getType())
+	if (LLURLSimString::parse())
 	{
-		case LLSLURL::LOCATION:
-		{
-			// a startup URL was specified
-			LLVector3 position = start_slurl.getPosition();
-			std::string unescaped_start = 
+		// a startup URL was specified
+		std::string unescaped_start = 
 			STRINGIZE(  "uri:" 
-					  << start_slurl.getRegion() << "&" 
-						<< position[VX] << "&" 
-						<< position[VY] << "&" 
-						<< position[VZ]);
-			start = xml_escape_string(unescaped_start);
-			break;
-		}
-		case LLSLURL::HOME_LOCATION:
-		{
-			start = "home";
-			break;
-		}
-		default:
-		{
-			start = "last";
-		}
+						<< LLURLSimString::sInstance.mSimName << "&" 
+						<< LLURLSimString::sInstance.mX << "&" 
+						<< LLURLSimString::sInstance.mY << "&" 
+						<< LLURLSimString::sInstance.mZ);
+		start = xml_escape_string(unescaped_start);
+	}
+	else
+	{
+		start = gSavedSettings.getString("LoginLocation");
 	}
 	return start;
 }
diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h
index 159e05046c40767c01fc8a75bfb4d8025b044fad..c8704eddb497dfb98ae7bebfe2f790d34fb4fa95 100644
--- a/indra/newview/lllogininstance.h
+++ b/indra/newview/lllogininstance.h
@@ -2,25 +2,31 @@
  * @file lllogininstance.h
  * @brief A host for the viewer's login connection.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -30,7 +36,6 @@
 #include "lleventdispatcher.h"
 #include <boost/scoped_ptr.hpp>
 #include <boost/function.hpp>
-#include "llsecapi.h"
 class LLLogin;
 class LLEventStream;
 class LLNotificationsInterface;
@@ -43,8 +48,8 @@ class LLLoginInstance : public LLSingleton<LLLoginInstance>
 	LLLoginInstance();
 	~LLLoginInstance();
 
-	void connect(LLPointer<LLCredential> credentials); // Connect to the current grid choice.
-	void connect(const std::string& uri, LLPointer<LLCredential> credentials);	// Connect to the given uri.
+	void connect(const LLSD& credential); // Connect to the current grid choice.
+	void connect(const std::string& uri, const LLSD& credential);	// Connect to the given uri.
 	void reconnect(); // reconnect using the current credentials.
 	void disconnect();
 
@@ -76,7 +81,7 @@ class LLLoginInstance : public LLSingleton<LLLoginInstance>
 	void setUpdaterLauncher(const UpdaterLauncherCallback& ulc) { mUpdaterLauncher = ulc; }
 
 private:
-	void constructAuthParams(LLPointer<LLCredential> user_credentials);
+	void constructAuthParams(const LLSD& credentials); 
 	void updateApp(bool mandatory, const std::string& message);
 	bool updateDialogCallback(const LLSD& notification, const LLSD& response);
 
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 43a16f8ed830a0b46b846023a4fdae697944eba0..6747bcb9c91b66f6214c66a3731e50e3615e99f7 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -2,25 +2,31 @@
  * @file llmaniprotate.cpp
  * @brief LLManipRotate class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 5eb3b789f2656991e8bd7a92fd66b7970bb06f98..5f0c5e1795186f233f83a02d2381fe2b94bf4928 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -2,25 +2,31 @@
  * @file llmaniptranslate.cpp
  * @brief LLManipTranslate class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index eaa044cb593053442337d8aedc3578fb7edfb42e..d670eb6ffd61b6bba2111e7dac74381453caecfe 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -2,25 +2,31 @@
  * @file llmorphview.cpp
  * @brief Container for Morph functionality
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -36,6 +42,7 @@
 #include "lldrawpoolavatar.h"
 #include "llface.h"
 //#include "llfirstuse.h"
+#include "llfloatercustomize.h"
 #include "llfloatertools.h"
 #include "llresmgr.h"
 #include "lltoolmgr.h"
@@ -69,6 +76,7 @@ LLMorphView::LLMorphView(const LLMorphView::Params& p)
 	mOldCameraNearClip( 0.f ),
 	mCameraPitch( 0.f ),
 	mCameraYaw( 0.f ),
+	mCameraDist( -1.f ),
 	mCameraDrivenByKeys( FALSE )
 {}
 
@@ -79,6 +87,7 @@ void	LLMorphView::initialize()
 {
 	mCameraPitch = 0.f;
 	mCameraYaw = 0.f;
+	mCameraDist = -1.f;
 
 	if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
 	{
@@ -122,7 +131,14 @@ void LLMorphView::setVisible(BOOL visible)
 
 		if (visible)
 		{
-			// TODO: verify some user action has already opened outfit editor? - Nyx
+			llassert( !gFloaterCustomize );
+			gFloaterCustomize = new LLFloaterCustomize();
+			gFloaterCustomize->fetchInventory();
+			gFloaterCustomize->openFloater();
+
+			// Must do this _after_ gFloaterView is initialized.
+			gFloaterCustomize->switchToDefaultSubpart();
+
 			initialize();
 
 			// First run dialog
@@ -130,7 +146,13 @@ void LLMorphView::setVisible(BOOL visible)
 		}
 		else
 		{
-			// TODO: verify some user action has already closed outfit editor ? - Nyx
+			if( gFloaterCustomize )
+			{
+				gFloaterView->removeChild( gFloaterCustomize );
+				delete gFloaterCustomize;
+				gFloaterCustomize = NULL;
+			}
+
 			shutdown();
 		}
 	}
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index 3d0f4cc1ed40528d8d96987522f24b2ba9dcee42..0f22a500937828a934dd8d1b5f3566d9e3bba558 100644
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -2,25 +2,31 @@
  * @file llmoveview.cpp
  * @brief Container for movement buttons like forward, left, fly
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -77,16 +83,6 @@ LLFloaterMove::LLFloaterMove(const LLSD& key)
 {
 }
 
-LLFloaterMove::~LLFloaterMove()
-{
-	// Ensure LLPanelStandStopFlying panel is not among floater's children. See EXT-8458.
-	setVisible(FALSE);
-
-	// Otherwise it can be destroyed and static pointer in LLPanelStandStopFlying::getInstance() will become invalid.
-	// Such situation was possible when LLFloaterReg returns "dead" instance of floater.
-	// Should not happen after LLFloater::destroy was modified to remove "dead" instances from LLFloaterReg.
-}
-
 // virtual
 BOOL LLFloaterMove::postBuild()
 {
@@ -95,20 +91,12 @@ BOOL LLFloaterMove::postBuild()
 	
 	LLDockableFloater::postBuild();
 	
-	// Code that implements floater buttons toggling when user moves via keyboard is located in LLAgent::propagate()
-
 	mForwardButton = getChild<LLJoystickAgentTurn>("forward btn"); 
 	mForwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
 
 	mBackwardButton = getChild<LLJoystickAgentTurn>("backward btn"); 
 	mBackwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
 
-	mSlideLeftButton = getChild<LLJoystickAgentSlide>("move left btn");
-	mSlideLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
-
-	mSlideRightButton = getChild<LLJoystickAgentSlide>("move right btn");
-	mSlideRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
-
 	mTurnLeftButton = getChild<LLButton>("turn left btn"); 
 	mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
 	mTurnLeftButton->setHeldDownCallback(boost::bind(&LLFloaterMove::turnLeft, this));
@@ -137,6 +125,8 @@ BOOL LLFloaterMove::postBuild()
 	btn = getChild<LLButton>("mode_fly_btn");
 	btn->setCommitCallback(boost::bind(&LLFloaterMove::onFlyButtonClick, this));
 
+	showFlyControls(false);
+
 	initModeTooltips();
 
 	initModeButtonMap();
@@ -148,6 +138,18 @@ BOOL LLFloaterMove::postBuild()
 	return TRUE;
 }
 
+// virtual
+void LLFloaterMove::setEnabled(BOOL enabled)
+{
+	//we need to enable/disable only buttons, EXT-1061.
+
+	// is called before postBuild() - use findChild here.
+	LLPanel *panel_actions = findChild<LLPanel>("panel_actions");
+	if (panel_actions) panel_actions->setEnabled(enabled);
+
+	showModeButtons(enabled);
+}
+
 // *NOTE: we assume that setVisible() is called on floater close.
 // virtual
 void LLFloaterMove::setVisible(BOOL visible)
@@ -198,12 +200,7 @@ void LLFloaterMove::setFlyingMode(BOOL fly)
 	if (instance)
 	{
 		instance->setFlyingModeImpl(fly);
-		LLVOAvatarSelf* avatar_object = gAgentAvatarp;
-		bool is_sitting = avatar_object
-			&& (avatar_object->getRegion() != NULL)
-			&& (!avatar_object->isDead())
-			&& avatar_object->isSitting();
-		instance->showModeButtons(!fly && !is_sitting);
+		instance->showModeButtons(!fly);
 	}
 	if (fly)
 	{
@@ -343,38 +340,33 @@ void LLFloaterMove::setMovementMode(const EMovementMode mode)
 
 void LLFloaterMove::updateButtonsWithMovementMode(const EMovementMode newMode)
 {
+	showFlyControls(MM_FLY == newMode);
 	setModeTooltip(newMode);
 	setModeButtonToggleState(newMode);
 	setModeTitle(newMode);
 }
 
+void LLFloaterMove::showFlyControls(bool bShow)
+{
+	mMoveUpButton->setVisible(bShow);
+	mMoveDownButton->setVisible(bShow);
+}
+
 void LLFloaterMove::initModeTooltips()
 {
 	control_tooltip_map_t walkTipMap;
 	walkTipMap.insert(std::make_pair(mForwardButton, getString("walk_forward_tooltip")));
 	walkTipMap.insert(std::make_pair(mBackwardButton, getString("walk_back_tooltip")));
-	walkTipMap.insert(std::make_pair(mSlideLeftButton, getString("walk_left_tooltip")));
-	walkTipMap.insert(std::make_pair(mSlideRightButton, getString("walk_right_tooltip")));
-	walkTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip")));
-	walkTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip")));
 	mModeControlTooltipsMap[MM_WALK] = walkTipMap;
 
 	control_tooltip_map_t runTipMap;
 	runTipMap.insert(std::make_pair(mForwardButton, getString("run_forward_tooltip")));
 	runTipMap.insert(std::make_pair(mBackwardButton, getString("run_back_tooltip")));
-	runTipMap.insert(std::make_pair(mSlideLeftButton, getString("run_left_tooltip")));
-	runTipMap.insert(std::make_pair(mSlideRightButton, getString("run_right_tooltip")));
-	runTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip")));
-	runTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip")));
 	mModeControlTooltipsMap[MM_RUN] = runTipMap;
 
 	control_tooltip_map_t flyTipMap;
 	flyTipMap.insert(std::make_pair(mForwardButton, getString("fly_forward_tooltip")));
 	flyTipMap.insert(std::make_pair(mBackwardButton, getString("fly_back_tooltip")));
-	flyTipMap.insert(std::make_pair(mSlideLeftButton, getString("fly_left_tooltip")));
-	flyTipMap.insert(std::make_pair(mSlideRightButton, getString("fly_right_tooltip")));
-	flyTipMap.insert(std::make_pair(mMoveUpButton, getString("fly_up_tooltip")));
-	flyTipMap.insert(std::make_pair(mMoveDownButton, getString("fly_down_tooltip")));
 	mModeControlTooltipsMap[MM_FLY] = flyTipMap;
 
 	setModeTooltip(MM_WALK);
@@ -398,7 +390,7 @@ void LLFloaterMove::initMovementMode()
 
 	if (isAgentAvatarValid())
 	{
-		showModeButtons(!gAgentAvatarp->isSitting());
+		setEnabled(!gAgentAvatarp->isSitting());
 	}
 }
 
@@ -468,7 +460,8 @@ void LLFloaterMove::sUpdateFlyingStatus()
 
 void LLFloaterMove::showModeButtons(BOOL bShow)
 {
-	if (mModeActionsPanel->getVisible() == bShow)
+	// is called from setEnabled so can be called before postBuild(), check mModeActionsPanel agains to NULL
+	if (NULL == mModeActionsPanel || mModeActionsPanel->getVisible() == bShow)
 		return;
 	mModeActionsPanel->setVisible(bShow);
 }
@@ -479,14 +472,12 @@ void LLFloaterMove::enableInstance(BOOL bEnable)
 	LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
 	if (instance)
 	{
+		instance->setEnabled(bEnable);
+
 		if (gAgent.getFlying())
 		{
 			instance->showModeButtons(FALSE);
 		}
-		else
-		{
-			instance->showModeButtons(bEnable);
-		}
 	}
 }
 
@@ -705,7 +696,6 @@ void LLPanelStandStopFlying::onStandButtonClick()
 	gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
 
 	setFocus(FALSE); // EXT-482
-	mStandButton->setVisible(FALSE); // force visibility changing to avoid seeing Stand & Move buttons at once.
 }
 
 void LLPanelStandStopFlying::onStopFlyingButtonClick()
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index e7e60f544cdf0b5e9296ac02609824e7293cbdf1..9611c286eb20f29d166861a6d223c52e5e5942e3 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -2,25 +2,31 @@
  * @file llnamelistctrl.cpp
  * @brief A list of names, automatically refreshed from name cache.
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -66,7 +72,7 @@ LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p)
 
 // public
 void LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos,
-								 BOOL enabled, const std::string& suffix)
+								 BOOL enabled, std::string& suffix)
 {
 	//llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl;
 
@@ -75,7 +81,7 @@ void LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos,
 	item.enabled = enabled;
 	item.target = INDIVIDUAL;
 
-	addNameItemRow(item, pos, suffix);
+	addNameItemRow(item, pos);
 }
 
 // virtual, public
@@ -262,7 +268,7 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition p
 LLScrollListItem* LLNameListCtrl::addNameItemRow(
 	const LLNameListCtrl::NameItem& name_item,
 	EAddPosition pos,
-	const std::string& suffix)
+	std::string& suffix)
 {
 	LLUUID id = name_item.value().asUUID();
 	LLNameListItem* item = NULL;
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index e4d6a45ee8df52296c5a575097a5bad95eb1fafc..e11df06d868c6a87b82c28756348bf5ee24949b3 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -2,25 +2,31 @@
  * @file llnavigationbar.cpp
  * @brief Navigation bar implementation
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -42,11 +48,11 @@
 #include "lllandmarkactions.h"
 #include "lllocationhistory.h"
 #include "lllocationinputctrl.h"
-#include "llpaneltopinfobar.h"
 #include "llteleporthistory.h"
 #include "llsearchcombobox.h"
 #include "llsidetray.h"
 #include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llurlregistry.h"
 #include "llurldispatcher.h"
 #include "llviewerinventory.h"
@@ -369,6 +375,7 @@ void LLNavigationBar::draw()
 	if(mPurgeTPHistoryItems)
 	{
 		LLTeleportHistory::getInstance()->purgeItems();
+		onTeleportHistoryChanged();
 		mPurgeTPHistoryItems = false;
 	}
 
@@ -501,34 +508,29 @@ void LLNavigationBar::onLocationSelection()
 	
 	std::string region_name;
 	LLVector3 local_coords(128, 128, 0);
+	S32 x = 0, y = 0, z = 0;
 	// Is the typed location a SLURL?
-	LLSLURL slurl = LLSLURL(typed_location);
-	if (slurl.getType() == LLSLURL::LOCATION)
+	if (LLSLURL::isSLURL(typed_location))
 	{
-	  region_name = slurl.getRegion();
-	  local_coords = slurl.getPosition();
+		// Yes. Extract region name and local coordinates from it.
+		if (LLURLSimString::parse(LLSLURL::stripProtocol(typed_location), &region_name, &x, &y, &z))
+				local_coords.set(x, y, z);
+		else
+			return;
 	}
-	else if(!slurl.isValid())
+	// we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too  
+	//but we need to know whether typed_location is a simple http url.
+	else if (LLUrlRegistry::instance().isUrl(typed_location)) 
 	{
-	  // we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too  
-	  // but we need to know whether typed_location is a simple http url.
-	  if (LLUrlRegistry::instance().isUrl(typed_location)) 
-	    {
 		// display http:// URLs in the media browser, or
 		// anything else is sent to the search floater
 		LLWeb::loadURL(typed_location);
 		return;
-	  }
-	  else
-	  {
-	      // assume that an user has typed the {region name} or possible {region_name, parcel}
-	      region_name  = typed_location.substr(0,typed_location.find(','));
-	    }
 	}
 	else
 	{
-	  // was an app slurl, home, whatever.  Bail
-	  return;
+		// assume that an user has typed the {region name} or possible {region_name, parcel}
+		region_name  = typed_location.substr(0,typed_location.find(','));
 	}
 	
 	// Resolve the region name to its global coordinates.
@@ -560,7 +562,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
 	 */
 		LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY,
 					gAgent.getPosAgentFromGlobal(global_agent_pos));
-	std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString());
+	std::string tooltip (LLSLURL::buildSLURLfromPosGlobal(gAgent.getRegion()->getName(), global_agent_pos, false));
 	
 	LLLocationHistoryItem item (location,
 			global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location
@@ -649,7 +651,7 @@ void LLNavigationBar::onRegionNameResponse(
 	LLVector3d region_pos = from_region_handle(region_handle);
 	LLVector3d global_pos = region_pos + (LLVector3d) local_coords;
 
-	llinfos << "Teleporting to: " << LLSLURL(region_name,	global_pos).getSLURLString()  << llendl;
+	llinfos << "Teleporting to: " << LLSLURL::buildSLURLfromPosGlobal(region_name,	global_pos, false)  << llendl;
 	gAgent.teleportViaLocation(global_pos);
 }
 
@@ -708,8 +710,6 @@ void LLNavigationBar::onNavigationButtonHeldUp(LLButton* nav_button)
 
 void LLNavigationBar::handleLoginComplete()
 {
-	LLTeleportHistory::getInstance()->handleLoginComplete();
-	LLPanelTopInfoBar::instance().handleLoginComplete();
 	mCmbLocation->handleLoginComplete();
 }
 
@@ -770,7 +770,7 @@ void LLNavigationBar::showNavigationPanel(BOOL visible)
 		{
 			// Navigation Panel must be shown. Favorites Panel is hidden.
 
-			S32 height = mDefaultNbRect.getHeight() - mDefaultFpRect.getHeight() - FAVBAR_TOP_PADDING;
+			S32 height = mDefaultNbRect.getHeight() - mDefaultFpRect.getHeight();
 			nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), height);
 
 			reshape(nbRect.getWidth(), nbRect.getHeight());
@@ -784,11 +784,8 @@ void LLNavigationBar::showNavigationPanel(BOOL visible)
 		{
 			// Navigation Panel must be hidden. Favorites Panel is visible.
 
-			S32 fpHeight = mDefaultFpRect.getHeight() + FAVBAR_TOP_PADDING;
-			S32 fpTop = fpHeight - (mDefaultFpRect.getHeight() / 2) + 1;
-
-			nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), fpHeight);
-			fbRect.setLeftTopAndSize(fbRect.mLeft, fpTop, fbRect.getWidth(), mDefaultFpRect.getHeight());
+			nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), fbRect.getHeight());
+			fbRect.setLeftTopAndSize(fbRect.mLeft, fbRect.getHeight(), fbRect.getWidth(), fbRect.getHeight());
 
 			// this is duplicated in 'else' section because it should be called BEFORE fb->reshape
 			reshape(nbRect.getWidth(), nbRect.getHeight());
@@ -810,9 +807,8 @@ void LLNavigationBar::showNavigationPanel(BOOL visible)
 		}
 	}
 
-	childSetVisible("bg_icon", visible && fpVisible);
-	childSetVisible("bg_icon_no_fav_bevel", visible && !fpVisible);
-	childSetVisible("bg_icon_no_nav_bevel", !visible && fpVisible);
+	childSetVisible("bg_icon", fpVisible);
+	childSetVisible("bg_icon_no_fav", !fpVisible);
 }
 
 void LLNavigationBar::showFavoritesPanel(BOOL visible)
@@ -831,7 +827,7 @@ void LLNavigationBar::showFavoritesPanel(BOOL visible)
 			// Favorites Panel must be shown. Navigation Panel is visible.
 
 			S32 fbHeight = fbRect.getHeight();
-			S32 newHeight = nbRect.getHeight() + fbHeight + FAVBAR_TOP_PADDING;
+			S32 newHeight = nbRect.getHeight() + fbHeight;
 
 			nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), newHeight);
 			fbRect.setLeftTopAndSize(mDefaultFpRect.mLeft, mDefaultFpRect.mTop, fbRect.getWidth(), fbRect.getHeight());
@@ -840,11 +836,9 @@ void LLNavigationBar::showFavoritesPanel(BOOL visible)
 		{
 			// Favorites Panel must be shown. Navigation Panel is hidden.
 
-			S32 fpHeight = mDefaultFpRect.getHeight() + FAVBAR_TOP_PADDING;
-			S32 fpTop = fpHeight - (mDefaultFpRect.getHeight() / 2) + 1;
-
+			S32 fpHeight = mDefaultFpRect.getHeight();
 			nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), fpHeight);
-			fbRect.setLeftTopAndSize(fbRect.mLeft, fpTop, fbRect.getWidth(), mDefaultFpRect.getHeight());
+			fbRect.setLeftTopAndSize(fbRect.mLeft, fpHeight, fbRect.getWidth(), fpHeight);
 		}
 
 		reshape(nbRect.getWidth(), nbRect.getHeight());
@@ -861,7 +855,7 @@ void LLNavigationBar::showFavoritesPanel(BOOL visible)
 			// Favorites Panel must be hidden. Navigation Panel is visible.
 
 			S32 fbHeight = fbRect.getHeight();
-			S32 newHeight = nbRect.getHeight() - fbHeight - FAVBAR_TOP_PADDING;
+			S32 newHeight = nbRect.getHeight() - fbHeight;
 
 			nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), newHeight);
 		}
@@ -877,9 +871,8 @@ void LLNavigationBar::showFavoritesPanel(BOOL visible)
 		getParent()->reshape(nbRect.getWidth(), nbRect.getHeight());
 	}
 
-	childSetVisible("bg_icon", npVisible && visible);
-	childSetVisible("bg_icon_no_fav_bevel", npVisible && !visible);
-	childSetVisible("bg_icon_no_nav_bevel", !npVisible && visible);
+	childSetVisible("bg_icon", visible);
+	childSetVisible("bg_icon_no_fav", !visible);
 
 	fb->setVisible(visible);
 }
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index 9bef0a6192e532f313368c4fab6b8aed23746371..1507b7d324bc86a455889bd7e4d67d7f9e1a86da 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -2,25 +2,31 @@
  * @file llnearbychatbar.cpp
  * @brief LLNearbyChatBar class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -28,7 +34,6 @@
 
 #include "message.h"
 
-#include "llappviewer.h"
 #include "llfloaterreg.h"
 #include "lltrans.h"
 
@@ -64,33 +69,6 @@ static LLChatTypeTrigger sChatTypeTriggers[] = {
 	{ "/shout"	, CHAT_TYPE_SHOUT}
 };
 
-//ext-7367
-//Problem: gesture list control (actually LLScrollListCtrl) didn't actually process mouse wheel message. 
-// introduce new gesture list subclass to "eat" mouse wheel messages (and probably some other messages)
-class LLGestureScrollListCtrl: public LLScrollListCtrl
-{
-protected:
-	friend class LLUICtrlFactory;
-	LLGestureScrollListCtrl(const LLScrollListCtrl::Params& params)
-		:LLScrollListCtrl(params)
-	{
-	}
-public:
-	BOOL handleScrollWheel(S32 x, S32 y, S32 clicks)
-	{
-		LLScrollListCtrl::handleScrollWheel( x, y, clicks );
-		return TRUE;
-	}
-	//See EXT-6598
-	//Mouse hover over separator will result in not processing tooltip message
-	//So eat this message
-	BOOL handleToolTip(S32 x, S32 y, MASK mask)
-	{
-		LLScrollListCtrl::handleToolTip( x, y, mask );
-		return TRUE;
-	}
-};
-
 LLGestureComboList::Params::Params()
 :	combo_button("combo_button"),
 	combo_list("combo_list")
@@ -101,7 +79,6 @@ LLGestureComboList::LLGestureComboList(const LLGestureComboList::Params& p)
 :	LLUICtrl(p)
 	, mLabel(p.label)
 	, mViewAllItemIndex(0)
-	, mGetMoreItemIndex(0)
 {
 	LLButton::Params button_params = p.combo_button;
 	button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT);
@@ -112,14 +89,13 @@ LLGestureComboList::LLGestureComboList(const LLGestureComboList::Params& p)
 
 	addChild(mButton);
 
-	LLGestureScrollListCtrl::Params params(p.combo_list);
-	
+	LLScrollListCtrl::Params params = p.combo_list;
 	params.name("GestureComboList");
 	params.commit_callback.function(boost::bind(&LLGestureComboList::onItemSelected, this, _2));
 	params.visible(false);
 	params.commit_on_keyboard_movement(false);
 
-	mList = LLUICtrlFactory::create<LLGestureScrollListCtrl>(params);
+	mList = LLUICtrlFactory::create<LLScrollListCtrl>(params);
 	addChild(mList);
 
 	//****************************Gesture Part********************************/
@@ -284,12 +260,9 @@ void LLGestureComboList::refreshGestures()
 
 	sortByName();
 
-	// store indices for Get More and View All items (idx is the index followed by the last added Gesture)
-	mGetMoreItemIndex = idx;
-	mViewAllItemIndex = idx + 1;
-
-	// add Get More and View All items at the bottom
-	mList->addSimpleElement(LLTrans::getString("GetMoreGestures"), ADD_BOTTOM, LLSD(mGetMoreItemIndex));
+	// store index followed by the last added Gesture and add View All item at bottom
+	mViewAllItemIndex = idx;
+	
 	mList->addSimpleElement(LLTrans::getString("ViewAllGestures"), ADD_BOTTOM, LLSD(mViewAllItemIndex));
 
 	// Insert label after sorting, at top, with separator below it
@@ -311,19 +284,9 @@ void LLGestureComboList::refreshGestures()
 	
 	if (gestures)
 	{
-		S32 sel_index = gestures->getFirstSelectedIndex();
-		if (sel_index != 0)
-		{
-			S32 index = gestures->getSelectedValue().asInteger();
-			if (index<0 || index >= (S32)mGestures.size())
-			{
-				llwarns << "out of range gesture access" << llendl;
-			}
-			else
-			{
-				gesture = mGestures.at(index);
-			}
-		}
+		S32 index = gestures->getSelectedValue().asInteger();
+		if(index > 0)
+			gesture = mGestures.at(index);
 	}
 	
 	if(gesture && LLGestureMgr::instance().isGesturePlaying(gesture))
@@ -339,13 +302,13 @@ void LLGestureComboList::onCommitGesture()
 	LLCtrlListInterface* gestures = getListInterface();
 	if (gestures)
 	{
-		S32 sel_index = gestures->getFirstSelectedIndex();
-		if (sel_index == 0)
+		S32 index = gestures->getFirstSelectedIndex();
+		if (index == 0)
 		{
 			return;
 		}
 
-		S32 index = gestures->getSelectedValue().asInteger();
+		index = gestures->getSelectedValue().asInteger();
 
 		if (mViewAllItemIndex == index)
 		{
@@ -355,26 +318,13 @@ void LLGestureComboList::onCommitGesture()
 			return;
 		}
 
-		if (mGetMoreItemIndex == index)
-		{
-			LLWeb::loadURLExternal(gSavedSettings.getString("GesturesMarketplaceURL"));
-			return;
-		}
-
-		if (index<0 || index >= (S32)mGestures.size())
+		LLMultiGesture* gesture = mGestures.at(index);
+		if(gesture)
 		{
-			llwarns << "out of range gesture index" << llendl;
-		}
-		else
-		{
-			LLMultiGesture* gesture = mGestures.at(index);
-			if(gesture)
+			LLGestureMgr::instance().playGesture(gesture);
+			if(!gesture->mReplaceText.empty())
 			{
-				LLGestureMgr::instance().playGesture(gesture);
-				if(!gesture->mReplaceText.empty())
-				{
-					LLNearbyChatBar::sendChatFromViewer(gesture->mReplaceText, CHAT_TYPE_NORMAL, FALSE);
-				}
+				LLNearbyChatBar::sendChatFromViewer(gesture->mReplaceText, CHAT_TYPE_NORMAL, FALSE);
 			}
 		}
 	}
@@ -385,11 +335,6 @@ LLGestureComboList::~LLGestureComboList()
 	LLGestureMgr::instance().removeObserver(this);
 }
 
-LLCtrlListInterface* LLGestureComboList::getListInterface()
-{
-	return mList;
-};
-
 LLNearbyChatBar::LLNearbyChatBar() 
 	: LLPanel()
 	, mChatBox(NULL)
@@ -405,7 +350,6 @@ BOOL LLNearbyChatBar::postBuild()
 	mChatBox->setCommitCallback(boost::bind(&LLNearbyChatBar::onChatBoxCommit, this));
 	mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this);
 	mChatBox->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this));
-	mChatBox->setFocusReceivedCallback(boost::bind(&LLNearbyChatBar::onChatBoxFocusReceived, this));
 
 	mChatBox->setIgnoreArrowKeys( FALSE ); 
 	mChatBox->setCommitOnFocusLost( FALSE );
@@ -449,6 +393,7 @@ BOOL LLNearbyChatBar::handleKeyHere( KEY key, MASK mask )
 {
 	BOOL handled = FALSE;
 
+	// ALT-RETURN is reserved for windowed/fullscreen toggle
 	if( KEY_RETURN == key && mask == MASK_CONTROL)
 	{
 		// shout
@@ -562,11 +507,6 @@ void LLNearbyChatBar::onChatBoxFocusLost(LLFocusableElement* caller, void* userd
 	gAgent.stopTyping();
 }
 
-void LLNearbyChatBar::onChatBoxFocusReceived()
-{
-	mChatBox->setEnabled(!gDisconnected);
-}
-
 EChatType LLNearbyChatBar::processChatTypeTriggers(EChatType type, std::string &str)
 {
 	U32 length = str.length();
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index 060eccf5c7a1666b31704fb6db23b3af3cfb0163..99a1fedcf3a7784c52081eb44c258e029892629c 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -2,25 +2,31 @@
  * @file llnotificationhandler.h
  * @brief Here are implemented Notification Handling Classes.
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index b5683296ebf6c73e047357a20dcc60229ee6c38c..3f551f6b325c4daede359022627b91459a196593 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -2,25 +2,31 @@
  * @file llnotificationofferhandler.cpp
  * @brief Provides set of utility methods for notifications processing.
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ *
+ * Copyright (c) 2000-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -108,7 +114,8 @@ void LLSysHandler::removeExclusiveNotifications(const LLNotificationPtr& notif)
 
 const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"),
 		REVOKED_MODIFY_RIGHTS("RevokedModifyRights"), OBJECT_GIVE_ITEM(
-				"ObjectGiveItem"), PAYMENT_RECIVED("PaymentRecived"),
+				"ObjectGiveItem"), OBJECT_GIVE_ITEM_UNKNOWN_USER(
+				"ObjectGiveItemUnknownUser"), PAYMENT_RECIVED("PaymentRecived"),
 						ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"),
 						USER_GIVE_ITEM("UserGiveItem"),
 						INVENTORY_ACCEPTED("InventoryAccepted"),
@@ -320,7 +327,8 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi
 			"SESSION_NAME") ? notification->getPayload()["SESSION_NAME"].asString() : name;
 
 	// don't create IM p2p session with objects, it's necessary condition to log
-	if (notification->getName() != OBJECT_GIVE_ITEM)
+	if (notification->getName() != OBJECT_GIVE_ITEM && notification->getName()
+			!= OBJECT_GIVE_ITEM_UNKNOWN_USER)
 	{
 		LLUUID from_id = notification->getPayload()["from_id"];
 
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index 85f95bd0c718ef0a2f395e6df1ca24d4e9210bed..c5960a904071d4c84522ac0ad3f11bda02920492 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -2,25 +2,31 @@
  * @file llnotificationofferhandler.cpp
  * @brief Notification Handler Class for Simple Notifications and Notification Tips
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ *
+ * Copyright (c) 2000-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 94612975a2615e2849f9f60ed042c7e822f4d748..afc00bf7ef3176cb89f04da015e2d9d5c65a31f1 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -2,25 +2,31 @@
  * @file llnotificationtiphandler.cpp
  * @brief Notification Handler Class for Notification Tips
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -35,10 +41,41 @@
 #include "llviewercontrol.h"
 #include "llviewerwindow.h"
 #include "llnotificationmanager.h"
-#include "llpaneltiptoast.h"
 
 using namespace LLNotificationsUI;
 
+class LLOnlineStatusToast : public LLToastPanel
+{
+public:
+
+	struct Params
+	{
+		LLNotificationPtr	notification;
+		LLUUID				avatar_id;
+		std::string			message;
+
+		Params() {}
+	};
+
+	LLOnlineStatusToast(Params& p) : LLToastPanel(p.notification)
+	{
+		LLUICtrlFactory::getInstance()->buildPanel(this, "panel_online_status_toast.xml");
+
+		childSetValue("avatar_icon", p.avatar_id);
+		childSetValue("message", p.message);
+
+		if (p.notification->getPayload().has("respond_on_mousedown") 
+			&& p.notification->getPayload()["respond_on_mousedown"] )
+		{
+			setMouseDownCallback(boost::bind(&LLNotification::respond, p.notification, 
+				p.notification->getResponseTemplate()));
+		}
+
+		// set line max count to 3 in case of a very long name
+		snapToMessageHeight(getChild<LLTextBox>("message"), 3);
+	}
+};
+
 //--------------------------------------------------------------------------
 LLTipHandler::LLTipHandler(e_notification_type type, const LLSD& id)
 {
@@ -100,16 +137,11 @@ bool LLTipHandler::processNotification(const LLSD& notify)
 			}
 		}
 
-		std::string session_name = notification->getPayload()["SESSION_NAME"];
 		const std::string name = notification->getSubstitutions()["NAME"];
-		if (session_name.empty())
-		{
-			session_name = name;
-		}
 		LLUUID from_id = notification->getPayload()["from_id"];
 		if (LLHandlerUtil::canLogToIM(notification))
 		{
-			LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name,
+			LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, name, name,
 					notification->getMessage(), from_id, from_id);
 		}
 
@@ -124,7 +156,19 @@ bool LLTipHandler::processNotification(const LLSD& notify)
 			return true;
 		}
 
-		LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
+		LLToastPanel* notify_box = NULL;
+		if("FriendOffline" == notification->getName() || "FriendOnline" == notification->getName())
+		{
+			LLOnlineStatusToast::Params p;
+			p.notification = notification;
+			p.message = notification->getMessage();
+			p.avatar_id = notification->getPayload()["FROM_ID"];
+			notify_box = new LLOnlineStatusToast(p);
+		}
+		else
+		{
+			notify_box = new LLToastNotifyPanel(notification);
+		}
 
 		LLToast::Params p;
 		p.notif_id = notification->getID();
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp
index 85626d8783877bdd6d5722103c52f205d0bfa05f..d6d48a4eadce51b06436ba6844c24716cdb25a60 100644
--- a/indra/newview/lloutputmonitorctrl.cpp
+++ b/indra/newview/lloutputmonitorctrl.cpp
@@ -2,25 +2,31 @@
  * @file lloutputmonitorctrl.cpp
  * @brief LLOutputMonitorCtrl base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -136,7 +142,7 @@ void LLOutputMonitorCtrl::draw()
 
 	// Copied from llmediaremotectrl.cpp
 	// *TODO: Give the LLOutputMonitorCtrl an agent-id to monitor, then
-	// call directly into LLVoiceClient::getInstance() to ask if that agent-id is muted, is
+	// call directly into gVoiceClient to ask if that agent-id is muted, is
 	// speaking, and what power.  This avoids duplicating data, which can get
 	// out of sync.
 	const F32 LEVEL_0 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL / 3.f;
@@ -145,14 +151,14 @@ void LLOutputMonitorCtrl::draw()
 
 	if (getVisible() && mAutoUpdate && !mIsMuted && mSpeakerId.notNull())
 	{
-		setPower(LLVoiceClient::getInstance()->getCurrentPower(mSpeakerId));
+		setPower(gVoiceClient->getCurrentPower(mSpeakerId));
 		if(mIsAgentControl)
 		{
-			setIsTalking(LLVoiceClient::getInstance()->getUserPTTState());
+			setIsTalking(gVoiceClient->getUserPTTState());
 		}
 		else
 		{
-			setIsTalking(LLVoiceClient::getInstance()->getIsSpeaking(mSpeakerId));
+			setIsTalking(gVoiceClient->getIsSpeaking(mSpeakerId));
 		}
 	}
 
diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h
index 026803584d8b663a457af66879d6b36f47ceea0f..b7454a5066a60379fd4e47a6dd15970d7e0ab575 100644
--- a/indra/newview/lloutputmonitorctrl.h
+++ b/indra/newview/lloutputmonitorctrl.h
@@ -2,25 +2,31 @@
  * @file lloutputmonitorctrl.h
  * @brief LLOutputMonitorCtrl base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -137,7 +143,7 @@ class LLOutputMonitorCtrl
 	LLPointer<LLUIImage> mImageLevel2;
 	LLPointer<LLUIImage> mImageLevel3;
 
-	/** whether to deal with LLVoiceClient::getInstance() directly */
+	/** whether to deal with gVoiceClient directly */
 	bool			mAutoUpdate;
 
 	/** uuid of a speaker being monitored */
diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp
index c2bbec04700ed77ec65745199c7d76c6cb9033d9..67e048885f76cbc2c5756408a0346355272f3b5f 100644
--- a/indra/newview/lloverlaybar.cpp
+++ b/indra/newview/lloverlaybar.cpp
@@ -2,25 +2,31 @@
  * @file lloverlaybar.cpp
  * @brief LLOverlayBar class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -252,7 +258,7 @@ void LLOverlayBar::refresh()
 	{
 		// update "remotes"
 		childSetVisible("media_remote_container", TRUE);
-		childSetVisible("voice_remote_container", LLVoiceClient::getInstance()->voiceEnabled());
+		childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled());
 		childSetVisible("state_buttons", TRUE);
 	}
 
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 38a8e17827183f4f1d66f1f1419d24a1431dc069..a0ba2f739b07a28e8fa8f9cec4ecd104331afb64 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -2,25 +2,31 @@
  * @file llpanelavatar.cpp
  * @brief LLPanelAvatar and related class implementations
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -45,7 +51,6 @@
 #include "llnotificationsutil.h"
 #include "llvoiceclient.h"
 #include "llnamebox.h"
-#include "lltrans.h"
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLDropTarget
@@ -158,7 +163,7 @@ BOOL LLPanelAvatarNotes::postBuild()
 	resetControls();
 	resetData();
 
-	LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
+	gVoiceClient->addObserver((LLVoiceClientStatusObserver*)this);
 
 	return TRUE;
 }
@@ -369,7 +374,7 @@ void LLPanelAvatarNotes::onChange(EStatusType status, const std::string &channel
 		return;
 	}
 
-	childSetEnabled("call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
+	childSetEnabled("call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
 }
 
 void LLPanelAvatarNotes::setAvatarId(const LLUUID& id)
@@ -507,7 +512,13 @@ BOOL LLPanelAvatarProfile::postBuild()
 
 	mProfileMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 
-	LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
+	LLTextureCtrl* pic = getChild<LLTextureCtrl>("2nd_life_pic");
+	pic->setFallbackImageName("default_profile_picture.j2c");
+
+	pic = getChild<LLTextureCtrl>("real_world_pic");
+	pic->setFallbackImageName("default_profile_picture.j2c");
+
+	gVoiceClient->addObserver((LLVoiceClientStatusObserver*)this);
 
 	resetControls();
 	resetData();
@@ -634,11 +645,7 @@ void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
 	LLAvatarIconIDCache::getInstance()->remove(avatar_data->avatar_id);
 
 	LLStringUtil::format_map_t args;
-	{
-		std::string birth_date = LLTrans::getString("AvatarBirthDateFormat");
-		LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) avatar_data->born_on.secondsSinceEpoch()));
-		args["[REG_DATE]"] = birth_date;
-	}
+	args["[REG_DATE]"] = avatar_data->born_on;
 	args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now());
 	std::string register_date = getString("RegisterDateFormat", args);
 	childSetValue("register_date", register_date );
@@ -802,7 +809,7 @@ void LLPanelAvatarProfile::onChange(EStatusType status, const std::string &chann
 		return;
 	}
 
-	childSetEnabled("call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
+	childSetEnabled("call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
 }
 
 void LLPanelAvatarProfile::setAvatarId(const LLUUID& id)
@@ -831,6 +838,9 @@ BOOL LLPanelMyProfile::postBuild()
 {
 	LLPanelAvatarProfile::postBuild();
 
+	mStatusCombobox = getChild<LLComboBox>("status_combo");
+
+	childSetCommitCallback("status_combo", boost::bind(&LLPanelMyProfile::onStatusChanged, this), NULL);
 	childSetCommitCallback("status_me_message_text", boost::bind(&LLPanelMyProfile::onStatusMessageChanged, this), NULL);
 
 	resetControls();
@@ -850,9 +860,30 @@ void LLPanelMyProfile::processProfileProperties(const LLAvatarData* avatar_data)
 
 	fillPartnerData(avatar_data);
 
+	fillStatusData(avatar_data);
+
 	fillAccountStatus(avatar_data);
 }
 
+void LLPanelMyProfile::fillStatusData(const LLAvatarData* avatar_data)
+{
+	std::string status;
+	if (gAgent.getAFK())
+	{
+		status = "away";
+	}
+	else if (gAgent.getBusy())
+	{
+		status = "busy";
+	}
+	else
+	{
+		status = "online";
+	}
+
+	mStatusCombobox->setValue(status);
+}
+
 void LLPanelMyProfile::resetControls()
 {
 	childSetVisible("status_panel", false);
@@ -863,6 +894,27 @@ void LLPanelMyProfile::resetControls()
 	childSetVisible("profile_me_buttons_panel", true);
 }
 
+void LLPanelMyProfile::onStatusChanged()
+{
+	LLSD::String status = mStatusCombobox->getValue().asString();
+
+	if ("online" == status)
+	{
+		gAgent.clearAFK();
+		gAgent.clearBusy();
+	}
+	else if ("away" == status)
+	{
+		gAgent.clearBusy();
+		gAgent.setAFK();
+	}
+	else if ("busy" == status)
+	{
+		gAgent.clearAFK();
+		gAgent.setBusy();
+		LLNotificationsUtil::add("BusyModeSet");
+	}
+}
 
 void LLPanelMyProfile::onStatusMessageChanged()
 {
diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp
index 6fe29ed6bb9b1a0141cf50f5ea407c1bc304b24e..c72f0f8012cfef7cdca1371619490089eb335a0b 100644
--- a/indra/newview/llpanelblockedlist.cpp
+++ b/indra/newview/llpanelblockedlist.cpp
@@ -2,25 +2,31 @@
  * @file llpanelblockedlist.cpp
  * @brief Container for blocked Residents & Objects list
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h
index eb9f082d87a6f285a80cb082bddfa03d760572d8..a100577e438b925e8c37985f92d46bf8b6bd84ba 100644
--- a/indra/newview/llpanelblockedlist.h
+++ b/indra/newview/llpanelblockedlist.h
@@ -2,25 +2,31 @@
  * @file llpanelblockedlist.h
  * @brief Container for blocked Residents & Objects list
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp
index 3952e80962c64bc81dda8f29fd236e836114c1c0..f4c0a842e7968eeff8313ead2e4d42e911ac8412 100644
--- a/indra/newview/llpanelcontents.cpp
+++ b/indra/newview/llpanelcontents.cpp
@@ -2,25 +2,31 @@
  * @file llpanelcontents.cpp
  * @brief Object contents panel in the tools floater.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 85bddab02c1d648c9a9bc6a8bd546aa57d10de75..da74295f9e6371770e3f152d47b2a7af38d95fee 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -2,25 +2,31 @@
  * @file llpaneleditwearable.cpp
  * @brief UI panel for editing of a particular wearable item.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -41,24 +47,9 @@
 #include "llvoavatarself.h"
 #include "lltexteditor.h"
 #include "lltextbox.h"
-#include "llaccordionctrl.h"
 #include "llaccordionctrltab.h"
 #include "llagentwearables.h"
 #include "llscrollingpanelparam.h"
-#include "llradiogroup.h"
-#include "llnotificationsutil.h"
-
-#include "llcolorswatch.h"
-#include "lltexturectrl.h"
-#include "lltextureentry.h"
-#include "llviewercontrol.h"	// gSavedSettings
-#include "llviewertexturelist.h"
-#include "llagentcamera.h"
-#include "llmorphview.h"
-
-#include "llcommandhandler.h"
-#include "lltextutil.h"
-#include "llappearancemgr.h"
 
 // register panel with appropriate XML
 static LLRegisterPanelClassWrapper<LLPanelEditWearable> t_edit_wearable("panel_edit_wearable");
@@ -97,8 +88,6 @@ enum ESubpart {
 	SUBPART_TATTOO
  };
 
-using namespace LLVOAvatarDefines;
-
 typedef std::vector<ESubpart> subpart_vec_t;
 
 // Locally defined classes
@@ -118,28 +107,25 @@ class LLEditWearableDictionary : public LLSingleton<LLEditWearableDictionary>
 public:
 	struct WearableEntry : public LLDictionaryEntry
 	{
-		WearableEntry(LLWearableType::EType type,
+		WearableEntry(EWearableType type,
 					  const std::string &title,
 					  const std::string &desc_title,
-					  U8 num_color_swatches,  // number of 'color_swatches'
-					  U8 num_texture_pickers, // number of 'texture_pickers'
-					  U8 num_subparts, ... ); // number of subparts followed by a list of ETextureIndex and ESubparts
+					  U8 num_subparts, ... ); // number of subparts followed by a list of ESubparts
 
 
-		const LLWearableType::EType mWearableType;
+		const EWearableType mWearableType;
 		const std::string   mTitle;
 		const std::string	mDescTitle;
 		subpart_vec_t		mSubparts;
-		texture_vec_t		mColorSwatchCtrls;
-		texture_vec_t		mTextureCtrls;
+
 	};
 
-	struct Wearables : public LLDictionary<LLWearableType::EType, WearableEntry>
+	struct Wearables : public LLDictionary<EWearableType, WearableEntry>
 	{
 		Wearables();
 	} mWearables;
 
-	const WearableEntry*	getWearable(LLWearableType::EType type) const { return mWearables.lookup(type); }
+	const WearableEntry*	getWearable(EWearableType type) const { return mWearables.lookup(type); }
 
 	//--------------------------------------------------------------------
 	// Subparts
@@ -172,35 +158,6 @@ class LLEditWearableDictionary : public LLSingleton<LLEditWearableDictionary>
 	} mSubparts;
 
 	const SubpartEntry*  getSubpart(ESubpart subpart) const { return mSubparts.lookup(subpart); }
-
-	//--------------------------------------------------------------------
-	// Picker Control Entries
-	//--------------------------------------------------------------------
-public:
-	struct PickerControlEntry : public LLDictionaryEntry
-	{
-		PickerControlEntry(ETextureIndex tex_index,
-						   const std::string name,
-						   const LLUUID default_image_id = LLUUID::null,
-						   const bool allow_no_texture = false);
-		ETextureIndex		mTextureIndex;
-		const std::string	mControlName;
-		const LLUUID		mDefaultImageId;
-		const bool			mAllowNoTexture;
-	};
-
-	struct ColorSwatchCtrls : public LLDictionary<ETextureIndex, PickerControlEntry>
-	{
-		ColorSwatchCtrls();
-	} mColorSwatchCtrls;
-
-	struct TextureCtrls : public LLDictionary<ETextureIndex, PickerControlEntry>
-	{
-		TextureCtrls();
-	} mTextureCtrls;
-
-	const PickerControlEntry* getTexturePicker(ETextureIndex index) const { return mTextureCtrls.lookup(index); }
-	const PickerControlEntry* getColorSwatch(ETextureIndex index) const { return mColorSwatchCtrls.lookup(index); }
 };
 
 LLEditWearableDictionary::LLEditWearableDictionary()
@@ -215,31 +172,26 @@ LLEditWearableDictionary::~LLEditWearableDictionary()
 
 LLEditWearableDictionary::Wearables::Wearables()
 {
-	// note the subpart that is listed first is treated as "default", regardless of what order is in enum.
-	// Please match the order presented in XUI. -Nyx
-	// this will affect what camera angle is shown when first editing a wearable
-	addEntry(LLWearableType::WT_SHAPE, 		new WearableEntry(LLWearableType::WT_SHAPE,"edit_shape_title","shape_desc_text",0,0,9,	SUBPART_SHAPE_WHOLE, SUBPART_SHAPE_HEAD,	SUBPART_SHAPE_EYES,	SUBPART_SHAPE_EARS,	SUBPART_SHAPE_NOSE,	SUBPART_SHAPE_MOUTH, SUBPART_SHAPE_CHIN, SUBPART_SHAPE_TORSO, SUBPART_SHAPE_LEGS ));
-	addEntry(LLWearableType::WT_SKIN, 		new WearableEntry(LLWearableType::WT_SKIN,"edit_skin_title","skin_desc_text",0,3,4, TEX_HEAD_BODYPAINT, TEX_UPPER_BODYPAINT, TEX_LOWER_BODYPAINT, SUBPART_SKIN_COLOR, SUBPART_SKIN_FACEDETAIL, SUBPART_SKIN_MAKEUP, SUBPART_SKIN_BODYDETAIL));
-	addEntry(LLWearableType::WT_HAIR, 		new WearableEntry(LLWearableType::WT_HAIR,"edit_hair_title","hair_desc_text",0,1,4, TEX_HAIR, SUBPART_HAIR_COLOR,	SUBPART_HAIR_STYLE,	SUBPART_HAIR_EYEBROWS, SUBPART_HAIR_FACIAL));
-	addEntry(LLWearableType::WT_EYES, 		new WearableEntry(LLWearableType::WT_EYES,"edit_eyes_title","eyes_desc_text",0,1,1, TEX_EYES_IRIS, SUBPART_EYES));
-	addEntry(LLWearableType::WT_SHIRT, 		new WearableEntry(LLWearableType::WT_SHIRT,"edit_shirt_title","shirt_desc_text",1,1,1, TEX_UPPER_SHIRT, TEX_UPPER_SHIRT, SUBPART_SHIRT));
-	addEntry(LLWearableType::WT_PANTS, 		new WearableEntry(LLWearableType::WT_PANTS,"edit_pants_title","pants_desc_text",1,1,1, TEX_LOWER_PANTS, TEX_LOWER_PANTS, SUBPART_PANTS));
-	addEntry(LLWearableType::WT_SHOES, 		new WearableEntry(LLWearableType::WT_SHOES,"edit_shoes_title","shoes_desc_text",1,1,1, TEX_LOWER_SHOES, TEX_LOWER_SHOES, SUBPART_SHOES));
-	addEntry(LLWearableType::WT_SOCKS, 		new WearableEntry(LLWearableType::WT_SOCKS,"edit_socks_title","socks_desc_text",1,1,1, TEX_LOWER_SOCKS, TEX_LOWER_SOCKS, SUBPART_SOCKS));
-	addEntry(LLWearableType::WT_JACKET, 	new WearableEntry(LLWearableType::WT_JACKET,"edit_jacket_title","jacket_desc_text",1,2,1, TEX_UPPER_JACKET, TEX_UPPER_JACKET, TEX_LOWER_JACKET, SUBPART_JACKET));
-	addEntry(LLWearableType::WT_GLOVES, 	new WearableEntry(LLWearableType::WT_GLOVES,"edit_gloves_title","gloves_desc_text",1,1,1, TEX_UPPER_GLOVES, TEX_UPPER_GLOVES, SUBPART_GLOVES));
-	addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry(LLWearableType::WT_UNDERSHIRT,"edit_undershirt_title","undershirt_desc_text",1,1,1, TEX_UPPER_UNDERSHIRT, TEX_UPPER_UNDERSHIRT, SUBPART_UNDERSHIRT));
-	addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry(LLWearableType::WT_UNDERPANTS,"edit_underpants_title","underpants_desc_text",1,1,1, TEX_LOWER_UNDERPANTS, TEX_LOWER_UNDERPANTS, SUBPART_UNDERPANTS));
-	addEntry(LLWearableType::WT_SKIRT, 		new WearableEntry(LLWearableType::WT_SKIRT,"edit_skirt_title","skirt_desc_text",1,1,1, TEX_SKIRT, TEX_SKIRT, SUBPART_SKIRT));
-	addEntry(LLWearableType::WT_ALPHA, 		new WearableEntry(LLWearableType::WT_ALPHA,"edit_alpha_title","alpha_desc_text",0,5,1, TEX_LOWER_ALPHA, TEX_UPPER_ALPHA, TEX_HEAD_ALPHA, TEX_EYES_ALPHA, TEX_HAIR_ALPHA, SUBPART_ALPHA));
-	addEntry(LLWearableType::WT_TATTOO, 	new WearableEntry(LLWearableType::WT_TATTOO,"edit_tattoo_title","tattoo_desc_text",1,3,1, TEX_HEAD_TATTOO, TEX_LOWER_TATTOO, TEX_UPPER_TATTOO, TEX_HEAD_TATTOO, SUBPART_TATTOO));
-}
-
-LLEditWearableDictionary::WearableEntry::WearableEntry(LLWearableType::EType type,
+	addEntry(WT_SHAPE, new WearableEntry(WT_SHAPE,"edit_shape_title","shape_desc_text",9,	SUBPART_SHAPE_HEAD,	SUBPART_SHAPE_EYES,	SUBPART_SHAPE_EARS,	SUBPART_SHAPE_NOSE,	SUBPART_SHAPE_MOUTH, SUBPART_SHAPE_CHIN, SUBPART_SHAPE_TORSO, SUBPART_SHAPE_LEGS, SUBPART_SHAPE_WHOLE));
+	addEntry(WT_SKIN, new WearableEntry(WT_SKIN,"edit_skin_title","skin_desc_text",4, SUBPART_SKIN_COLOR, SUBPART_SKIN_FACEDETAIL, SUBPART_SKIN_MAKEUP, SUBPART_SKIN_BODYDETAIL));
+	addEntry(WT_HAIR, new WearableEntry(WT_HAIR,"edit_hair_title","hair_desc_text",4, SUBPART_HAIR_COLOR,	SUBPART_HAIR_STYLE,	SUBPART_HAIR_EYEBROWS, SUBPART_HAIR_FACIAL));
+	addEntry(WT_EYES, new WearableEntry(WT_EYES,"edit_eyes_title","eyes_desc_text",1, SUBPART_EYES));
+	addEntry(WT_SHIRT, new WearableEntry(WT_SHIRT,"edit_shirt_title","shirt_desc_text",1, SUBPART_SHIRT));
+	addEntry(WT_PANTS, new WearableEntry(WT_PANTS,"edit_pants_title","pants_desc_text",1, SUBPART_PANTS));
+	addEntry(WT_SHOES, new WearableEntry(WT_SHOES,"edit_shoes_title","shoes_desc_text",1, SUBPART_SHOES));
+	addEntry(WT_SOCKS, new WearableEntry(WT_SOCKS,"edit_socks_title","socks_desc_text",1, SUBPART_SOCKS));
+	addEntry(WT_JACKET, new WearableEntry(WT_JACKET,"edit_jacket_title","jacket_desc_text",1, SUBPART_JACKET));
+	addEntry(WT_GLOVES, new WearableEntry(WT_GLOVES,"edit_gloves_title","gloves_desc_text",1, SUBPART_GLOVES));
+	addEntry(WT_UNDERSHIRT, new WearableEntry(WT_UNDERSHIRT,"edit_undershirt_title","undershirt_desc_text",1, SUBPART_UNDERSHIRT));
+	addEntry(WT_UNDERPANTS, new WearableEntry(WT_UNDERPANTS,"edit_underpants_title","underpants_desc_text",1, SUBPART_UNDERPANTS));
+	addEntry(WT_SKIRT, new WearableEntry(WT_SKIRT,"edit_skirt_title","skirt_desc_text",1, SUBPART_SKIRT));
+	addEntry(WT_ALPHA, new WearableEntry(WT_ALPHA,"edit_alpha_title","alpha_desc_text",1, SUBPART_ALPHA));
+	addEntry(WT_TATTOO, new WearableEntry(WT_TATTOO,"edit_tattoo_title","tattoo_desc_text",1, SUBPART_TATTOO));
+}
+
+LLEditWearableDictionary::WearableEntry::WearableEntry(EWearableType type,
 					  const std::string &title,
 					  const std::string &desc_title,
-					  U8 num_color_swatches,
-					  U8 num_texture_pickers,
 					  U8 num_subparts, ... ) :
 	LLDictionaryEntry(title),
 	mWearableType(type),
@@ -249,18 +201,6 @@ LLEditWearableDictionary::WearableEntry::WearableEntry(LLWearableType::EType typ
 	va_list argp;
 	va_start(argp, num_subparts);
 
-	for (U8 i = 0; i < num_color_swatches; ++i)
-	{
-		ETextureIndex index = (ETextureIndex)va_arg(argp,int);
-		mColorSwatchCtrls.push_back(index);
-	}
-
-	for (U8 i = 0; i < num_texture_pickers; ++i)
-	{
-		ETextureIndex index = (ETextureIndex)va_arg(argp,int);
-		mTextureCtrls.push_back(index);
-	}
-
 	for (U8 i = 0; i < num_subparts; ++i)
 	{
 		ESubpart part = (ESubpart)va_arg(argp,int);
@@ -325,295 +265,6 @@ LLEditWearableDictionary::SubpartEntry::SubpartEntry(ESubpart part,
 {
 }
 
-LLEditWearableDictionary::ColorSwatchCtrls::ColorSwatchCtrls()
-{
-	addEntry ( TEX_UPPER_SHIRT,  new PickerControlEntry (TEX_UPPER_SHIRT, "Color/Tint" ));
-	addEntry ( TEX_LOWER_PANTS,  new PickerControlEntry (TEX_LOWER_PANTS, "Color/Tint" ));
-	addEntry ( TEX_LOWER_SHOES,  new PickerControlEntry (TEX_LOWER_SHOES, "Color/Tint" ));
-	addEntry ( TEX_LOWER_SOCKS,  new PickerControlEntry (TEX_LOWER_SOCKS, "Color/Tint" ));
-	addEntry ( TEX_UPPER_JACKET, new PickerControlEntry (TEX_UPPER_JACKET, "Color/Tint" ));
-	addEntry ( TEX_SKIRT,  new PickerControlEntry (TEX_SKIRT, "Color/Tint" ));
-	addEntry ( TEX_UPPER_GLOVES, new PickerControlEntry (TEX_UPPER_GLOVES, "Color/Tint" ));
-	addEntry ( TEX_UPPER_UNDERSHIRT, new PickerControlEntry (TEX_UPPER_UNDERSHIRT, "Color/Tint" ));
-	addEntry ( TEX_LOWER_UNDERPANTS, new PickerControlEntry (TEX_LOWER_UNDERPANTS, "Color/Tint" ));
-	addEntry ( TEX_HEAD_TATTOO, new PickerControlEntry(TEX_HEAD_TATTOO, "Color/Tint" ));
-}
-
-LLEditWearableDictionary::TextureCtrls::TextureCtrls()
-{
-	addEntry ( TEX_HEAD_BODYPAINT,  new PickerControlEntry (TEX_HEAD_BODYPAINT,  "Head Tattoos", LLUUID::null, TRUE ));
-	addEntry ( TEX_UPPER_BODYPAINT, new PickerControlEntry (TEX_UPPER_BODYPAINT, "Upper Tattoos", LLUUID::null, TRUE ));
-	addEntry ( TEX_LOWER_BODYPAINT, new PickerControlEntry (TEX_LOWER_BODYPAINT, "Lower Tattoos", LLUUID::null, TRUE ));
-	addEntry ( TEX_HAIR, new PickerControlEntry (TEX_HAIR, "Texture", LLUUID( gSavedSettings.getString( "UIImgDefaultHairUUID" ) ), FALSE ));
-	addEntry ( TEX_EYES_IRIS, new PickerControlEntry (TEX_EYES_IRIS, "Iris", LLUUID( gSavedSettings.getString( "UIImgDefaultEyesUUID" ) ), FALSE ));
-	addEntry ( TEX_UPPER_SHIRT, new PickerControlEntry (TEX_UPPER_SHIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultShirtUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_PANTS, new PickerControlEntry (TEX_LOWER_PANTS, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultPantsUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_SHOES, new PickerControlEntry (TEX_LOWER_SHOES, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultShoesUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_SOCKS, new PickerControlEntry (TEX_LOWER_SOCKS, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultSocksUUID" ) ), FALSE ));
-	addEntry ( TEX_UPPER_JACKET, new PickerControlEntry (TEX_UPPER_JACKET, "Upper Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultJacketUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_JACKET, new PickerControlEntry (TEX_LOWER_JACKET, "Lower Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultJacketUUID" ) ), FALSE ));
-	addEntry ( TEX_SKIRT, new PickerControlEntry (TEX_SKIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultSkirtUUID" ) ), FALSE ));
-	addEntry ( TEX_UPPER_GLOVES, new PickerControlEntry (TEX_UPPER_GLOVES, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultGlovesUUID" ) ), FALSE ));
-	addEntry ( TEX_UPPER_UNDERSHIRT, new PickerControlEntry (TEX_UPPER_UNDERSHIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultUnderwearUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_UNDERPANTS, new PickerControlEntry (TEX_LOWER_UNDERPANTS, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultUnderwearUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_ALPHA, new PickerControlEntry (TEX_LOWER_ALPHA, "Lower Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_UPPER_ALPHA, new PickerControlEntry (TEX_UPPER_ALPHA, "Upper Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_HEAD_ALPHA, new PickerControlEntry (TEX_HEAD_ALPHA, "Head Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_EYES_ALPHA, new PickerControlEntry (TEX_EYES_ALPHA, "Eye Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_HAIR_ALPHA, new PickerControlEntry (TEX_HAIR_ALPHA, "Hair Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_LOWER_TATTOO, new PickerControlEntry (TEX_LOWER_TATTOO, "Lower Tattoo", LLUUID::null, TRUE ));
-	addEntry ( TEX_UPPER_TATTOO, new PickerControlEntry (TEX_UPPER_TATTOO, "Upper Tattoo", LLUUID::null, TRUE ));
-	addEntry ( TEX_HEAD_TATTOO, new PickerControlEntry (TEX_HEAD_TATTOO, "Head Tattoo", LLUUID::null, TRUE ));
-}
-
-LLEditWearableDictionary::PickerControlEntry::PickerControlEntry(ETextureIndex tex_index,
-					 const std::string name,
-					 const LLUUID default_image_id,
-					 const bool allow_no_texture) :
-	LLDictionaryEntry(name),
-	mTextureIndex(tex_index),
-	mControlName(name),
-	mDefaultImageId(default_image_id),
-	mAllowNoTexture(allow_no_texture)
-{
-}
-
-/**
- * Class to prevent hack in LLButton's constructor and use paddings declared in xml.
- */
-class LLLabledBackButton : public LLButton
-{
-public:
-	struct Params : public LLInitParam::Block<Params, LLButton::Params>
-	{
-		Params() {}
-	};
-protected:
-	friend class LLUICtrlFactory;
-	LLLabledBackButton(const Params&);
-};
-
-static LLDefaultChildRegistry::Register<LLLabledBackButton> labeled_back_btn("labeled_back_button");
-
-LLLabledBackButton::LLLabledBackButton(const Params& params)
-: LLButton(params)
-{
-	// override hack in LLButton's constructor to use paddings have been set in xml
-	setLeftHPad(params.pad_left);
-	setRightHPad(params.pad_right);
-}
-
-// Helper functions.
-static const texture_vec_t null_texture_vec;
-
-// Specializations of this template function return a vector of texture indexes of particular control type
-// (i.e. LLColorSwatchCtrl or LLTextureCtrl) which are contained in given WearableEntry.
-template <typename T>
-const texture_vec_t&
-get_pickers_indexes(const LLEditWearableDictionary::WearableEntry *wearable_entry) { return null_texture_vec; }
-
-// Specializations of this template function return picker control entry for particular control type.
-template <typename T>
-const LLEditWearableDictionary::PickerControlEntry*
-get_picker_entry (const ETextureIndex index) { return NULL; }
-
-typedef boost::function<void(LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry*)> function_t;
-
-typedef struct PickerControlEntryNamePredicate
-{
-	PickerControlEntryNamePredicate(const std::string name) : mName (name) {};
-	bool operator()(const LLEditWearableDictionary::PickerControlEntry* entry) const
-	{
-		return (entry && entry->mName == mName);
-	}
-private:
-	const std::string mName;
-} PickerControlEntryNamePredicate;
-
-// A full specialization of get_pickers_indexes for LLColorSwatchCtrl
-template <>
-const texture_vec_t&
-get_pickers_indexes<LLColorSwatchCtrl> (const LLEditWearableDictionary::WearableEntry *wearable_entry)
-{
-	if (!wearable_entry)
-	{
-		llwarns << "could not get LLColorSwatchCtrl indexes for null wearable entry." << llendl;
-		return null_texture_vec;
-	}
-	return wearable_entry->mColorSwatchCtrls;
-}
-
-// A full specialization of get_pickers_indexes for LLTextureCtrl
-template <>
-const texture_vec_t&
-get_pickers_indexes<LLTextureCtrl> (const LLEditWearableDictionary::WearableEntry *wearable_entry)
-{
-	if (!wearable_entry)
-	{
-		llwarns << "could not get LLTextureCtrl indexes for null wearable entry." << llendl;
-		return null_texture_vec;
-	}
-	return wearable_entry->mTextureCtrls;
-}
-
-// A full specialization of get_picker_entry for LLColorSwatchCtrl
-template <>
-const LLEditWearableDictionary::PickerControlEntry*
-get_picker_entry<LLColorSwatchCtrl> (const ETextureIndex index)
-{
-	return LLEditWearableDictionary::getInstance()->getColorSwatch(index);
-}
-
-// A full specialization of get_picker_entry for LLTextureCtrl
-template <>
-const LLEditWearableDictionary::PickerControlEntry*
-get_picker_entry<LLTextureCtrl> (const ETextureIndex index)
-{
-	return LLEditWearableDictionary::getInstance()->getTexturePicker(index);
-}
-
-template <typename CtrlType, class Predicate>
-const LLEditWearableDictionary::PickerControlEntry*
-find_picker_ctrl_entry_if(LLWearableType::EType type, const Predicate pred)
-{
-	const LLEditWearableDictionary::WearableEntry *wearable_entry
-		= LLEditWearableDictionary::getInstance()->getWearable(type);
-	if (!wearable_entry)
-	{
-		llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
-		return NULL;
-	}
-	const texture_vec_t& indexes = get_pickers_indexes<CtrlType>(wearable_entry);
-	for (texture_vec_t::const_iterator
-			 iter = indexes.begin(),
-			 iter_end = indexes.end();
-		 iter != iter_end; ++iter)
-	{
-		const ETextureIndex te = *iter;
-		const LLEditWearableDictionary::PickerControlEntry*	entry
-			= get_picker_entry<CtrlType>(te);
-		if (!entry)
-		{
-			llwarns << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << llendl;
-			continue;
-		}
-		if (pred(entry))
-		{
-			return entry;
-		}
-	}
-	return NULL;
-}
-
-template <typename CtrlType>
-void
-for_each_picker_ctrl_entry(LLPanel* panel, LLWearableType::EType type, function_t fun)
-{
-	if (!panel)
-	{
-		llwarns << "the panel wasn't passed for wearable of type: " << type << llendl;
-		return;
-	}
-	const LLEditWearableDictionary::WearableEntry *wearable_entry
-		= LLEditWearableDictionary::getInstance()->getWearable(type);
-	if (!wearable_entry)
-	{
-		llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
-		return;
-	}
-	const texture_vec_t& indexes = get_pickers_indexes<CtrlType>(wearable_entry);
-	for (texture_vec_t::const_iterator
-			 iter = indexes.begin(),
-			 iter_end = indexes.end();
-		 iter != iter_end; ++iter)
-	{
-		const ETextureIndex te = *iter;
-		const LLEditWearableDictionary::PickerControlEntry*	entry
-			= get_picker_entry<CtrlType>(te);
-		if (!entry)
-		{
-			llwarns << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << llendl;
-			continue;
-		}
-		fun (panel, entry);
-	}
-}
-
-// The helper functions for pickers management
-static void init_color_swatch_ctrl(LLPanelEditWearable* self, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
-{
-	LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName);
-	if (color_swatch_ctrl)
-	{
-		// Can't get the color from the wearable here, since the wearable may not be set when this is called.
-		color_swatch_ctrl->setOriginal(LLColor4::white);
-	}
-}
-
-static void init_texture_ctrl(LLPanelEditWearable* self, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
-{
-	LLTextureCtrl* texture_ctrl = panel->getChild<LLTextureCtrl>(entry->mControlName);
-	if (texture_ctrl)
-	{
-		texture_ctrl->setDefaultImageAssetID(entry->mDefaultImageId);
-		texture_ctrl->setAllowNoTexture(entry->mAllowNoTexture);
-		// Don't allow (no copy) or (notransfer) textures to be selected.
-		texture_ctrl->setImmediateFilterPermMask(PERM_NONE);
-		texture_ctrl->setNonImmediateFilterPermMask(PERM_NONE);
-	}
-}
-
-static void update_color_swatch_ctrl(LLPanelEditWearable* self, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
-{
-	LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName);
-	if (color_swatch_ctrl)
-	{
-		color_swatch_ctrl->set(self->getWearable()->getClothesColor(entry->mTextureIndex));
-	}
-}
-
-static void update_texture_ctrl(LLPanelEditWearable* self, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
-{
-	LLTextureCtrl* texture_ctrl = panel->getChild<LLTextureCtrl>(entry->mControlName);
-	if (texture_ctrl)
-	{
-		LLUUID new_id;
-		LLLocalTextureObject *lto = self->getWearable()->getLocalTextureObject(entry->mTextureIndex);
-		if( lto && (lto->getID() != IMG_DEFAULT_AVATAR) )
-		{
-			new_id = lto->getID();
-		}
-		else
-		{
-			new_id = LLUUID::null;
-		}
-		LLUUID old_id = texture_ctrl->getImageAssetID();
-		if (old_id != new_id)
-		{
-			// texture has changed, close the floater to avoid DEV-22461
-			texture_ctrl->closeDependentFloater();
-		}
-		texture_ctrl->setImageAssetID(new_id);
-	}
-}
-
-static void set_enabled_color_swatch_ctrl(bool enabled, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
-{
-	LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName);
-	if (color_swatch_ctrl)
-	{
-		color_swatch_ctrl->setEnabled(enabled);
-	}
-}
-
-static void set_enabled_texture_ctrl(bool enabled, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
-{
-	LLTextureCtrl* texture_ctrl = panel->getChild<LLTextureCtrl>(entry->mControlName);
-	if (texture_ctrl)
-	{
-		texture_ctrl->setEnabled(enabled);
-	}
-}
 
 // LLPanelEditWearable
 
@@ -622,8 +273,6 @@ LLPanelEditWearable::LLPanelEditWearable()
 	, mWearablePtr(NULL)
 	, mWearableItem(NULL)
 {
-	mCommitCallbackRegistrar.add("ColorSwatch.Commit", boost::bind(&LLPanelEditWearable::onColorSwatchCommit, this, _1));
-	mCommitCallbackRegistrar.add("TexturePicker.Commit", boost::bind(&LLPanelEditWearable::onTexturePickerCommit, this, _1));
 }
 
 //virtual
@@ -632,65 +281,6 @@ LLPanelEditWearable::~LLPanelEditWearable()
 
 }
 
-bool LLPanelEditWearable::changeHeightUnits(const LLSD& new_value)
-{
-	updateMetricLayout( new_value.asBoolean() );
-	updateTypeSpecificControls(LLWearableType::WT_SHAPE);
-	return true;
-}
-
-void LLPanelEditWearable::updateMetricLayout(BOOL new_value)
-{
-	LLUIString current_metric, replacment_metric;
-	current_metric = new_value ? mMeters : mFeet;
-	replacment_metric = new_value ? mFeet : mMeters;
-	mHeigthValue.setArg( "[METRIC1]", current_metric.getString() );
-	mReplacementMetricUrl.setArg( "[URL_METRIC2]", std::string("[secondlife:///app/metricsystem ") + replacment_metric.getString() + std::string("]"));
-}
-
-void LLPanelEditWearable::updateAvatarHeightLabel()
-{
-	mTxtAvatarHeight->setText(LLStringUtil::null);
-	LLStyle::Params param;
-	param.color = mAvatarHeigthLabelColor;
-	mTxtAvatarHeight->appendText(mHeigth, false, param);
-	param.color = mAvatarHeigthValueLabelColor;
-	mTxtAvatarHeight->appendText(mHeigthValue, false, param);
-	param.color = mAvatarHeigthLabelColor; // using mAvatarHeigthLabelColor for '/' separator
-	mTxtAvatarHeight->appendText(" / ", false, param);
-	mTxtAvatarHeight->appendText(this->mReplacementMetricUrl, false, param);
-}
-
-void LLPanelEditWearable::onWearablePanelVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl)
-{
-	if (in_visible_chain.asBoolean() && accordion_ctrl != NULL)
-	{
-		accordion_ctrl->expandDefaultTab();
-	}
-}
-
-void LLPanelEditWearable::setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel)
-{
-	if (bodypart_panel != NULL)
-	{
-		LLAccordionCtrl* accordion_ctrl = bodypart_panel->getChild<LLAccordionCtrl>("wearable_accordion");
-
-		if (accordion_ctrl != NULL)
-		{
-			bodypart_panel->setVisibleCallback(
-					boost::bind(&LLPanelEditWearable::onWearablePanelVisibilityChange, this, _2, accordion_ctrl));
-		}
-		else
-		{
-			llwarns << "accordion_ctrl is NULL" << llendl;
-		}
-	}
-	else
-	{
-		llwarns << "bodypart_panel is NULL" << llendl;
-	}
-}
-
 // virtual 
 BOOL LLPanelEditWearable::postBuild()
 {
@@ -699,19 +289,14 @@ BOOL LLPanelEditWearable::postBuild()
 	mBtnRevert->setClickedCallback(boost::bind(&LLPanelEditWearable::onRevertButtonClicked, this));
 
 	mBtnBack = getChild<LLButton>("back_btn");
-	mBackBtnLabel = mBtnBack->getLabelUnselected();
-	mBtnBack->setLabel(LLStringUtil::null);
 	// handled at appearance panel level?
 	//mBtnBack->setClickedCallback(boost::bind(&LLPanelEditWearable::onBackButtonClicked, this));
 
-	mNameEditor = getChild<LLLineEditor>("description");
+	mTextEditor = getChild<LLTextEditor>("description");
 
 	mPanelTitle = getChild<LLTextBox>("edit_wearable_title");
 	mDescTitle = getChild<LLTextBox>("description_text");
 
-	getChild<LLRadioGroup>("sex_radio")->setCommitCallback(boost::bind(&LLPanelEditWearable::onCommitSexChange, this));
-	getChild<LLButton>("save_as_button")->setCommitCallback(boost::bind(&LLPanelEditWearable::onSaveAsButtonClicked, this));
-
 	// The following panels will be shown/hidden based on what wearable we're editing
 	// body parts
 	mPanelShape = getChild<LLPanel>("edit_shape_panel");
@@ -719,14 +304,6 @@ BOOL LLPanelEditWearable::postBuild()
 	mPanelEyes = getChild<LLPanel>("edit_eyes_panel");
 	mPanelHair = getChild<LLPanel>("edit_hair_panel");
 
-	// Setting the visibility callback is applied only to the bodyparts panel
-	// because currently they are the only ones whose 'wearable_accordion' has
-	// multiple accordion tabs (see EXT-8164 for details).
-	setWearablePanelVisibilityChangeCallback(mPanelShape);
-	setWearablePanelVisibilityChangeCallback(mPanelSkin);
-	setWearablePanelVisibilityChangeCallback(mPanelEyes);
-	setWearablePanelVisibilityChangeCallback(mPanelHair);
-
 	//clothes
 	mPanelShirt = getChild<LLPanel>("edit_shirt_panel");
 	mPanelPants = getChild<LLPanel>("edit_pants_panel");
@@ -740,73 +317,8 @@ BOOL LLPanelEditWearable::postBuild()
 	mPanelAlpha = getChild<LLPanel>("edit_alpha_panel");
 	mPanelTattoo = getChild<LLPanel>("edit_tattoo_panel");
 
-	mTxtAvatarHeight = mPanelShape->getChild<LLTextBox>("avatar_height");
-
 	mWearablePtr = NULL;
 
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible");
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible");
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_HEAD_ALPHA, "head alpha texture invisible");
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_EYES_ALPHA, "eye alpha texture invisible");
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible");
-
-	// configure tab expanded callbacks
-	for (U32 type_index = 0; type_index < (U32)LLWearableType::WT_COUNT; ++type_index)
-	{
-		LLWearableType::EType type = (LLWearableType::EType) type_index;
-		const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
-		if (!wearable_entry)
-		{
-			llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
-			continue;
-		}
-		U8 num_subparts = wearable_entry->mSubparts.size();
-	
-		for (U8 index = 0; index < num_subparts; ++index)
-		{
-			// dive into data structures to get the panel we need
-			ESubpart subpart_e = wearable_entry->mSubparts[index];
-			const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
-	
-			if (!subpart_entry)
-			{
-				llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
-				continue;
-			}
-	
-			const std::string accordion_tab = subpart_entry->mAccordionTab;
-	
-			LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab);
-	
-			if (!tab)
-			{
-				llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl;
-				continue;
-			}
-	
-			// initialize callback to ensure camera view changes appropriately.
-			tab->setDropDownStateChangedCallback(boost::bind(&LLPanelEditWearable::onTabExpandedCollapsed,this,_2,index));
-		}
-
-		// initialize texture and color picker controls
-		for_each_picker_ctrl_entry <LLColorSwatchCtrl> (getPanel(type), type, boost::bind(init_color_swatch_ctrl, this, _1, _2));
-		for_each_picker_ctrl_entry <LLTextureCtrl>     (getPanel(type), type, boost::bind(init_texture_ctrl, this, _1, _2));
-	}
-
-	// init all strings
-	mMeters		= mPanelShape->getString("meters");
-	mFeet		= mPanelShape->getString("feet");
-	mHeigth		= mPanelShape->getString("height") + " ";
-	mHeigthValue	= "[HEIGHT] [METRIC1]";
-	mReplacementMetricUrl	= "[URL_METRIC2]";
-
-	std::string color = mPanelShape->getString("heigth_label_color");
-	mAvatarHeigthLabelColor = LLUIColorTable::instance().getColor(color, LLColor4::green);
-	color = mPanelShape->getString("heigth_value_label_color");
-	mAvatarHeigthValueLabelColor = LLUIColorTable::instance().getColor(color, LLColor4::green);
-	gSavedSettings.getControl("HeightUnits")->getSignal()->connect(boost::bind(&LLPanelEditWearable::changeHeightUnits, this, _2));
-	updateMetricLayout(gSavedSettings.getBOOL("HeightUnits"));
-
 	return TRUE;
 }
 
@@ -818,7 +330,7 @@ BOOL LLPanelEditWearable::isDirty() const
 	if (mWearablePtr)
 	{
 		if (mWearablePtr->isDirty() ||
-			mWearableItem->getName().compare(mNameEditor->getText()) != 0)
+			mWearablePtr->getName().compare(mTextEditor->getText()) != 0)
 		{
 			isDirty = TRUE;
 		}
@@ -829,11 +341,6 @@ BOOL LLPanelEditWearable::isDirty() const
 void LLPanelEditWearable::draw()
 {
 	updateVerbs();
-	if (getWearable() && getWearable()->getType() == LLWearableType::WT_SHAPE)
-	{
-		//updating avatar height
-		updateTypeSpecificControls(LLWearableType::WT_SHAPE);
-	}
 
 	LLPanel::draw();
 }
@@ -843,8 +350,9 @@ void LLPanelEditWearable::setWearable(LLWearable *wearable)
 	showWearable(mWearablePtr, FALSE);
 	mWearablePtr = wearable;
 	showWearable(mWearablePtr, TRUE);
-}
 
+	initializePanel();
+}
 
 //static 
 void LLPanelEditWearable::onRevertButtonClicked(void* userdata)
@@ -853,157 +361,8 @@ void LLPanelEditWearable::onRevertButtonClicked(void* userdata)
 	panel->revertChanges();
 }
 
-void LLPanelEditWearable::onSaveAsButtonClicked()
-{
-	LLSD args;
-	args["DESC"] = mNameEditor->getText();
-
-	LLNotificationsUtil::add("SaveWearableAs", args, LLSD(), boost::bind(&LLPanelEditWearable::saveAsCallback, this, _1, _2));
-}
 
-void LLPanelEditWearable::saveAsCallback(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (0 == option)
-	{
-		std::string wearable_name = response["message"].asString();
-		LLStringUtil::trim(wearable_name);
-		if( !wearable_name.empty() )
-		{
-			mNameEditor->setText(wearable_name);
-			saveChanges(true);
-		}
-	}
-}
-
-void LLPanelEditWearable::onCommitSexChange()
-{
-	if (!isAgentAvatarValid()) return;
-
-	LLWearableType::EType type = mWearablePtr->getType();
-	U32 index = gAgentWearables.getWearableIndex(mWearablePtr);
-
-	if( !gAgentWearables.isWearableModifiable(type, index))
-	{
-		return;
-	}
-
-	LLViewerVisualParam* param = static_cast<LLViewerVisualParam*>(gAgentAvatarp->getVisualParam( "male" ));
-	if( !param )
-	{
-		return;
-	}
-
-	bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE;
-	LLWearable*	wearable = gAgentWearables.getWearable(type, index);
-	if (wearable)
-	{
-		wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE);
-	}
-	param->setWeight( is_new_sex_male, FALSE );
-
-	gAgentAvatarp->updateSexDependentLayerSets( FALSE );
-
-	gAgentAvatarp->updateVisualParams();
-
-	updateScrollingPanelUI();
-}
-
-void LLPanelEditWearable::onTexturePickerCommit(const LLUICtrl* ctrl)
-{
-	const LLTextureCtrl* texture_ctrl = dynamic_cast<const LLTextureCtrl*>(ctrl);
-	if (!texture_ctrl)
-	{
-		llwarns << "got commit signal from not LLTextureCtrl." << llendl;
-		return;
-	}
-
-	if (getWearable())
-	{
-		LLWearableType::EType type = getWearable()->getType();
-		const PickerControlEntryNamePredicate name_pred(texture_ctrl->getName());
-		const LLEditWearableDictionary::PickerControlEntry* entry
-			= find_picker_ctrl_entry_if<LLTextureCtrl, PickerControlEntryNamePredicate>(type, name_pred);
-		if (entry)
-		{
-			// Set the new version
-			LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(texture_ctrl->getImageAssetID());
-			if( image->getID() == IMG_DEFAULT )
-			{
-				image = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
-			}
-			if (getWearable())
-			{
-				U32 index = gAgentWearables.getWearableIndex(getWearable());
-				gAgentAvatarp->setLocalTexture(entry->mTextureIndex, image, FALSE, index);
-				LLVisualParamHint::requestHintUpdates();
-				gAgentAvatarp->wearableUpdated(type, FALSE);
-			}
-		}
-		else
-		{
-			llwarns << "could not get texture picker dictionary entry for wearable of type: " << type << llendl;
-		}
-	}
-}
-
-void LLPanelEditWearable::onColorSwatchCommit(const LLUICtrl* ctrl)
-{
-	if (getWearable())
-	{
-		LLWearableType::EType type = getWearable()->getType();
-		const PickerControlEntryNamePredicate name_pred(ctrl->getName());
-		const LLEditWearableDictionary::PickerControlEntry* entry
-			= find_picker_ctrl_entry_if<LLColorSwatchCtrl, PickerControlEntryNamePredicate>(type, name_pred);
-		if (entry)
-		{
-			const LLColor4& old_color = getWearable()->getClothesColor(entry->mTextureIndex);
-			const LLColor4& new_color = LLColor4(ctrl->getValue());
-			if( old_color != new_color )
-			{
-				getWearable()->setClothesColor(entry->mTextureIndex, new_color, TRUE);
-				LLVisualParamHint::requestHintUpdates();
-				gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
-			}
-		}
-		else
-		{
-			llwarns << "could not get color swatch dictionary entry for wearable of type: " << type << llendl;
-		}
-	}
-}
-
-void LLPanelEditWearable::updatePanelPickerControls(LLWearableType::EType type)
-{
-	LLPanel* panel = getPanel(type);
-	if (!panel)
-		return;
-
-	bool is_modifiable = false;
-	bool is_copyable   = false;
-
-	if(mWearableItem)
-	{
-		const LLPermissions& perm = mWearableItem->getPermissions();
-		is_modifiable = perm.allowModifyBy(gAgent.getID(), gAgent.getGroupID());
-		is_copyable = perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID());
-	}
-
-	if (is_modifiable)
-	{
-		// Update picker controls
-		for_each_picker_ctrl_entry <LLColorSwatchCtrl> (panel, type, boost::bind(update_color_swatch_ctrl, this, _1, _2));
-		for_each_picker_ctrl_entry <LLTextureCtrl>     (panel, type, boost::bind(update_texture_ctrl, this, _1, _2));
-	}
-	else
-	{
-		// Disable controls
-		for_each_picker_ctrl_entry <LLColorSwatchCtrl> (panel, type, boost::bind(set_enabled_color_swatch_ctrl, false, _1, _2));
-		for_each_picker_ctrl_entry <LLTextureCtrl>     (panel, type, boost::bind(set_enabled_texture_ctrl, false, _1, _2));
-	}
-}
-
-void LLPanelEditWearable::saveChanges(bool force_save_as)
+void LLPanelEditWearable::saveChanges()
 {
 	if (!mWearablePtr || !isDirty())
 	{
@@ -1012,18 +371,15 @@ void LLPanelEditWearable::saveChanges(bool force_save_as)
 	}
 
 	U32 index = gAgentWearables.getWearableIndex(mWearablePtr);
-
-	std::string new_name = mNameEditor->getText();
-	if (force_save_as)
+	
+	if (mWearablePtr->getName().compare(mTextEditor->getText()) != 0)
 	{
 		// the name of the wearable has changed, re-save wearable with new name
-		LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID(),false);
-		gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE);
-		mNameEditor->setText(mWearableItem->getName());
+		gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, mTextEditor->getText(), FALSE);
 	}
 	else
 	{
-		gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name);
+		gAgentWearables.saveWearable(mWearablePtr->getType(), index);
 	}
 }
 
@@ -1036,10 +392,7 @@ void LLPanelEditWearable::revertChanges()
 	}
 
 	mWearablePtr->revertValues();
-	mNameEditor->setText(mWearableItem->getName());
-	updatePanelPickerControls(mWearablePtr->getType());
-	updateTypeSpecificControls(mWearablePtr->getType());
-	gAgentAvatarp->wearableUpdated(mWearablePtr->getType(), FALSE);
+	mTextEditor->setText(mWearablePtr->getName());
 }
 
 void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show)
@@ -1052,195 +405,95 @@ void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show)
 	mWearableItem = gInventory.getItem(mWearablePtr->getItemID());
 	llassert(mWearableItem);
 
-	LLWearableType::EType type = wearable->getType();
+	EWearableType type = wearable->getType();
 	LLPanel *targetPanel = NULL;
 	std::string title;
 	std::string description_title;
 
-	const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
-	if (!wearable_entry)
+	const LLEditWearableDictionary::WearableEntry *entry = LLEditWearableDictionary::getInstance()->getWearable(type);
+	if (!entry)
 	{
 		llwarns << "called LLPanelEditWearable::showWearable with an invalid wearable type! (" << type << ")" << llendl;
 		return;
 	}
 
 	targetPanel = getPanel(type);
-	title = getString(wearable_entry->mTitle);
-	description_title = getString(wearable_entry->mDescTitle);
-
-	// Update picker controls state
-	for_each_picker_ctrl_entry <LLColorSwatchCtrl> (targetPanel, type, boost::bind(set_enabled_color_swatch_ctrl, show, _1, _2));
-	for_each_picker_ctrl_entry <LLTextureCtrl>     (targetPanel, type, boost::bind(set_enabled_texture_ctrl, show, _1, _2));
+	title = getString(entry->mTitle);
+	description_title = getString(entry->mDescTitle);
 
 	targetPanel->setVisible(show);
-	toggleTypeSpecificControls(type);
-
 	if (show)
 	{
 		mPanelTitle->setText(title);
-		mPanelTitle->setToolTip(title);
 		mDescTitle->setText(description_title);
-		
-		// set name
-		mNameEditor->setText(mWearableItem->getName());
-
-		updatePanelPickerControls(type);
-		updateTypeSpecificControls(type);
-
-		// clear and rebuild visual param list
-		U8 num_subparts = wearable_entry->mSubparts.size();
-	
-		for (U8 index = 0; index < num_subparts; ++index)
-		{
-			// dive into data structures to get the panel we need
-			ESubpart subpart_e = wearable_entry->mSubparts[index];
-			const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
-	
-			if (!subpart_entry)
-			{
-				llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
-				continue;
-			}
-	
-			const std::string scrolling_panel = subpart_entry->mParamList;
-			const std::string accordion_tab = subpart_entry->mAccordionTab;
-	
-			LLScrollingPanelList *panel_list = getChild<LLScrollingPanelList>(scrolling_panel);
-			LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab);
-	
-			if (!panel_list)
-			{
-				llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl;
-				continue;
-			}
-	
-			if (!tab)
-			{
-				llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl;
-				continue;
-			}
-	
-			// what edit group do we want to extract params for?
-			const std::string edit_group = subpart_entry->mEditGroup;
-	
-			// storage for ordered list of visual params
-			value_map_t sorted_params;
-			getSortedParams(sorted_params, edit_group);
-
-			LLJoint* jointp = gAgentAvatarp->getJoint( subpart_entry->mTargetJoint );
-			if (!jointp)
-			{
-				jointp = gAgentAvatarp->getJoint("mHead");
-			}
-
-			buildParamList(panel_list, sorted_params, tab, jointp);
-	
-			updateScrollingPanelUI();
-		}
-		showDefaultSubpart();
-
-		updateVerbs();
 	}
-}
 
-void LLPanelEditWearable::showDefaultSubpart()
-{
-	changeCamera(0);
 }
 
-void LLPanelEditWearable::onTabExpandedCollapsed(const LLSD& param, U8 index)
+void LLPanelEditWearable::initializePanel()
 {
-	bool expanded = param.asBoolean();
-
-	if (!mWearablePtr || !gAgentCamera.cameraCustomizeAvatar())
+	if (!mWearablePtr)
 	{
-		// we don't have a valid wearable we're editing, or we've left the wearable editor
+		// cannot initialize with a null reference.
 		return;
 	}
 
-	if (expanded)
-	{
-		changeCamera(index);
-	}
+	EWearableType type = mWearablePtr->getType();
 
-}
+	// set name
+	mTextEditor->setText(mWearablePtr->getName());
 
-void LLPanelEditWearable::changeCamera(U8 subpart)
-{
-	const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mWearablePtr->getType());
+	// clear and rebuild visual param list
+	const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
 	if (!wearable_entry)
 	{
-		llinfos << "could not get wearable dictionary entry for wearable type: " << mWearablePtr->getType() << llendl;
+		llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
 		return;
 	}
+	U8 num_subparts = wearable_entry->mSubparts.size();
 
-	if (subpart >= wearable_entry->mSubparts.size())
+	for (U8 index = 0; index < num_subparts; ++index)
 	{
-		llinfos << "accordion tab expanded for invalid subpart. Wearable type: " << mWearablePtr->getType() << " subpart num: " << subpart << llendl;
-		return;
-	}
-
-	ESubpart subpart_e = wearable_entry->mSubparts[subpart];
-	const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
+		// dive into data structures to get the panel we need
+		ESubpart subpart_e = wearable_entry->mSubparts[index];
+		const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
 
-	if (!subpart_entry)
-	{
-		llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
-		return;
-	}
+		if (!subpart_entry)
+		{
+			llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
+			continue;
+		}
 
-	// Update the camera
-	gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( subpart_entry->mTargetJoint ) );
-	gMorphView->setCameraTargetOffset( subpart_entry->mTargetOffset );
-	gMorphView->setCameraOffset( subpart_entry->mCameraOffset );
-	if (gSavedSettings.getBOOL("AppearanceCameraMovement"))
-	{
-		gMorphView->updateCamera();
-	}
-}
+		const std::string scrolling_panel = subpart_entry->mParamList;
+		const std::string accordion_tab = subpart_entry->mAccordionTab;
 
-void LLPanelEditWearable::updateScrollingPanelList()
-{
-	updateScrollingPanelUI();
-}
+		LLScrollingPanelList *panel_list = getChild<LLScrollingPanelList>(scrolling_panel);
+		LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab);
 
-void LLPanelEditWearable::toggleTypeSpecificControls(LLWearableType::EType type)
-{
-	// Toggle controls specific to shape editing panel.
-	{
-		bool is_shape = (type == LLWearableType::WT_SHAPE);
-		childSetVisible("sex_radio", is_shape);
-		childSetVisible("female_icon", is_shape);
-		childSetVisible("male_icon", is_shape);
-	}
-}
+		if (!panel_list)
+		{
+			llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl;
+			continue;
+		}
 
-void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type)
-{
-	const F32 ONE_METER = 1.0;
-	const F32 ONE_FOOT = 0.3048 * ONE_METER; // in meters
-	// Update controls specific to shape editing panel.
-	if (type == LLWearableType::WT_SHAPE)
-	{
-		// Update avatar height
-		F32 new_size = gAgentAvatarp->mBodySize.mV[VZ];
-		if (gSavedSettings.getBOOL("HeightUnits") == FALSE)
+		if (!tab)
 		{
-			// convert meters to feet
-			new_size = new_size / ONE_FOOT;
+			llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl;
+			continue;
 		}
 
-		std::string avatar_height_str = llformat("%.2f", new_size);
-		mHeigthValue.setArg("[HEIGHT]", avatar_height_str);
-		updateAvatarHeightLabel();
-	}
+		// what edit group do we want to extract params for?
+		const std::string edit_group = subpart_entry->mEditGroup;
 
-	if (LLWearableType::WT_ALPHA == type)
-	{
-		updateAlphaCheckboxes();
+		// storage for ordered list of visual params
+		value_map_t sorted_params;
+		getSortedParams(sorted_params, edit_group);
+
+		buildParamList(panel_list, sorted_params, tab);
 
-		initPreviousAlphaTextures();
+		updateScrollingPanelUI();
 	}
+	updateVerbs();
 }
 
 void LLPanelEditWearable::updateScrollingPanelUI()
@@ -1251,14 +504,12 @@ void LLPanelEditWearable::updateScrollingPanelUI()
 		return;
 	}
 
-	LLWearableType::EType type = mWearablePtr->getType();
+	EWearableType type = mWearablePtr->getType();
 	LLPanel *panel = getPanel(type);
 
 	if(panel && (mWearablePtr->getItemID().notNull()))
 	{
 		const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
-		llassert(wearable_entry);
-		if (!wearable_entry) return;
 		U8 num_subparts = wearable_entry->mSubparts.size();
 
 		LLScrollingPanelParam::sUpdateDelayFrames = 0;
@@ -1283,67 +534,67 @@ void LLPanelEditWearable::updateScrollingPanelUI()
 	}
 }
 
-LLPanel* LLPanelEditWearable::getPanel(LLWearableType::EType type)
+LLPanel* LLPanelEditWearable::getPanel(EWearableType type)
 {
 	switch (type)
 	{
-		case LLWearableType::WT_SHAPE:
+		case WT_SHAPE:
 			return mPanelShape;
 			break;
 
-		case LLWearableType::WT_SKIN:
+		case WT_SKIN:
 			return mPanelSkin;
 			break;
 
-		case LLWearableType::WT_HAIR:
+		case WT_HAIR:
 			return mPanelHair;
 			break;
 
-		case LLWearableType::WT_EYES:
+		case WT_EYES:
 			return mPanelEyes;
 			break;
 
-		case LLWearableType::WT_SHIRT:
+		case WT_SHIRT:
 			return mPanelShirt;
 			break;
 
-		case LLWearableType::WT_PANTS:
+		case WT_PANTS:
 			return mPanelPants;
 			break;
 
-		case LLWearableType::WT_SHOES:
+		case WT_SHOES:
 			return mPanelShoes;
 			break;
 
-		case LLWearableType::WT_SOCKS:
+		case WT_SOCKS:
 			return mPanelSocks;
 			break;
 
-		case LLWearableType::WT_JACKET:
+		case WT_JACKET:
 			return mPanelJacket;
 			break;
 
-		case LLWearableType::WT_GLOVES:
+		case WT_GLOVES:
 			return mPanelGloves;
 			break;
 
-		case LLWearableType::WT_UNDERSHIRT:
+		case WT_UNDERSHIRT:
 			return mPanelUndershirt;
 			break;
 
-		case LLWearableType::WT_UNDERPANTS:
+		case WT_UNDERPANTS:
 			return mPanelUnderpants;
 			break;
 
-		case LLWearableType::WT_SKIRT:
+		case WT_SKIRT:
 			return mPanelSkirt;
 			break;
 
-		case LLWearableType::WT_ALPHA:
+		case WT_ALPHA:
 			return mPanelAlpha;
 			break;
 
-		case LLWearableType::WT_TATTOO:
+		case WT_TATTOO:
 			return mPanelTattoo;
 			break;
 		default:
@@ -1365,8 +616,8 @@ void LLPanelEditWearable::getSortedParams(value_map_t &sorted_params, const std:
 	{
 		LLViewerVisualParam *param = (LLViewerVisualParam*) *iter;
 
-		if (param->getID() == -1 
-			|| !param->isTweakable()
+		if (param->getID() == -1
+			|| param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE 
 			|| param->getEditGroup() != edit_group 
 			|| !(param->getSex() & avatar_sex))
 		{
@@ -1379,7 +630,7 @@ void LLPanelEditWearable::getSortedParams(value_map_t &sorted_params, const std:
 	}
 }
 
-void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab, LLJoint* jointp)
+void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab)
 {
 	// sorted_params is sorted according to magnitude of effect from
 	// least to greatest.  Adding to the front of the child list
@@ -1393,7 +644,7 @@ void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value
 		{
 			LLPanel::Params p;
 			p.name("LLScrollingPanelParam");
-			LLScrollingPanelParam* panel_param = new LLScrollingPanelParam( p, NULL, (*it).second, TRUE, this->getWearable(), jointp);
+			LLScrollingPanelParam* panel_param = new LLScrollingPanelParam( p, NULL, (*it).second, TRUE, this->getWearable());
 			height = panel_list->addPanel( panel_param );
 		}
 	}
@@ -1412,132 +663,6 @@ void LLPanelEditWearable::updateVerbs()
 
 	mBtnRevert->setEnabled(is_dirty);
 	childSetEnabled("save_as_button", is_dirty && can_copy);
-
-	if(isAgentAvatarValid())
-	{
-		// Update viewer's radio buttons (of RadioGroup with control_name="AvatarSex") of Avatar's gender
-		// with value from "AvatarSex" setting
-		gSavedSettings.setU32("AvatarSex", (gAgentAvatarp->getSex() == SEX_MALE) );
-	}
-
-	// update back button and title according to dirty state.
-	static BOOL was_dirty = FALSE;
-	if (was_dirty != is_dirty) // to avoid redundant changes because this method is called from draw
-	{
-		static S32 label_width = mBtnBack->getFont()->getWidth(mBackBtnLabel);
-		const std::string& label = is_dirty ? mBackBtnLabel : LLStringUtil::null;
-		const S32 delta_width = is_dirty ? label_width : -label_width;
-
-		mBtnBack->setLabel(label);
-
-		// update rect according to label width
-		LLRect rect = mBtnBack->getRect();
-		rect.mRight += delta_width;
-		mBtnBack->setShape(rect);
-
-		// update title rect according to back button width
-		rect = mPanelTitle->getRect();
-		rect.mLeft += delta_width;
-		mPanelTitle->setShape(rect);
-
-		was_dirty = is_dirty;
-	}
-}
-
-void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name)
-{
-	LLCheckBoxCtrl* checkbox = mPanelAlpha->getChild<LLCheckBoxCtrl>(name);
-	checkbox->setCommitCallback(boost::bind(&LLPanelEditWearable::onInvisibilityCommit, this, checkbox, te));
-
-	mAlphaCheckbox2Index[name] = te;
-}
-
-void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te)
-{
-	if (!checkbox_ctrl) return;
-	if (!getWearable()) return;
-
-	llinfos << "onInvisibilityCommit, self " << this << " checkbox_ctrl " << checkbox_ctrl << llendl;
-
-	bool new_invis_state = checkbox_ctrl->get();
-	if (new_invis_state)
-	{
-		LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
-		mPreviousAlphaTexture[te] = lto->getID();
-		
-		LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( IMG_INVISIBLE );
-		U32 index = gAgentWearables.getWearableIndex(getWearable());
-		gAgentAvatarp->setLocalTexture(te, image, FALSE, index);
-		gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
-	}
-	else
-	{
-		// Try to restore previous texture, if any.
-		LLUUID prev_id = mPreviousAlphaTexture[te];
-		if (prev_id.isNull() || (prev_id == IMG_INVISIBLE))
-		{
-			prev_id = LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) );
-		}
-		if (prev_id.isNull()) return;
-		
-		LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(prev_id);
-		if (!image) return;
-
-		U32 index = gAgentWearables.getWearableIndex(getWearable());
-		gAgentAvatarp->setLocalTexture(te, image, FALSE, index);
-		gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
-	}
-
-	updatePanelPickerControls(getWearable()->getType());
 }
 
-void LLPanelEditWearable::updateAlphaCheckboxes()
-{
-	for(string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin();
-		iter != mAlphaCheckbox2Index.end(); ++iter )
-	{
-		LLVOAvatarDefines::ETextureIndex te = (LLVOAvatarDefines::ETextureIndex)iter->second;
-		LLCheckBoxCtrl* ctrl = mPanelAlpha->getChild<LLCheckBoxCtrl>(iter->first);
-		if (ctrl)
-		{
-			ctrl->set(!gAgentAvatarp->isTextureVisible(te, mWearablePtr));
-		}
-	}
-}
-
-void LLPanelEditWearable::initPreviousAlphaTextures()
-{
-	initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
-	initPreviousAlphaTextureEntry(TEX_UPPER_ALPHA);
-	initPreviousAlphaTextureEntry(TEX_HEAD_ALPHA);
-	initPreviousAlphaTextureEntry(TEX_EYES_ALPHA);
-	initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
-}
-
-void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te)
-{
-	LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
-	if (lto)
-	{
-		mPreviousAlphaTexture[te] = lto->getID();
-	}
-}
-
-// handle secondlife:///app/metricsystem
-class LLMetricSystemHandler : public LLCommandHandler
-{
-public:
-	LLMetricSystemHandler() : LLCommandHandler("metricsystem", UNTRUSTED_THROTTLE) { }
-
-	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
-	{
-		// change height units TRUE for meters and FALSE for feet
-		BOOL new_value = (gSavedSettings.getBOOL("HeightUnits") == FALSE) ? TRUE : FALSE;
-		gSavedSettings.setBOOL("HeightUnits", new_value);
-		return true;
-	}
-};
-
-LLMetricSystemHandler gMetricSystemHandler;
-
 // EOF
diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h
index 2d586276a6442892e863806f71fbf0148a8e0f8c..8b63685177bd8e2d050b5154fb4b2477b220b259 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -1,26 +1,32 @@
 /** 
- * @file llpaneleditwearable.h
- * @brief A LLPanel dedicated to the editing of wearables.
+ * @file llfloatercustomize.h
+ * @brief The customize avatar floater, triggered by "Appearance..."
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -30,20 +36,16 @@
 #include "llpanel.h"
 #include "llscrollingpanellist.h"
 #include "llmodaldialog.h"
-#include "llvoavatardefines.h"
-#include "llwearabletype.h"
+#include "llwearabledictionary.h"
 
-class LLAccordionCtrl;
-class LLCheckBoxCtrl;
 class LLWearable;
+class LLTextEditor;
 class LLTextBox;
 class LLViewerInventoryItem;
 class LLViewerVisualParam;
 class LLVisualParamHint;
 class LLViewerJointMesh;
 class LLAccordionCtrlTab;
-class LLJoint;
-class LLLineEditor;
 
 class LLPanelEditWearable : public LLPanel
 {
@@ -58,60 +60,23 @@ class LLPanelEditWearable : public LLPanel
 	LLWearable* 		getWearable() { return mWearablePtr; }
 	void				setWearable(LLWearable *wearable);
 
-	void				saveChanges(bool force_save_as = false);
+	void				saveChanges();
 	void				revertChanges();
 
-	void				showDefaultSubpart();
-	void				onTabExpandedCollapsed(const LLSD& param, U8 index);
-
-	void 				updateScrollingPanelList();
-
 	static void			onRevertButtonClicked(void* userdata);
-	void				onCommitSexChange();
-	void				onSaveAsButtonClicked();
-	void				saveAsCallback(const LLSD& notification, const LLSD& response);
-
 
 private:
 	typedef std::map<F32, LLViewerVisualParam*> value_map_t;
 
 	void				showWearable(LLWearable* wearable, BOOL show);
+	void				initializePanel();
 	void				updateScrollingPanelUI();
-	LLPanel*			getPanel(LLWearableType::EType type);
+	LLPanel*			getPanel(EWearableType type);
 	void				getSortedParams(value_map_t &sorted_params, const std::string &edit_group);
-	void				buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab, LLJoint* jointp);
+	void				buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab);
 	// update bottom bar buttons ("Save", "Revert", etc)
 	void				updateVerbs();
 
-	void				onColorSwatchCommit(const LLUICtrl*);
-	void				onTexturePickerCommit(const LLUICtrl*);
-	void				updatePanelPickerControls(LLWearableType::EType type);
-	void				toggleTypeSpecificControls(LLWearableType::EType type);
-	void				updateTypeSpecificControls(LLWearableType::EType type);
-
-	// changes camera angle to default for selected subpart
-	void				changeCamera(U8 subpart);
-
-	//alpha mask checkboxes
-	void configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name);
-	void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te);
-	void updateAlphaCheckboxes();
-	void initPreviousAlphaTextures();
-	void initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te);
-
-	// callback for HeightUnits parameter.
-	bool changeHeightUnits(const LLSD& new_value);
-
-	// updates current metric and replacemet metric label text
-	void updateMetricLayout(BOOL new_value);
-
-	// updates avatar height label
-	void updateAvatarHeightLabel();
-
-	void onWearablePanelVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl);
-
-	void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel);
-
 	// the pointer to the wearable we're editing. NULL means we're not editing a wearable.
 	LLWearable *mWearablePtr;
 	LLViewerInventoryItem* mWearableItem;
@@ -119,28 +84,14 @@ class LLPanelEditWearable : public LLPanel
 	// these are constant no matter what wearable we're editing
 	LLButton *mBtnRevert;
 	LLButton *mBtnBack;
-	std::string mBackBtnLabel;
 
 	LLTextBox *mPanelTitle;
 	LLTextBox *mDescTitle;
-	LLTextBox *mTxtAvatarHeight;
-
 
-	// localized and parametrized strings that used to build avatar_height_label
-	std::string mMeters;
-	std::string mFeet;
-	std::string mHeigth;
-	LLUIString  mHeigthValue;
-	LLUIString  mReplacementMetricUrl;
-
-	// color for mHeigth string
-	LLUIColor mAvatarHeigthLabelColor;
-	// color for mHeigthValue string
-	LLUIColor mAvatarHeigthValueLabelColor;
 
 	// This text editor reference will change each time we edit a new wearable - 
 	// it will be grabbed from the currently visible panel
-	LLLineEditor *mNameEditor;
+	LLTextEditor *mTextEditor;
 
 	// The following panels will be shown/hidden based on what wearable we're editing
 	// body parts
@@ -162,11 +113,6 @@ class LLPanelEditWearable : public LLPanel
 	LLPanel *mPanelAlpha;
 	LLPanel *mPanelTattoo;
 
-	typedef std::map<std::string, LLVOAvatarDefines::ETextureIndex> string_texture_index_map_t;
-	string_texture_index_map_t mAlphaCheckbox2Index;
-
-	typedef std::map<LLVOAvatarDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
-	s32_uuid_map_t mPreviousAlphaTexture;
 };
 
 #endif
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index 347937af013abc7a2485ed547b7c32265dd9e013..c00b6a41473e187e2b3368645cab0ef1263a72bd 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file llpanelgroup.cpp
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -86,7 +92,8 @@ LLPanelGroup::LLPanelGroup()
 :	LLPanel(),
 	LLGroupMgrObserver( LLUUID() ),
 	mSkipRefresh(FALSE),
-	mButtonJoin(NULL)
+	mButtonJoin(NULL),
+	mShowingNotifyDialog(false)
 {
 	// Set up the factory callbacks.
 	// Roles sub tabs
@@ -176,11 +183,6 @@ BOOL LLPanelGroup::postBuild()
 	LLPanelGroupTab* panel_notices = findChild<LLPanelGroupTab>("group_notices_tab_panel");
 	LLPanelGroupTab* panel_land = findChild<LLPanelGroupTab>("group_land_tab_panel");
 
-	if (LLAccordionCtrl* accordion_ctrl = getChild<LLAccordionCtrl>("groups_accordion"))
-	{
-		setVisibleCallback(boost::bind(&LLPanelGroup::onVisibilityChange, this, _2, accordion_ctrl));
-	}
-
 	if(panel_general)	mTabs.push_back(panel_general);
 	if(panel_roles)		mTabs.push_back(panel_roles);
 	if(panel_notices)	mTabs.push_back(panel_notices);
@@ -199,7 +201,7 @@ BOOL LLPanelGroup::postBuild()
 		mJoinText = panel_general->getChild<LLUICtrl>("join_cost_text");
 	}
 
-	LLVoiceClient::getInstance()->addObserver(this);
+	gVoiceClient->addObserver(this);
 	
 	return TRUE;
 }
@@ -304,13 +306,6 @@ void LLPanelGroup::onBtnCancel()
 	onBackBtnClick();
 }
 
-void LLPanelGroup::onVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl)
-{
-	if (in_visible_chain.asBoolean() && accordion_ctrl != NULL)
-	{
-		accordion_ctrl->expandDefaultTab();
-	}
-}
 
 void LLPanelGroup::changed(LLGroupChange gc)
 {
@@ -327,7 +322,7 @@ void LLPanelGroup::onChange(EStatusType status, const std::string &channelURI, b
 		return;
 	}
 
-	childSetEnabled("btn_call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
+	childSetEnabled("btn_call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
 }
 
 void LLPanelGroup::notifyObservers()
@@ -634,4 +629,69 @@ void LLPanelGroup::showNotice(const std::string& subject,
 
 }
 
+bool	LLPanelGroup::canClose()
+{
+	if(getVisible() == false)
+		return true;
+
+	bool need_save = false;
+	std::string mesg;
+	for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+		if(need_save|=(*it)->needsApply(mesg))
+			break;
+	if(!need_save)
+		return false;
+	// If no message was provided, give a generic one.
+	if (mesg.empty())
+	{
+		mesg = mDefaultNeedsApplyMesg;
+	}
+	// Create a notify box, telling the user about the unapplied tab.
+	LLSD args;
+	args["NEEDS_APPLY_MESSAGE"] = mesg;
+	args["WANT_APPLY_MESSAGE"] = mWantApplyMesg;
+
+	LLNotificationsUtil::add("SaveChanges", args, LLSD(), boost::bind(&LLPanelGroup::handleNotifyCallback,this, _1, _2));
+
+	mShowingNotifyDialog = true;
+
+	return false;
+}
+
+bool	LLPanelGroup::notifyChildren(const LLSD& info)
+{
+	if(info.has("request") && mID.isNull() )
+	{
+		std::string str_action = info["request"];
+
+		if (str_action == "quit" )
+		{
+			canClose();
+			return true;
+		}
+		if(str_action == "wait_quit")
+			return mShowingNotifyDialog;
+	}
+	return false;
+}
+bool LLPanelGroup::handleNotifyCallback(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	mShowingNotifyDialog = false;
+	switch (option)
+	{
+	case 0: // "Apply Changes"
+		apply();
+		break;
+	case 1: // "Ignore Changes"
+		break;
+	case 2: // "Cancel"
+	default:
+		// Do nothing.  The user is canceling the action.
+		// If we were quitting, we didn't really mean it.
+		LLAppViewer::instance()->abortQuit();
+		break;
+	}
+	return false;
+}
 
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 3c752f760609c9ef632026fb9f549481f2c6df7e..0a83ba8212f1979b0ac8d81f0323919a34518056 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -2,25 +2,31 @@
  * @file llpanelgroupgeneral.cpp
  * @brief General information about a group.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -206,6 +212,7 @@ void LLPanelGroupGeneral::setupCtrls(LLPanel* panel_group)
 	if (mInsignia)
 	{
 		mInsignia->setCommitCallback(onCommitAny, this);
+		mDefaultIconID = mInsignia->getImageAssetID();
 	}
 	mFounderName = getChild<LLNameBox>("founder_name");
 
@@ -442,8 +449,6 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
 
 	gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);
 
-	resetDirty();
-
 	mChanged = FALSE;
 
 	return true;
@@ -651,7 +656,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
 		}
 		else
 		{
-			mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
+			mInsignia->setImageAssetID(mDefaultIconID);
 		}
 	}
 
@@ -841,8 +846,6 @@ void LLPanelGroupGeneral::reset()
 	
 	mInsignia->setEnabled(true);
 
-	mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
-
 	{
 		std::string empty_str = "";
 		mEditCharter->setText(empty_str);
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index 535b2a9e2dea703af2e06e2a9cf7d15483a56649..11d3768a3dd56f21dcea83fd180da3260ff946e1 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file llpanelgroupinvite.cpp
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpanelgroupinvite.h b/indra/newview/llpanelgroupinvite.h
index 01e73154867281296d96ecfd190ae31f19f3629b..2ed443ed46987b31e91a2706dfeabae567cc7503 100644
--- a/indra/newview/llpanelgroupinvite.h
+++ b/indra/newview/llpanelgroupinvite.h
@@ -1,25 +1,31 @@
 /** 
  * @file llpanelgroupinvite.h
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index 3514664f019555b53723292ec7939d03caaa089e..9ac3a0704175819642b95ad49d3b730333386c19 100644
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -2,25 +2,31 @@
  * @file llpanelgrouplandmoney.cpp
  * @brief Panel for group land and L$.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -230,7 +236,6 @@ class LLPanelGroupLandMoney::impl
 
 	std::string mCantViewParcelsText;
 	std::string mCantViewAccountsText;
-	std::string mEmptyParcelsText;
 };
 
 //*******************************************
@@ -447,7 +452,6 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)
 		// This power was removed to make group roles simpler
 		//if ( !gAgent.hasPowerInGroup(mGroupID, GP_LAND_VIEW_OWNED) ) return;
 		if (!gAgent.isInGroup(mPanel.mGroupID)) return;
-		mGroupParcelsp->setCommentText(mEmptyParcelsText);
 
 		std::string name;
 		std::string desc;
@@ -692,7 +696,6 @@ BOOL LLPanelGroupLandMoney::postBuild()
 
 	mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text");
 	mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text");
-	mImplementationp->mEmptyParcelsText = getString("epmty_view_group_land_text");
 	
 	if ( mImplementationp->mMapButtonp )
 	{
@@ -1426,10 +1429,10 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg,
 // 	text.append(llformat( "%-24s %6d      %6d \n", LLTrans::getString("GroupMoneyDebits").c_str(), total_debits, (S32)floor((F32)total_debits/(F32)non_exempt_members)));
 // 	text.append(llformat( "%-24s %6d      %6d \n", LLTrans::getString("GroupMoneyTotal").c_str(), total_credits + total_debits,  (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members)));
 
-	text.append(llformat( "%s\n", LLTrans::getString("GroupColumn").c_str()));
-	text.append(llformat( "%-24s %6d\n", LLTrans::getString("GroupMoneyCredits").c_str(), total_credits));
-	text.append(llformat( "%-24s %6d\n", LLTrans::getString("GroupMoneyDebits").c_str(), total_debits));
-	text.append(llformat( "%-24s %6d\n", LLTrans::getString("GroupMoneyTotal").c_str(), total_credits + total_debits));
+	text.append( "                      Group\n");
+	text.append(llformat( "%-24s %6d\n", "Credits", total_credits));
+	text.append(llformat( "%-24s %6d\n", "Debits", total_debits));
+	text.append(llformat( "%-24s %6d\n", "Total", total_credits + total_debits));
 	
 	if ( mImplementationp->mTextEditorp )
 	{
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index a24dbf6681504c9ddd4f59e82f56745742555e11..8da19d15743d429ab766a0b338237fb08901a49e 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -2,25 +2,31 @@
  * @file llpanelgroupnotices.cpp
  * @brief A panel to display group notices.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -38,6 +44,7 @@
 #include "llfloaterinventory.h"
 #include "llagent.h"
 #include "llagentui.h"
+#include "lltooldraganddrop.h"
 
 #include "lllineeditor.h"
 #include "lltexteditor.h"
@@ -53,7 +60,6 @@
 #include "llviewerwindow.h"
 #include "llviewermessage.h"
 #include "llnotificationsutil.h"
-#include "llgiveinventory.h"
 
 static LLRegisterPanelClassWrapper<LLPanelGroupNotices> t_panel_group_notices("panel_group_notices");
 
@@ -156,7 +162,7 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 		{
 			LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
 			if(gInventory.getItem(inv_item->getUUID())
-				&& LLGiveInventory::isInventoryGroupGiveAcceptable(inv_item))
+				&& LLToolDragAndDrop::isInventoryGroupGiveAcceptable(inv_item))
 			{
 				// *TODO: get multiple object transfers working
 				*accept = ACCEPT_YES_COPY_SINGLE;
@@ -329,7 +335,7 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item)
 		item_is_multi = TRUE;
 	};
 
-	std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
+	std::string icon_name = get_item_icon_name(inv_item->getType(),
 										inv_item->getInventoryType(),
 										inv_item->getFlags(),
 										item_is_multi );
@@ -511,11 +517,6 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
 
 	mNoticesList->setEnabled(TRUE);
 
-	//save sort state and set unsorted state to prevent unnecessary 
-	//sorting while adding notices
-	bool save_sort = mNoticesList->isSorted();
-	mNoticesList->setNeedsSort(false);
-
 	for (;i<count;++i)
 	{
 		msg->getUUID("Data","NoticeID",id,i);
@@ -526,13 +527,6 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
 			mNoticesList->setEnabled(FALSE);
 			return;
 		}
-
-		//with some network delays we can receive notice list more then once...
-		//so add only unique notices
-		S32 pos = mNoticesList->getItemIndex(id);
-
-		if(pos!=-1)//if items with this ID already in the list - skip it
-			continue;
 			
 		msg->getString("Data","Subject",subj,i);
 		msg->getString("Data","FromName",name,i);
@@ -546,9 +540,9 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
 		row["columns"][0]["column"] = "icon";
 		if (has_attachment)
 		{
-			std::string icon_name = LLInventoryIcon::getIconName(
+			std::string icon_name = get_item_icon_name(
 									(LLAssetType::EType)asset_type,
-									LLInventoryType::IT_NONE);
+									LLInventoryType::IT_NONE,FALSE, FALSE);
 			row["columns"][0]["type"] = "icon";
 			row["columns"][0]["value"] = icon_name;
 		}
@@ -568,7 +562,6 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
 		mNoticesList->addElement(row, ADD_BOTTOM);
 	}
 
-	mNoticesList->setNeedsSort(save_sort);
 	mNoticesList->updateSort();
 }
 
@@ -614,8 +607,9 @@ void LLPanelGroupNotices::showNotice(const std::string& subject,
 	{
 		mInventoryOffer = inventory_offer;
 
-		std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType,
-												LLInventoryType::IT_TEXTURE);
+		std::string icon_name = get_item_icon_name(mInventoryOffer->mType,
+												LLInventoryType::IT_TEXTURE,
+												0, FALSE);
 
 		mViewInventoryIcon->setValue(icon_name);
 		mViewInventoryIcon->setVisible(TRUE);
@@ -662,9 +656,6 @@ void LLPanelGroupNotices::setGroupID(const LLUUID& id)
 
 	if(mViewMessage) 
 		mViewMessage->clear();
-
-	if(mViewInventoryName)
-		mViewInventoryName->clear();
 	
 	activate();
 }
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index 579a271ce818ebee8ed51c220d14d1f35a753cd8..0c24e6ad22646d6f5c5cbfe6c6d4eaddc72cc61d 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -2,25 +2,31 @@
  * @file llpanelgrouproles.cpp
  * @brief Panel for roles information about a particular group.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -45,7 +51,6 @@
 #include "lltabcontainer.h"
 #include "lltextbox.h"
 #include "lltexteditor.h"
-#include "lltrans.h"
 #include "llviewertexturelist.h"
 #include "llviewerwindow.h"
 #include "llfocusmgr.h"
@@ -113,7 +118,8 @@ LLPanelGroupRoles::LLPanelGroupRoles()
 	mCurrentTab(NULL),
 	mRequestedTab( NULL ),
 	mSubTabContainer( NULL ),
-	mFirstUse( TRUE )
+	mFirstUse( TRUE ),
+	mIgnoreTransition( FALSE )
 {
 }
 
@@ -139,6 +145,8 @@ BOOL LLPanelGroupRoles::postBuild()
 			llwarns << "Invalid subtab panel: " << panel->getName() << llendl;
 			return FALSE;
 		}
+		// Add click callbacks to all the tabs.
+		mSubTabContainer->setCommitCallback(boost::bind(&LLPanelGroupRoles::handleClickSubTab, this));
 
 		// Hand the subtab a pointer to this LLPanelGroupRoles, so that it can
 		// look around for the widgets it is interested in.
@@ -147,8 +155,6 @@ BOOL LLPanelGroupRoles::postBuild()
 
 		//subtabp->addObserver(this);
 	}
-	// Add click callbacks to tab switching.
-	mSubTabContainer->setValidateBeforeCommit(boost::bind(&LLPanelGroupRoles::handleSubTabSwitch, this, _1));
 
 	// Set the current tab to whatever is currently being shown.
 	mCurrentTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
@@ -190,17 +196,30 @@ BOOL LLPanelGroupRoles::isVisibleByAgent(LLAgent* agentp)
 								   
 }
 
-bool LLPanelGroupRoles::handleSubTabSwitch(const LLSD& data)
+void LLPanelGroupRoles::handleClickSubTab()
 {
-	std::string panel_name = data.asString();
-	
-	if(mRequestedTab != NULL)//we already have tab change request
+	// If we are already handling a transition,
+	// ignore this.
+	if (mIgnoreTransition)
 	{
-		return false;
+		return;
 	}
 
-	mRequestedTab = static_cast<LLPanelGroupTab*>(mSubTabContainer->getPanelByName(panel_name));
+	mRequestedTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
 
+	// Make sure they aren't just clicking the same tab...
+	if (mRequestedTab == mCurrentTab)
+	{
+		return;
+	}
+
+	// Try to switch from the current panel to the panel the user selected.
+	attemptTransition();
+}
+
+BOOL LLPanelGroupRoles::attemptTransition()
+{
+	// Check if the current tab needs to be applied.
 	std::string mesg;
 	if (mCurrentTab && mCurrentTab->needsApply(mesg))
 	{
@@ -216,14 +235,26 @@ bool LLPanelGroupRoles::handleSubTabSwitch(const LLSD& data)
 		LLNotificationsUtil::add("PanelGroupApply", args, LLSD(),
 			boost::bind(&LLPanelGroupRoles::handleNotifyCallback, this, _1, _2));
 		mHasModal = TRUE;
-		
+		// We need to reselect the current tab, since it isn't finished.
+		if (mSubTabContainer)
+		{
+			mIgnoreTransition = TRUE;
+			mSubTabContainer->selectTabPanel( mCurrentTab );
+			mIgnoreTransition = FALSE;
+		}
 		// Returning FALSE will block a close action from finishing until
 		// we get a response back from the user.
-		return false;
+		return FALSE;
+	}
+	else
+	{
+		// The current panel didn't have anything it needed to apply.
+		if (mRequestedTab)
+		{
+			transitionToTab();
+		}
+		return TRUE;
 	}
-
-	transitionToTab();
-	return true;
 }
 
 void LLPanelGroupRoles::transitionToTab()
@@ -240,7 +271,6 @@ void LLPanelGroupRoles::transitionToTab()
 		// This is now the current tab;
 		mCurrentTab = mRequestedTab;
 		mCurrentTab->activate();
-		mRequestedTab = 0;
 	}
 }
 
@@ -248,7 +278,6 @@ bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLS
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 	mHasModal = FALSE;
-	LLPanelGroupTab* transition_tab = mRequestedTab;
 	switch (option)
 	{
 	case 0: // "Apply Changes"
@@ -268,20 +297,26 @@ bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLS
 			// Skip switching tabs.
 			break;
 		}
+
+		// This panel's info successfully applied.
+		// Switch to the next panel.
+		// No break!  Continue into 'Ignore Changes' which just switches tabs.
+		mIgnoreTransition = TRUE;
+		mSubTabContainer->selectTabPanel( mRequestedTab );
+		mIgnoreTransition = FALSE;
 		transitionToTab();
-		mSubTabContainer->selectTabPanel( transition_tab );
-		
 		break;
 	}
 	case 1: // "Ignore Changes"
 		// Switch to the requested panel without applying changes
 		cancel();
+		mIgnoreTransition = TRUE;
+		mSubTabContainer->selectTabPanel( mRequestedTab );
+		mIgnoreTransition = FALSE;
 		transitionToTab();
-		mSubTabContainer->selectTabPanel( transition_tab );
 		break;
 	case 2: // "Cancel"
 	default:
-		mRequestedTab = NULL;
 		// Do nothing.  The user is canceling the action.
 		break;
 	}
@@ -582,7 +617,7 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
 
 		row["columns"][1]["column"] = "action";
 		row["columns"][1]["type"] = "text";
-		row["columns"][1]["value"] = LLTrans::getString(action_set->mActionSetData->mName);
+		row["columns"][1]["value"] = action_set->mActionSetData->mName;
 		row["columns"][1]["font"]["name"] = "SANSSERIF_SMALL";
 		
 
@@ -792,39 +827,8 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
 
 void LLPanelGroupMembersSubTab::setGroupID(const LLUUID& id)
 {
-	//clear members list
-	if(mMembersList) mMembersList->deleteAllItems();
-	if(mAssignedRolesList) mAssignedRolesList->deleteAllItems();
-	if(mAllowedActionsList) mAllowedActionsList->deleteAllItems();
-
 	LLPanelGroupSubTab::setGroupID(id);
-}
-
-void LLPanelGroupRolesSubTab::setGroupID(const LLUUID& id)
-{
-	if(mRolesList) mRolesList->deleteAllItems();
-	if(mAssignedMembersList) mAssignedMembersList->deleteAllItems();
-	if(mAllowedActionsList) mAllowedActionsList->deleteAllItems();
-
-	if(mRoleName) mRoleName->clear();
-	if(mRoleDescription) mRoleDescription->clear();
-	if(mRoleTitle) mRoleTitle->clear();
 
-	mHasRoleChange = FALSE;
-
-	setFooterEnabled(FALSE);
-
-	LLPanelGroupSubTab::setGroupID(id);
-}
-void LLPanelGroupActionsSubTab::setGroupID(const LLUUID& id)
-{
-	if(mActionList) mActionList->deleteAllItems();
-	if(mActionRoles) mActionRoles->deleteAllItems();
-	if(mActionMembers) mActionMembers->deleteAllItems();
-
-	if(mActionDescription) mActionDescription->clear();
-
-	LLPanelGroupSubTab::setGroupID(id);
 }
 
 
@@ -1588,7 +1592,6 @@ void LLPanelGroupMembersSubTab::updateMembers()
 
 
 	LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
-	LLUIString donated = getString("donation_area");
 
 	S32 i = 0;
 	for( ; mMemberProgress != end && i<UPDATE_MEMBERS_PER_FRAME; 
@@ -1610,7 +1613,9 @@ void LLPanelGroupMembersSubTab::updateMembers()
 
 		if (add_member)
 		{
-			donated.setArg("[AREA]", llformat("%d", mMemberProgress->second->getContribution()));
+			// Build the donated tier string.
+			std::ostringstream donated;
+			donated << mMemberProgress->second->getContribution() << " sq. m.";
 
 			LLSD row;
 			row["id"] = (*mMemberProgress).first;
@@ -1619,7 +1624,7 @@ void LLPanelGroupMembersSubTab::updateMembers()
 			// value is filled in by name list control
 
 			row["columns"][1]["column"] = "donated";
-			row["columns"][1]["value"] = donated.getString();
+			row["columns"][1]["value"] = donated.str();
 
 			row["columns"][2]["column"] = "online";
 			row["columns"][2]["value"] = mMemberProgress->second->getOnlineStatus();
@@ -1745,7 +1750,8 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
 	mRoleTitle->setKeystrokeCallback(onPropertiesKey, this);
 
 	mRoleDescription->setCommitOnFocusLost(TRUE);
-	mRoleDescription->setKeystrokeCallback(boost::bind(&LLPanelGroupRolesSubTab::onDescriptionKeyStroke, this, _1));
+	mRoleDescription->setCommitCallback(onDescriptionCommit, this);
+	mRoleDescription->setFocusReceivedCallback(boost::bind(onDescriptionFocus, _1, this));
 
 	setFooterEnabled(FALSE);
 
@@ -2201,10 +2207,14 @@ void LLPanelGroupRolesSubTab::onPropertiesKey(LLLineEditor* ctrl, void* user_dat
 	self->notifyObservers();
 }
 
-void LLPanelGroupRolesSubTab::onDescriptionKeyStroke(LLTextEditor* caller)
+// static 
+void LLPanelGroupRolesSubTab::onDescriptionFocus(LLFocusableElement* ctrl, void* user_data)
 {
-	mHasRoleChange = TRUE;
-	notifyObservers();
+	LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
+	if (!self) return;
+
+	self->mHasRoleChange = TRUE;
+	self->notifyObservers();
 }
 
 // static 
diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h
index 6a773f1ebb3d6717e45d8b8a8f6ad9b77bb41660..98cebe9882bd801d539ec2f6668eb8da27a55df4 100644
--- a/indra/newview/llpanelgrouproles.h
+++ b/indra/newview/llpanelgrouproles.h
@@ -2,25 +2,31 @@
  * @file llpanelgrouproles.h
  * @brief Panel for roles information about a particular group.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -59,7 +65,7 @@ class LLPanelGroupRoles : public LLPanelGroupTab
 	virtual BOOL isVisibleByAgent(LLAgent* agentp);
 
 	
-	bool handleSubTabSwitch(const LLSD& data);
+	void handleClickSubTab();
 
 	// Checks if the current tab needs to be applied, and tries to switch to the requested tab.
 	BOOL attemptTransition();
@@ -87,6 +93,7 @@ class LLPanelGroupRoles : public LLPanelGroupTab
 	LLPanelGroupTab*		mRequestedTab;
 	LLTabContainer*	mSubTabContainer;
 	BOOL					mFirstUse;
+	BOOL					mIgnoreTransition;
 
 	std::string				mDefaultNeedsApplyMesg;
 	std::string				mWantApplyMesg;
@@ -238,9 +245,8 @@ class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab
 
 	static void onPropertiesKey(LLLineEditor*, void*);
 
-	void onDescriptionKeyStroke(LLTextEditor* caller);
-
 	static void onDescriptionCommit(LLUICtrl*, void*);
+	static void onDescriptionFocus(LLFocusableElement*, void*);
 
 	static void onMemberVisibilityChange(LLUICtrl*, void*);
 	void handleMemberVisibilityChange(bool value);
@@ -252,8 +258,6 @@ class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab
 	void handleDeleteRole();
 
 	void saveRoleChanges();
-
-	virtual void setGroupID(const LLUUID& id);
 protected:
 	void handleActionCheck(LLUICtrl* ctrl, bool force);
 	LLSD createRoleItem(const LLUUID& role_id, std::string name, std::string title, S32 members);
@@ -291,8 +295,6 @@ class LLPanelGroupActionsSubTab : public LLPanelGroupSubTab
 	virtual void update(LLGroupChange gc);
 
 	void handleActionSelect();
-
-	virtual void setGroupID(const LLUUID& id);
 protected:
 	LLScrollListCtrl*	mActionList;
 	LLScrollListCtrl*	mActionRoles;
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index 9dc31f770f374fa3c52e02a1ccdc0575d723cf37..c34f0633b9860445303aef6eefa9862fcfdfa65c 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -2,25 +2,31 @@
  * @file llpanelavatar.cpp
  * @brief LLPanelAvatar and related class implementations
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -31,7 +37,6 @@
 #include "llpanelimcontrolpanel.h"
 
 #include "llagent.h"
-#include "llappviewer.h" // for gDisconnected
 #include "llavataractions.h"
 #include "llavatariconctrl.h"
 #include "llbutton.h"
@@ -76,8 +81,7 @@ void LLPanelChatControlPanel::onVoiceChannelStateChanged(const LLVoiceChannel::E
 
 void LLPanelChatControlPanel::updateCallButton()
 {
-	// hide/show call button
-	bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+	bool voice_enabled = LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
 
 	LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId);
 	
@@ -120,7 +124,7 @@ BOOL LLPanelChatControlPanel::postBuild()
 	childSetAction("end_call_btn", boost::bind(&LLPanelChatControlPanel::onEndCallButtonClicked, this));
 	childSetAction("voice_ctrls_btn", boost::bind(&LLPanelChatControlPanel::onOpenVoiceControlsClicked, this));
 
-	LLVoiceClient::getInstance()->addObserver(this);
+	gVoiceClient->addObserver(this);
 
 	return TRUE;
 }
@@ -158,7 +162,7 @@ BOOL LLPanelIMControlPanel::postBuild()
 	childSetAction("pay_btn", boost::bind(&LLPanelIMControlPanel::onPayButtonClicked, this));
 	childSetEnabled("add_friend_btn", !LLAvatarActions::isFriend(getChild<LLAvatarIconCtrl>("avatar_icon")->getAvatarId()));
 
-	setFocusReceivedCallback(boost::bind(&LLPanelIMControlPanel::onFocusReceived, this));
+	
 	
 	return LLPanelChatControlPanel::postBuild();
 }
@@ -189,15 +193,6 @@ void LLPanelIMControlPanel::onShareButtonClicked()
 	LLAvatarActions::share(mAvatarID);
 }
 
-void LLPanelIMControlPanel::onFocusReceived()
-{
-	// Disable all the buttons (Call, Teleport, etc) if disconnected.
-	if (gDisconnected)
-	{
-		setAllChildrenEnabled(FALSE);
-	}
-}
-
 void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id)
 {
 	LLPanelChatControlPanel::setSessionId(session_id);
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index e6281f4605decc1e289509ca2d4013f5cd6a68f7..4ffd43cb0febe3b2cb59feee775ff370b3a71c85 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -2,25 +2,31 @@
  * @file llpanellandmarkinfo.cpp
  * @brief Displays landmark info in Side Tray.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index d8250718251de6705022a7f50a743d31d8ed801a..8d8c996374e91259672f346d6ee0d12e2dfa5186 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -2,25 +2,30 @@
  * @file llpanellandmarks.cpp
  * @brief Landmarks tab for Side Bar "Places" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -216,6 +221,8 @@ BOOL LLLandmarksPanel::postBuild()
 	// mast be called before any other initXXX methods to init Gear menu
 	initListCommandsHandlers();
 
+	U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER);
+	mSortByDate = sort_order & LLInventoryFilter::SO_DATE;
 	initFavoritesInventoryPanel();
 	initLandmarksInventoryPanel();
 	initMyInventoryPanel();
@@ -273,17 +280,6 @@ void LLLandmarksPanel::onShowOnMap()
 	doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doShowOnMap, this, _1));
 }
 
-//virtual
-void LLLandmarksPanel::onShowProfile()
-{
-	LLFolderViewItem* cur_item = getCurSelectedItem();
-
-	if(!cur_item)
-		return;
-
-	cur_item->getListener()->performAction(mCurrentSelectedList->getModel(),"about");
-}
-
 // virtual
 void LLLandmarksPanel::onTeleport()
 {
@@ -301,25 +297,6 @@ void LLLandmarksPanel::onTeleport()
 	}
 }
 
-// virtual
-bool LLLandmarksPanel::isSingleItemSelected()
-{
-	bool result = false;
-
-	if (mCurrentSelectedList != NULL)
-	{
-		LLPlacesFolderView* root_view =
-				static_cast<LLPlacesFolderView*>(mCurrentSelectedList->getRootFolder());
-
-		if (root_view->getSelectedCount() == 1)
-		{
-			result = isLandmarkSelected();
-		}
-	}
-
-	return result;
-}
-
 // virtual
 void LLLandmarksPanel::updateVerbs()
 {
@@ -328,7 +305,6 @@ void LLLandmarksPanel::updateVerbs()
 
 	bool landmark_selected = isLandmarkSelected();
 	mTeleportBtn->setEnabled(landmark_selected && isActionEnabled("teleport"));
-	mShowProfile->setEnabled(landmark_selected && isActionEnabled("more_info"));
 	mShowOnMapBtn->setEnabled(landmark_selected && isActionEnabled("show_on_map"));
 
 	// TODO: mantipov: Uncomment when mShareBtn is supported
@@ -517,9 +493,6 @@ void LLLandmarksPanel::setParcelID(const LLUUID& parcel_id)
 {
 	if (!parcel_id.isNull())
 	{
-        //ext-4655, defensive. remove now incase this gets called twice without a remove
-        LLRemoteParcelInfoProcessor::getInstance()->removeObserver(parcel_id, this);
-        
 		LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this);
 		LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id);
 	}
@@ -598,13 +571,11 @@ void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list
 	if (!inventory_list->getFilter())
 		return;
 
-	inventory_list->getFilter()->setEmptyLookupMessage("PlacesNoMatchingItems");
 	inventory_list->setFilterTypes(0x1 << LLInventoryType::IT_LANDMARK);
 	inventory_list->setSelectCallback(boost::bind(&LLLandmarksPanel::onSelectionChange, this, inventory_list, _1, _2));
 
 	inventory_list->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-	bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
-	updateSortOrder(inventory_list, sorting_order);
+	updateSortOrder(inventory_list, mSortByDate);
 
 	LLPlacesFolderView* root_folder = dynamic_cast<LLPlacesFolderView*>(inventory_list->getRootFolder());
 	if (root_folder)
@@ -692,7 +663,6 @@ void LLLandmarksPanel::initListCommandsHandlers()
 	trash_btn->setDragAndDropHandler(boost::bind(&LLLandmarksPanel::handleDragAndDropToTrash, this
 			,	_4 // BOOL drop
 			,	_5 // EDragAndDropType cargo_type
-			,	_6 // void* cargo_data
 			,	_7 // EAcceptance* accept
 			));
 
@@ -872,12 +842,10 @@ void LLLandmarksPanel::onFoldingAction(const LLSD& userdata)
 	}
 	else if ("sort_by_date" == command_name)
 	{
-		bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
-		sorting_order=!sorting_order;
-		gSavedSettings.setBOOL("LandmarksSortedByDate",sorting_order);
-		updateSortOrder(mLandmarksInventoryPanel, sorting_order);
-		updateSortOrder(mMyInventoryPanel, sorting_order);
-		updateSortOrder(mLibraryInventoryPanel, sorting_order);
+		mSortByDate = !mSortByDate;
+		updateSortOrder(mLandmarksInventoryPanel, mSortByDate);
+		updateSortOrder(mMyInventoryPanel, mSortByDate);
+		updateSortOrder(mLibraryInventoryPanel, mSortByDate);
 	}
 	else
 	{
@@ -894,8 +862,7 @@ bool LLLandmarksPanel::isActionChecked(const LLSD& userdata) const
 
 	if ( "sort_by_date" == command_name)
 	{
-		bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
-		return  sorting_order;
+		return  mSortByDate;
 	}
 
 	return false;
@@ -993,13 +960,10 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
 	}
 	else if("create_pick" == command_name)
 	{
-		if (mCurrentSelectedList)
+		std::set<LLUUID> selection;
+		if ( mCurrentSelectedList && mCurrentSelectedList->getRootFolder()->getSelectionList(selection) )
 		{
-			std::set<LLUUID> selection = mCurrentSelectedList->getRootFolder()->getSelectionList();
-			if (!selection.empty())
-			{
-				return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() );
-			}
+			return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() );
 		}
 		return false;
 	}
@@ -1013,10 +977,13 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
 
 void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
 {
+	LLFolderViewItem* cur_item = getCurSelectedItem();
+	if(!cur_item)
+		return;
 	std::string command_name = userdata.asString();
 	if("more_info" == command_name)
 	{
-		onShowProfile();
+		cur_item->getListener()->performAction(mCurrentSelectedList->getModel(),"about");
 	}
 	else if ("teleport" == command_name)
 	{
@@ -1133,7 +1100,7 @@ void LLLandmarksPanel::onPickPanelExit( LLPanelPickEdit* pick_panel, LLView* own
 	pick_panel = NULL;
 }
 
-bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data , EAcceptance* accept)
+bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept)
 {
 	*accept = ACCEPT_NO;
 
@@ -1149,21 +1116,7 @@ bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType carg
 
 			if (is_enabled && drop)
 			{
-				// don't call onClipboardAction("delete")
-				// this lead to removing (N * 2 - 1) items if drag N>1 items into trash. EXT-6757
-				// So, let remove items one by one.
-				LLInventoryItem* item = static_cast<LLInventoryItem*>(cargo_data);
-				if (item)
-				{
-					LLFolderViewItem* fv_item = (mCurrentSelectedList && mCurrentSelectedList->getRootFolder()) ?
-						mCurrentSelectedList->getRootFolder()->getItemByID(item->getUUID()) : NULL;
-
-					if (fv_item)
-					{
-						// is Item Removable checked inside of remove()
-						fv_item->remove();
-					}
-				}
+				onClipboardAction("delete");
 			}
 		}
 		break;
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 3af38f35eff10b26b6c4ffda6bba884cbb9589cc..ee4dcc44fe14bf447fa8458acb59173e05a5a3f3 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -2,25 +2,31 @@
  * @file llpanellogin.cpp
  * @brief Login dialog and logo display
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -45,12 +51,11 @@
 #include "llfocusmgr.h"
 #include "lllineeditor.h"
 #include "llnotificationsutil.h"
-#include "llsecapi.h"
 #include "llstartup.h"
 #include "lltextbox.h"
 #include "llui.h"
 #include "lluiconstants.h"
-#include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llversioninfo.h"
 #include "llviewerhelp.h"
 #include "llviewertexturelist.h"
@@ -72,7 +77,6 @@
 #pragma warning(disable: 4355)      // 'this' used in initializer list
 #endif  // LL_WINDOWS
 
-#include "llsdserialize.h"
 #define USE_VIEWER_AUTH 0
 
 const S32 BLACK_BORDER_HEIGHT = 160;
@@ -100,6 +104,7 @@ class LLLoginRefreshHandler : public LLCommandHandler
 LLLoginRefreshHandler gLoginRefreshHandler;
 
 
+
 // helper class that trys to download a URL from a web site and calls a method 
 // on parent class indicating if the web server is working or not
 class LLIamHereLogin : public LLHTTPClient::Responder
@@ -148,6 +153,10 @@ namespace {
 	boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0;
 };
 
+void set_start_location(LLUICtrl* ctrl, void* data)
+{
+    LLURLSimString::setString(ctrl->getValue().asString());
+}
 
 //---------------------------------------------------------------------------
 // Public methods
@@ -178,7 +187,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 		delete LLPanelLogin::sInstance;
 	}
 
-	mPasswordModified = FALSE;
 	LLPanelLogin::sInstance = this;
 
 	// add to front so we are the bottom-most child
@@ -205,27 +213,42 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 	}
 
 #if !USE_VIEWER_AUTH
-	childSetPrevalidate("username_edit", LLTextValidate::validateASCIIPrintableNoPipe);
+	childSetPrevalidate("first_name_edit", LLTextValidate::validateASCIIPrintableNoSpace);
+	childSetPrevalidate("last_name_edit", LLTextValidate::validateASCIIPrintableNoSpace);
+
+	childSetCommitCallback("password_edit", mungePassword, this);
 	getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);
 
 	// change z sort of clickable text to be behind buttons
-	//sendChildToBack(getChildView("channel_text"));
+	sendChildToBack(getChildView("channel_text"));
 	sendChildToBack(getChildView("forgot_password_text"));
 
 	LLLineEditor* edit = getChild<LLLineEditor>("password_edit");
 	if (edit) edit->setDrawAsterixes(TRUE);
 
-	if(LLStartUp::getStartSLURL().getType() != LLSLURL::LOCATION)
+	LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
+
+	std::string sim_string = LLURLSimString::sInstance.mSimString;
+	if(sim_string.empty())
+	{
+		LLURLSimString::setString(gSavedSettings.getString("LoginLocation"));
+		sim_string = LLURLSimString::sInstance.mSimString;
+	}
+
+	if (!sim_string.empty())
 	{
-		LLSLURL slurl(gSavedSettings.getString("LoginLocation"));
-		LLStartUp::setStartSLURL(slurl);
+		// Replace "<Type region name>" with this region name
+		combo->remove(2);
+		combo->add( sim_string );
+		combo->setTextEntry(sim_string);
+		combo->setCurrentByIndex( 2 );
 	}
-	updateLocationCombo(false);
+
+	combo->setCommitCallback( &set_start_location, NULL );
 
 	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
 	server_choice_combo->setCommitCallback(onSelectServer, NULL);
 	server_choice_combo->setFocusLostCallback(boost::bind(onServerComboLostFocus, _1));
-	updateServerCombo();
 
 	childSetAction("connect_btn", onClickConnect, this);
 
@@ -235,10 +258,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 	std::string version = llformat("%s (%d)",
 								   LLVersionInfo::getShortVersion().c_str(),
 								   LLVersionInfo::getBuild());
-	//LLTextBox* channel_text = getChild<LLTextBox>("channel_text");
-	//channel_text->setTextArg("[CHANNEL]", channel); // though not displayed
-	//channel_text->setTextArg("[VERSION]", version);
-	//channel_text->setClickedCallback(onClickVersion, this);
+	LLTextBox* channel_text = getChild<LLTextBox>("channel_text");
+	channel_text->setTextArg("[CHANNEL]", channel); // though not displayed
+	channel_text->setTextArg("[VERSION]", version);
+	channel_text->setClickedCallback(onClickVersion, this);
 	
 	LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text");
 	forgot_password_text->setClickedCallback(onClickForgotPassword, NULL);
@@ -264,14 +287,34 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 	web_browser->setTabStop(FALSE);
 	// web_browser->navigateToLocalPage( "loading", "loading.html" );
 
-	reshapeBrowser();
+	if (gSavedSettings.getBOOL("RegInClient"))
+	{
+		// need to follow links in the internal browser
+		web_browser->setOpenInExternalBrowser( false );
+
+		getChild<LLView>("login_widgets")->setVisible(false);
+	}
+	else
+	{
+		// make links open in external browser
+		web_browser->setOpenInExternalBrowser( true );
+
+		reshapeBrowser();
+	}
 
 	// kick off a request to grab the url manually
 	gResponsePtr = LLIamHereLogin::build( this );
+	std::string login_page = gSavedSettings.getString("LoginPage");
+	if (login_page.empty())
+	{
+		login_page = getString( "real_url" );
+	}
+	LLHTTPClient::head( login_page, gResponsePtr );
 
-	LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr );
-	
-	updateLocationCombo(false);
+#if !USE_VIEWER_AUTH
+	// Initialize visibility (and don't force visibility - use prefs)
+	refreshLocation( false );
+#endif
 
 }
 
@@ -335,6 +378,21 @@ void LLPanelLogin::setSiteIsAlive( bool alive )
 	}
 }
 
+void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data)
+{
+	LLPanelLogin* self = (LLPanelLogin*)user_data;
+	LLLineEditor* editor = (LLLineEditor*)caller;
+	std::string password = editor->getText();
+
+	// Re-md5 if we've changed at all
+	if (password != self->mIncomingPassword)
+	{
+		LLMD5 pass((unsigned char *)password.c_str());
+		char munged_password[MD5HEX_STR_SIZE];
+		pass.hex_digest(munged_password);
+		self->mMungedPassword = munged_password;
+	}
+}
 
 LLPanelLogin::~LLPanelLogin()
 {
@@ -397,6 +455,12 @@ void LLPanelLogin::draw()
 // virtual
 BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask)
 {
+	if (( KEY_RETURN == key ) && (MASK_ALT == mask))
+	{
+		gViewerWindow->toggleFullscreen(FALSE);
+		return TRUE;
+	}
+
 	if ( KEY_F1 == key )
 	{
 		LLViewerHelp* vhelp = LLViewerHelp::getInstance();
@@ -435,14 +499,14 @@ void LLPanelLogin::giveFocus()
 	if( sInstance )
 	{
 		// Grab focus and move cursor to first blank input field
-		std::string username = sInstance->childGetText("username_edit");
+		std::string first = sInstance->childGetText("first_name_edit");
 		std::string pass = sInstance->childGetText("password_edit");
 
-		BOOL have_username = !username.empty();
+		BOOL have_first = !first.empty();
 		BOOL have_pass = !pass.empty();
 
 		LLLineEditor* edit = NULL;
-		if (have_username && !have_pass)
+		if (have_first && !have_pass)
 		{
 			// User saved his name but not his password.  Move
 			// focus to password field.
@@ -451,7 +515,7 @@ void LLPanelLogin::giveFocus()
 		else
 		{
 			// User doesn't have a name, so start there.
-			edit = sInstance->getChild<LLLineEditor>("username_edit");
+			edit = sInstance->getChild<LLLineEditor>("first_name_edit");
 		}
 
 		if (edit)
@@ -468,12 +532,13 @@ void LLPanelLogin::showLoginWidgets()
 {
 	sInstance->childSetVisible("login_widgets", true);
 	LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
+	web_browser->setOpenInExternalBrowser( true );
 	sInstance->reshapeBrowser();
 	// *TODO: Append all the usual login parameters, like first_login=Y etc.
 	std::string splash_screen_url = sInstance->getString("real_url");
 	web_browser->navigateTo( splash_screen_url, "text/html" );
-	LLUICtrl* username_edit = sInstance->getChild<LLUICtrl>("username_edit");
-	username_edit->setFocus(TRUE);
+	LLUICtrl* first_name_edit = sInstance->getChild<LLUICtrl>("first_name_edit");
+	first_name_edit->setFocus(TRUE);
 }
 
 // static
@@ -495,127 +560,77 @@ void LLPanelLogin::show(const LLRect &rect,
 }
 
 // static
-void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
-							 BOOL remember)
+void LLPanelLogin::setFields(const std::string& firstname,
+			     const std::string& lastname,
+			     const std::string& password)
 {
 	if (!sInstance)
 	{
 		llwarns << "Attempted fillFields with no login view shown" << llendl;
 		return;
 	}
-	LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;
 
-	LLSD identifier = credential->getIdentifier();
-	if((std::string)identifier["type"] == "agent") 
-	{
-		sInstance->childSetText("username_edit", (std::string)identifier["first_name"] + " " + 
-								(std::string)identifier["last_name"]);	
-	}
-	else if((std::string)identifier["type"] == "account")
-	{
-		sInstance->childSetText("username_edit", (std::string)identifier["account_name"]);		
-	}
-	else
-	{
-	  sInstance->childSetText("username_edit", std::string());	
-	}
-	// if the password exists in the credential, set the password field with
-	// a filler to get some stars
-	LLSD authenticator = credential->getAuthenticator();
-	LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
-	if(authenticator.isMap() && 
-	   authenticator.has("secret") && 
-	   (authenticator["secret"].asString().size() > 0))
+	sInstance->childSetText("first_name_edit", firstname);
+	sInstance->childSetText("last_name_edit", lastname);
+
+	// Max "actual" password length is 16 characters.
+	// Hex digests are always 32 characters.
+	if (password.length() == 32)
 	{
-		
 		// This is a MD5 hex digest of a password.
 		// We don't actually use the password input field, 
 		// fill it with MAX_PASSWORD characters so we get a 
 		// nice row of asterixes.
 		const std::string filler("123456789!123456");
-		sInstance->childSetText("password_edit", std::string("123456789!123456"));
+		sInstance->childSetText("password_edit", filler);
+		sInstance->mIncomingPassword = filler;
+		sInstance->mMungedPassword = password;
 	}
 	else
 	{
-		sInstance->childSetText("password_edit", std::string());		
+		// this is a normal text password
+		sInstance->childSetText("password_edit", password);
+		sInstance->mIncomingPassword = password;
+		LLMD5 pass((unsigned char *)password.c_str());
+		char munged_password[MD5HEX_STR_SIZE];
+		pass.hex_digest(munged_password);
+		sInstance->mMungedPassword = munged_password;
 	}
-	sInstance->childSetValue("remember_check", remember);
 }
 
 
 // static
-void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
-							 BOOL& remember)
+void LLPanelLogin::addServer(const std::string& server, S32 domain_name)
 {
 	if (!sInstance)
 	{
-		llwarns << "Attempted getFields with no login view shown" << llendl;
+		llwarns << "Attempted addServer with no login view shown" << llendl;
 		return;
 	}
-	
-	// load the credential so we can pass back the stored password or hash if the user did
-	// not modify the password field.
-	
-	credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
 
-	LLSD identifier = LLSD::emptyMap();
-	LLSD authenticator = LLSD::emptyMap();
-	
-	if(credential.notNull())
+	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+	combo->add(server, LLSD(domain_name) );
+	combo->setCurrentByIndex(0);
+}
+
+// static
+void LLPanelLogin::getFields(std::string *firstname,
+			     std::string *lastname,
+			     std::string *password)
+{
+	if (!sInstance)
 	{
-		authenticator = credential->getAuthenticator();
+		llwarns << "Attempted getFields with no login view shown" << llendl;
+		return;
 	}
 
-	std::string username = sInstance->childGetText("username_edit");
-	LLStringUtil::trim(username);
-	std::string password = sInstance->childGetText("password_edit");
+	*firstname = sInstance->childGetText("first_name_edit");
+	LLStringUtil::trim(*firstname);
 
-	LL_INFOS2("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL;
-	// determine if the username is a first/last form or not.
-	size_t separator_index = username.find_first_of(' ');
-	if (separator_index == username.npos)
-	{
-		LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL;
-		// single username, so this is a 'clear' identifier
-		identifier["type"] = CRED_IDENTIFIER_TYPE_ACCOUNT;
-		identifier["account_name"] = username;
-		
-		if (LLPanelLogin::sInstance->mPasswordModified)
-		{
-			authenticator = LLSD::emptyMap();
-			// password is plaintext
-			authenticator["type"] = CRED_AUTHENTICATOR_TYPE_CLEAR;
-			authenticator["secret"] = password;
-		}
-	}
-	else
-	{
-		std::string first = username.substr(0, separator_index);
-		std::string last = username.substr(separator_index, username.npos);
-		LLStringUtil::trim(last);
-		
-		if (last.find_first_of(' ') == last.npos)
-		{
-			LL_INFOS2("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
-			// traditional firstname / lastname
-			identifier["type"] = CRED_IDENTIFIER_TYPE_AGENT;
-			identifier["first_name"] = first;
-			identifier["last_name"] = last;
-		
-			if (LLPanelLogin::sInstance->mPasswordModified)
-			{
-				authenticator = LLSD::emptyMap();
-				authenticator["type"] = CRED_AUTHENTICATOR_TYPE_HASH;
-				authenticator["algorithm"] = "md5";
-				LLMD5 pass((const U8 *)password.c_str());
-				char md5pass[33];               /* Flawfinder: ignore */
-				pass.hex_digest(md5pass);
-				authenticator["secret"] = md5pass;
-			}
-		}
-	}
-	credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), identifier, authenticator);
-	remember = sInstance->childGetValue("remember_check");
+	*lastname = sInstance->childGetText("last_name_edit");
+	LLStringUtil::trim(*lastname);
+
+	*password = sInstance->mMungedPassword;
 }
 
 // static
@@ -635,112 +650,64 @@ BOOL LLPanelLogin::isGridComboDirty()
 }
 
 // static
-BOOL LLPanelLogin::areCredentialFieldsDirty()
+void LLPanelLogin::getLocation(std::string &location)
 {
 	if (!sInstance)
 	{
-		llwarns << "Attempted getServer with no login view shown" << llendl;
-	}
-	else
-	{
-		std::string username = sInstance->childGetText("username_edit");
-		LLStringUtil::trim(username);
-		std::string password = sInstance->childGetText("password_edit");
-		LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("username_edit");
-		if(ctrl && ctrl->isDirty())
-		{
-			return true;
-		}
-		ctrl = sInstance->getChild<LLLineEditor>("password_edit");
-		if(ctrl && ctrl->isDirty()) 
-		{
-			return true;
-		}
+		llwarns << "Attempted getLocation with no login view shown" << llendl;
+		return;
 	}
-	return false;	
+	
+	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+	location = combo->getValue().asString();
 }
 
-
 // static
-void LLPanelLogin::updateLocationCombo( bool force_visible )
+void LLPanelLogin::refreshLocation( bool force_visible )
 {
-	if (!sInstance) 
-	{
-		return;
-	}	
-	
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
-	
-	switch(LLStartUp::getStartSLURL().getType())
-	{
-		case LLSLURL::LOCATION:
-		{
-			
-			combo->setCurrentByIndex( 2 );	
-			combo->setTextEntry(LLStartUp::getStartSLURL().getLocationString());	
-			break;
-		}
-		case LLSLURL::HOME_LOCATION:
-			combo->setCurrentByIndex(1);
-			break;
-		default:
-			combo->setCurrentByIndex(0);
-			break;
-	}
-	
+	if (!sInstance) return;
+
+#if USE_VIEWER_AUTH
+	loadLoginPage();
+#else
 	BOOL show_start = TRUE;
-	
+
 	if ( ! force_visible )
+	{
+		// Don't show on first run after install
+		// Otherwise ShowStartLocation defaults to true.
 		show_start = gSavedSettings.getBOOL("ShowStartLocation");
+	}
+
+	// Update the value of the location combo.
+	updateLocationUI();
 	
 	sInstance->childSetVisible("start_location_combo", show_start);
 	sInstance->childSetVisible("start_location_text", show_start);
-	
+
 	BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
-	sInstance->childSetVisible("server_combo_text", show_server);	
 	sInstance->childSetVisible("server_combo", show_server);
+
+#endif
 }
 
 // static
-void LLPanelLogin::updateStartSLURL()
+void LLPanelLogin::updateLocationUI()
 {
 	if (!sInstance) return;
 	
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
-	S32 index = combo->getCurrentIndex();
-	
-	switch (index)
+	std::string sim_string = LLURLSimString::sInstance.mSimString;
+	if (!sim_string.empty())
 	{
-		case 0:
-		{
-			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
-			break;
-		}			
-		case 1:
-		{
-			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
-			break;
-		}
-		default:
-		{
-			LLSLURL slurl = LLSLURL(combo->getValue().asString());
-			if(slurl.getType() == LLSLURL::LOCATION)
-			{
-				// we've changed the grid, so update the grid selection
-				LLStartUp::setStartSLURL(slurl);
-			}
-			break;
-		}			
+		// Replace "<Type region name>" with this region name
+		LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+		combo->remove(2);
+		combo->add( sim_string );
+		combo->setTextEntry(sim_string);
+		combo->setCurrentByIndex( 2 );
 	}
 }
 
-
-void LLPanelLogin::setLocation(const LLSLURL& slurl)
-{
-	LLStartUp::setStartSLURL(slurl);
-	updateServer();
-}
-
 // static
 void LLPanelLogin::closePanel()
 {
@@ -774,13 +741,15 @@ void LLPanelLogin::loadLoginPage()
 	
 	std::ostringstream oStr;
 
-	std::string login_page = LLGridManager::getInstance()->getLoginPage();
-
+	std::string login_page = gSavedSettings.getString("LoginPage");
+	if (login_page.empty())
+	{
+		login_page = sInstance->getString( "real_url" );
+	}
 	oStr << login_page;
 	
 	// Use the right delimeter depending on how LLURI parses the URL
 	LLURI login_page_uri = LLURI(login_page);
-	
 	std::string first_query_delimiter = "&";
 	if (login_page_uri.queryMap().size() == 0)
 	{
@@ -812,10 +781,11 @@ void LLPanelLogin::loadLoginPage()
 	curl_free(curl_version);
 
 	// Grid
-	char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridLoginID().c_str(), 0);
+	char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridLabel().c_str(), 0);
 	oStr << "&grid=" << curl_grid;
 	curl_free(curl_grid);
-	gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
+
+	gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
 	gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
 
 
@@ -840,20 +810,30 @@ void LLPanelLogin::loadLoginPage()
 		location = gSavedSettings.getString("LoginLocation");
 	}
 	
-	std::string username;
+	std::string firstname, lastname;
 
     if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
     {
         LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
-		username = cmd_line_login[0].asString() + " " + cmd_line_login[1];
+		firstname = cmd_line_login[0].asString();
+		lastname = cmd_line_login[1].asString();
         password = cmd_line_login[2].asString();
     }
     	
+	if (firstname.empty())
+	{
+		firstname = gSavedSettings.getString("FirstName");
+	}
+	
+	if (lastname.empty())
+	{
+		lastname = gSavedSettings.getString("LastName");
+	}
 	
 	char* curl_region = curl_escape(region.c_str(), 0);
 
-	oStr <<"username=" << username <<
-		 "&location=" << location <<	"&region=" << curl_region;
+	oStr <<"firstname=" << firstname <<
+		"&lastname=" << lastname << "&location=" << location <<	"&region=" << curl_region;
 	
 	curl_free(curl_region);
 
@@ -886,7 +866,7 @@ void LLPanelLogin::loadLoginPage()
 #endif
 	
 	LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
-
+	
 	// navigate to the "real" page
 	if (gSavedSettings.getBOOL("RegInClient"))
 	{
@@ -935,66 +915,39 @@ void LLPanelLogin::onClickConnect(void *)
 		// JC - Make sure the fields all get committed.
 		sInstance->setFocus(FALSE);
 
-		LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
-		LLSD combo_val = combo->getSelectedValue();
-		if (combo_val.isUndefined())
-		{
-			combo_val = combo->getValue();
-		}
-		if(combo_val.isUndefined())
-		{
-			LLNotificationsUtil::add("StartRegionEmpty");
-			return;
-		}		
-		try
+		std::string first = sInstance->childGetText("first_name_edit");
+		std::string last  = sInstance->childGetText("last_name_edit");
+		LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+		std::string combo_text = combo->getSimple();
+		
+		bool has_first_and_last = !(first.empty() || last.empty());
+		bool has_location = false;
+
+		if(combo_text=="<Type region name>" || combo_text =="")
 		{
-			LLGridManager::getInstance()->setGridChoice(combo_val.asString());
+			// *NOTE: Mani - Location field is not always committed by this point!
+			// This may be duplicate work, but better than not doing the work!
+			LLURLSimString::sInstance.setString("");
 		}
-		catch (LLInvalidGridName ex)
+		else 
 		{
-			LLSD args;
-			args["GRID"] = combo_val.asString();
-			LLNotificationsUtil::add("InvalidGrid", args);
-			return;
+			// *NOTE: Mani - Location field is not always committed by this point!
+			LLURLSimString::sInstance.setString(combo_text);
+			has_location = true;
 		}
-		updateStartSLURL();
-		std::string username = sInstance->childGetText("username_edit");
 
-		
-		if(username.empty())
+		if(!has_first_and_last)
 		{
-			// user must type in something into the username field
 			LLNotificationsUtil::add("MustHaveAccountToLogIn");
 		}
+		else if(!has_location)
+		{
+			LLNotificationsUtil::add("StartRegionEmpty");
+		}
 		else
 		{
-			LLPointer<LLCredential> cred;
-			BOOL remember;
-			getFields(cred, remember);
-			std::string identifier_type;
-			cred->identifierType(identifier_type);
-			LLSD allowed_credential_types;
-			LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
-			
-			// check the typed in credential type against the credential types expected by the server.
-			for(LLSD::array_iterator i = allowed_credential_types.beginArray();
-				i != allowed_credential_types.endArray();
-				i++)
-			{
-				
-				if(i->asString() == identifier_type)
-				{
-					// yay correct credential type
-					sInstance->mCallback(0, sInstance->mCallbackData);
-					return;
-				}
-			}
-			
-			// Right now, maingrid is the only thing that is picky about
-			// credential format, as it doesn't yet allow account (single username)
-			// format creds.  - Rox.  James, we wanna fix the message when we change
-			// this.
-			LLNotificationsUtil::add("InvalidCredentialFormat");			
+			// has both first and last name typed
+			sInstance->mCallback(0, sInstance->mCallbackData);
 		}
 	}
 }
@@ -1052,105 +1005,66 @@ void LLPanelLogin::onClickHelp(void*)
 // static
 void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
 {
-	LLPanelLogin *This = (LLPanelLogin *) user_data;
-	This->mPasswordModified = TRUE;
 	if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
 	{
-// *TODO: use another way to notify user about enabled caps lock, see EXT-6858
+		LLNotificationsUtil::add("CapsKeyOn");
 		sCapslockDidNotification = TRUE;
 	}
 }
 
-
-void LLPanelLogin::updateServer()
+// static
+void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
 {
-	try 
+	// *NOTE: The paramters for this method are ignored. 
+	// LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
+	// calls this method.
+
+	// The user twiddled with the grid choice ui.
+	// apply the selection to the grid setting.
+	std::string grid_label;
+	S32 grid_index;
+
+	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+	LLSD combo_val = combo->getValue();
+
+	if (LLSD::TypeInteger == combo_val.type())
 	{
+		grid_index = combo->getValue().asInteger();
 
-		updateServerCombo();	
-		// if they've selected another grid, we should load the credentials
-		// for that grid and set them to the UI.
-		if(sInstance && !sInstance->areCredentialFieldsDirty())
+		if ((S32)GRID_INFO_OTHER == grid_index)
 		{
-			LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());	
-			bool remember = sInstance->childGetValue("remember_check");
-			sInstance->setFields(credential, remember);
+			// This happens if the user specifies a custom grid
+			// via command line.
+			grid_label = combo->getSimple();
 		}
-		// grid changed so show new splash screen (possibly)
-		loadLoginPage();
-		updateLocationCombo(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION);
 	}
-	catch (LLInvalidGridName ex)
+	else
 	{
-		// do nothing
+		// no valid selection, return other
+		grid_index = (S32)GRID_INFO_OTHER;
+		grid_label = combo_val.asString();
 	}
-}
 
-void LLPanelLogin::updateServerCombo()
-{
-	if (!sInstance) 
+	// This new seelction will override preset uris
+	// from the command line.
+	LLViewerLogin* vl = LLViewerLogin::getInstance();
+	vl->resetURIs();
+	if(grid_index != GRID_INFO_OTHER)
 	{
-		return;	
+		vl->setGridChoice((EGridInfo)grid_index);
 	}
-	// We add all of the possible values, sorted, and then add a bar and the current value at the top
-	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");	
-	server_choice_combo->removeall();
-
-	std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(!gSavedSettings.getBOOL("ShowBetaGrids"));
-
-	for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
-		 grid_choice != known_grids.end();
-		 grid_choice++)
+	else
 	{
-		if (!grid_choice->first.empty())
-		{
-			server_choice_combo->add(grid_choice->second, grid_choice->first, ADD_SORTED);
-		}
+		vl->setGridChoice(grid_label);
 	}
-	
-	server_choice_combo->addSeparator(ADD_TOP);
-	
-	server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(), 
-		LLGridManager::getInstance()->getGrid(), ADD_TOP);	
-	
-	server_choice_combo->selectFirstItem();	
-}
 
-// static
-void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
-{
-	// *NOTE: The paramters for this method are ignored. 
-	// LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
-	// calls this method.
-	LL_INFOS("AppInit") << "onSelectServer" << LL_ENDL;
-	// The user twiddled with the grid choice ui.
-	// apply the selection to the grid setting.
-	LLPointer<LLCredential> credential;
-	
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
-	LLSD combo_val = combo->getSelectedValue();
-	if (combo_val.isUndefined())
-	{
-		combo_val = combo->getValue();
-	}
-	
-	combo = sInstance->getChild<LLComboBox>("start_location_combo");	
-	combo->setCurrentByIndex(1);
-	LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation")));
-	LLGridManager::getInstance()->setGridChoice(combo_val.asString());
-	// This new selection will override preset uris
-	// from the command line.
-	updateServer();
-	updateLocationCombo(false);
-	updateLoginPanelLinks();
+	// grid changed so show new splash screen (possibly)
+	loadLoginPage();
 }
 
 void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
 {
-	if (!sInstance)
-	{
-		return;
-	}
+	if (!sInstance) return;
 
 	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
 	if(fe == combo)
@@ -1158,15 +1072,3 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
 		onSelectServer(combo, NULL);	
 	}
 }
-
-void LLPanelLogin::updateLoginPanelLinks()
-{
-	LLSD grid_data;
-	LLGridManager::getInstance()->getGridInfo(grid_data);
-	bool system_grid = grid_data.has(GRID_IS_SYSTEM_GRID_VALUE);
-	
-	// need to call through sInstance, as it's called from onSelectServer, which
-	// is static.
-	sInstance->childSetVisible("create_new_account_text", system_grid);
-	sInstance->childSetVisible("forgot_password_text", system_grid);
-}
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index 83e76a308bc1abc229e1213c22a870453b2746c8..1fdc3a936198caab610c955f99e5d6e62cdb40ad 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -2,25 +2,31 @@
  * @file llpanellogin.h
  * @brief Login username entry fields.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -35,8 +41,6 @@
 class LLLineEditor;
 class LLUIImage;
 class LLPanelLoginListener;
-class LLSLURL;
-class LLCredential;
 
 class LLPanelLogin:	
 	public LLPanel,
@@ -61,15 +65,20 @@ class LLPanelLogin:
 		void (*callback)(S32 option, void* user_data), 
 		void* callback_data);
 
-	static void setFields(LLPointer<LLCredential> credential, BOOL remember);
+	// Remember password checkbox is set via gSavedSettings "RememberPassword"
+	static void setFields(const std::string& firstname, const std::string& lastname, 
+		const std::string& password);
+
+	static void addServer(const std::string& server, S32 domain_name);
+	static void refreshLocation( bool force_visible );
+	static void updateLocationUI();
 
-	static void getFields(LLPointer<LLCredential>& credential, BOOL& remember);
+	static void getFields(std::string *firstname, std::string *lastname,
+						  std::string *password);
 
 	static BOOL isGridComboDirty();
-	static BOOL areCredentialFieldsDirty();
-	static void setLocation(const LLSLURL& slurl);
-	
-	static void updateLocationCombo(bool force_visible);  // simply update the combo box
+	static void getLocation(std::string &location);
+
 	static void closePanel();
 
 	void setSiteIsAlive( bool alive );
@@ -77,10 +86,10 @@ class LLPanelLogin:
 	static void loadLoginPage();	
 	static void giveFocus();
 	static void setAlwaysRefresh(bool refresh); 
+	static void mungePassword(LLUICtrl* caller, void* user_data);
 	
 	// inherited from LLViewerMediaObserver
 	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
-	static void updateServer();  // update the combo box, change the login page to the new server, clear the combo
 
 private:
 	friend class LLPanelLoginListener;
@@ -94,10 +103,6 @@ class LLPanelLogin:
 	static void onPassKey(LLLineEditor* caller, void* user_data);
 	static void onSelectServer(LLUICtrl*, void*);
 	static void onServerComboLostFocus(LLFocusableElement*);
-	static void updateServerCombo();
-	static void updateStartSLURL();
-	
-	static void updateLoginPanelLinks();
 
 private:
 	LLPointer<LLUIImage> mLogoImage;
@@ -106,7 +111,8 @@ class LLPanelLogin:
 	void			(*mCallback)(S32 option, void *userdata);
 	void*			mCallbackData;
 
-	BOOL            mPasswordModified;
+	std::string mIncomingPassword;
+	std::string mMungedPassword;
 
 	static LLPanelLogin* sInstance;
 	static BOOL		sCapslockDidNotification;
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index f5e33034a3e1f9de4735a4be67c2e8cdacf0f8e2..8be4c8402c632b3f9e9f8c618aa0a060117751c0 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -2,25 +2,31 @@
  * @file llsidepanelmaininventory.cpp
  * @brief Implementation of llsidepanelmaininventory.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -28,7 +34,6 @@
 #include "llpanelmaininventory.h"
 
 #include "llagent.h"
-#include "llavataractions.h"
 #include "lldndbutton.h"
 #include "lleconomy.h"
 #include "llfilepicker.h"
@@ -47,8 +52,6 @@
 #include "lltooldraganddrop.h"
 #include "llviewermenu.h"
 #include "llviewertexturelist.h"
-#include "llsidepanelinventory.h"
-#include "llsidetray.h"
 
 const std::string FILTERS_FILENAME("filters.xml");
 
@@ -113,7 +116,6 @@ LLPanelMainInventory::LLPanelMainInventory()
 	mCommitCallbackRegistrar.add("Inventory.ShowFilters", boost::bind(&LLPanelMainInventory::toggleFindOptions, this));
 	mCommitCallbackRegistrar.add("Inventory.ResetFilters", boost::bind(&LLPanelMainInventory::resetFilters, this));
 	mCommitCallbackRegistrar.add("Inventory.SetSortBy", boost::bind(&LLPanelMainInventory::setSortBy, this, _2));
-	mCommitCallbackRegistrar.add("Inventory.Share",  boost::bind(&LLAvatarActions::shareWithAvatars));
 
 	// Controls
 	// *TODO: Just use persistant settings for each of these
@@ -163,7 +165,7 @@ BOOL LLPanelMainInventory::postBuild()
 	// Now load the stored settings from disk, if available.
 	std::ostringstream filterSaveName;
 	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
-	llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName.str() << llendl;
+	llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName << llendl;
 	llifstream file(filterSaveName.str());
 	LLSD savedFilterState;
 	if (file.is_open())
@@ -191,15 +193,14 @@ BOOL LLPanelMainInventory::postBuild()
 		mFilterEditor->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterEdit, this, _2));
 	}
 
-	initListCommandsHandlers();
-
 	// *TODO:Get the cost info from the server
 	const std::string upload_cost("10");
-	mMenuAdd->getChild<LLMenuItemGL>("Upload Image")->setLabelArg("[COST]", upload_cost);
-	mMenuAdd->getChild<LLMenuItemGL>("Upload Sound")->setLabelArg("[COST]", upload_cost);
-	mMenuAdd->getChild<LLMenuItemGL>("Upload Animation")->setLabelArg("[COST]", upload_cost);
-	mMenuAdd->getChild<LLMenuItemGL>("Bulk Upload")->setLabelArg("[COST]", upload_cost);
+	childSetLabelArg("Upload Image", "[COST]", upload_cost);
+	childSetLabelArg("Upload Sound", "[COST]", upload_cost);
+	childSetLabelArg("Upload Animation", "[COST]", upload_cost);
+	childSetLabelArg("Bulk Upload", "[COST]", upload_cost);
 
+	initListCommandsHandlers();
 	return TRUE;
 }
 
@@ -389,7 +390,6 @@ void LLPanelMainInventory::onClearSearch()
 	{
 		mActivePanel->setFilterSubString(LLStringUtil::null);
 		mActivePanel->setFilterTypes(0xffffffff);
-		mActivePanel->setFilterLinks(LLInventoryFilter::FILTERLINK_INCLUDE_LINKS);
 	}
 
 	if (finder)
@@ -490,10 +490,6 @@ void LLPanelMainInventory::onFilterSelected()
 	{
 		return;
 	}
-
-	BOOL recent_active = ("Recent Items" == mActivePanel->getName());
-	childSetVisible("add_btn_panel", !recent_active);
-
 	setFilterSubString(mFilterSubString);
 	LLInventoryFilter* filter = mActivePanel->getFilter();
 	LLFloaterInventoryFinder *finder = getFinder();
@@ -561,8 +557,7 @@ void LLPanelMainInventory::draw()
 
 void LLPanelMainInventory::updateItemcountText()
 {
-	// *TODO: Calling setlocale() on each frame may be inefficient.
-	LLLocale locale(LLStringUtil::getLocale());
+	LLLocale locale(LLLocale::USER_LOCALE);
 	std::string item_count_string;
 	LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount());
 
@@ -603,7 +598,7 @@ void LLPanelMainInventory::toggleFindOptions()
 		finder->openFloater();
 
 		LLFloater* parent_floater = gFloaterView->getParentFloater(this);
-		if (parent_floater)
+		if (parent_floater) // Seraph: Fix this, shouldn't be null even for sidepanel
 			parent_floater->addDependentFloater(mFinderHandle);
 		// start background fetch of folders
 		LLInventoryModelBackgroundFetch::instance().start();
@@ -899,12 +894,14 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
 
 void LLPanelMainInventory::initListCommandsHandlers()
 {
-	childSetAction("options_gear_btn", boost::bind(&LLPanelMainInventory::onGearButtonClick, this));
-	childSetAction("trash_btn", boost::bind(&LLPanelMainInventory::onTrashButtonClick, this));
-	childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
+	mListCommands = getChild<LLPanel>("bottom_panel");
+
+	mListCommands->childSetAction("options_gear_btn", boost::bind(&LLPanelMainInventory::onGearButtonClick, this));
+	mListCommands->childSetAction("trash_btn", boost::bind(&LLPanelMainInventory::onTrashButtonClick, this));
+	mListCommands->childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
 
-	mTrashButton = getChild<LLDragAndDropButton>("trash_btn");
-	mTrashButton->setDragAndDropHandler(boost::bind(&LLPanelMainInventory::handleDragAndDropToTrash, this
+	LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>("trash_btn");
+	trash_btn->setDragAndDropHandler(boost::bind(&LLPanelMainInventory::handleDragAndDropToTrash, this
 			,	_4 // BOOL drop
 			,	_5 // EDragAndDropType cargo_type
 			,	_7 // EAcceptance* accept
@@ -920,7 +917,7 @@ void LLPanelMainInventory::updateListCommands()
 {
 	bool trash_enabled = isActionEnabled("delete");
 
-	mTrashButton->setEnabled(trash_enabled);
+	mListCommands->childSetEnabled("trash_btn", trash_enabled);
 }
 
 void LLPanelMainInventory::onGearButtonClick()
@@ -1067,7 +1064,6 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
 		mFilterEditor->setFocus(TRUE);
 		filter->setFilterUUID(item_id);
 		filter->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-		filter->setFilterLinks(LLInventoryFilter::FILTERLINK_ONLY_LINKS);
 	}
 }
 
@@ -1097,7 +1093,8 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
 		if (root)
 		{
 			can_delete = TRUE;
-			std::set<LLUUID> selection_set = root->getSelectionList();
+			std::set<LLUUID> selection_set;
+			root->getSelectionList(selection_set);
 			if (selection_set.empty()) return FALSE;
 			for (std::set<LLUUID>::iterator iter = selection_set.begin();
 				 iter != selection_set.end();
@@ -1134,10 +1131,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
 
 	if (command_name == "find_links")
 	{
-		LLFolderView* root = getActivePanel()->getRootFolder();
-		std::set<LLUUID> selection_set = root->getSelectionList();
-		if (selection_set.size() != 1) return FALSE;
-		LLFolderViewItem* current_item = root->getCurSelectedItem();
+		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
 		if (!current_item) return FALSE;
 		const LLUUID& item_id = current_item->getListener()->getUUID();
 		const LLInventoryObject *obj = gInventory.getObject(item_id);
@@ -1161,12 +1155,6 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
 		return FALSE;
 	}
 
-	if (command_name == "share")
-	{
-		LLSidepanelInventory* parent = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
-		return parent ? parent->canShare() : FALSE;
-	}
-
 	return TRUE;
 }
 
@@ -1196,7 +1184,7 @@ void LLPanelMainInventory::setUploadCostIfNeeded()
 		LLMenuItemBranchGL* upload_menu = mMenuAdd->findChild<LLMenuItemBranchGL>("upload");
 		if(upload_menu)
 		{
-			S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+			S32 upload_cost = -1;//LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
 			std::string cost_str;
 
 			// getPriceUpload() returns -1 if no data available yet.
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 211b9cf4b1a281fa23089b9386b1825daba8a6b1..df74c5dd470b574d1212140bcdff12a3a3d6e40c 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -2,25 +2,31 @@
  * @file llsidepanelinventory.cpp
  * @brief LLPanelObjectInventory class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -40,9 +46,8 @@
 #include "roles_constants.h"
 
 #include "llagent.h"
-#include "llavataractions.h"
 #include "llcallbacklist.h"
-#include "llbuycurrencyhtml.h"
+#include "llfloaterbuycurrency.h"
 #include "llfloaterreg.h"
 #include "llinventorybridge.h"
 #include "llinventorydefines.h"
@@ -77,17 +82,16 @@ class LLTaskInvFVBridge : public LLFolderViewEventListener
 	mutable std::string mDisplayName;
 	LLPanelObjectInventory* mPanel;
 	U32 mFlags;
-	LLAssetType::EType mAssetType;	
-	LLInventoryType::EType mInventoryType;
 
 	LLInventoryItem* findItem() const;
 
 public:
-	LLTaskInvFVBridge(LLPanelObjectInventory* panel,
-					  const LLUUID& uuid,
-					  const std::string& name,
-					  U32 flags=0);
-	virtual ~LLTaskInvFVBridge() {}
+	LLTaskInvFVBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name,
+		U32 flags=0);
+	virtual ~LLTaskInvFVBridge( void ) {}
 
 	virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
 	virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
@@ -108,7 +112,6 @@ class LLTaskInvFVBridge : public LLFolderViewEventListener
 	virtual time_t getCreationDate() const;
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
-	virtual BOOL canOpenItem() const { return FALSE; }
 	virtual void closeItem() {}
 	virtual void previewItem();
 	virtual void selectItem() {}
@@ -130,8 +133,6 @@ class LLTaskInvFVBridge : public LLFolderViewEventListener
 	virtual BOOL isUpToDate() const { return TRUE; }
 	virtual BOOL hasChildren() const { return FALSE; }
 	virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; }
-	virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; }
-
 	// LLDragAndDropBridge functionality
 	virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
 	virtual BOOL dragOrDrop(MASK mask, BOOL drop,
@@ -147,16 +148,9 @@ LLTaskInvFVBridge::LLTaskInvFVBridge(
 	mUUID(uuid),
 	mName(name),
 	mPanel(panel),
-	mFlags(flags),
-	mAssetType(LLAssetType::AT_NONE),
-	mInventoryType(LLInventoryType::IT_NONE)
+	mFlags(flags)
 {
-	const LLInventoryItem *item = findItem();
-	if (item)
-	{
-		mAssetType = item->getType();
-		mInventoryType = item->getInventoryType();
-	}
+
 }
 
 LLInventoryItem* LLTaskInvFVBridge::findItem() const
@@ -171,7 +165,20 @@ LLInventoryItem* LLTaskInvFVBridge::findItem() const
 
 void LLTaskInvFVBridge::showProperties()
 {
-	show_task_item_profile(mUUID, mPanel->getTaskUUID());
+	LLSD key;
+	key["object"] = mPanel->getTaskUUID();
+	key["id"] = mUUID;
+	LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
+
+
+	// Disable old properties floater; this is replaced by the sidepanel.
+	/*
+	LLFloaterProperties* floater = LLFloaterReg::showTypedInstance<LLFloaterProperties>("properties", mUUID);
+	if (floater)
+	{
+		floater->setObjectID(mPanel->getTaskUUID());
+	}
+	*/
 }
 
 struct LLBuyInvItemData
@@ -337,9 +344,13 @@ time_t LLTaskInvFVBridge::getCreationDate() const
 
 LLUIImagePtr LLTaskInvFVBridge::getIcon() const
 {
-	const BOOL item_is_multi = (mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS);
+	BOOL item_is_multi = FALSE;
+	if ( mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
+	{
+		item_is_multi = TRUE;
+	}
 
-	return LLInventoryIcon::getIcon(mAssetType, mInventoryType, 0, item_is_multi );
+	return get_item_icon(LLAssetType::AT_OBJECT, LLInventoryType::IT_OBJECT, 0, item_is_multi );
 }
 
 void LLTaskInvFVBridge::openItem()
@@ -359,7 +370,8 @@ BOOL LLTaskInvFVBridge::isItemRenameable() const
 	LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
 	if(object)
 	{
-		LLInventoryItem* item = (LLInventoryItem*)(object->getInventoryObject(mUUID));
+		LLInventoryItem* item;
+		item = (LLInventoryItem*)(object->getInventoryObject(mUUID));
 		if(item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(),
 										 GP_OBJECT_MANIPULATE, GOD_LIKE))
 		{
@@ -600,7 +612,7 @@ void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string actio
 			{
 				LLStringUtil::format_map_t args;
 				args["AMOUNT"] = llformat("%d", price);
-				LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("this_costs", args), price );
+				LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_costs", args), price);
 			}
 			else
 			{
@@ -662,7 +674,7 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 			}
 		}
 	}
-	else if (canOpenItem())
+	else
 	{
 		items.push_back(std::string("Task Open"));
 		if (!isItemCopyable())
@@ -708,8 +720,6 @@ class LLTaskCategoryBridge : public LLTaskInvFVBridge
 	virtual BOOL dragOrDrop(MASK mask, BOOL drop,
 							EDragAndDropType cargo_type,
 							void* cargo_data);
-	virtual BOOL canOpenItem() const { return TRUE; }
-	virtual void openItem();
 };
 
 LLTaskCategoryBridge::LLTaskCategoryBridge(
@@ -744,6 +754,7 @@ void LLTaskCategoryBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 {
 	std::vector<std::string> items;
 	std::vector<std::string> disabled_items;
+	items.push_back(std::string("Task Open"));
 	hide_context_entries(menu, items, disabled_items);
 }
 
@@ -754,10 +765,6 @@ BOOL LLTaskCategoryBridge::hasChildren() const
 	return FALSE;
 }
 
-void LLTaskCategoryBridge::openItem()
-{
-}
-
 BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
 {
 	//llinfos << "LLTaskInvFVBridge::startDrag()" << llendl;
@@ -859,15 +866,33 @@ BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop,
 class LLTaskTextureBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskTextureBridge(LLPanelObjectInventory* panel,
-						const LLUUID& uuid,
-						const std::string& name) :
-		LLTaskInvFVBridge(panel, uuid, name) {}
+	LLTaskTextureBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name,
+		LLInventoryType::EType it);
 
-	virtual BOOL canOpenItem() const { return TRUE; }
+	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
+protected:
+	LLInventoryType::EType mInventoryType;
 };
 
+LLTaskTextureBridge::LLTaskTextureBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name,
+	LLInventoryType::EType it) :
+	LLTaskInvFVBridge(panel, uuid, name),
+	mInventoryType(it)
+{
+}
+
+LLUIImagePtr LLTaskTextureBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_TEXTURE, mInventoryType, 0, FALSE);
+}
+
 void LLTaskTextureBridge::openItem()
 {
 	llinfos << "LLTaskTextureBridge::openItem()" << llendl;
@@ -886,18 +911,31 @@ void LLTaskTextureBridge::openItem()
 class LLTaskSoundBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskSoundBridge(LLPanelObjectInventory* panel,
-					  const LLUUID& uuid,
-					  const std::string& name) :
-		LLTaskInvFVBridge(panel, uuid, name) {}
+	LLTaskSoundBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name);
 
-	virtual BOOL canOpenItem() const { return TRUE; }
+	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	static void openSoundPreview(void* data);
 };
 
+LLTaskSoundBridge::LLTaskSoundBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name) :
+	LLTaskInvFVBridge(panel, uuid, name)
+{
+}
+
+LLUIImagePtr LLTaskSoundBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_SOUND, LLInventoryType::IT_SOUND, 0, FALSE);
+}
+
 void LLTaskSoundBridge::openItem()
 {
 	openSoundPreview((void*)this);
@@ -968,8 +1006,9 @@ void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 			}
 		}
 	}
-	else if (canOpenItem())
+	else
 	{
+		items.push_back(std::string("Task Open")); 
 		if (!isItemCopyable())
 		{
 			disabled_items.push_back(std::string("Task Open"));
@@ -998,12 +1037,28 @@ void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 class LLTaskLandmarkBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskLandmarkBridge(LLPanelObjectInventory* panel,
-						 const LLUUID& uuid,
-						 const std::string& name) :
-		LLTaskInvFVBridge(panel, uuid, name) {}
+	LLTaskLandmarkBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name);
+
+	virtual LLUIImagePtr getIcon() const;
 };
 
+LLTaskLandmarkBridge::LLTaskLandmarkBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name) :
+	LLTaskInvFVBridge(panel, uuid, name)
+{
+}
+
+LLUIImagePtr LLTaskLandmarkBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, 0, FALSE);
+}
+
+
 ///----------------------------------------------------------------------------
 /// Class LLTaskCallingCardBridge
 ///----------------------------------------------------------------------------
@@ -1011,15 +1066,29 @@ class LLTaskLandmarkBridge : public LLTaskInvFVBridge
 class LLTaskCallingCardBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskCallingCardBridge(LLPanelObjectInventory* panel,
-							const LLUUID& uuid,
-							const std::string& name) :
-		LLTaskInvFVBridge(panel, uuid, name) {}
+	LLTaskCallingCardBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name);
 
+	virtual LLUIImagePtr getIcon() const;
 	virtual BOOL isItemRenameable() const;
 	virtual BOOL renameItem(const std::string& new_name);
 };
 
+LLTaskCallingCardBridge::LLTaskCallingCardBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name) :
+	LLTaskInvFVBridge(panel, uuid, name)
+{
+}
+
+LLUIImagePtr LLTaskCallingCardBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, 0, FALSE);
+}
+
 BOOL LLTaskCallingCardBridge::isItemRenameable() const
 {
 	return FALSE;
@@ -1038,23 +1107,37 @@ BOOL LLTaskCallingCardBridge::renameItem(const std::string& new_name)
 class LLTaskScriptBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskScriptBridge(LLPanelObjectInventory* panel,
-					   const LLUUID& uuid,
-					   const std::string& name) :
-		LLTaskInvFVBridge(panel, uuid, name) {}
+	LLTaskScriptBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name);
 
+	virtual LLUIImagePtr getIcon() const;
 	//static BOOL enableIfCopyable( void* userdata );
 };
 
+LLTaskScriptBridge::LLTaskScriptBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name) :
+	LLTaskInvFVBridge(panel, uuid, name)
+{
+}
+
+LLUIImagePtr LLTaskScriptBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
+}
+
+
 class LLTaskLSLBridge : public LLTaskScriptBridge
 {
 public:
-	LLTaskLSLBridge(LLPanelObjectInventory* panel,
-					const LLUUID& uuid,
-					const std::string& name) :
-		LLTaskScriptBridge(panel, uuid, name) {}
+	LLTaskLSLBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name);
 
-	virtual BOOL canOpenItem() const { return TRUE; }
 	virtual void openItem();
 	virtual BOOL removeItem();
 	//virtual void buildContextMenu(LLMenuGL& menu);
@@ -1062,6 +1145,14 @@ class LLTaskLSLBridge : public LLTaskScriptBridge
 	//static void copyToInventory(void* userdata);
 };
 
+LLTaskLSLBridge::LLTaskLSLBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name) :
+	LLTaskScriptBridge(panel, uuid, name)
+{
+}
+
 void LLTaskLSLBridge::openItem()
 {
 	llinfos << "LLTaskLSLBridge::openItem() " << mUUID << llendl;
@@ -1097,13 +1188,35 @@ BOOL LLTaskLSLBridge::removeItem()
 class LLTaskObjectBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskObjectBridge(LLPanelObjectInventory* panel,
-					   const LLUUID& uuid,
-					   const std::string& name,
-					   U32 flags = 0) :
-		LLTaskInvFVBridge(panel, uuid, name, flags) {}
+	LLTaskObjectBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name,
+		U32 flags = 0);
+
+	virtual LLUIImagePtr getIcon() const;
 };
 
+LLTaskObjectBridge::LLTaskObjectBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name,
+	U32 flags) :
+	LLTaskInvFVBridge(panel, uuid, name, flags)
+{
+}
+
+LLUIImagePtr LLTaskObjectBridge::getIcon() const
+{
+	BOOL item_is_multi = FALSE;
+	if ( mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
+	{
+		item_is_multi = TRUE;
+	}
+
+	return get_item_icon(LLAssetType::AT_OBJECT, LLInventoryType::IT_OBJECT, 0, item_is_multi);
+}
+
 ///----------------------------------------------------------------------------
 /// Class LLTaskNotecardBridge
 ///----------------------------------------------------------------------------
@@ -1111,16 +1224,29 @@ class LLTaskObjectBridge : public LLTaskInvFVBridge
 class LLTaskNotecardBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskNotecardBridge(LLPanelObjectInventory* panel,
-						 const LLUUID& uuid,
-						 const std::string& name) :
-		LLTaskInvFVBridge(panel, uuid, name) {}
+	LLTaskNotecardBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name);
 
-	virtual BOOL canOpenItem() const { return TRUE; }
+	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 	virtual BOOL removeItem();
 };
 
+LLTaskNotecardBridge::LLTaskNotecardBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name) :
+	LLTaskInvFVBridge(panel, uuid, name)
+{
+}
+
+LLUIImagePtr LLTaskNotecardBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, 0, FALSE);
+}
+
 void LLTaskNotecardBridge::openItem()
 {
 	LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
@@ -1151,16 +1277,29 @@ BOOL LLTaskNotecardBridge::removeItem()
 class LLTaskGestureBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskGestureBridge(LLPanelObjectInventory* panel,
-						const LLUUID& uuid,
-						const std::string& name) :
-	LLTaskInvFVBridge(panel, uuid, name) {}
+	LLTaskGestureBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name);
 
-	virtual BOOL canOpenItem() const { return TRUE; }
+	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 	virtual BOOL removeItem();
 };
 
+LLTaskGestureBridge::LLTaskGestureBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name) :
+	LLTaskInvFVBridge(panel, uuid, name)
+{
+}
+
+LLUIImagePtr LLTaskGestureBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, 0, FALSE);
+}
+
 void LLTaskGestureBridge::openItem()
 {
 	LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
@@ -1185,16 +1324,29 @@ BOOL LLTaskGestureBridge::removeItem()
 class LLTaskAnimationBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskAnimationBridge(LLPanelObjectInventory* panel,
-						  const LLUUID& uuid,
-						  const std::string& name) :
-		LLTaskInvFVBridge(panel, uuid, name) {}
+	LLTaskAnimationBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name);
 
-	virtual BOOL canOpenItem() const { return TRUE; }
+	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 	virtual BOOL removeItem();
 };
 
+LLTaskAnimationBridge::LLTaskAnimationBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name) :
+	LLTaskInvFVBridge(panel, uuid, name)
+{
+}
+
+LLUIImagePtr LLTaskAnimationBridge::getIcon() const
+{
+	return get_item_icon(LLAssetType::AT_ANIMATION, LLInventoryType::IT_ANIMATION, 0, FALSE);
+}
+
 void LLTaskAnimationBridge::openItem()
 {
 	LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
@@ -1223,18 +1375,33 @@ BOOL LLTaskAnimationBridge::removeItem()
 class LLTaskWearableBridge : public LLTaskInvFVBridge
 {
 public:
-	LLTaskWearableBridge(LLPanelObjectInventory* panel,
-						 const LLUUID& uuid,
-						 const std::string& name,
-						 U32 flags) :
-		LLTaskInvFVBridge(panel, uuid, name, flags) {}
+	LLTaskWearableBridge(
+		LLPanelObjectInventory* panel,
+		const LLUUID& uuid,
+		const std::string& name,
+		LLAssetType::EType asset_type,
+		U32 flags);
 
 	virtual LLUIImagePtr getIcon() const;
+
+protected:
+	LLAssetType::EType		mAssetType;
 };
 
+LLTaskWearableBridge::LLTaskWearableBridge(
+	LLPanelObjectInventory* panel,
+	const LLUUID& uuid,
+	const std::string& name,
+	LLAssetType::EType asset_type,
+	U32 flags) :
+	LLTaskInvFVBridge(panel, uuid, name, flags),
+	mAssetType( asset_type )
+{
+}
+
 LLUIImagePtr LLTaskWearableBridge::getIcon() const
 {
-	return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, FALSE );
+	return get_item_icon(mAssetType, LLInventoryType::IT_WEARABLE, mFlags, FALSE );
 }
 
 
@@ -1246,31 +1413,31 @@ LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory*
 														 LLInventoryObject* object)
 {
 	LLTaskInvFVBridge* new_bridge = NULL;
-	const LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(object);
-	const U32 itemflags = ( NULL == item ? 0 : item->getFlags() );
 	LLAssetType::EType type = object->getType();
-
+	LLInventoryItem* item = NULL;
 	switch(type)
 	{
 	case LLAssetType::AT_TEXTURE:
+		item = (LLInventoryItem*)object;
 		new_bridge = new LLTaskTextureBridge(panel,
-						     object->getUUID(),
-						     object->getName());
+											 object->getUUID(),
+											 object->getName(),
+											 item->getInventoryType());
 		break;
 	case LLAssetType::AT_SOUND:
 		new_bridge = new LLTaskSoundBridge(panel,
-						   object->getUUID(),
-						   object->getName());
+										   object->getUUID(),
+										   object->getName());
 		break;
 	case LLAssetType::AT_LANDMARK:
 		new_bridge = new LLTaskLandmarkBridge(panel,
-						      object->getUUID(),
-						      object->getName());
+											  object->getUUID(),
+											  object->getName());
 		break;
 	case LLAssetType::AT_CALLINGCARD:
 		new_bridge = new LLTaskCallingCardBridge(panel,
-							 object->getUUID(),
-							 object->getName());
+												 object->getUUID(),
+												 object->getName());
 		break;
 	case LLAssetType::AT_SCRIPT:
 		// OLD SCRIPTS DEPRECATED - JC
@@ -1280,42 +1447,51 @@ LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory*
 		//									   object->getName());
 		break;
 	case LLAssetType::AT_OBJECT:
+		{
+		item = dynamic_cast<LLInventoryItem*>(object);
+		U32 flags = ( NULL == item ? 0 : item->getFlags() );
+
 		new_bridge = new LLTaskObjectBridge(panel,
-						    object->getUUID(),
-						    object->getName(),
-						    itemflags);
+											object->getUUID(),
+											object->getName(),
+											flags);
+		}
 		break;
 	case LLAssetType::AT_NOTECARD:
 		new_bridge = new LLTaskNotecardBridge(panel,
-						      object->getUUID(),
-						      object->getName());
+											  object->getUUID(),
+											  object->getName());
 		break;
 	case LLAssetType::AT_ANIMATION:
 		new_bridge = new LLTaskAnimationBridge(panel,
-						       object->getUUID(),
-						       object->getName());
+											  object->getUUID(),
+											  object->getName());
 		break;
 	case LLAssetType::AT_GESTURE:
 		new_bridge = new LLTaskGestureBridge(panel,
-						     object->getUUID(),
-						     object->getName());
+											  object->getUUID(),
+											  object->getName());
 		break;
 	case LLAssetType::AT_CLOTHING:
 	case LLAssetType::AT_BODYPART:
+		item = (LLInventoryItem*)object;
 		new_bridge = new LLTaskWearableBridge(panel,
-						      object->getUUID(),
-						      object->getName(),
-						      itemflags);
+											  object->getUUID(),
+											  object->getName(),
+											  type,
+											  item->getFlags());
 		break;
 	case LLAssetType::AT_CATEGORY:
 		new_bridge = new LLTaskCategoryBridge(panel,
-						      object->getUUID(),
-						      object->getName());
+											  object->getUUID(),
+											  object->getName());
 		break;
 	case LLAssetType::AT_LSL_TEXT:
 		new_bridge = new LLTaskLSLBridge(panel,
-						 object->getUUID(),
-						 object->getName());
+										 object->getUUID(),
+										 object->getName());
+		break;
+	
 		break;
 	default:
 		llinfos << "Unhandled inventory type (llassetstorage.h): "
@@ -1352,7 +1528,6 @@ LLPanelObjectInventory::LLPanelObjectInventory(const LLPanelObjectInventory::Par
 	mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&do_nothing));
 	mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&do_nothing));
 	mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&do_nothing));
-	mCommitCallbackRegistrar.add("Inventory.Share",  boost::bind(&LLAvatarActions::shareWithAvatars));
 }
 
 // Destroys the object
@@ -1481,7 +1656,7 @@ void LLPanelObjectInventory::updateInventory()
 	BOOL inventory_has_focus = FALSE;
 	if (mHaveInventory)
 	{
-		selected_items = mFolders->getSelectionList();
+		mFolders->getSelectionList(selected_items);
 		inventory_has_focus = gFocusMgr.childHasKeyboardFocus(mFolders);
 	}
 
diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h
index 607b705f7f85809392b13382305ca243070fc42b..d015929841ac2baf9fa047457e50930e1b9f7fcd 100644
--- a/indra/newview/llpanelobjectinventory.h
+++ b/indra/newview/llpanelobjectinventory.h
@@ -2,25 +2,31 @@
  * @file llpanelobjectinventory.h
  * @brief LLPanelObjectInventory class definition
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index d67b95a70e2cd2c18186164b4909af7dd6fac39e..cf04ab378fadacb97fc85a7b8d1979e6214311ab 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -2,25 +2,31 @@
  * @file llpaneloutfitedit.cpp
  * @brief Displays outfit edit information in Side Tray.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -30,21 +36,15 @@
 
 // *TODO: reorder includes to match the coding standard
 #include "llagent.h"
-#include "llagentcamera.h"
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
-#include "lloutfitobserver.h"
-#include "llcofwearables.h"
-#include "llfilteredwearablelist.h"
 #include "llinventory.h"
-#include "llinventoryitemslist.h"
 #include "llviewercontrol.h"
 #include "llui.h"
 #include "llfloater.h"
 #include "llfloaterreg.h"
 #include "llinventoryfunctions.h"
 #include "llinventorypanel.h"
-#include "llviewermenu.h"
 #include "llviewerwindow.h"
 #include "llviewerinventory.h"
 #include "llbutton.h"
@@ -54,22 +54,13 @@
 #include "llinventorybridge.h"
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
-#include "llloadingindicator.h"
-#include "llpaneloutfitsinventory.h"
 #include "lluiconstants.h"
-#include "llsaveoutfitcombobtn.h"
 #include "llscrolllistctrl.h"
 #include "lltextbox.h"
-#include "lltrans.h"
 #include "lluictrlfactory.h"
 #include "llsdutil.h"
 #include "llsidepanelappearance.h"
-#include "lltoggleablemenu.h"
-#include "llvoavatarself.h"
 #include "llwearablelist.h"
-#include "llwearableitemslist.h"
-#include "llwearabletype.h"
-#include "llweb.h"
 
 static LLRegisterPanelClassWrapper<LLPanelOutfitEdit> t_outfit_edit("panel_outfit_edit");
 
@@ -77,430 +68,184 @@ const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE);
 const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT);
 const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK;
 
-static const std::string REVERT_BTN("revert_btn");
-
-class LLShopURLDispatcher
+class LLInventoryLookObserver : public LLInventoryObserver
 {
 public:
-	std::string resolveURL(LLWearableType::EType wearable_type, ESex sex);
-	std::string resolveURL(LLAssetType::EType asset_type, ESex sex);
-};
-
-std::string LLShopURLDispatcher::resolveURL(LLWearableType::EType wearable_type, ESex sex)
-{
-	const std::string prefix = "MarketplaceURL";
-	const std::string sex_str = (sex == SEX_MALE) ? "Male" : "Female";
-	const std::string type_str = LLWearableType::getTypeName(wearable_type);
-
-	std::string setting_name = prefix;
-
-	switch (wearable_type)
+	LLInventoryLookObserver(LLPanelOutfitEdit *panel) : mPanel(panel) {}
+	virtual ~LLInventoryLookObserver() 
 	{
-	case LLWearableType::WT_ALPHA:
-	case LLWearableType::WT_NONE:
-	case LLWearableType::WT_INVALID:	// just in case, this shouldn't happen
-	case LLWearableType::WT_COUNT:		// just in case, this shouldn't happen
-		break;
-
-	default:
-		setting_name += '_';
-		setting_name += type_str;
-		setting_name += sex_str;
-		break;
-	}
-
-	return gSavedSettings.getString(setting_name);
-}
-
-std::string LLShopURLDispatcher::resolveURL(LLAssetType::EType asset_type, ESex sex)
-{
-	const std::string prefix = "MarketplaceURL";
-	const std::string sex_str = (sex == SEX_MALE) ? "Male" : "Female";
-	const std::string type_str = LLAssetType::lookup(asset_type);
-
-	std::string setting_name = prefix;
-
-	switch (asset_type)
-	{
-	case LLAssetType::AT_CLOTHING:
-	case LLAssetType::AT_OBJECT:
-	case LLAssetType::AT_BODYPART:
-		setting_name += '_';
-		setting_name += type_str;
-		setting_name += sex_str;
-		break;
-
-	// to suppress warnings
-	default:
-		break;
-	}
-
-	return gSavedSettings.getString(setting_name);
-}
-
-class LLPanelOutfitEditGearMenu
-{
-public:
-	static LLMenuGL* create()
-	{
-		LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-
-		registrar.add("Wearable.Create", boost::bind(onCreate, _2));
-
-		LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
-			"menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
-		llassert(menu);
-		if (menu)
-		{
-			populateCreateWearableSubmenus(menu);
-			menu->buildDrawLabels();
-		}
-
-		return menu;
-	}
-
-private:
-	static void onCreate(const LLSD& param)
-	{
-		LLWearableType::EType type = LLWearableType::typeNameToType(param.asString());
-		if (type == LLWearableType::WT_NONE)
+		if (gInventory.containsObserver(this))
 		{
-			llwarns << "Invalid wearable type" << llendl;
-			return;
+			gInventory.removeObserver(this);
 		}
-
-		LLAgentWearables::createWearable(type, true);
 	}
-
-	// Populate the menu with items like "New Skin", "New Pants", etc.
-	static void populateCreateWearableSubmenus(LLMenuGL* menu)
+	
+	virtual void changed(U32 mask)
 	{
-		LLView* menu_clothes	= gMenuHolder->findChildView("COF.Gear.New_Clothes", FALSE);
-		LLView* menu_bp			= gMenuHolder->findChildView("COF.Geear.New_Body_Parts", FALSE);
-
-		if (!menu_clothes || !menu_bp)
+		if (mask & (LLInventoryObserver::ADD | LLInventoryObserver::REMOVE))
 		{
-			llassert(menu_clothes && menu_bp);
-			return;
-		}
-
-		for (U8 i = LLWearableType::WT_SHAPE; i != (U8) LLWearableType::WT_COUNT; ++i)
-		{
-			LLWearableType::EType type = (LLWearableType::EType) i;
-			const std::string& type_name = LLWearableType::getTypeName(type);
-
-			LLMenuItemCallGL::Params p;
-			p.name = type_name;
-			p.label = LLTrans::getString(LLWearableType::getTypeDefaultNewName(type));
-			p.on_click.function_name = "Wearable.Create";
-			p.on_click.parameter = LLSD(type_name);
-
-			LLView* parent = LLWearableType::getAssetType(type) == LLAssetType::AT_CLOTHING ?
-				menu_clothes : menu_bp;
-			LLUICtrlFactory::create<LLMenuItemCallGL>(p, parent);
+			mPanel->updateLookInfo();
 		}
 	}
+protected:
+	LLPanelOutfitEdit *mPanel;
 };
 
-class LLCOFDragAndDropObserver : public LLInventoryAddItemByAssetObserver
+class LLLookFetchObserver : public LLInventoryFetchDescendentsObserver
 {
 public:
-	LLCOFDragAndDropObserver(LLInventoryModel* model);
-
-	virtual ~LLCOFDragAndDropObserver();
-
-	virtual void done();
-
+	LLLookFetchObserver(LLPanelOutfitEdit *panel) :
+	mPanel(panel)
+	{}
+	LLLookFetchObserver() {}
+	virtual void done()
+	{
+		mPanel->lookFetched();
+		if(gInventory.containsObserver(this))
+		{
+			gInventory.removeObserver(this);
+		}
+	}
 private:
-	LLInventoryModel* mModel;
+	LLPanelOutfitEdit *mPanel;
 };
 
-inline LLCOFDragAndDropObserver::LLCOFDragAndDropObserver(LLInventoryModel* model):
-		mModel(model)
-{
-	if (model != NULL)
-	{
-		model->addObserver(this);
-	}
-}
-
-inline LLCOFDragAndDropObserver::~LLCOFDragAndDropObserver()
-{
-	if (mModel != NULL && mModel->containsObserver(this))
-	{
-		mModel->removeObserver(this);
-	}
-}
 
-void LLCOFDragAndDropObserver::done()
-{
-	LLAppearanceMgr::instance().updateAppearanceFromCOF();
-}
 
 LLPanelOutfitEdit::LLPanelOutfitEdit()
-:	LLPanel(), 
-	mSearchFilter(NULL),
-	mCOFWearables(NULL),
-	mInventoryItemsPanel(NULL),
-	mGearMenu(NULL),
-	mCOFDragAndDropObserver(NULL),
-	mInitialized(false),
-	mAddWearablesPanel(NULL),
-	mFolderViewFilterCmbBox(NULL),
-	mListViewFilterCmbBox(NULL),
-	mPlusBtn(NULL)
+:	LLPanel(), mCurrentOutfitID(), mFetchLook(NULL), mSearchFilter(NULL),
+mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToLookBtn(NULL),
+mRemoveFromLookBtn(NULL), mLookObserver(NULL)
 {
 	mSavedFolderState = new LLSaveFolderState();
 	mSavedFolderState->setApply(FALSE);
 	
-
-	LLOutfitObserver& observer = LLOutfitObserver::instance();
-	observer.addBOFReplacedCallback(boost::bind(&LLPanelOutfitEdit::updateCurrentOutfitName, this));
-	observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this));
-	observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this));
-	observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::onCOFChanged, this));
-
-	gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, true));
-	gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, false));
+	mFetchLook = new LLLookFetchObserver(this);
+	mLookObserver = new LLInventoryLookObserver(this);
+	gInventory.addObserver(mLookObserver);
 	
-	mFolderViewItemTypes.reserve(NUM_FOLDER_VIEW_ITEM_TYPES);
-	for (U32 i = 0; i < NUM_FOLDER_VIEW_ITEM_TYPES; i++)
+	mLookItemTypes.reserve(NUM_LOOK_ITEM_TYPES);
+	for (U32 i = 0; i < NUM_LOOK_ITEM_TYPES; i++)
 	{
-		mFolderViewItemTypes.push_back(LLLookItemType());
+		mLookItemTypes.push_back(LLLookItemType());
 	}
+	
+	// TODO: make these strings translatable
+	mLookItemTypes[LIT_ALL] = LLLookItemType("All Items", ALL_ITEMS_MASK);
+	mLookItemTypes[LIT_WEARABLE] = LLLookItemType("Shape & Clothing", WEARABLE_MASK);
+	mLookItemTypes[LIT_ATTACHMENT] = LLLookItemType("Attachments", ATTACHMENT_MASK);
 
 }
 
 LLPanelOutfitEdit::~LLPanelOutfitEdit()
 {
 	delete mSavedFolderState;
-
-	delete mCOFDragAndDropObserver;
-
-	while (!mListViewItemTypes.empty()) {
-		delete mListViewItemTypes.back();
-		mListViewItemTypes.pop_back();
+	if (gInventory.containsObserver(mFetchLook))
+	{
+		gInventory.removeObserver(mFetchLook);
 	}
+	delete mFetchLook;
+	
+	if (gInventory.containsObserver(mLookObserver))
+	{
+		gInventory.removeObserver(mLookObserver);
+	}
+	delete mLookObserver;
 }
 
 BOOL LLPanelOutfitEdit::postBuild()
 {
 	// gInventory.isInventoryUsable() no longer needs to be tested per Richard's fix for race conditions between inventory and panels
-	
-	mFolderViewItemTypes[FVIT_ALL] = LLLookItemType(getString("Filter.All"), ALL_ITEMS_MASK);
-	mFolderViewItemTypes[FVIT_WEARABLE] = LLLookItemType(getString("Filter.Clothes/Body"), WEARABLE_MASK);
-	mFolderViewItemTypes[FVIT_ATTACHMENT] = LLLookItemType(getString("Filter.Objects"), ATTACHMENT_MASK);
-
-	//order is important, see EListViewItemType for order information
-	mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.All"), new LLFindNonLinksByMask(ALL_ITEMS_MASK)));
-	mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Clothing"), new LLIsTypeActual(LLAssetType::AT_CLOTHING)));
-	mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Bodyparts"), new LLIsTypeActual(LLAssetType::AT_BODYPART)));
-	mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Objects"), new LLFindByMask(ATTACHMENT_MASK)));;
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shape"), new LLFindActualWearablesOfType(LLWearableType::WT_SHAPE)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("skin"), new LLFindActualWearablesOfType(LLWearableType::WT_SKIN)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("hair"), new LLFindActualWearablesOfType(LLWearableType::WT_HAIR)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("eyes"), new LLFindActualWearablesOfType(LLWearableType::WT_EYES)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shirt"), new LLFindActualWearablesOfType(LLWearableType::WT_SHIRT)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("pants"), new LLFindActualWearablesOfType(LLWearableType::WT_PANTS)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shoes"), new LLFindActualWearablesOfType(LLWearableType::WT_SHOES)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("socks"), new LLFindActualWearablesOfType(LLWearableType::WT_SOCKS)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("jacket"), new LLFindActualWearablesOfType(LLWearableType::WT_JACKET)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("gloves"), new LLFindActualWearablesOfType(LLWearableType::WT_GLOVES)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("undershirt"), new LLFindActualWearablesOfType(LLWearableType::WT_UNDERSHIRT)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("underpants"), new LLFindActualWearablesOfType(LLWearableType::WT_UNDERPANTS)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("skirt"), new LLFindActualWearablesOfType(LLWearableType::WT_SKIRT)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("alpha"), new LLFindActualWearablesOfType(LLWearableType::WT_ALPHA)));
-	mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("tattoo"), new LLFindActualWearablesOfType(LLWearableType::WT_TATTOO)));
-
+		
 	mCurrentOutfitName = getChild<LLTextBox>("curr_outfit_name"); 
-	mStatus = getChild<LLTextBox>("status");
-
-	mFolderViewBtn = getChild<LLButton>("folder_view_btn");
-	mListViewBtn = getChild<LLButton>("list_view_btn");
-
-	childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL);
-	childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesFolderView, this), NULL);
-	childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesListView, this), NULL);
-	childSetCommitCallback("wearables_gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
-	childSetCommitCallback("gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
-	childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
-	childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
-
-	setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2));
-
-	mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list");
-	mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
 
-	mCOFWearables->getCOFCallbacks().mAddWearable = boost::bind(&LLPanelOutfitEdit::onAddWearableClicked, this);
-	mCOFWearables->getCOFCallbacks().mEditWearable = boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this);
-	mCOFWearables->getCOFCallbacks().mDeleteWearable = boost::bind(&LLPanelOutfitEdit::onRemoveFromOutfitClicked, this);
-	mCOFWearables->getCOFCallbacks().mMoveWearableCloser = boost::bind(&LLPanelOutfitEdit::moveWearable, this, true);
-	mCOFWearables->getCOFCallbacks().mMoveWearableFurther = boost::bind(&LLPanelOutfitEdit::moveWearable, this, false);
+	childSetCommitCallback("add_btn", boost::bind(&LLPanelOutfitEdit::showAddWearablesPanel, this), NULL);
 
-	mAddWearablesPanel = getChild<LLPanel>("add_wearables_panel");
-
-	mInventoryItemsPanel = getChild<LLInventoryPanel>("folder_view");
+	/*
+	mLookContents->setDoubleClickCallback(onDoubleClickSpeaker, this);
+	mLookContents->setCommitOnSelectionChange(TRUE);
+	mLookContents->setCommitCallback(boost::bind(&LLPanelActiveSpeakers::handleSpeakerSelect, this, _2));
+	mLookContents->setSortChangedCallback(boost::bind(&LLPanelActiveSpeakers::onSortChanged, this));
+	mLookContents->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+	*/
+	
+	mInventoryItemsPanel = getChild<LLInventoryPanel>("inventory_items");
 	mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK);
 	mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-	mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
-	mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
-
-	mCOFDragAndDropObserver = new LLCOFDragAndDropObserver(mInventoryItemsPanel->getModel());
-
-	mFolderViewFilterCmbBox = getChild<LLComboBox>("folder_view_filter_combobox");
-	mFolderViewFilterCmbBox->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onFolderViewFilterCommitted, this, _1));
-	mFolderViewFilterCmbBox->removeall();
-	for (U32 i = 0; i < mFolderViewItemTypes.size(); ++i)
-	{
-		mFolderViewFilterCmbBox->add(mFolderViewItemTypes[i].displayName);
-	}
-	mFolderViewFilterCmbBox->setCurrentByIndex(FVIT_ALL);
+	// mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2));
+	// mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2));
 	
-	mListViewFilterCmbBox = getChild<LLComboBox>("list_view_filter_combobox");
-	mListViewFilterCmbBox->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onListViewFilterCommitted, this, _1));
-	mListViewFilterCmbBox->removeall();
-	for (U32 i = 0; i < mListViewItemTypes.size(); ++i)
+	LLComboBox* type_filter = getChild<LLComboBox>("inventory_filter");
+	type_filter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onTypeFilterChanged, this, _1));
+	type_filter->removeall();
+	for (U32 i = 0; i < mLookItemTypes.size(); ++i)
 	{
-		mListViewFilterCmbBox->add(mListViewItemTypes[i]->displayName);
+		type_filter->add(mLookItemTypes[i].displayName);
 	}
-	mListViewFilterCmbBox->setCurrentByIndex(LVIT_ALL);
-
+	type_filter->setCurrentByIndex(LIT_ALL);
+	
 	mSearchFilter = getChild<LLFilterEditor>("look_item_filter");
 	mSearchFilter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onSearchEdit, this, _2));
+	
+	/* Removing add to look inline button (not part of mvp for viewer 2)
+	LLButton::Params add_params;
+	add_params.name("add_to_look");
+	add_params.click_callback.function(boost::bind(&LLPanelOutfitEdit::onAddToLookClicked, this));
+	add_params.label("+");
+	
+	mAddToLookBtn = LLUICtrlFactory::create<LLButton>(add_params);
+	mAddToLookBtn->setEnabled(FALSE);
+	mAddToLookBtn->setVisible(FALSE); */
+	
+	childSetAction("add_item_btn", boost::bind(&LLPanelOutfitEdit::onAddToLookClicked, this), this);
 
-	childSetAction("show_add_wearables_btn", boost::bind(&LLPanelOutfitEdit::onAddMoreButtonClicked, this));
-
-	mPlusBtn = getChild<LLButton>("plus_btn");
-	mPlusBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this));
+	mUpBtn = getChild<LLButton>("up_btn");
+	mUpBtn->setEnabled(TRUE);
+	mUpBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onUpClicked, this));
+	
+	mLookContents = getChild<LLScrollListCtrl>("look_items_list");
+	mLookContents->sortByColumn("look_item_sort", TRUE);
+	mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onLookItemSelectionChange, this));
+
+	/*
+	LLButton::Params remove_params;
+	remove_params.name("remove_from_look");
+	remove_params.click_callback.function(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this));
+	remove_params.label("-"); */
+	
+	//mRemoveFromLookBtn = LLUICtrlFactory::create<LLButton>(remove_params);
+	mRemoveFromLookBtn = getChild<LLButton>("remove_from_look_btn");
+	mRemoveFromLookBtn->setEnabled(FALSE);
+	mRemoveFromLookBtn->setVisible(FALSE);
+	//childSetAction("remove_from_look_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this);
+	mRemoveFromLookBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this));
+	//getChild<LLPanel>("look_info_group_bar")->addChild(mRemoveFromLookBtn); remove_item_btn
 	
 	mEditWearableBtn = getChild<LLButton>("edit_wearable_btn");
 	mEditWearableBtn->setEnabled(FALSE);
 	mEditWearableBtn->setVisible(FALSE);
 	mEditWearableBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this));
 
-	childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance()));
-
-	mWearablesListViewPanel = getChild<LLPanel>("filtered_wearables_panel");
-	mWearableItemsList = getChild<LLInventoryItemsList>("list_view");
-	mWearableItemsList->setCommitOnSelectionChange(true);
-	mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
-	mWearableItemsList->setDoubleClickCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this));
-
-	mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));
-	return TRUE;
-}
-
-// virtual
-void LLPanelOutfitEdit::onOpen(const LLSD& key)
-{
-	if (!mInitialized)
-	{
-		// *TODO: this method is called even panel is not visible to user because its parent layout panel is hidden.
-		// So, we can defer initializing a bit.
-		mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, mListViewItemTypes[LVIT_ALL]->collector);
-		mWearableListManager->populateList();
-		displayCurrentOutfit();
-		mInitialized = true;
-	}
-}
-
-void LLPanelOutfitEdit::moveWearable(bool closer_to_body)
-{
-	LLUUID item_id = mCOFWearables->getSelectedUUID();
-	if (item_id.isNull()) return;
+	childSetAction("remove_item_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this);
 	
-	LLViewerInventoryItem* wearable_to_move = gInventory.getItem(item_id);
-	LLAppearanceMgr::getInstance()->moveWearable(wearable_to_move, closer_to_body);
-}
-
-void LLPanelOutfitEdit::toggleAddWearablesPanel()
-{
-	BOOL current_visibility = mAddWearablesPanel->getVisible();
-	showAddWearablesPanel(!current_visibility);
-}
-
-void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables)
-{
-	mAddWearablesPanel->setVisible(show_add_wearables);
-	
-	childSetValue("show_add_wearables_btn", show_add_wearables);
-
-	updateFiltersVisibility();
-	childSetVisible("filter_button", show_add_wearables);
-
-	//search filter should be disabled
-	if (!show_add_wearables)
-	{
-		childSetValue("filter_button", false);
-
-		mFolderViewFilterCmbBox->setVisible(false);
-		mListViewFilterCmbBox->setVisible(false);
-
-		showWearablesFilter();
-
-		// Reset mWearableItemsList position to top. See EXT-8180.
-		mWearableItemsList->goToTop();
-	}
-
-	//switching button bars
-	childSetVisible("no_add_wearables_button_bar", !show_add_wearables);
-	childSetVisible("add_wearables_button_bar", show_add_wearables);
-}
-
-void LLPanelOutfitEdit::showWearablesFilter()
-{
-	bool filter_visible = childGetValue("filter_button");
-
-	childSetVisible("filter_panel", filter_visible);
-
-	if(!filter_visible)
-	{
-		mSearchFilter->clear();
-		onSearchEdit(LLStringUtil::null);
-	}
-	else
-	{
-		mSearchFilter->setFocus(TRUE);
-	}
+	return TRUE;
 }
 
-void LLPanelOutfitEdit::showWearablesListView()
+void LLPanelOutfitEdit::showAddWearablesPanel()
 {
-	if(switchPanels(mInventoryItemsPanel, mWearablesListViewPanel))
-	{
-		mFolderViewBtn->setToggleState(FALSE);
-		mFolderViewBtn->setImageOverlay(getString("folder_view_off"), mFolderViewBtn->getImageOverlayHAlign());
-		mListViewBtn->setImageOverlay(getString("list_view_on"), mListViewBtn->getImageOverlayHAlign());
-		updateFiltersVisibility();
-	}
-	mListViewBtn->setToggleState(TRUE);
+	childSetVisible("add_wearables_panel", childGetValue("add_btn"));
 }
 
-void LLPanelOutfitEdit::showWearablesFolderView()
+void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl)
 {
-	if(switchPanels(mWearablesListViewPanel, mInventoryItemsPanel))
+	LLComboBox* type_filter = dynamic_cast<LLComboBox*>(ctrl);
+	llassert(type_filter);
+	if (type_filter)
 	{
-		mListViewBtn->setToggleState(FALSE);
-		mListViewBtn->setImageOverlay(getString("list_view_off"), mListViewBtn->getImageOverlayHAlign());
-		mFolderViewBtn->setImageOverlay(getString("folder_view_on"), mFolderViewBtn->getImageOverlayHAlign());
-		updateFiltersVisibility();
+		U32 curr_filter_type = type_filter->getCurrentIndex();
+		mInventoryItemsPanel->setFilterTypes(mLookItemTypes[curr_filter_type].inventoryMask);
 	}
-	mFolderViewBtn->setToggleState(TRUE);
-}
-
-void LLPanelOutfitEdit::updateFiltersVisibility()
-{
-	mListViewFilterCmbBox->setVisible(mWearablesListViewPanel->getVisible());
-	mFolderViewFilterCmbBox->setVisible(mInventoryItemsPanel->getVisible());
-}
-
-void LLPanelOutfitEdit::onFolderViewFilterCommitted(LLUICtrl* ctrl)
-{
-	S32 curr_filter_type = mFolderViewFilterCmbBox->getCurrentIndex();
-	if (curr_filter_type < 0) return;
-
-	mInventoryItemsPanel->setFilterTypes(mFolderViewItemTypes[curr_filter_type].inventoryMask);
-
+	
 	mSavedFolderState->setApply(TRUE);
 	mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
 	
@@ -511,14 +256,6 @@ void LLPanelOutfitEdit::onFolderViewFilterCommitted(LLUICtrl* ctrl)
 	LLInventoryModelBackgroundFetch::instance().start();
 }
 
-void LLPanelOutfitEdit::onListViewFilterCommitted(LLUICtrl* ctrl)
-{
-	S32 curr_filter_type = mListViewFilterCmbBox->getCurrentIndex();
-	if (curr_filter_type < 0) return;
-
-	mWearableListManager->setFilterCollector(mListViewItemTypes[curr_filter_type]->collector);
-}
-
 void LLPanelOutfitEdit::onSearchEdit(const std::string& string)
 {
 	if (mSearchString != string)
@@ -533,7 +270,7 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string)
 	if (mSearchString == "")
 	{
 		mInventoryItemsPanel->setFilterSubString(LLStringUtil::null);
-		mWearableItemsList->setFilterSubString(LLStringUtil::null);
+		
 		// re-open folders that were initially open
 		mSavedFolderState->setApply(TRUE);
 		mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
@@ -559,209 +296,116 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string)
 	
 	// set new filter string
 	mInventoryItemsPanel->setFilterSubString(mSearchString);
-	mWearableItemsList->setFilterSubString(mSearchString);
-
 }
 
-void LLPanelOutfitEdit::onPlusBtnClicked(void)
+void LLPanelOutfitEdit::onAddToLookClicked(void)
 {
-	uuid_vec_t selected_items;
-	getSelectedItemsUUID(selected_items);
+	LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
+	LLFolderViewEventListener* listenerp  = curr_item->getListener();
+	link_inventory_item(gAgent.getID(), listenerp->getUUID(), mCurrentOutfitID, listenerp->getName(),
+						LLAssetType::AT_LINK, LLPointer<LLInventoryCallback>(NULL));
+	updateLookInfo();
+}
 
-	LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
+
+void LLPanelOutfitEdit::onRemoveFromLookClicked(void)
+{
+	LLUUID id_to_remove = mLookContents->getSelectionInterface()->getCurrentID();
 	
-	for(uuid_vec_t::iterator iter = selected_items.begin(); iter != selected_items.end(); iter++)
-	{
-		LLUUID selected_id = *iter;
-		if (!selected_id.isNull())
-		{
-			//replacing instead of adding the item
-			LLAppearanceMgr::getInstance()->wearItemOnAvatar(selected_id, false, true, link_waiter);
+	LLViewerInventoryItem * item_to_remove = gInventory.getItem(id_to_remove);
+	
+	if (item_to_remove)
+	{
+		// returns null if not a wearable (attachment, etc).
+		const LLWearable* wearable_to_remove = gAgentWearables.getWearableFromAssetID(item_to_remove->getAssetUUID());
+		if (!wearable_to_remove || gAgentWearables.canWearableBeRemoved( wearable_to_remove ))
+		{											 
+			gInventory.purgeObject( id_to_remove );
+			updateLookInfo();
+			mRemoveFromLookBtn->setEnabled(FALSE);
+			if (mRemoveFromLookBtn->getVisible())
+			{
+				mRemoveFromLookBtn->setVisible(FALSE);
+			}
 		}
 	}
 }
 
-void LLPanelOutfitEdit::onVisibilityChange(const LLSD &in_visible_chain)
-{
-	showAddWearablesPanel(false);
-	mWearableItemsList->resetSelection();
-	mInventoryItemsPanel->clearSelection();
-
-	if (in_visible_chain.asBoolean())
-	{
-		update();
-	}
-}
 
-void LLPanelOutfitEdit::onAddWearableClicked(void)
+void LLPanelOutfitEdit::onUpClicked(void)
 {
-	LLPanelDummyClothingListItem* item = dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem());
-
-	if(item)
+	LLUUID inv_id = mLookContents->getSelectionInterface()->getCurrentID();
+	if (inv_id.isNull())
 	{
-		showFilteredWearablesListView(item->getWearableType());
+		//nothing selected, do nothing
+		return;
 	}
-}
-
-void LLPanelOutfitEdit::onReplaceMenuItemClicked(LLUUID selected_item_id)
-{
-	LLViewerInventoryItem* item = gInventory.getLinkedItem(selected_item_id);
 
-	if (item)
+	LLViewerInventoryItem *link_item = gInventory.getItem(inv_id);
+	if (!link_item)
 	{
-		showFilteredWearablesListView(item->getWearableType());
+		llwarns << "could not find inventory item based on currently worn link." << llendl;
+		return;
 	}
-}
 
-void LLPanelOutfitEdit::onShopButtonClicked()
-{
-	static LLShopURLDispatcher url_resolver;
-
-	// will contain the resultant URL
-	std::string url;
 
-	if (isAgentAvatarValid())
+	LLUUID asset_id = link_item->getAssetUUID();
+	if (asset_id.isNull())
 	{
-		// 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);
+		llwarns << "inventory link has null Asset ID. could not get object reference" << llendl;
 	}
 
-	LLWeb::loadURLExternal(url);
+	static const std::string empty = "";
+	LLWearableList::instance().getAsset(asset_id,
+										empty,	// don't care about wearable name
+										link_item->getActualType(),
+										LLSidepanelAppearance::editWearable,
+										(void*)getParentUICtrl());
 }
 
-LLWearableType::EType LLPanelOutfitEdit::getCOFWearablesSelectionType() const
-{
-	std::vector<LLPanel*> selected_items;
-	LLWearableType::EType type = LLWearableType::WT_NONE;
-
-	mCOFWearables->getSelectedItems(selected_items);
-
-	if (selected_items.size() == 1)
-	{
-		LLPanel* item = selected_items.front();
 
-		// LLPanelDummyClothingListItem is lower then LLPanelInventoryListItemBase in hierarchy tree
-		if (LLPanelDummyClothingListItem* dummy_item = dynamic_cast<LLPanelDummyClothingListItem*>(item))
-		{
-			type = dummy_item->getWearableType();
-		}
-		else if (LLPanelInventoryListItemBase* real_item = dynamic_cast<LLPanelInventoryListItemBase*>(item))
-		{
-			type = real_item->getWearableType();
-		}
-	}
-
-	return type;
-}
-
-LLWearableType::EType LLPanelOutfitEdit::getAddMorePanelSelectionType() const
+void LLPanelOutfitEdit::onEditWearableClicked(void)
 {
-	LLWearableType::EType type = LLWearableType::WT_NONE;
+	LLUUID id_to_edit = mLookContents->getSelectionInterface()->getCurrentID();
+	LLViewerInventoryItem * item_to_edit = gInventory.getItem(id_to_edit);
 
-	if (mAddWearablesPanel != NULL && mAddWearablesPanel->getVisible())
+	if (item_to_edit)
 	{
-		if (mInventoryItemsPanel != NULL && mInventoryItemsPanel->getVisible())
+		// returns null if not a wearable (attachment, etc).
+		LLWearable* wearable_to_edit = gAgentWearables.getWearableFromAssetID(item_to_edit->getAssetUUID());
+		if(wearable_to_edit)
 		{
-			std::set<LLUUID> selected_uuids = mInventoryItemsPanel->getRootFolder()->getSelectionList();
-
-			if (selected_uuids.size() == 1)
+			bool can_modify = false;
+			bool is_complete = item_to_edit->isComplete();
+			// if item_to_edit is a link, its properties are not appropriate, 
+			// lets get original item with actual properties
+			LLViewerInventoryItem* original_item = gInventory.getItem(wearable_to_edit->getItemID());
+			if(original_item)
 			{
-				type = getWearableTypeByItemUUID(*(selected_uuids.begin()));
+				can_modify = original_item->getPermissions().allowModifyBy(gAgentID);
+				is_complete = original_item->isComplete();
 			}
-		}
-		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 (can_modify && is_complete)
+			{											 
+				LLSidepanelAppearance::editWearable(wearable_to_edit, getParent());
+				if (mEditWearableBtn->getVisible())
+				{
+					mEditWearableBtn->setVisible(FALSE);
+				}
 			}
 		}
 	}
-
-	return type;
 }
 
-LLWearableType::EType LLPanelOutfitEdit::getWearableTypeByItemUUID(const LLUUID& item_uuid) const
+void LLPanelOutfitEdit::onInventorySelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
 {
-	LLViewerInventoryItem* item = gInventory.getLinkedItem(item_uuid);
-	return (item != NULL) ? item->getWearableType() : LLWearableType::WT_NONE;
-}
-
-void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void)
-{
-	LLUUID id_to_remove = mCOFWearables->getSelectedUUID();
-	
-	LLAppearanceMgr::getInstance()->removeItemFromAvatar(id_to_remove);
-}
-
-
-void LLPanelOutfitEdit::onEditWearableClicked(void)
-{
-	LLUUID selected_item_id = mCOFWearables->getSelectedUUID();
-	if (selected_item_id.notNull())
-	{
-		gAgentWearables.editWearable(selected_item_id);
-	}
-}
-
-void LLPanelOutfitEdit::updatePlusButton()
-{
-	uuid_vec_t selected_items;
-	getSelectedItemsUUID(selected_items);
-	if (selected_items.empty())
+	LLFolderViewItem* current_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
+	if (!current_item)
 	{
-		mPlusBtn->setEnabled(false);
 		return;
 	}
-
-	// If any of the selected items are not wearable (due to already being worn OR being of the wrong type), disable the add button.
-	uuid_vec_t::iterator unwearable_item = std::find_if(selected_items.begin(), selected_items.end(), !boost::bind(& get_can_item_be_worn, _1));
-	bool can_add = ( unwearable_item == selected_items.end() );
-
-	mPlusBtn->setEnabled(can_add);
-
-	LLViewerInventoryItem* first_item(gInventory.getItem(selected_items.front()));
-
-	if (can_add && 
-		first_item &&
-		selected_items.size() == 1 && 
-		first_item->getType() == LLAssetType::AT_BODYPART)
-	{
-		mPlusBtn->setToolTip(getString("replace_body_part"));
-	}
-	else
-	{
-		mPlusBtn->setToolTip(LLStringUtil::null);
-	}
-
+	
 	/* Removing add to look inline button (not part of mvp for viewer 2)
 	LLRect btn_rect(current_item->getLocalRect().mRight - 50,
 					current_item->getLocalRect().mTop,
@@ -778,184 +422,85 @@ void LLPanelOutfitEdit::updatePlusButton()
 	current_item->addChild(mAddToLookBtn); */
 }
 
-
-void LLPanelOutfitEdit::applyFolderViewFilter(EFolderViewItemType type)
-{
-	mFolderViewFilterCmbBox->setCurrentByIndex(type);
-	mFolderViewFilterCmbBox->onCommit();
-}
-
-void LLPanelOutfitEdit::applyListViewFilter(EListViewItemType type)
-{
-	mListViewFilterCmbBox->setCurrentByIndex(type);
-	mListViewFilterCmbBox->onCommit();
-}
-
-void LLPanelOutfitEdit::filterWearablesBySelectedItem(void)
-{
-	if (!mAddWearablesPanel->getVisible()) return;
-	
-	uuid_vec_t ids;
-	mCOFWearables->getSelectedUUIDs(ids);
-
-	bool nothing_selected = ids.empty();
-	bool one_selected = ids.size() == 1;
-	bool more_than_one_selected = ids.size() > 1;
-	bool is_dummy_item = (ids.size() && dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem()));
-
-	// selected, expanded accordion tabs and selection in flat list view determine filtering when no item is selected in COF
-	// selection in flat list view participates in determining filtering because of EXT-7963
-	// So the priority of criterions in is:
-	//                   1. Selected accordion tab            |  IF (any accordion selected)
-	//                                                        |     filter_type = selected_accordion_type
-	//                   2. Selected item in flat list view   |  ELSEIF (any item in flat list view selected)
-	//                                                        |     filter_type = selected_item_type
-	//                   3. Expanded accordion tab            |  ELSEIF (any accordion expanded)
-	//                                                        |      filter_type = expanded accordion_type
-	if (nothing_selected)
-	{
-		showWearablesListView();
-
-		//selected accordion tab is more priority than expanded tab
-		//and selected item in flat list view of 'Add more' panel when
-		//determining filtering
-		LLAssetType::EType type = mCOFWearables->getSelectedAccordionAssetType();
-		if (type == LLAssetType::AT_NONE)
-		{ //no accordion selected
-
-			// when no accordion selected then selected item from flat list view
-			// has more priority than expanded when determining filtering
-			LLUUID selected_item_id = mWearableItemsList->getSelectedUUID();
-			LLViewerInventoryItem* item = gInventory.getLinkedItem(selected_item_id);
-			if(item)
-		{
-				showFilteredWearablesListView(item->getWearableType());
-				return;
-			}
-
-			// when no accordion selected and no selected items in flat list view
-			// determine filtering according to expanded accordion
-			type = mCOFWearables->getExpandedAccordionAssetType();
-		}
-
-		switch (type)
-		{
-		case LLAssetType::AT_OBJECT:
-			applyListViewFilter(LVIT_ATTACHMENT);
-			break;
-		case LLAssetType::AT_BODYPART:
-			applyListViewFilter(LVIT_BODYPART);
-			break;
-		case LLAssetType::AT_CLOTHING:
-		default:
-			applyListViewFilter(LVIT_CLOTHING);
-			break;
-		}
-
-		return;
-	}
-
-	//resetting selection if more than one item is selected
-	if (more_than_one_selected)
-	{
-		showWearablesListView();
-		applyListViewFilter(LVIT_ALL);
-		return;
-	}
-
-
-	//filter wearables by a type represented by a dummy item
-	if (one_selected && is_dummy_item)
-	{
-		onAddWearableClicked();
+void LLPanelOutfitEdit::onLookItemSelectionChange(void)
+{	
+	S32 left_offset = -4;
+	S32 top_offset = -10;
+	LLScrollListItem* item = mLookContents->getLastSelectedItem();
+	if (!item)
 		return;
-	}
 
-	LLViewerInventoryItem* item = gInventory.getItem(ids[0]);
-	if (!item && ids[0].notNull())
+	LLRect rect = item->getRect();
+	LLRect btn_rect(
+					left_offset + rect.mRight - 50,
+					top_offset  + rect.mTop,
+					left_offset + rect.mRight - 30,
+					top_offset  + rect.mBottom);
+	
+	mEditWearableBtn->setRect(btn_rect);
+	
+	mEditWearableBtn->setEnabled(TRUE);
+	if (!mEditWearableBtn->getVisible())
 	{
-		//Inventory misses an item with non-zero id
-		showWearablesListView();
-		applyListViewFilter(LVIT_ALL);
-		return;
+		mEditWearableBtn->setVisible(TRUE);
 	}
-
-	if (item && one_selected && !is_dummy_item)
-	{
-		if (item->isWearableType())
-		{
-			//single clothing or bodypart item is selected
-			showFilteredWearablesListView(item->getWearableType());
-			return;
-		}
-		else
-		{
-			//attachment is selected
-			showWearablesListView();
-			applyListViewFilter(LVIT_ATTACHMENT);
-			return;
-		}
-	}
-
+	//mLookContents->addChild(mRemoveFromLookBtn);
 }
 
-
-
-void LLPanelOutfitEdit::update()
+void LLPanelOutfitEdit::changed(U32 mask)
 {
-	mCOFWearables->refresh();
-
-	updateVerbs();
 }
 
-BOOL LLPanelOutfitEdit::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
-										  EDragAndDropType cargo_type,
-										  void* cargo_data,
-										  EAcceptance* accept,
-										  std::string& tooltip_msg)
+void LLPanelOutfitEdit::lookFetched(void)
 {
-	if (cargo_data == NULL)
-	{
-		llwarns << "cargo_data is NULL" << llendl;
-		return TRUE;
-	}
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t item_array;
 
-	switch (cargo_type)
+	// collectDescendentsIf takes non-const reference:
+	LLFindCOFValidItems is_cof_valid;
+	gInventory.collectDescendentsIf(mCurrentOutfitID,
+									cat_array,
+									item_array,
+									LLInventoryModel::EXCLUDE_TRASH,
+									is_cof_valid);
+	for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
+		 iter != item_array.end();
+		 iter++)
 	{
-	case DAD_BODYPART:
-	case DAD_CLOTHING:
-	case DAD_OBJECT:
-	case DAD_LINK:
-		*accept = ACCEPT_YES_MULTI;
-		break;
-	default:
-		*accept = ACCEPT_NO;
+		const LLViewerInventoryItem *item = (*iter);
+		
+		LLSD row;
+		row["id"] = item->getUUID();
+		LLSD& columns = row["columns"];
+		columns[0]["column"] = "look_item";
+		columns[0]["type"] = "text";
+		columns[0]["value"] = item->getName();
+		columns[1]["column"] = "look_item_sort";
+		columns[1]["type"] = "text"; // TODO: multi-wearable sort "type" should go here.
+		columns[1]["value"] = "BAR"; // TODO: Multi-wearable sort index should go here
+		
+		mLookContents->addElement(row);
 	}
+}
 
-	if (drop)
+void LLPanelOutfitEdit::updateLookInfo()
+{	
+	if (getVisible())
 	{
-		LLInventoryItem* item = static_cast<LLInventoryItem*>(cargo_data);
-
-		if (LLAssetType::lookupIsAssetIDKnowable(item->getType()))
+		mLookContents->clearRows();
+		
+		uuid_vec_t folders;
+		folders.push_back(mCurrentOutfitID);
+		mFetchLook->fetch(folders);
+		if (mFetchLook->isEverythingComplete())
 		{
-			mCOFDragAndDropObserver->watchAsset(item->getAssetUUID());
-
-			/*
-			 * Adding request to wear item. If the item is a link, then getLinkedUUID() will
-			 * return the ID of the linked item. Otherwise it will return the item's ID. The
-			 * second argument is used to delay the appearance update until all dragged items
-			 * are added to optimize user experience.
-			 */
-			LLAppearanceMgr::instance().addCOFItemLink(item->getLinkedUUID(), false);
+			mFetchLook->done();
 		}
 		else
 		{
-			// if asset id is not available for the item we must wear it immediately (attachments only)
-			LLAppearanceMgr::instance().addCOFItemLink(item->getLinkedUUID(), true);
+			gInventory.addObserver(mFetchLook);
 		}
 	}
-
-	return TRUE;
 }
 
 void LLPanelOutfitEdit::displayCurrentOutfit()
@@ -965,13 +510,8 @@ void LLPanelOutfitEdit::displayCurrentOutfit()
 		setVisible(TRUE);
 	}
 
-	updateCurrentOutfitName();
+	mCurrentOutfitID = LLAppearanceMgr::getInstance()->getCOF();
 
-	update();
-}
-
-void LLPanelOutfitEdit::updateCurrentOutfitName()
-{
 	std::string current_outfit_name;
 	if (LLAppearanceMgr::getInstance()->getBaseOutfitName(current_outfit_name))
 	{
@@ -981,150 +521,8 @@ void LLPanelOutfitEdit::updateCurrentOutfitName()
 	{
 		mCurrentOutfitName->setText(getString("No Outfit"));
 	}
-}
-
-//private
-void LLPanelOutfitEdit::updateVerbs()
-{
-	bool outfit_is_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
-	bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked();
-	bool has_baseoutfit = LLAppearanceMgr::getInstance()->getBaseOutfitUUID().notNull();
-
-	mSaveComboBtn->setSaveBtnEnabled(!outfit_locked && outfit_is_dirty);
-	childSetEnabled(REVERT_BTN, outfit_is_dirty && has_baseoutfit);
-
-	mSaveComboBtn->setMenuItemEnabled("save_outfit", !outfit_locked && outfit_is_dirty);
-
-	mStatus->setText(outfit_is_dirty ? getString("unsaved_changes") : getString("now_editing"));
-
-	updateCurrentOutfitName();
-
-	//updating state of "Wear Item" button previously known as "Plus" button
-	updatePlusButton();
-}
-
-bool LLPanelOutfitEdit::switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel)
-{
-	if(switch_from_panel && switch_to_panel && !switch_to_panel->getVisible())
-	{
-		switch_from_panel->setVisible(FALSE);
-		switch_to_panel->setVisible(TRUE);
-		return true;
-	}
-	return false;
-}
-
-void LLPanelOutfitEdit::resetAccordionState()
-{
-	if (mCOFWearables != NULL)
-	{
-		mCOFWearables->expandDefaultAccordionTab();
-	}
-	else
-	{
-		llwarns << "mCOFWearables is NULL" << llendl;
-	}
-}
-
-void LLPanelOutfitEdit::onGearButtonClick(LLUICtrl* clicked_button)
-{
-	if(!mGearMenu)
-	{
-		mGearMenu = LLPanelOutfitEditGearMenu::create();
-	}
-
-	S32 menu_y = mGearMenu->getRect().getHeight() + clicked_button->getRect().getHeight();
-	LLMenuGL::showPopup(clicked_button, mGearMenu, 0, menu_y);
-}
-
-void LLPanelOutfitEdit::onAddMoreButtonClicked()
-{
-	toggleAddWearablesPanel();
-	filterWearablesBySelectedItem();
-}
-
-void LLPanelOutfitEdit::showFilteredWearablesListView(LLWearableType::EType type)
-{
-	showAddWearablesPanel(true);
-	showWearablesListView();
-
-	//e_list_view_item_type implicitly contains LLWearableType::EType starting from LVIT_SHAPE
-	applyListViewFilter((EListViewItemType) (LVIT_SHAPE + type));
-}
-
-static void update_status_widget_rect(LLView * widget, S32 right_border)
-{
-	LLRect rect = widget->getRect();
-	rect.mRight = right_border;
-
-	widget->setShape(rect);
-}
-
-void LLPanelOutfitEdit::onOutfitChanging(bool started)
-{
-	static LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("edit_outfit_loading_indicator");
-	static LLView* status_panel = getChild<LLView>("outfit_name_and_status");
-	static S32 indicator_delta = status_panel->getRect().getWidth() - indicator->getRect().mLeft;
-
-	S32 delta = started ? indicator_delta : 0;
-	S32 right_border = status_panel->getRect().getWidth() - delta;
-
-	update_status_widget_rect(mCurrentOutfitName, right_border);
-	update_status_widget_rect(mStatus, right_border);
-
-	indicator->setVisible(started);
-}
-
-void LLPanelOutfitEdit::getCurrentItemUUID(LLUUID& selected_id)
-{
-	if (mInventoryItemsPanel->getVisible())
-	{
-		LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
-		if (!curr_item) return;
-
-		LLFolderViewEventListener* listenerp  = curr_item->getListener();
-		if (!listenerp) return;
-
-		selected_id = listenerp->getUUID();
-	}
-	else if (mWearablesListViewPanel->getVisible())
-	{
-		selected_id = mWearableItemsList->getSelectedUUID();
-	}
-}
-
-
-void LLPanelOutfitEdit::getSelectedItemsUUID(uuid_vec_t& uuid_list)
-{
-	if (mInventoryItemsPanel->getVisible())
-	{
-		std::set<LLUUID> item_set = mInventoryItemsPanel->getRootFolder()->getSelectionList();
-
-		std::for_each(item_set.begin(), item_set.end(), boost::bind( &uuid_vec_t::push_back, &uuid_list, _1));
-	}
-	else if (mWearablesListViewPanel->getVisible())
-	{
-		std::vector<LLSD> item_set;
-		mWearableItemsList->getSelectedValues(item_set);
-
-		std::for_each(item_set.begin(), item_set.end(), boost::bind( &uuid_vec_t::push_back, &uuid_list, boost::bind(&LLSD::asUUID, _1 )));
-
-	}
-
-//	return selected_id;
-}
-
-void LLPanelOutfitEdit::onCOFChanged()
-{
-	//the panel is only updated when is visible to a user
-
-	// BAP - this check has to be removed because otherwise item name
-	// changes made when the panel is not visible will not be
-	// propagated to the panel.
-	// if (!isInVisibleChain()) return;
 
-	update();
+	updateLookInfo();
 }
 
 
-// EOF
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index 836bba8c4452cc7b37b342609b64f1c6ffb82f9d..ba382d73200abd3a080235d168dc67657314ccc0 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -2,25 +2,31 @@
  * @file llpaneloutfitedit.h
  * @brief Displays outfit edit information in Side Tray.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -36,199 +42,85 @@
 
 #include "llremoteparcelrequest.h"
 #include "llinventory.h"
-#include "llinventoryfunctions.h"
-#include "llinventoryitemslist.h"
 #include "llinventorymodel.h"
 
 class LLButton;
-class LLCOFWearables;
-class LLComboBox;
 class LLTextBox;
 class LLInventoryCategory;
-class LLOutfitObserver;
-class LLCOFDragAndDropObserver;
+class LLInventoryLookObserver;
 class LLInventoryPanel;
 class LLSaveFolderState;
 class LLFolderViewItem;
 class LLScrollListCtrl;
-class LLToggleableMenu;
+class LLLookFetchObserver;
 class LLFilterEditor;
-class LLFilteredWearableListManager;
-class LLMenuGL;
-class LLFindNonLinksByMask;
-class LLFindWearablesOfType;
-class LLSaveOutfitComboBtn;
 
 class LLPanelOutfitEdit : public LLPanel
 {
-	LOG_CLASS(LLPanelOutfitEdit);
 public:
 	
-	// NOTE: initialize mFolderViewItemTypes at the index of any new enum you add in the LLPanelOutfitEdit() constructor
-	typedef enum e_folder_view_item_type
+	// NOTE: initialize mLookItemTypes at the index of any new enum you add in the LLPanelOutfitEdit() constructor
+	typedef enum e_look_item_type
 	{
-		FVIT_ALL = 0,
-		FVIT_WEARABLE, // clothing or shape
-		FVIT_ATTACHMENT,
-		NUM_FOLDER_VIEW_ITEM_TYPES
-	} EFolderViewItemType; 
+		LIT_ALL = 0,
+		LIT_WEARABLE, // clothing or shape
+		LIT_ATTACHMENT,
+		NUM_LOOK_ITEM_TYPES
+	} ELookItemType; 
 	
-	//should reflect order from LLWearableType::EType
-	typedef enum e_list_view_item_type
-	{
-		LVIT_ALL = 0,
-		LVIT_CLOTHING,
-		LVIT_BODYPART,
-		LVIT_ATTACHMENT,
-		LVIT_SHAPE,
-		LVIT_SKIN,
-		LVIT_HAIR,
-		LVIT_EYES,
-		LVIT_SHIRT,
-		LVIT_PANTS,
-		LVIT_SHOES,
-		LVIT_SOCKS,
-		LVIT_JACKET,
-		LVIT_GLOVES,
-		LVIT_UNDERSHIRT,
-		LVIT_UNDERPANTS,
-		LVIT_SKIRT,
-		LVIT_ALPHA,
-		LVIT_TATTOO,
-		NUM_LIST_VIEW_ITEM_TYPES
-	} EListViewItemType; 
-
 	struct LLLookItemType {
 		std::string displayName;
 		U64 inventoryMask;
 		LLLookItemType() : displayName("NONE"), inventoryMask(0) {}
 		LLLookItemType(std::string name, U64 mask) : displayName(name), inventoryMask(mask) {}
 	};
-
-	struct LLFilterItem {
-		std::string displayName;
-		LLInventoryCollectFunctor* collector;
-		LLFilterItem() : displayName("NONE"), collector(NULL) {}
-		LLFilterItem(std::string name, LLInventoryCollectFunctor* _collector) : displayName(name), collector(_collector) {}
-		~LLFilterItem() { delete collector; }
-
-	//the struct is not supposed to by copied, either way the destructor kills collector
-	//LLPointer is not used as it requires LLInventoryCollectFunctor to extend LLRefCount what it doesn't do
-	private:
-		LLFilterItem(const LLFilterItem& filter_item) {};
-	};
 	
 	LLPanelOutfitEdit();
 	/*virtual*/ ~LLPanelOutfitEdit();
 
 	/*virtual*/ BOOL postBuild();
-	/*virtual*/ void onOpen(const LLSD& key);
-
-	void moveWearable(bool closer_to_body);
+	/*virtual*/ void changed(U32 mask);
 
-	void toggleAddWearablesPanel();
-	void showAddWearablesPanel(bool show__add_wearables);
+	/*virtual*/ void setParcelID(const LLUUID& parcel_id);
+		// Sends a request for data about the given parcel, which will
+		// only update the location if there is none already available.
 
-	//following methods operate with "add wearables" panel
-	void showWearablesFilter();
-	void showWearablesListView();
-	void showWearablesFolderView();
+	void showAddWearablesPanel();
 
-	void updateFiltersVisibility();
-
-	void onFolderViewFilterCommitted(LLUICtrl* ctrl);
-	void onListViewFilterCommitted(LLUICtrl* ctrl);
+	void onTypeFilterChanged(LLUICtrl* ctrl);
 	void onSearchEdit(const std::string& string);
-	void updatePlusButton();
-	void onPlusBtnClicked(void);
-
-	void onVisibilityChange(const LLSD &in_visible_chain);
-
-	void applyFolderViewFilter(EFolderViewItemType type);
-	void applyListViewFilter(EListViewItemType type);
-
-	/**
-	 * Filter items in views of Add Wearables Panel and show appropriate view depending on currently selected COF item(s)
-	 * No COF items selected - shows the folder view, reset filter
-	 * 1 COF item selected - shows the list view and filters wearables there by a wearable type of the selected item
-	 * More than 1 COF item selected - shows the list view and filters it by a type of the selected item (attachment or clothing)
-	 */
-	void filterWearablesBySelectedItem(void);
-
-	void onRemoveFromOutfitClicked(void);
+	void onInventorySelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
+	void onAddToLookClicked(void);
+	void onLookItemSelectionChange(void);
+	void onRemoveFromLookClicked(void);
 	void onEditWearableClicked(void);
-	void onAddWearableClicked(void);
-	void onReplaceMenuItemClicked(LLUUID selected_item_id);
-	void onShopButtonClicked();
+	void onUpClicked(void);
 
 	void displayCurrentOutfit();
-	void updateCurrentOutfitName();
-
-	void update();
-
-	void updateVerbs();
-	/**
-	 * @brief Helper function. Shows one panel instead of another.
-	 *		  If panels already switched does nothing and returns false.
-	 * @param  switch_from_panel panel to hide
-	 * @param  switch_to_panel panel to show
-	 * @retun  returns true if switching happened, false if not.
-	 */
-	bool switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel);
-
-	void resetAccordionState();
-
-	virtual BOOL	handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
-									  EDragAndDropType cargo_type,
-									  void* cargo_data,
-									  EAcceptance* accept,
-									  std::string& tooltip_msg);
+	
+	void lookFetched(void);
+	
+	void updateLookInfo(void);
 
 private:
 
-	void onGearButtonClick(LLUICtrl* clicked_button);
-	void onAddMoreButtonClicked();
-	void showFilteredWearablesListView(LLWearableType::EType type);
-	void onOutfitChanging(bool started);
-	void getSelectedItemsUUID(uuid_vec_t& uuid_list);
-	void getCurrentItemUUID(LLUUID& selected_id);
-	void onCOFChanged();
-
-	LLWearableType::EType getCOFWearablesSelectionType() const;
-	LLWearableType::EType getAddMorePanelSelectionType() const;
-	LLWearableType::EType getWearableTypeByItemUUID(const LLUUID& item_uuid) const;
+	//*TODO got rid of mCurrentOutfitID
+	LLUUID				mCurrentOutfitID;
 
 	LLTextBox*			mCurrentOutfitName;
-	LLTextBox*			mStatus;
+	LLScrollListCtrl*	mLookContents;
 	LLInventoryPanel*	mInventoryItemsPanel;
 	LLFilterEditor*		mSearchFilter;
 	LLSaveFolderState*	mSavedFolderState;
 	std::string			mSearchString;
+	LLButton*			mAddToLookBtn;
+	LLButton*			mRemoveFromLookBtn;
+	LLButton*			mUpBtn;
 	LLButton*			mEditWearableBtn;
-	LLButton*			mFolderViewBtn;
-	LLButton*			mListViewBtn;
-	LLButton*			mPlusBtn;
-	LLPanel*			mAddWearablesPanel;
 	
-	LLComboBox*			mFolderViewFilterCmbBox;
-	LLComboBox*			mListViewFilterCmbBox;
-
-	LLFilteredWearableListManager* 	mWearableListManager;
-	LLInventoryItemsList* 			mWearableItemsList;
-	LLPanel*						mWearablesListViewPanel;
-
-	LLCOFDragAndDropObserver* mCOFDragAndDropObserver;
-
-	std::vector<LLLookItemType> mFolderViewItemTypes;
-	std::vector<LLFilterItem*> mListViewItemTypes;
-
-	LLCOFWearables*		mCOFWearables;
-	LLMenuGL*			mGearMenu;
-	bool				mInitialized;
-	std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;
-
-
-
+	LLLookFetchObserver*		mFetchLook;
+	LLInventoryLookObserver*	mLookObserver;
+	std::vector<LLLookItemType> mLookItemTypes;
 };
 
 #endif // LL_LLPANELOUTFITEDIT_H
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index c6a7bd88a0421547363e52c3b972eaa2eba6189e..7d8b1dea0e2d1c1cb91b78e6ce0bb9d31627cafe 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -2,25 +2,30 @@
  * @file llpaneloutfitsinventory.cpp
  * @brief Outfits inventory panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -28,86 +33,74 @@
 
 #include "llpaneloutfitsinventory.h"
 
-#include "llnotificationsutil.h"
-#include "lltabcontainer.h"
+#include "llagent.h"
+#include "llagentwearables.h"
+#include "llappearancemgr.h"
 
+#include "llbutton.h"
+#include "llfloaterreg.h"
+#include "llfloaterworldmap.h"
+#include "llfloaterinventory.h"
+#include "llfoldervieweventlistener.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodelbackgroundfetch.h"
-#include "llagentwearables.h"
-#include "llappearancemgr.h"
-#include "lloutfitobserver.h"
-#include "lloutfitslist.h"
-#include "llpanelwearing.h"
-#include "llsaveoutfitcombobtn.h"
+#include "llinventorypanel.h"
+#include "lllandmark.h"
+#include "lllineeditor.h"
+#include "llmodaldialog.h"
+#include "llnotificationsutil.h"
 #include "llsidepanelappearance.h"
 #include "llsidetray.h"
+#include "lltabcontainer.h"
 #include "llviewerfoldertype.h"
+#include "llviewerjointattachment.h"
+#include "llvoavatarself.h"
+
+// List Commands
+#include "lldndbutton.h"
+#include "llmenugl.h"
+#include "llviewermenu.h"
+
+#include "llviewercontrol.h"
 
 static const std::string OUTFITS_TAB_NAME = "outfitslist_tab";
 static const std::string COF_TAB_NAME = "cof_tab";
 
 static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
+bool LLPanelOutfitsInventory::sShowDebugEditor = false;
+
 
 LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
-	mMyOutfitsPanel(NULL),
-	mCurrentOutfitPanel(NULL),
 	mActivePanel(NULL),
-	mInitialized(false)
+	mParent(NULL)
 {
-	gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoaded, this));
-	gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoading, this));
-
-	LLOutfitObserver& observer = LLOutfitObserver::instance();
-	observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
-	observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
-	observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
+	mSavedFolderState = new LLSaveFolderState();
+	mSavedFolderState->setApply(FALSE);
 }
 
 LLPanelOutfitsInventory::~LLPanelOutfitsInventory()
 {
+	delete mSavedFolderState;
 }
 
 // virtual
 BOOL LLPanelOutfitsInventory::postBuild()
 {
+	sShowDebugEditor = gSavedSettings.getBOOL("ShowDebugAppearanceEditor");
 	initTabPanels();
 	initListCommandsHandlers();
 
-	// Fetch your outfits folder so that the links are in memory.
-	// ( This is only necessary if we want to show a warning if a user deletes an item that has a
-	// a link in an outfit, see "ConfirmItemDeleteHasLinks". )
-	const LLUUID &outfits_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTFIT, false);
-	if (outfits_cat.notNull())
-	{
-		LLInventoryModelBackgroundFetch::instance().start(outfits_cat);
-	}
-	
-	mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this, true));
-
 	return TRUE;
 }
 
 // virtual
 void LLPanelOutfitsInventory::onOpen(const LLSD& key)
 {
-	if (!mInitialized)
-	{
-		LLSidepanelAppearance* panel_appearance = getAppearanceSP();
-		if (panel_appearance)
-		{
-			// *TODO: move these methods to LLPanelOutfitsInventory?
-			panel_appearance->fetchInventory();
-			panel_appearance->refreshCurrentOutfitName();
-		}
-		mInitialized = true;
-	}
-
 	// Make sure we know which tab is selected, update the filter,
 	// and update verbs.
 	onTabChange();
 	
-	// *TODO: Auto open the first outfit newly created so new users can see sample outfit contents
-	/*
+	// Auto open the first outfit newly created so new users can see sample outfit contents
 	static bool should_open_outfit = true;
 	if (should_open_outfit && gAgent.isFirstLogin())
 	{
@@ -127,27 +120,41 @@ void LLPanelOutfitsInventory::onOpen(const LLSD& key)
 		}
 	}
 	should_open_outfit = false;
-	*/
 }
 
 void LLPanelOutfitsInventory::updateVerbs()
 {
+	if (mParent)
+	{
+		mParent->updateVerbs();
+	}
+
 	if (mListCommands)
 	{
+		mListCommands->childSetVisible("edit_current_outfit_btn",sShowDebugEditor);
 		updateListCommands();
 	}
 }
 
+void LLPanelOutfitsInventory::setParent(LLSidepanelAppearance* parent)
+{
+	mParent = parent;
+}
+
 // virtual
 void LLPanelOutfitsInventory::onSearchEdit(const std::string& string)
 {
-	if (!mActivePanel) return;
-
 	mFilterSubString = string;
-
 	if (string == "")
 	{
 		mActivePanel->setFilterSubString(LLStringUtil::null);
+
+		// re-open folders that were initially open
+		mSavedFolderState->setApply(TRUE);
+		getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+		LLOpenFoldersWithSelection opener;
+		getRootFolder()->applyFunctorRecursively(opener);
+		getRootFolder()->scrollToShowSelection();
 	}
 
 	LLInventoryModelBackgroundFetch::instance().start();
@@ -158,22 +165,48 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string)
 		return;
 	}
 
+	// save current folder open state if no filter currently applied
+	if (getRootFolder()->getFilterSubString().empty())
+	{
+		mSavedFolderState->setApply(FALSE);
+		getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+	}
+
 	// set new filter string
 	mActivePanel->setFilterSubString(string);
 }
 
 void LLPanelOutfitsInventory::onWearButtonClick()
 {
-	if (mMyOutfitsPanel->hasItemSelected())
+	LLFolderViewEventListener* listenerp = getCorrectListenerForAction();
+	if (listenerp)
 	{
-		mMyOutfitsPanel->wearSelectedItems();
+		listenerp->performAction(NULL, "replaceoutfit");
 	}
-	else
+}
+
+void LLPanelOutfitsInventory::onAdd()
+{
+	LLFolderViewEventListener* listenerp = getCorrectListenerForAction();
+	if (listenerp)
+	{
+		listenerp->performAction(NULL, "addtooutfit");
+	}
+}
+
+void LLPanelOutfitsInventory::onRemove()
+{
+	LLFolderViewEventListener* listenerp = getCorrectListenerForAction();
+	if (listenerp)
 	{
-		mMyOutfitsPanel->performAction("replaceoutfit");
+		listenerp->performAction(NULL, "removefromoutfit");
 	}
 }
 
+void LLPanelOutfitsInventory::onEdit()
+{
+}
+
 bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& response)
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -183,13 +216,9 @@ bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD&
 		LLStringUtil::trim(outfit_name);
 		if( !outfit_name.empty() )
 		{
-			LLUUID outfit_folder = LLAppearanceMgr::getInstance()->makeNewOutfitLinks(outfit_name);
-
-			LLSidepanelAppearance* panel_appearance = getAppearanceSP();
-			if (panel_appearance)
-			{
-				panel_appearance->showOutfitsInventoryPanel();
-			}
+			LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name);
+			LLSD key;
+			LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
 
 			if (mAppearanceTabs)
 			{
@@ -201,6 +230,8 @@ bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD&
 	return false;
 }
 
+
+
 void LLPanelOutfitsInventory::onSave()
 {
 	std::string outfit_name;
@@ -228,10 +259,54 @@ void LLPanelOutfitsInventory::onSave()
 	}*/
 }
 
-//static
-LLPanelOutfitsInventory* LLPanelOutfitsInventory::findInstance()
+void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
 {
-	return dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory"));
+	updateVerbs();
+	if (getRootFolder()->needsAutoRename() && items.size())
+	{
+		getRootFolder()->startRenamingSelectedItem();
+		getRootFolder()->setNeedsAutoRename(FALSE);
+	}
+}
+
+void LLPanelOutfitsInventory::showEditOutfitPanel()
+{
+	LLSD key;
+	key["type"] = "edit_outfit";
+	
+	LLSideTray::getInstance()->showPanel("sidepanel_appearance", key);
+}
+
+LLFolderViewEventListener *LLPanelOutfitsInventory::getCorrectListenerForAction()
+{
+	LLFolderViewItem* current_item = getRootFolder()->getCurSelectedItem();
+	if (!current_item)
+		return NULL;
+
+	LLFolderViewEventListener* listenerp = current_item->getListener();
+	if (getIsCorrectType(listenerp))
+	{
+		return listenerp;
+	}
+	return NULL;
+}
+
+bool LLPanelOutfitsInventory::getIsCorrectType(const LLFolderViewEventListener *listenerp) const
+{
+	if (listenerp->getInventoryType() == LLInventoryType::IT_CATEGORY)
+	{
+		LLViewerInventoryCategory *cat = gInventory.getCategory(listenerp->getUUID());
+		if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+LLFolderView *LLPanelOutfitsInventory::getRootFolder()
+{
+	return mActivePanel->getRootFolder();
 }
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -240,116 +315,297 @@ LLPanelOutfitsInventory* LLPanelOutfitsInventory::findInstance()
 void LLPanelOutfitsInventory::initListCommandsHandlers()
 {
 	mListCommands = getChild<LLPanel>("bottom_panel");
+
+	mListCommands->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::onGearButtonClick, this));
+	mListCommands->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
+	mListCommands->childSetAction("make_outfit_btn", boost::bind(&LLPanelOutfitsInventory::onAddButtonClick, this));
 	mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
-	mMyOutfitsPanel->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::showGearMenu, this));
-	mMyOutfitsPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
-	mCurrentOutfitPanel->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::showGearMenu, this));
+
+	mListCommands->childSetAction("edit_current_outfit_btn", boost::bind(&LLPanelOutfitsInventory::showEditOutfitPanel, this));
+
+	LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>("trash_btn");
+	trash_btn->setDragAndDropHandler(boost::bind(&LLPanelOutfitsInventory::handleDragAndDropToTrash, this
+				   ,       _4 // BOOL drop
+				   ,       _5 // EDragAndDropType cargo_type
+				   ,       _7 // EAcceptance* accept
+				   ));
+
+	mCommitCallbackRegistrar.add("panel_outfits_inventory_gear_default.Custom.Action",
+								 boost::bind(&LLPanelOutfitsInventory::onCustomAction, this, _2));
+	mEnableCallbackRegistrar.add("panel_outfits_inventory_gear_default.Enable",
+								 boost::bind(&LLPanelOutfitsInventory::isActionEnabled, this, _2));
+	mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("panel_outfits_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 }
 
 void LLPanelOutfitsInventory::updateListCommands()
 {
 	bool trash_enabled = isActionEnabled("delete");
-	bool wear_enabled =  isActionEnabled("wear");
-	bool wear_visible = !isCOFPanelActive();
-	bool make_outfit_enabled = isActionEnabled("save_outfit");
+	bool wear_enabled = isActionEnabled("wear");
+	bool make_outfit_enabled = isActionEnabled("make_outfit");
 
-	mMyOutfitsPanel->childSetEnabled("trash_btn", trash_enabled);
+	mListCommands->childSetEnabled("trash_btn", trash_enabled);
 	mListCommands->childSetEnabled("wear_btn", wear_enabled);
-	mListCommands->childSetVisible("wear_btn", wear_visible);
-	mSaveComboBtn->setMenuItemEnabled("save_outfit", make_outfit_enabled);
-	if (mMyOutfitsPanel->hasItemSelected())
-	{
-		mListCommands->childSetToolTip("wear_btn", getString("wear_items_tooltip"));
-	}
-	else
-	{
-		mListCommands->childSetToolTip("wear_btn", getString("wear_outfit_tooltip"));
-	}
+	mListCommands->childSetVisible("wear_btn", wear_enabled);
+	mListCommands->childSetEnabled("make_outfit_btn", make_outfit_enabled);
 }
 
-void LLPanelOutfitsInventory::showGearMenu()
+void LLPanelOutfitsInventory::onGearButtonClick()
 {
-	if (!mActivePanel) return;
+	showActionMenu(mMenuGearDefault,"options_gear_btn");
+}
 
-	LLView* spawning_view = getChild<LLView>("options_gear_btn");
-	mActivePanel->showGearMenu(spawning_view);
+void LLPanelOutfitsInventory::onAddButtonClick()
+{
+	onSave();
 }
 
-void LLPanelOutfitsInventory::onTrashButtonClick()
+void LLPanelOutfitsInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)
 {
-	LLNotificationsUtil::add("DeleteOutfits", LLSD(), LLSD(), boost::bind(&LLPanelOutfitsInventory::onOutfitsRemovalConfirmation, this, _1, _2));
+	if (menu)
+	{
+		menu->buildDrawLabels();
+		menu->updateParent(LLMenuGL::sMenuContainer);
+		LLView* spawning_view = getChild<LLView> (spawning_view_name);
+		S32 menu_x, menu_y;
+		//show menu in co-ordinates of panel
+		spawning_view->localPointToOtherView(0, spawning_view->getRect().getHeight(), &menu_x, &menu_y, this);
+		menu_y += menu->getRect().getHeight();
+		LLMenuGL::showPopup(this, menu, menu_x, menu_y);
+	}
 }
 
-void LLPanelOutfitsInventory::onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response)
+void LLPanelOutfitsInventory::onTrashButtonClick()
 {
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (option != 0) return; // canceled
+	onClipboardAction("delete");
+}
 
-	mMyOutfitsPanel->removeSelected();
+void LLPanelOutfitsInventory::onClipboardAction(const LLSD& userdata)
+{
+	std::string command_name = userdata.asString();
+	getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name);
 	updateListCommands();
 	updateVerbs();
 }
 
-bool LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
+void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata)
 {
-	return mActivePanel && mActivePanel->isActionEnabled(userdata);
-}
-// List Commands                                                                //
-//////////////////////////////////////////////////////////////////////////////////
+	if (!isActionEnabled(userdata))
+		return;
 
-//////////////////////////////////////////////////////////////////////////////////
-// Tab panels                                                                   //
+	const std::string command_name = userdata.asString();
+	if (command_name == "new")
+	{
+		onSave();
+	}
+	if (command_name == "edit")
+	{
+		onEdit();
+	}
+	if (command_name == "wear")
+	{
+		onWearButtonClick();
+	}
+	// Note: This option has been removed from the gear menu.
+	if (command_name == "add")
+	{
+		onAdd();
+	}
+	if (command_name == "remove")
+	{
+		onRemove();
+	}
+	if (command_name == "rename")
+	{
+		onClipboardAction("rename");
+	}
+	if (command_name == "remove_link")
+	{
+		onClipboardAction("delete");
+	}
+	if (command_name == "delete")
+	{
+		onClipboardAction("delete");
+	}
+	updateListCommands();
+	updateVerbs();
+}
 
-void LLPanelOutfitsInventory::initTabPanels()
+BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 {
-	mCurrentOutfitPanel = getChild<LLPanelWearing>(COF_TAB_NAME);
-	mCurrentOutfitPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
-
-	mMyOutfitsPanel = getChild<LLOutfitsList>(OUTFITS_TAB_NAME);
-	mMyOutfitsPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
+	const std::string command_name = userdata.asString();
+	if (command_name == "delete" || command_name == "remove")
+	{
+		BOOL can_delete = FALSE;
+		LLFolderView* root = getActivePanel()->getRootFolder();
+		if (root)
+		{
+			std::set<LLUUID> selection_set;
+			root->getSelectionList(selection_set);
+			can_delete = (selection_set.size() > 0);
+			for (std::set<LLUUID>::iterator iter = selection_set.begin();
+				 iter != selection_set.end();
+				 ++iter)
+			{
+				const LLUUID &item_id = (*iter);
+				LLFolderViewItem *item = root->getItemByID(item_id);
+				can_delete &= item->getListener()->isItemRemovable();
+			}
+			return can_delete;
+		}
+		return FALSE;
+	}
+	if (command_name == "remove_link")
+	{
+		BOOL can_delete = FALSE;
+		LLFolderView* root = getActivePanel()->getRootFolder();
+		if (root)
+		{
+			std::set<LLUUID> selection_set;
+			root->getSelectionList(selection_set);
+			can_delete = (selection_set.size() > 0);
+			for (std::set<LLUUID>::iterator iter = selection_set.begin();
+				 iter != selection_set.end();
+				 ++iter)
+			{
+				const LLUUID &item_id = (*iter);
+				LLViewerInventoryItem *item = gInventory.getItem(item_id);
+				if (!item || !item->getIsLinkType())
+					return FALSE;
+			}
+			return can_delete;
+		}
+		return FALSE;
+	}
+	if (command_name == "rename" ||
+		command_name == "delete_outfit")
+	{
+		return (getCorrectListenerForAction() != NULL) && hasItemsSelected();
+	}
+	
+	if (command_name == "wear")
+	{
+		if (isCOFPanelActive())
+		{
+			return FALSE;
+		}
+	}
+	if (command_name == "make_outfit")
+	{
+		return TRUE;
+	}
+   
+	if (command_name == "edit" || 
+		command_name == "add"
+		)
+	{
+		return (getCorrectListenerForAction() != NULL);
+	}
+	return TRUE;
+}
 
-	mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs");
-	mAppearanceTabs->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onTabChange, this));
+bool LLPanelOutfitsInventory::hasItemsSelected()
+{
+	bool has_items_selected = false;
+	LLFolderView* root = getActivePanel()->getRootFolder();
+	if (root)
+	{
+		std::set<LLUUID> selection_set;
+		root->getSelectionList(selection_set);
+		has_items_selected = (selection_set.size() > 0);
+	}
+	return has_items_selected;
 }
 
-void LLPanelOutfitsInventory::onTabChange()
+bool LLPanelOutfitsInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept)
 {
-	mActivePanel = dynamic_cast<LLPanelAppearanceTab*>(mAppearanceTabs->getCurrentPanel());
-	if (!mActivePanel) return;
+	*accept = ACCEPT_NO;
 
-	mActivePanel->setFilterSubString(mFilterSubString);
-	mActivePanel->onOpen(LLSD());
+	const bool is_enabled = isActionEnabled("delete");
+	if (is_enabled) *accept = ACCEPT_YES_MULTI;
 
-	updateVerbs();
+	if (is_enabled && drop)
+	{
+		onClipboardAction("delete");
+	}
+	return true;
 }
 
-bool LLPanelOutfitsInventory::isCOFPanelActive() const
+// List Commands                                                              //
+////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////
+// Tab panels                                                                    //
+
+void LLPanelOutfitsInventory::initTabPanels()
 {
-	if (!mActivePanel) return false;
+	LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>(COF_TAB_NAME);
+	cof_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+	mTabPanels.push_back(cof_panel);
+
+	LLInventoryPanel *myoutfits_panel = getChild<LLInventoryPanel>(OUTFITS_TAB_NAME);
+	myoutfits_panel->setFilterTypes(1LL << LLFolderType::FT_OUTFIT, LLInventoryFilter::FILTERTYPE_CATEGORY);
+	myoutfits_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+	mTabPanels.push_back(myoutfits_panel);
+	
+	for (tabpanels_vec_t::iterator iter = mTabPanels.begin();
+		 iter != mTabPanels.end();
+		 ++iter)
+	{
+		LLInventoryPanel *panel = (*iter);
+		panel->setSelectCallback(boost::bind(&LLPanelOutfitsInventory::onTabSelectionChange, this, panel, _1, _2));
+	}
 
-	return mActivePanel->getName() == COF_TAB_NAME;
+	mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs");
+	mAppearanceTabs->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onTabChange, this));
+	mActivePanel = (LLInventoryPanel*)mAppearanceTabs->getCurrentPanel();
 }
 
-void LLPanelOutfitsInventory::setWearablesLoading(bool val)
+void LLPanelOutfitsInventory::onTabSelectionChange(LLInventoryPanel* tab_panel, const std::deque<LLFolderViewItem*> &items, BOOL user_action)
 {
-	updateVerbs();
+	if (user_action && items.size() > 0)
+	{
+		for (tabpanels_vec_t::iterator iter = mTabPanels.begin();
+			 iter != mTabPanels.end();
+			 ++iter)
+		{
+			LLInventoryPanel *panel = (*iter);
+			if (panel == tab_panel)
+			{
+				mActivePanel = panel;
+			}
+			else
+			{
+				panel->getRootFolder()->clearSelection();
+			}
+		}
+	}
+	onSelectionChange(items, user_action);
 }
 
-void LLPanelOutfitsInventory::onWearablesLoaded()
+void LLPanelOutfitsInventory::onTabChange()
 {
-	setWearablesLoading(false);
+	mActivePanel = (LLInventoryPanel*)childGetVisibleTab("appearance_tabs");
+	if (!mActivePanel)
+	{
+		return;
+	}
+	mActivePanel->setFilterSubString(mFilterSubString);
+	updateVerbs();
 }
 
-void LLPanelOutfitsInventory::onWearablesLoading()
+BOOL LLPanelOutfitsInventory::isTabPanel(LLInventoryPanel *panel) const
 {
-	setWearablesLoading(true);
+	for(tabpanels_vec_t::const_iterator it = mTabPanels.begin();
+		it != mTabPanels.end();
+		++it)
+	{
+		if (*it == panel)
+			return TRUE;
+	}
+	return FALSE;
 }
 
-// static
-LLSidepanelAppearance* LLPanelOutfitsInventory::getAppearanceSP()
+BOOL LLPanelOutfitsInventory::isCOFPanelActive() const
 {
-	static LLSidepanelAppearance* panel_appearance =
-		dynamic_cast<LLSidepanelAppearance*>
-		(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
-	return panel_appearance;
+	return (getActivePanel()->getName() == COF_TAB_NAME);
 }
diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h
index f1ca1dbfeb20b48787dfcda47a96b82fd331ecc6..41afc2f37260d4f356bd0de61e47f5b6ba3c14c9 100644
--- a/indra/newview/llpaneloutfitsinventory.h
+++ b/indra/newview/llpaneloutfitsinventory.h
@@ -3,25 +3,30 @@
  * @brief Outfits inventory panel
  * class definition
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -29,19 +34,20 @@
 #define LL_LLPANELOUTFITSINVENTORY_H
 
 #include "llpanel.h"
+#include "llinventoryobserver.h"
 
-class LLOutfitsList;
-class LLOutfitListGearMenu;
-class LLPanelAppearanceTab;
-class LLPanelWearing;
+class LLFolderView;
+class LLFolderViewItem;
+class LLFolderViewEventListener;
+class LLInventoryPanel;
+class LLSaveFolderState;
+class LLButton;
 class LLMenuGL;
 class LLSidepanelAppearance;
 class LLTabContainer;
-class LLSaveOutfitComboBtn;
 
 class LLPanelOutfitsInventory : public LLPanel
 {
-	LOG_CLASS(LLPanelOutfitsInventory);
 public:
 	LLPanelOutfitsInventory();
 	virtual ~LLPanelOutfitsInventory();
@@ -50,57 +56,79 @@ class LLPanelOutfitsInventory : public LLPanel
 	/*virtual*/ void onOpen(const LLSD& key);
 	
 	void onSearchEdit(const std::string& string);
+	void onAdd();
+	void onRemove();
+	void onEdit();
 	void onSave();
 	
 	bool onSaveCommit(const LLSD& notification, const LLSD& response);
 
-	static LLSidepanelAppearance* getAppearanceSP();
+	void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
+	void showEditOutfitPanel();
+
+	// If a compatible listener type is selected, then return a pointer to that.
+	// Otherwise, return NULL.
+	LLFolderViewEventListener* getCorrectListenerForAction();
+	void setParent(LLSidepanelAppearance *parent);
 
-	static LLPanelOutfitsInventory* findInstance();
+	LLFolderView* getRootFolder();
 
 protected:
 	void updateVerbs();
+	bool getIsCorrectType(const LLFolderViewEventListener *listenerp) const;
 
 private:
+	LLSidepanelAppearance*  mParent;
+	LLSaveFolderState*		mSavedFolderState;
 	LLTabContainer*			mAppearanceTabs;
 	std::string 			mFilterSubString;
-	std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;
 
+public:
 	//////////////////////////////////////////////////////////////////////////////////
-	// tab panels                                                                   //
+	// tab panels
+	LLInventoryPanel* 		getActivePanel() { return mActivePanel; }
+	const LLInventoryPanel* getActivePanel() const { return mActivePanel; }
+	BOOL 					isTabPanel(LLInventoryPanel *panel) const;
+	
 protected:
 	void 					initTabPanels();
+	void 					onTabSelectionChange(LLInventoryPanel* tab_panel, const std::deque<LLFolderViewItem*> &items, BOOL user_action);
 	void 					onTabChange();
-	bool 					isCOFPanelActive() const;
+	BOOL 					isCOFPanelActive() const;
 
 private:
-	LLPanelAppearanceTab*	mActivePanel;
-	LLOutfitsList*			mMyOutfitsPanel;
-	LLPanelWearing*			mCurrentOutfitPanel;
+	LLInventoryPanel* 		mActivePanel;
+	typedef std::vector<LLInventoryPanel *> tabpanels_vec_t;
+	tabpanels_vec_t 		mTabPanels;
 
-	// tab panels                                                                   //
-	//////////////////////////////////////////////////////////////////////////////////
+	// tab panels                                                               //
+	////////////////////////////////////////////////////////////////////////////////
+	
 
 	//////////////////////////////////////////////////////////////////////////////////
 	// List Commands                                                                //
 protected:
 	void initListCommandsHandlers();
 	void updateListCommands();
+	void onGearButtonClick();
 	void onWearButtonClick();
-	void showGearMenu();
+	void onAddButtonClick();
+	void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
 	void onTrashButtonClick();
-	void onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response);
-	bool isActionEnabled(const LLSD& userdata);
-	void setWearablesLoading(bool val);
-	void onWearablesLoaded();
-	void onWearablesLoading();
+	void onClipboardAction(const LLSD& userdata);
+	BOOL isActionEnabled(const LLSD& command_name);
+	void onCustomAction(const LLSD& command_name);
+	bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
+	bool hasItemsSelected();
 private:
 	LLPanel*					mListCommands;
+	LLMenuGL*					mMenuGearDefault;
 	LLMenuGL*					mMenuAdd;
-	// List Commands                                                                //
-	//////////////////////////////////////////////////////////////////////////////////
-
-	bool mInitialized;
+	// List Commands                                                              //
+	////////////////////////////////////////////////////////////////////////////////
+	///
+public:
+	static bool sShowDebugEditor;
 };
 
 #endif //LL_LLPANELOUTFITSINVENTORY_H
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 1c4476ca4942ac724a7e108714e0e8e5e2d0e3ac..5802d53cd181d9e5ee04432646733b7857149ad0 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -2,25 +2,31 @@
  * @file llpanelpeople.cpp
  * @brief Side tray "People" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -437,7 +443,6 @@ class LLRecentListUpdater : public LLAvatarListUpdater, public boost::signals2::
 LLPanelPeople::LLPanelPeople()
 	:	LLPanel(),
 		mFilterSubString(LLStringUtil::null),
-		mFilterSubStringOrig(LLStringUtil::null),
 		mFilterEditor(NULL),
 		mTabContainer(NULL),
 		mOnlineFriendList(NULL),
@@ -507,19 +512,15 @@ BOOL LLPanelPeople::postBuild()
 
 	mNearbyList = getChild<LLPanel>(NEARBY_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
 	mNearbyList->setNoItemsCommentText(getString("no_one_near"));
-	mNearbyList->setNoItemsMsg(getString("no_one_near"));
-	mNearbyList->setNoFilteredItemsMsg(getString("no_one_filtered_near"));
 	mNearbyList->setShowIcons("NearbyListShowIcons");
 
 	mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
-	mRecentList->setNoItemsCommentText(getString("no_recent_people"));
-	mRecentList->setNoItemsMsg(getString("no_recent_people"));
-	mRecentList->setNoFilteredItemsMsg(getString("no_filtered_recent_people"));
+	mRecentList->setNoItemsCommentText(getString("no_people"));
 	mRecentList->setShowIcons("RecentListShowIcons");
 
 	mGroupList = getChild<LLGroupList>("group_list");
-	mGroupList->setNoItemsMsg(getString("no_groups_msg"));
-	mGroupList->setNoFilteredItemsMsg(getString("no_filtered_groups_msg"));
+	mGroupList->setNoGroupsMsg(getString("no_groups_msg"));
+	mGroupList->setNoFilteredGroupsMsg(getString("no_filtered_groups_msg"));
 
 	mNearbyList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu);
 	mRecentList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu);
@@ -618,7 +619,7 @@ BOOL LLPanelPeople::postBuild()
 	if(recent_view_sort)
 		mRecentViewSortMenuHandle  = recent_view_sort->getHandle();
 
-	LLVoiceClient::getInstance()->addObserver(this);
+	gVoiceClient->addObserver(this);
 
 	// call this method in case some list is empty and buttons can be in inconsistent state
 	updateButtons();
@@ -640,25 +641,6 @@ void LLPanelPeople::onChange(EStatusType status, const std::string &channelURI,
 	updateButtons();
 }
 
-void LLPanelPeople::updateFriendListHelpText()
-{
-	// show special help text for just created account to help finding friends. EXT-4836
-	static LLTextBox* no_friends_text = getChild<LLTextBox>("no_friends_help_text");
-
-	// Seems sometimes all_friends can be empty because of issue with Inventory loading (clear cache, slow connection...)
-	// So, lets check all lists to avoid overlapping the text with online list. See EXT-6448.
-	bool any_friend_exists = mAllFriendList->filterHasMatches() || mOnlineFriendList->filterHasMatches();
-	no_friends_text->setVisible(!any_friend_exists);
-	if (no_friends_text->getVisible())
-	{
-		//update help text for empty lists
-		std::string message_name = mFilterSubString.empty() ? "no_friends_msg" : "no_filtered_friends_msg";
-		LLStringUtil::format_map_t args;
-		args["[SEARCH_TERM]"] = LLURI::escape(mFilterSubStringOrig);
-		no_friends_text->setText(getString(message_name, args));
-	}
-}
-
 void LLPanelPeople::updateFriendList()
 {
 	if (!mOnlineFriendList || !mAllFriendList)
@@ -698,6 +680,14 @@ void LLPanelPeople::updateFriendList()
 			online_friendsp.push_back(buddy_id);
 	}
 
+	// show special help text for just created account to help found friends. EXT-4836
+	static LLTextBox* no_friends_text = getChild<LLTextBox>("no_friends_msg");
+
+	// Seems sometimes all_friends can be empty because of issue with Inventory loading (clear cache, slow connection...)
+	// So, lets check all lists to avoid overlapping the text with online list. See EXT-6448.
+	bool any_friend_exists = (all_friendsp.size() > 0) || (online_friendsp.size() > 0);
+	no_friends_text->setVisible(!any_friend_exists);
+
 	/*
 	 * Avatarlists  will be hidden by showFriendsAccordionsIfNeeded(), if they do not have items.
 	 * But avatarlist can be updated only if it is visible @see LLAvatarList::draw();   
@@ -819,7 +809,7 @@ void LLPanelPeople::updateButtons()
 		}
 	}
 
-	bool enable_calls = LLVoiceClient::getInstance()->isVoiceWorking() && LLVoiceClient::getInstance()->voiceEnabled();
+	bool enable_calls = gVoiceClient->voiceWorking() && gVoiceClient->voiceEnabled();
 
 	buttonSetEnabled("teleport_btn",		friends_tab_active && item_selected && isFriendOnline(selected_uuids.front()));
 	buttonSetEnabled("view_profile_btn",	item_selected);
@@ -978,11 +968,10 @@ bool LLPanelPeople::isRealGroup()
 
 void LLPanelPeople::onFilterEdit(const std::string& search_string)
 {
-	mFilterSubStringOrig = search_string;
-	LLStringUtil::trimHead(mFilterSubStringOrig);
+	std::string search_upper = search_string;
 	// Searches are case-insensitive
-	std::string search_upper = mFilterSubStringOrig;
 	LLStringUtil::toUpper(search_upper);
+	LLStringUtil::trimHead(search_upper);
 
 	if (mFilterSubString == search_upper)
 		return;
@@ -997,11 +986,11 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string)
 
 
 	// Apply new filter.
-	mNearbyList->setNameFilter(mFilterSubStringOrig);
-	mOnlineFriendList->setNameFilter(mFilterSubStringOrig);
-	mAllFriendList->setNameFilter(mFilterSubStringOrig);
-	mRecentList->setNameFilter(mFilterSubStringOrig);
-	mGroupList->setNameFilter(mFilterSubStringOrig);
+	mNearbyList->setNameFilter(mFilterSubString);
+	mOnlineFriendList->setNameFilter(mFilterSubString);
+	mAllFriendList->setNameFilter(mFilterSubString);
+	mRecentList->setNameFilter(mFilterSubString);
+	mGroupList->setNameFilter(mFilterSubString);
 
 	setAccordionCollapsedByUser("tab_online", false);
 	setAccordionCollapsedByUser("tab_all", false);
@@ -1443,11 +1432,6 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded()
 		// Rearrange accordions
 		LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion");
 		accordion->arrange();
-
-		// *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368).
-		// this code should be refactored to use it
-		// keep help text in a synchronization with accordions visibility.
-		updateFriendListHelpText();
 	}
 }
 
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index e93153704207622b1b567b66a53c70a748db8643..891381e2dee80b0063735709eddedd66aabf6445 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -2,25 +2,31 @@
  * @file llpanelpeople.h
  * @brief Side tray "People" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -67,7 +73,6 @@ class LLPanelPeople
 	} ESortOrder;
 
 	// methods indirectly called by the updaters
-	void					updateFriendListHelpText();
 	void					updateFriendList();
 	void					updateNearbyList();
 	void					updateRecentList();
@@ -163,7 +168,6 @@ class LLPanelPeople
 	Updater*				mRecentListUpdater;
 
 	std::string				mFilterSubString;
-	std::string				mFilterSubStringOrig;
 };
 
 #endif //LL_LLPANELPEOPLE_H
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index efca3ae1c2c9cd84fae733fb08ddafad97afded4..862e32cca86b1c6f210e19ccb98ba5d690f786c9 100644
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -2,25 +2,31 @@
  * @file llpanelpeoplemenus.h
  * @brief Menus used by the side tray "People" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -36,7 +42,6 @@
 #include "llagent.h"
 #include "llagentdata.h"			// for gAgentID
 #include "llavataractions.h"
-#include "llcallingcard.h"			// for LLAvatarTracker
 #include "llviewermenu.h"			// for gMenuHolder
 
 namespace LLPanelPeopleMenus
@@ -44,6 +49,64 @@ namespace LLPanelPeopleMenus
 
 NearbyMenu gNearbyMenu;
 
+//== ContextMenu ==============================================================
+
+ContextMenu::ContextMenu()
+:	mMenu(NULL)
+{
+}
+
+ContextMenu::~ContextMenu()
+{
+	// do not forget delete LLContextMenu* mMenu.
+	// It can have registered Enable callbacks which are called from the LLMenuHolderGL::draw()
+	// via selected item (menu_item_call) by calling LLMenuItemCallGL::buildDrawLabel.
+	// we can have a crash via using callbacks of deleted instance of ContextMenu. EXT-4725
+
+	// menu holder deletes its menus on viewer exit, so we have no way to determine if instance 
+	// of mMenu has already been deleted except of using LLHandle. EXT-4762.
+	if (!mMenuHandle.isDead())
+	{
+		mMenu->die();
+		mMenu = NULL;
+	}
+}
+
+void ContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
+{
+	if (mMenu)
+	{
+		//preventing parent (menu holder) from deleting already "dead" context menus on exit
+		LLView* parent = mMenu->getParent();
+		if (parent)
+		{
+			parent->removeChild(mMenu);
+		}
+		delete mMenu;
+		mMenu = NULL;
+		mUUIDs.clear();
+	}
+
+	if ( uuids.empty() )
+		return;
+
+	mUUIDs.resize(uuids.size());
+	std::copy(uuids.begin(), uuids.end(), mUUIDs.begin());
+
+	mMenu = createMenu();
+	mMenuHandle = mMenu->getHandle();
+	mMenu->show(x, y);
+	LLMenuGL::showPopup(spawning_view, mMenu, x, y);
+}
+
+void ContextMenu::hide()
+{
+	if(mMenu)
+	{
+		mMenu->hide();
+	}
+}
+
 //== NearbyMenu ===============================================================
 
 LLContextMenu* NearbyMenu::createMenu()
@@ -72,7 +135,8 @@ LLContextMenu* NearbyMenu::createMenu()
 		enable_registrar.add("Avatar.CheckItem",  boost::bind(&NearbyMenu::checkContextMenuItem,	this, _2));
 
 		// create the context menu from the XUI
-		return createFromFile("menu_people_nearby.xml");
+		return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
+			"menu_people_nearby.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
 	}
 	else
 	{
@@ -87,7 +151,9 @@ LLContextMenu* NearbyMenu::createMenu()
 		enable_registrar.add("Avatar.EnableItem",	boost::bind(&NearbyMenu::enableContextMenuItem,	this, _2));
 
 		// create the context menu from the XUI
-		return createFromFile("menu_people_nearby_multiselect.xml");
+		return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>
+			("menu_people_nearby_multiselect.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+
 	}
 }
 
@@ -109,12 +175,6 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata)
 		// - there are selected people
 		// - and there are no friends among selection yet.
 
-		//EXT-7389 - disable for more than 1
-		if(mUUIDs.size() > 1)
-		{
-			return false;
-		}
-
 		bool result = (mUUIDs.size() > 0);
 
 		uuid_vec_t::const_iterator
diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h
index d51eaec7167a9b80c905796e6196a9fb5d999f63..8e12710afc47efb98db7576c7a4413c1d4a3ebe7 100644
--- a/indra/newview/llpanelpeoplemenus.h
+++ b/indra/newview/llpanelpeoplemenus.h
@@ -2,40 +2,73 @@
  * @file llpanelpeoplemenus.h
  * @brief Menus used by the side tray "People" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #ifndef LL_LLPANELPEOPLEMENUS_H
 #define LL_LLPANELPEOPLEMENUS_H
 
-#include "lllistcontextmenu.h"
+#include "llavatarlistitem.h"
 
 namespace LLPanelPeopleMenus
 {
 
+/**
+ * Base context menu.
+ */
+class ContextMenu : public LLAvatarListItem::ContextMenu
+{
+public:
+	ContextMenu();
+	virtual ~ContextMenu();
+
+	/**
+	 * Show the menu at specified coordinates.
+	 *
+	 * @param  uuids - an array of avatar or group ids
+	 */
+	/*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
+
+	virtual void hide();
+
+protected:
+
+	virtual LLContextMenu* createMenu() = 0;
+
+	uuid_vec_t	mUUIDs;
+	LLContextMenu*		mMenu;
+	LLHandle<LLView>	mMenuHandle;
+};
+
 /**
  * Menu used in the nearby people list.
  */
-class NearbyMenu : public LLListContextMenu
+class NearbyMenu : public ContextMenu
 {
 public:
 	/*virtual*/ LLContextMenu* createMenu();
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp
index 0317d1050c50ef1b2ad9fba3176740f6505df1bf..71d16a08b4894ad0c73664da13e5f010f7c1d63f 100644
--- a/indra/newview/llpanelpermissions.cpp
+++ b/indra/newview/llpanelpermissions.cpp
@@ -4,25 +4,31 @@
  * This class represents the panel in the build view for
  * viewing/editing object names, owners, permissions, etc.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index ff069e34b7d20dc5bc03fc725884ac2a6559fba0..bde8d0288552e6f16b4b322a22437c70293f9816 100644
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -2,25 +2,31 @@
  * @file llpanelpicks.cpp
  * @brief LLPanelPicks and related class implementations
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index e244a6255e815248eac2b56ba8a64d21b958b2bc..54455afa4f3a45aa78fa472500dbc88467540bc4 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -2,25 +2,30 @@
  * @file llpanelplaces.cpp
  * @brief Side Bar "Places" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -247,9 +252,6 @@ BOOL LLPanelPlaces::postBuild()
 	mOverflowBtn = getChild<LLButton>("overflow_btn");
 	mOverflowBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onOverflowButtonClicked, this));
 
-	mPlaceInfoBtn = getChild<LLButton>("profile_btn");
-	mPlaceInfoBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onProfileButtonClicked, this));
-
 	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 	registrar.add("Places.OverflowMenu.Action",  boost::bind(&LLPanelPlaces::onOverflowMenuItemClicked, this, _2));
 	LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
@@ -523,7 +525,8 @@ void LLPanelPlaces::onFilterEdit(const std::string& search_string, bool force_fi
 		std::string string = search_string;
 
 		// Searches are case-insensitive
-		// but we don't convert the typed string to upper-case so that it can be fed to the web search as-is.
+		LLStringUtil::toUpper(string);
+		LLStringUtil::trimHead(string);
 
 		mActivePanel->onSearchEdit(string);
 	}
@@ -610,21 +613,8 @@ void LLPanelPlaces::onShowOnMapButtonClicked()
 	}
 	else
 	{
-		if (mActivePanel && mActivePanel->isSingleItemSelected())
-		{
+		if (mActivePanel)
 			mActivePanel->onShowOnMap();
-		}
-		else
-		{
-			LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
-			LLVector3d global_pos = gAgent.getPositionGlobal();
-
-			if (!global_pos.isExactlyZero() && worldmap_instance)
-			{
-				worldmap_instance->trackLocation(global_pos);
-				LLFloaterReg::showInstance("world_map", "center");
-			}
-		}
 	}
 }
 
@@ -713,8 +703,8 @@ void LLPanelPlaces::onOverflowButtonClicked()
 	bool is_agent_place_info_visible = mPlaceInfoType == AGENT_INFO_TYPE;
 
 	if ((is_agent_place_info_visible ||
-		 mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
-		 mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE) && mPlaceMenu != NULL)
+		 mPlaceInfoType == "remote_place" ||
+		 mPlaceInfoType == "teleport_history") && mPlaceMenu != NULL)
 	{
 		menu = mPlaceMenu;
 
@@ -755,14 +745,6 @@ void LLPanelPlaces::onOverflowButtonClicked()
 	LLMenuGL::showPopup(this, menu, rect.mRight, rect.mTop);
 }
 
-void LLPanelPlaces::onProfileButtonClicked()
-{
-	if (!mActivePanel)
-		return;
-
-	mActivePanel->onShowProfile();
-}
-
 bool LLPanelPlaces::onOverflowMenuItemEnable(const LLSD& param)
 {
 	std::string value = param.asString();
@@ -1033,7 +1015,7 @@ void LLPanelPlaces::showAddedLandmarkInfo(const uuid_vec_t& items)
 		 ++item_iter)
 	{
 		const LLUUID& item_id = (*item_iter);
-		if(!highlight_offered_object(item_id))
+		if(!highlight_offered_item(item_id))
 		{
 			continue;
 		}
@@ -1078,14 +1060,11 @@ void LLPanelPlaces::updateVerbs()
 	mSaveBtn->setVisible(isLandmarkEditModeOn);
 	mCancelBtn->setVisible(isLandmarkEditModeOn);
 	mCloseBtn->setVisible(is_create_landmark_visible && !isLandmarkEditModeOn);
-	mPlaceInfoBtn->setVisible(!is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn);
 
-	mPlaceInfoBtn->setEnabled(!is_create_landmark_visible && !isLandmarkEditModeOn && have_3d_pos);
+	mShowOnMapBtn->setEnabled(!is_create_landmark_visible && !isLandmarkEditModeOn && have_3d_pos);
 
 	if (is_place_info_visible)
 	{
-		mShowOnMapBtn->setEnabled(have_3d_pos);
-
 		if (is_agent_place_info_visible)
 		{
 			// We don't need to teleport to the current location
diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h
index c3b2ab806f13211ecda30f463412ef5ea6ba8b7e..97cf43d222dd3b9b0dbce11edb83a4e655fd788e 100644
--- a/indra/newview/llpanelplaces.h
+++ b/indra/newview/llpanelplaces.h
@@ -2,25 +2,30 @@
  * @file llpanelplaces.h
  * @brief Side Bar "Places" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -93,7 +98,6 @@ class LLPanelPlaces : public LLPanel
 	bool onOverflowMenuItemEnable(const LLSD& param);
 	void onCreateLandmarkButtonClicked(const LLUUID& folder_id);
 	void onBackButtonClicked();
-	void onProfileButtonClicked();
 
 	void toggleMediaPanel();
 	void togglePickPanel(BOOL visible);
@@ -124,7 +128,6 @@ class LLPanelPlaces : public LLPanel
 	LLButton*					mCancelBtn;
 	LLButton*					mCloseBtn;
 	LLButton*					mOverflowBtn;
-	LLButton*					mPlaceInfoBtn;
 
 	LLPlacesInventoryObserver*	mInventoryObserver;
 	LLPlacesParcelObserver*		mParcelObserver;
diff --git a/indra/newview/llpanelplacestab.cpp b/indra/newview/llpanelplacestab.cpp
index 9644b7518e883feead5315f66cd1672431290437..9806b8c64d55380873494b1f5863fc1e16c1bf4d 100644
--- a/indra/newview/llpanelplacestab.cpp
+++ b/indra/newview/llpanelplacestab.cpp
@@ -2,25 +2,30 @@
  * @file llpanelplacestab.cpp
  * @brief Tabs interface for Side Bar "Places" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -51,7 +56,6 @@ void LLPanelPlacesTab::setPanelPlacesButtons(LLPanelPlaces* panel)
 {
 	mTeleportBtn = panel->getChild<LLButton>("teleport_btn");
 	mShowOnMapBtn = panel->getChild<LLButton>("map_btn");
-	mShowProfile = panel->getChild<LLButton>("profile_btn");
 }
 
 void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos,
@@ -66,7 +70,10 @@ void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos,
 	std::string sl_url;
 	if ( gotSimName )
 	{
-		sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString();
+		F32 region_x = (F32)fmod( landmark_global_pos.mdV[VX], (F64)REGION_WIDTH_METERS );
+		F32 region_y = (F32)fmod( landmark_global_pos.mdV[VY], (F64)REGION_WIDTH_METERS );
+
+		sl_url = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)landmark_global_pos.mdV[VZ]));
 	}
 	else
 	{
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index f198a411a3dd4a220eadb03bf663ff81a81806fa..ab2f9284f71ac0ce595b111204e01fed92409ca9 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -2,30 +2,36 @@
  * @file llpanelprimmediacontrols.cpp
  * @brief media controls popup panel
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2007, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 
+//LLPanelPrimMediaControls
 #include "llagent.h"
 #include "llagentcamera.h"
 #include "llparcel.h"
@@ -59,6 +65,7 @@
 #include "llvovolume.h"
 #include "llweb.h"
 #include "llwindow.h"
+
 #include "llfloatertools.h"  // to enable hide if build tools are up
 
 // Functions pulled from pipeline.cpp
@@ -345,11 +352,6 @@ void LLPanelPrimMediaControls::updateShape()
 		mHomeCtrl->setEnabled(has_focus && can_navigate);
 		LLPluginClassMediaOwner::EMediaStatus result = ((media_impl != NULL) && media_impl->hasMedia()) ? media_plugin->getStatus() : LLPluginClassMediaOwner::MEDIA_NONE;
 		
-		mVolumeCtrl->setVisible(has_focus);
-		mVolumeCtrl->setEnabled(has_focus);
-		mVolumeSliderCtrl->setEnabled(has_focus && shouldVolumeSliderBeVisible());
-		mVolumeSliderCtrl->setVisible(has_focus && shouldVolumeSliderBeVisible());
-
 		if(media_plugin && media_plugin->pluginSupportsMediaTime())
 		{
 			mReloadCtrl->setEnabled(false);
@@ -462,15 +464,11 @@ void LLPanelPrimMediaControls::updateShape()
 			mSkipBackCtrl->setVisible(FALSE);
 			mSkipBackCtrl->setEnabled(FALSE);
 			
-			if(media_impl->getVolume() <= 0.0)
-			{
-				mMuteBtn->setToggleState(true);
-			}
-			else
-			{
-				mMuteBtn->setToggleState(false);
-			}
-
+			mVolumeCtrl->setVisible(FALSE);
+			mVolumeSliderCtrl->setVisible(FALSE);
+			mVolumeCtrl->setEnabled(FALSE);
+			mVolumeSliderCtrl->setEnabled(FALSE);
+			
 			if (mMediaPanelScroll)
 			{
 				mMediaPanelScroll->setVisible(has_focus);
@@ -980,13 +978,6 @@ void LLPanelPrimMediaControls::onClickZoom()
 
 void LLPanelPrimMediaControls::nextZoomLevel()
 {
-	LLViewerObject* objectp = getTargetObject();
-	if(objectp && objectp->isHUDAttachment())
-	{
-		// Never allow zooming on HUD attachments.
-		return;
-	}
-	
 	int index = 0;
 	while (index < kNumZoomLevels)
 	{
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index ba6d9428387687d48eb68ae4360041147d0a1477..0a34531eeecb8814286113ea27b9d8d4e20ed52f 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -2,25 +2,30 @@
  * @file llpanelteleporthistory.cpp
  * @brief Teleport history represented by a scrolling list
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -471,12 +476,6 @@ void LLTeleportHistoryPanel::onSearchEdit(const std::string& string)
 	showTeleportHistory();
 }
 
-// virtual
-bool LLTeleportHistoryPanel::isSingleItemSelected()
-{
-	return mLastSelectedFlatlList && mLastSelectedFlatlList->getSelectedItem();
-}
-
 // virtual
 void LLTeleportHistoryPanel::onShowOnMap()
 {
@@ -497,20 +496,6 @@ void LLTeleportHistoryPanel::onShowOnMap()
 	}
 }
 
-//virtual
-void LLTeleportHistoryPanel::onShowProfile()
-{
-	if (!mLastSelectedFlatlList)
-		return;
-
-	LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
-
-	if(!itemp)
-		return;
-
-	LLTeleportHistoryFlatItem::showPlaceInfoPanel(itemp->getIndex());
-}
-
 // virtual
 void LLTeleportHistoryPanel::onTeleport()
 {
@@ -558,7 +543,6 @@ void LLTeleportHistoryPanel::updateVerbs()
 	if (!mLastSelectedFlatlList)
 	{
 		mTeleportBtn->setEnabled(false);
-		mShowProfile->setEnabled(false);
 		mShowOnMapBtn->setEnabled(false);
 		return;
 	}
@@ -566,7 +550,6 @@ void LLTeleportHistoryPanel::updateVerbs()
 	LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
 
 	mTeleportBtn->setEnabled(NULL != itemp);
-	mShowProfile->setEnabled(NULL != itemp);
 	mShowOnMapBtn->setEnabled(NULL != itemp);
 }
 
@@ -643,18 +626,16 @@ void LLTeleportHistoryPanel::refresh()
 	LLDate tab_boundary_date =  LLDate::now();
 
 	LLFlatListView* curr_flat_view = NULL;
-	std::string filter_string = sFilterSubString;
-	LLStringUtil::toUpper(filter_string);
 
 	U32 added_items = 0;
 	while (mCurrentItem >= 0)
 	{
 		// Filtering
-		if (!filter_string.empty())
+		if (!sFilterSubString.empty())
 		{
 			std::string landmark_title(items[mCurrentItem].mTitle);
 			LLStringUtil::toUpper(landmark_title);
-			if( std::string::npos == landmark_title.find(filter_string) )
+			if( std::string::npos == landmark_title.find(sFilterSubString) )
 			{
 				mCurrentItem--;
 				continue;
@@ -703,7 +684,7 @@ void LLTeleportHistoryPanel::refresh()
 				.getFlatItemForPersistentItem(&mContextMenu,
 											  items[mCurrentItem],
 											  mCurrentItem,
-											  filter_string);
+											  sFilterSubString);
 			if ( !curr_flat_view->addItem(item, LLUUID::null, ADD_BOTTOM, false) )
 				llerrs << "Couldn't add flat item to teleport history." << llendl;
 			if (mLastSelectedItemIndex == mCurrentItem)
@@ -726,8 +707,6 @@ void LLTeleportHistoryPanel::refresh()
 		}
 	}
 
-	mHistoryAccordion->setFilterSubString(sFilterSubString);
-
 	mHistoryAccordion->arrange();
 
 	updateVerbs();
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index b5a025b39bcedf200387cac4a2cecc59d53879f0..5e2ccc0c934c5c3c64197845015a6d8547a7a3d0 100644
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -3,25 +3,30 @@
  * @brief Teleport history represented by a scrolling list
  * class definition
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -42,7 +47,6 @@ class LLFlatListView;
 class LLTeleportHistoryPanel : public LLPanelPlacesTab
 {
 public:
-	// *TODO: derive from LLListContextMenu?
 	class ContextMenu
 	{
 	public:
@@ -69,11 +73,9 @@ class LLTeleportHistoryPanel : public LLPanelPlacesTab
 
 	/*virtual*/ void onSearchEdit(const std::string& string);
 	/*virtual*/ void onShowOnMap();
-	/*virtual*/ void onShowProfile();
 	/*virtual*/ void onTeleport();
 	///*virtual*/ void onCopySLURL();
 	/*virtual*/ void updateVerbs();
-	/*virtual*/ bool isSingleItemSelected();
 
 private:
 
@@ -120,6 +122,4 @@ class LLTeleportHistoryPanel : public LLPanelPlacesTab
 	LLHandle<LLView>		mGearMenuHandle;
 };
 
-
-
 #endif //LL_LLPANELTELEPORTHISTORY_H
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 49850748ee9cd211fe3eb4a2fd08ad2c6ceb1cdf..eb245453db62068d6cfcf9dded03b6e0121b57ea 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -2,25 +2,31 @@
  * @file llparticipantlist.cpp
  * @brief LLParticipantList intended to update view(LLAvatarList) according to incoming messages
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -31,11 +37,8 @@
 #include "llavataractions.h"
 #include "llagent.h"
 
-#include "llimview.h"
-#include "llnotificationsutil.h"
 #include "llparticipantlist.h"
 #include "llspeakers.h"
-#include "llviewercontrol.h"
 #include "llviewermenu.h"
 #include "llvoiceclient.h"
 
@@ -46,159 +49,8 @@
 
 static const LLAvatarItemAgentOnTopComparator AGENT_ON_TOP_NAME_COMPARATOR;
 
-// helper function to update AvatarList Item's indicator in the voice participant list
-static void update_speaker_indicator(const LLAvatarList* const avatar_list, const LLUUID& avatar_uuid, bool is_muted)
-{
-	LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(avatar_list->getItemByValue(avatar_uuid));
-	if (item)
-	{
-		LLOutputMonitorCtrl* indicator = item->getChild<LLOutputMonitorCtrl>("speaking_indicator");
-		indicator->setIsMuted(is_muted);
-	}
-}
-
-
-// See EXT-4301.
-/**
- * class LLAvalineUpdater - observe the list of voice participants in session and check
- *  presence of Avaline Callers among them.
- *
- * LLAvalineUpdater is a LLVoiceClientParticipantObserver. It provides two kinds of validation:
- *	- whether Avaline caller presence among participants;
- *	- whether watched Avaline caller still exists in voice channel.
- * Both validations have callbacks which will notify subscriber if any of event occur.
- *
- * @see findAvalineCaller()
- * @see checkIfAvalineCallersExist()
- */
-class LLAvalineUpdater : public LLVoiceClientParticipantObserver
-{
-public:
-	typedef boost::function<void(const LLUUID& speaker_id)> process_avaline_callback_t;
-
-	LLAvalineUpdater(process_avaline_callback_t found_cb, process_avaline_callback_t removed_cb)
-		: mAvalineFoundCallback(found_cb)
-		, mAvalineRemovedCallback(removed_cb)
-	{
-		LLVoiceClient::getInstance()->addObserver(this);
-	}
-	~LLAvalineUpdater()
-	{
-		if (LLVoiceClient::instanceExists())
-		{
-			LLVoiceClient::getInstance()->removeObserver(this);
-		}
-	}
-
-	/**
-	 * Adds UUID of Avaline caller to watch.
-	 *
-	 * @see checkIfAvalineCallersExist().
-	 */
-	void watchAvalineCaller(const LLUUID& avaline_caller_id)
-	{
-		mAvalineCallers.insert(avaline_caller_id);
-	}
-
-	void onParticipantsChanged()
-	{
-		uuid_set_t participant_uuids;
-		LLVoiceClient::getInstance()->getParticipantList(participant_uuids);
-
-
-		// check whether Avaline caller exists among voice participants
-		// and notify Participant List
-		findAvalineCaller(participant_uuids);
-
-		// check whether watched Avaline callers still present among voice participant
-		// and remove if absents.
-		checkIfAvalineCallersExist(participant_uuids);
-	}
-
-private:
-	typedef std::set<LLUUID> uuid_set_t;
-
-	/**
-	 * Finds Avaline callers among voice participants and calls mAvalineFoundCallback.
-	 *
-	 * When Avatar is in group call with Avaline caller and then ends call Avaline caller stays
-	 * in Group Chat floater (exists in LLSpeakerMgr). If Avatar starts call with that group again
-	 * Avaline caller is added to voice channel AFTER Avatar is connected to group call.
-	 * But Voice Control Panel (VCP) is filled from session LLSpeakerMgr and there is no information
-	 * if a speaker is Avaline caller.
-	 *
-	 * In this case this speaker is created as avatar and will be recreated when it appears in
-	 * Avatar's Voice session.
-	 *
-	 * @see LLParticipantList::onAvalineCallerFound()
-	 */
-	void findAvalineCaller(const uuid_set_t& participant_uuids)
-	{
-		uuid_set_t::const_iterator it = participant_uuids.begin(), it_end = participant_uuids.end();
-
-		for(; it != it_end; ++it)
-		{
-			const LLUUID& participant_id = *it;
-			if (!LLVoiceClient::getInstance()->isParticipantAvatar(participant_id))
-			{
-				LL_DEBUGS("Avaline") << "Avaline caller found among voice participants: " << participant_id << LL_ENDL;
-
-				if (mAvalineFoundCallback)
-				{
-					mAvalineFoundCallback(participant_id);
-				}
-			}
-		}
-	}
-
-	/**
-	 * Finds Avaline callers which are not anymore among voice participants and calls mAvalineRemovedCallback.
-	 *
-	 * The problem is when Avaline caller ends a call it is removed from Voice Client session but
-	 * still exists in LLSpeakerMgr. Server does not send such information.
-	 * This method implements a HUCK to notify subscribers that watched Avaline callers by class
-	 * are not anymore in the call.
-	 *
-	 * @see LLParticipantList::onAvalineCallerRemoved()
-	 */
-	void checkIfAvalineCallersExist(const uuid_set_t& participant_uuids)
-	{
-		uuid_set_t::iterator it = mAvalineCallers.begin();
-		uuid_set_t::const_iterator participants_it_end = participant_uuids.end();
-
-		while (it != mAvalineCallers.end())
-		{
-			const LLUUID participant_id = *it;
-			LL_DEBUGS("Avaline") << "Check avaline caller: " << participant_id << LL_ENDL;
-			bool not_found = participant_uuids.find(participant_id) == participants_it_end;
-			if (not_found)
-			{
-				LL_DEBUGS("Avaline") << "Watched Avaline caller is not found among voice participants: " << participant_id << LL_ENDL;
-
-				// notify Participant List
-				if (mAvalineRemovedCallback)
-				{
-					mAvalineRemovedCallback(participant_id);
-				}
-
-				// remove from the watch list
-				mAvalineCallers.erase(it++);
-			}
-			else
-			{
-				++it;
-			}
-		}
-	}
-
-	process_avaline_callback_t mAvalineFoundCallback;
-	process_avaline_callback_t mAvalineRemovedCallback;
-
-	uuid_set_t mAvalineCallers;
-};
-
 LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list,  bool use_context_menu/* = true*/,
-		bool exclude_agent /*= true*/, bool can_toggle_icons /*= true*/):
+		bool exclude_agent /*= true*/):
 	mSpeakerMgr(data_source),
 	mAvatarList(avatar_list),
 	mSortOrder(E_SORT_BY_NAME)
@@ -206,9 +58,6 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av
 ,	mExcludeAgent(exclude_agent)
 ,	mValidateSpeakerCallback(NULL)
 {
-	mAvalineUpdater = new LLAvalineUpdater(boost::bind(&LLParticipantList::onAvalineCallerFound, this, _1),
-		boost::bind(&LLParticipantList::onAvalineCallerRemoved, this, _1));
-
 	mSpeakerAddListener = new SpeakerAddListener(*this);
 	mSpeakerRemoveListener = new SpeakerRemoveListener(*this);
 	mSpeakerClearListener = new SpeakerClearListener(*this);
@@ -238,12 +87,6 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av
 		mAvatarList->setContextMenu(NULL);
 	}
 
-	if (use_context_menu && can_toggle_icons)
-	{
-		mAvatarList->setShowIcons("ParticipantListShowIcons");
-		mAvatarListToggleIconsConnection = gSavedSettings.getControl("ParticipantListShowIcons")->getSignal()->connect(boost::bind(&LLAvatarList::toggleIcons, mAvatarList));
-	}
-
 	//Lets fill avatarList with existing speakers
 	LLSpeakerMgr::speaker_list_t speaker_list;
 	mSpeakerMgr->getSpeakerList(&speaker_list, true);
@@ -270,7 +113,6 @@ LLParticipantList::~LLParticipantList()
 	mAvatarListDoubleClickConnection.disconnect();
 	mAvatarListRefreshConnection.disconnect();
 	mAvatarListReturnConnection.disconnect();
-	mAvatarListToggleIconsConnection.disconnect();
 
 	// It is possible Participant List will be re-created from LLCallFloater::onCurrentChannelChanged()
 	// See ticket EXT-3427
@@ -287,9 +129,6 @@ LLParticipantList::~LLParticipantList()
 	}
 
 	mAvatarList->setContextMenu(NULL);
-	mAvatarList->setComparator(NULL);
-
-	delete mAvalineUpdater;
 }
 
 void LLParticipantList::setSpeakingIndicatorsVisible(BOOL visible)
@@ -360,70 +199,7 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param)
 				}
 			}
 		}
-
-		// update voice mute state of all items. See EXT-7235
-		LLSpeakerMgr::speaker_list_t speaker_list;
-
-		// Use also participants which are not in voice session now (the second arg is TRUE).
-		// They can already have mModeratorMutedVoice set from the previous voice session
-		// and LLSpeakerVoiceModerationEvent will not be sent when speaker manager is updated next time.
-		mSpeakerMgr->getSpeakerList(&speaker_list, TRUE);
-		for(LLSpeakerMgr::speaker_list_t::iterator it = speaker_list.begin(); it != speaker_list.end(); it++)
-		{
-			const LLPointer<LLSpeaker>& speakerp = *it;
-
-			update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice);
-		}
-	}
-}
-
-/*
-Seems this method is not necessary after onAvalineCallerRemoved was implemented;
-
-It does nothing because list item is always created with correct class type for Avaline caller.
-For now Avaline Caller is removed from the LLSpeakerMgr List when it is removed from the Voice Client
-session.
-This happens in two cases: if Avaline Caller ends call itself or if Resident ends group call.
-
-Probably Avaline caller should be removed from the LLSpeakerMgr list ONLY if it ends call itself.
-Asked in EXT-4301.
-*/
-void LLParticipantList::onAvalineCallerFound(const LLUUID& participant_id)
-{
-	LLPanel* item = mAvatarList->getItemByValue(participant_id);
-
-	if (NULL == item)
-	{
-		LL_WARNS("Avaline") << "Something wrong. Unable to find item for: " << participant_id << LL_ENDL;
-		return;
 	}
-
-	if (typeid(*item) == typeid(LLAvalineListItem))
-	{
-		LL_DEBUGS("Avaline") << "Avaline caller has already correct class type for: " << participant_id << LL_ENDL;
-		// item representing an Avaline caller has a correct type already.
-		return;
-	}
-
-	LL_DEBUGS("Avaline") << "remove item from the list and re-add it: " << participant_id << LL_ENDL;
-
-	// remove UUID from LLAvatarList::mIDs to be able add it again.
-	uuid_vec_t& ids = mAvatarList->getIDs();
-	uuid_vec_t::iterator pos = std::find(ids.begin(), ids.end(), participant_id);
-	ids.erase(pos);
-
-	// remove item directly
-	mAvatarList->removeItem(item);
-
-	// re-add avaline caller with a correct class instance.
-	addAvatarIDExceptAgent(participant_id);
-}
-
-void LLParticipantList::onAvalineCallerRemoved(const LLUUID& participant_id)
-{
-	LL_DEBUGS("Avaline") << "Removing avaline caller from the list: " << participant_id << LL_ENDL;
-
-	mSpeakerMgr->removeAvalineSpeaker(participant_id);
 }
 
 void LLParticipantList::setSortOrder(EParticipantSortOrder order)
@@ -526,7 +302,12 @@ bool LLParticipantList::onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event
 	// update UI on confirmation of moderator mutes
 	if (event->getValue().asString() == "voice")
 	{
-		update_speaker_indicator(mAvatarList, speakerp->mID, speakerp->mModeratorMutedVoice);
+		LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(mAvatarList->getItemByValue(speakerp->mID));
+		if (item)
+		{
+			LLOutputMonitorCtrl* indicator = item->getChild<LLOutputMonitorCtrl>("speaking_indicator");
+			indicator->setIsMuted(speakerp->mModeratorMutedVoice);
+		}
 	}
 	return true;
 }
@@ -566,19 +347,8 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
 	if (mExcludeAgent && gAgent.getID() == avatar_id) return;
 	if (mAvatarList->contains(avatar_id)) return;
 
-	bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(avatar_id);
-
-	if (is_avatar)
-	{
-		mAvatarList->getIDs().push_back(avatar_id);
-		mAvatarList->setDirty();
-	}
-	else
-	{
-		std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id);
-		mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name);
-		mAvalineUpdater->watchAvalineCaller(avatar_id);
-	}
+	mAvatarList->getIDs().push_back(avatar_id);
+	mAvatarList->setDirty();
 	adjustParticipant(avatar_id);
 }
 
@@ -659,20 +429,17 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu()
 	registrar.add("ParticipantList.ModerateVoice", boost::bind(&LLParticipantList::LLParticipantListMenu::moderateVoice, this, _2));
 
 	enable_registrar.add("ParticipantList.EnableItem", boost::bind(&LLParticipantList::LLParticipantListMenu::enableContextMenuItem,	this, _2));
-	enable_registrar.add("ParticipantList.EnableItem.Moderate", boost::bind(&LLParticipantList::LLParticipantListMenu::enableModerateContextMenuItem,	this, _2));
 	enable_registrar.add("ParticipantList.CheckItem",  boost::bind(&LLParticipantList::LLParticipantListMenu::checkContextMenuItem,	this, _2));
 
 	// create the context menu from the XUI
-	LLContextMenu* main_menu = createFromFile("menu_participant_list.xml");
+	LLContextMenu* main_menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
+		"menu_participant_list.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
 
 	// Don't show sort options for P2P chat
 	bool is_sort_visible = (mParent.mAvatarList && mParent.mAvatarList->size() > 1);
 	main_menu->setItemVisible("SortByName", is_sort_visible);
 	main_menu->setItemVisible("SortByRecentSpeakers", is_sort_visible);
-	main_menu->setItemVisible("Moderator Options Separator", isGroupModerator());
 	main_menu->setItemVisible("Moderator Options", isGroupModerator());
-	main_menu->setItemVisible("View Icons Separator", mParent.mAvatarListToggleIconsConnection.connected());
-	main_menu->setItemVisible("View Icons", mParent.mAvatarListToggleIconsConnection.connected());
 	main_menu->arrangeAndClear();
 
 	return main_menu;
@@ -680,20 +447,22 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu()
 
 void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
 {
-	if (uuids.size() == 0) return;
+	LLPanelPeopleMenus::ContextMenu::show(spawning_view, uuids, x, y);
 
-	LLListContextMenu::show(spawning_view, uuids, x, y);
+	if (uuids.size() == 0) return;
 
-	const LLUUID& speaker_id = mUUIDs.front();
+	const LLUUID speaker_id = mUUIDs.front();
 	BOOL is_muted = isMuted(speaker_id);
 
 	if (is_muted)
 	{
 		LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceMuteSelected", false);
+		LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceMuteOthers", false);
 	}
 	else
 	{
 		LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceUnMuteSelected", false);
+		LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceUnMuteOthers", false);
 	}
 }
 
@@ -733,26 +502,10 @@ void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata,
 	{
 		return;
 	}
-	LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(mParent.mAvatarList->getItemByValue(speaker_id));
-	if (NULL == item) return;
 
-	name = item->getAvatarName();
+	name = speakerp->mDisplayName;
 
-	LLMute::EType mute_type;
-	switch (speakerp->mType)
-	{
-		case LLSpeaker::SPEAKER_AGENT:
-			mute_type = LLMute::AGENT;
-			break;
-		case LLSpeaker::SPEAKER_OBJECT:
-			mute_type = LLMute::OBJECT;
-			break;
-		case LLSpeaker::SPEAKER_EXTERNAL:
-		default:
-			mute_type = LLMute::EXTERNAL;
-			break;
-	}
-	LLMute mute(speaker_id, name, mute_type);
+	LLMute mute(speaker_id, name, speakerp->mType == LLSpeaker::SPEAKER_AGENT ? LLMute::AGENT : LLMute::OBJECT);
 
 	if (!is_muted)
 	{
@@ -798,17 +551,16 @@ void LLParticipantList::LLParticipantListMenu::moderateVoice(const LLSD& userdat
 	if (!gAgent.getRegion()) return;
 
 	bool moderate_selected = userdata.asString() == "selected";
+	const LLUUID& selected_avatar_id = mUUIDs.front();
+	bool is_muted = isMuted(selected_avatar_id);
 
 	if (moderate_selected)
 	{
-		const LLUUID& selected_avatar_id = mUUIDs.front();
-		bool is_muted = isMuted(selected_avatar_id);
 		moderateVoiceParticipant(selected_avatar_id, is_muted);
 	}
 	else
 	{
-		bool unmute_all = userdata.asString() == "unmute_all";
-		moderateVoiceAllParticipants(unmute_all);
+		moderateVoiceOtherParticipants(selected_avatar_id, is_muted);
 	}
 }
 
@@ -821,62 +573,40 @@ void LLParticipantList::LLParticipantListMenu::moderateVoiceParticipant(const LL
 	}
 }
 
-void LLParticipantList::LLParticipantListMenu::moderateVoiceAllParticipants(bool unmute)
+void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute)
 {
 	LLIMSpeakerMgr* mgr = dynamic_cast<LLIMSpeakerMgr*>(mParent.mSpeakerMgr);
 	if (mgr)
 	{
-		if (!unmute)
-		{
-			LLSD payload;
-			payload["session_id"] = mgr->getSessionID();
-			LLNotificationsUtil::add("ConfirmMuteAll", LLSD(), payload, confirmMuteAllCallback);
-			return;
-		}
-
-		mgr->moderateVoiceAllParticipants(unmute);
+		mgr->moderateVoiceOtherParticipants(excluded_avatar_id, unmute);
 	}
 }
 
-// static
-void LLParticipantList::LLParticipantListMenu::confirmMuteAllCallback(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	// if Cancel pressed
-	if (option == 1)
-	{
-		return;
-	}
-
-	const LLSD& payload = notification["payload"];
-	const LLUUID& session_id = payload["session_id"];
-
-	LLIMSpeakerMgr * speaker_manager = dynamic_cast<LLIMSpeakerMgr*> (
-			LLIMModel::getInstance()->getSpeakerManager(session_id));
-	if (speaker_manager)
-	{
-		speaker_manager->moderateVoiceAllParticipants(false);
-	}
-
-	return;
-}
-
-
 bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& userdata)
 {
 	std::string item = userdata.asString();
-	const LLUUID& participant_id = mUUIDs.front();
-
-	// For now non of "can_view_profile" action and menu actions listed below except "can_block"
-	// can be performed for Avaline callers.
-	bool is_participant_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(participant_id);
-	if (!is_participant_avatar && "can_block" != item) return false;
-
 	if (item == "can_mute_text" || "can_block" == item || "can_share" == item || "can_im" == item 
 		|| "can_pay" == item)
 	{
 		return mUUIDs.front() != gAgentID;
 	}
+	else if (item == "can_allow_text_chat")
+	{
+		return isGroupModerator();
+	}
+	else if ("can_moderate_voice" == item)
+	{
+		if (isGroupModerator())
+		{
+			LLPointer<LLSpeaker> speakerp = mParent.mSpeakerMgr->findSpeaker(mUUIDs.front());
+			if (speakerp.notNull())
+			{
+				// not in voice participants can not be moderated
+				return speakerp->isInVoiceChannel();
+			}
+		}
+		return false;
+	}
 	else if (item == std::string("can_add"))
 	{
 		// We can add friends if:
@@ -902,43 +632,13 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD&
 	else if (item == "can_call")
 	{
 		bool not_agent = mUUIDs.front() != gAgentID;
-		bool can_call = not_agent &&  LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+		bool can_call = not_agent && LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
 		return can_call;
 	}
 
 	return true;
 }
 
-/*
-Processed menu items with such parameters:
-	can_allow_text_chat
-	can_moderate_voice
-*/
-bool LLParticipantList::LLParticipantListMenu::enableModerateContextMenuItem(const LLSD& userdata)
-{
-	// only group moderators can perform actions related to this "enable callback"
-	if (!isGroupModerator()) return false;
-
-	const LLUUID& participant_id = mUUIDs.front();
-	LLPointer<LLSpeaker> speakerp = mParent.mSpeakerMgr->findSpeaker(participant_id);
-
-	// not in voice participants can not be moderated
-	bool speaker_in_voice = speakerp.notNull() && speakerp->isInVoiceChannel();
-
-	const std::string& item = userdata.asString();
-
-	if ("can_moderate_voice" == item)
-	{
-		return speaker_in_voice;
-	}
-
-	// For now non of menu actions except "can_moderate_voice" can be performed for Avaline callers.
-	bool is_participant_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(participant_id);
-	if (!is_participant_avatar) return false;
-
-	return true;
-}
-
 bool LLParticipantList::LLParticipantListMenu::checkContextMenuItem(const LLSD& userdata)
 {
 	std::string item = userdata.asString();
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index 722a749d19de30f3d40fa895c97b930a7a0b0e58..d9ca4230a99af0cba299e0b8a87472e6dd9f9128 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -2,37 +2,42 @@
  * @file llparticipantlist.h
  * @brief LLParticipantList intended to update view(LLAvatarList) according to incoming messages
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 #include "llevent.h"
+#include "llpanelpeoplemenus.h"
 #include "llavatarlist.h" // for LLAvatarItemRecentSpeakerComparator
-#include "lllistcontextmenu.h"
 
 class LLSpeakerMgr;
 class LLAvatarList;
 class LLUICtrl;
-class LLAvalineUpdater;
 
 class LLParticipantList
 {
@@ -41,7 +46,7 @@ class LLParticipantList
 
 		typedef boost::function<bool (const LLUUID& speaker_id)> validate_speaker_callback_t;
 
-		LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu = true, bool exclude_agent = true, bool can_toggle_icons = true);
+		LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu = true, bool exclude_agent = true);
 		~LLParticipantList();
 		void setSpeakingIndicatorsVisible(BOOL visible);
 
@@ -142,7 +147,7 @@ class LLParticipantList
 		/**
 		 * Menu used in the participant list.
 		 */
-		class LLParticipantListMenu : public LLListContextMenu
+		class LLParticipantListMenu : public LLPanelPeopleMenus::ContextMenu
 		{
 		public:
 			LLParticipantListMenu(LLParticipantList& parent):mParent(parent){};
@@ -152,7 +157,6 @@ class LLParticipantList
 			LLParticipantList& mParent;
 		private:
 			bool enableContextMenuItem(const LLSD& userdata);
-			bool enableModerateContextMenuItem(const LLSD& userdata);
 			bool checkContextMenuItem(const LLSD& userdata);
 
 			void sortParticipantList(const LLSD& userdata);
@@ -181,7 +185,7 @@ class LLParticipantList
 			 * @param userdata can be "selected" or "others".
 			 *
 			 * @see moderateVoiceParticipant()
-			 * @see moderateVoiceAllParticipants()
+			 * @see moderateVoiceOtherParticipants()
 			 */
 			void moderateVoice(const LLSD& userdata);
 
@@ -194,22 +198,22 @@ class LLParticipantList
 			 * @param[in] avatar_id UUID of avatar to be processed
 			 * @param[in] unmute if true - specified avatar will be muted, otherwise - unmuted.
 			 *
-			 * @see moderateVoiceAllParticipants()
+			 * @see moderateVoiceOtherParticipants()
 			 */
 			void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute);
 
 			/**
-			 * Mutes/Unmutes all avatars for current group voice chat.
+			 * Mutes/Unmutes all avatars except specified for current group voice chat.
 			 *
 			 * It only marks avatars as muted for session and does not use local Agent's Block list.
+			 * It based call moderateVoiceParticipant() for each avatar should be muted/unmuted.
 			 *
+			 * @param[in] excluded_avatar_id UUID of avatar NOT to be processed
 			 * @param[in] unmute if true - avatars will be muted, otherwise - unmuted.
 			 *
 			 * @see moderateVoiceParticipant()
 			 */
-			void moderateVoiceAllParticipants(bool unmute);
-
-			static void confirmMuteAllCallback(const LLSD& notification, const LLSD& response);
+			void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute);
 		};
 
 		/**
@@ -231,9 +235,6 @@ class LLParticipantList
 		void onAvatarListDoubleClicked(LLUICtrl* ctrl);
 		void onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param);
 
-		void onAvalineCallerFound(const LLUUID& participant_id);
-		void onAvalineCallerRemoved(const LLUUID& participant_id);
-
 		/**
 		 * Adjusts passed participant to work properly.
 		 *
@@ -267,9 +268,7 @@ class LLParticipantList
 		boost::signals2::connection mAvatarListDoubleClickConnection;
 		boost::signals2::connection mAvatarListRefreshConnection;
 		boost::signals2::connection mAvatarListReturnConnection;
-		boost::signals2::connection mAvatarListToggleIconsConnection;
 
 		LLPointer<LLAvatarItemRecentSpeakerComparator> mSortByRecentSpeakers;
 		validate_speaker_callback_t mValidateSpeakerCallback;
-		LLAvalineUpdater* mAvalineUpdater;
 };
diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp
index 225ac6e224fb06ae6eac3438cc9d16610ca1cded..f59a55cb8b74325a3d1696fa84a32d5753ba78eb 100644
--- a/indra/newview/llplacesinventorybridge.cpp
+++ b/indra/newview/llplacesinventorybridge.cpp
@@ -2,25 +2,31 @@
  * @file llplacesinventorybridge.cpp
  * @brief Implementation of the Inventory-Folder-View-Bridge classes for Places Panel.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -109,7 +115,7 @@ void LLPlacesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		// they should be synchronized with Places/My Landmarks/Gear menu. See EXT-1601 
 
 		// repeat parent functionality
- 		sSelf = getHandle(); // necessary for "New Folder" functionality
+ 		sSelf = this; // necessary for "New Folder" functionality
 
 		hide_context_entries(menu, items, disabled_items);
 	}
diff --git a/indra/newview/llplacesinventorybridge.h b/indra/newview/llplacesinventorybridge.h
index 52beacef9cf107a0f21d2e4a4ccc506fa7e797f5..7e5170cc33180b96c7fd97a7092883c5e3f2fa36 100644
--- a/indra/newview/llplacesinventorybridge.h
+++ b/indra/newview/llplacesinventorybridge.h
@@ -2,25 +2,31 @@
  * @file llplacesinventorybridge.h
  * @brief Declaration of the Inventory-Folder-View-Bridge classes for Places Panel.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp
index 29e262199e3fea24c028338b372f4b83610500bd..0930a7be7f6aaa387472511ad256bad89c1ce995 100644
--- a/indra/newview/llplacesinventorypanel.cpp
+++ b/indra/newview/llplacesinventorypanel.cpp
@@ -2,25 +2,31 @@
  * @file llplacesinventorypanel.cpp
  * @brief LLPlacesInventoryPanel  class definition
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp
index 4f3a2a40448226fcabd513d714bd9aa3becf2f17..d0db77dcbe43100b810fa3f094bf7520e20fcee4 100644
--- a/indra/newview/llpreview.cpp
+++ b/indra/newview/llpreview.cpp
@@ -2,25 +2,31 @@
  * @file llpreview.cpp
  * @brief LLPreview class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -132,7 +138,7 @@ void LLPreview::onCommit()
 	const LLViewerInventoryItem *item = dynamic_cast<const LLViewerInventoryItem*>(getItem());
 	if(item)
 	{
-		if (!item->isFinished())
+		if (!item->isComplete())
 		{
 			// We are attempting to save an item that was never loaded
 			llwarns << "LLPreview::onCommit() called with mIsComplete == FALSE"
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index a9984528885c18739c5d5b544620b1e13026dccf..262961b73b2f2ccb462c7a741398f3a52fcdae25 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -2,25 +2,31 @@
  * @file llpreviewanim.cpp
  * @brief LLPreviewAnim class implementation
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index a8da9e5129271ae0f724f45326d957ddb0f28c57..fce90e4c44cf54b181e599fc27840b4b64fb799f 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -2,54 +2,84 @@
  * @file llpreviewgesture.cpp
  * @brief Editing UI for inventory-based gestures.
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
+
 #include "llpreviewgesture.h"
 
-#include "llagent.h"
-#include "llanimstatelabels.h"
-#include "llanimationstates.h"
-#include "llappviewer.h"			// gVFS
-#include "llassetuploadresponders.h"
-#include "llcheckboxctrl.h"
-#include "llcombobox.h"
-#include "lldelayedgestureerror.h"
+#include <algorithm>
+
+// libraries
+#include "lldatapacker.h"
+#include "lldarray.h"
+#include "llstring.h"
+#include "lldir.h"
 #include "llfloaterreg.h"
-#include "llgesturemgr.h"
 #include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llmultigesture.h"
 #include "llnotificationsutil.h"
-#include "llradiogroup.h"
-#include "llresmgr.h"
-#include "lltrans.h"
 #include "llvfile.h"
+
+// newview
+#include "llagent.h"		// todo: remove
+#include "llanimationstates.h"
+#include "llassetuploadresponders.h"
+#include "llbutton.h"
+#include "llcheckboxctrl.h"
+#include "llcombobox.h"
+#include "lldelayedgestureerror.h"
+#include "llfloatergesture.h" // for some label constants
+#include "llgesturemgr.h"
+#include "llkeyboard.h"
+#include "lllineeditor.h"
+#include "llradiogroup.h"
+#include "llscrolllistctrl.h"
+#include "llscrolllistitem.h"
+#include "llscrolllistcell.h"
+#include "lltextbox.h"
+#include "lluictrlfactory.h"
+#include "llviewerinventory.h"
+#include "llviewerobject.h"
 #include "llviewerobjectlist.h"
 #include "llviewerregion.h"
 #include "llviewerstats.h"
+#include "llviewerwindow.h"		// busycount
+#include "llvoavatarself.h"
+#include "llappviewer.h"			// gVFS
+#include "llanimstatelabels.h"
+#include "llresmgr.h"
+#include "lltrans.h"
+
 
 std::string NONE_LABEL;
 std::string SHIFT_LABEL;
@@ -111,7 +141,7 @@ LLPreviewGesture* LLPreviewGesture::show(const LLUUID& item_id, const LLUUID& ob
 
 	// this will call refresh when we have everything.
 	LLViewerInventoryItem* item = (LLViewerInventoryItem*)preview->getItem();
-	if (item && !item->isFinished())
+	if (item && !item->isComplete())
 	{
 		LLInventoryGestureAvailable* observer;
 		observer = new LLInventoryGestureAvailable();
@@ -618,7 +648,7 @@ void LLPreviewGesture::refresh()
 	LLPreview::refresh();
 	// If previewing or item is incomplete, all controls are disabled
 	LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem();
-	bool is_complete = (item && item->isFinished()) ? true : false;
+	bool is_complete = (item && item->isComplete()) ? true : false;
 	if (mPreviewGesture || !is_complete)
 	{
 		
@@ -802,9 +832,7 @@ void LLPreviewGesture::loadAsset()
 	const LLInventoryItem* item = getItem();
 	if (!item) 
 	{
-		// Don't set asset status here; we may not have set the item id yet
-		// (e.g. when this gets called initially)
-		//mAssetStatus = PREVIEW_ASSET_ERROR;
+		mAssetStatus = PREVIEW_ASSET_ERROR;
 		return;
 	}
 
@@ -870,7 +898,6 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs,
 
 				self->mDirty = FALSE;
 				self->refresh();
-				self->refreshFromItem(); // to update description and title
 			}
 			else
 			{
@@ -1619,17 +1646,7 @@ std::string LLPreviewGesture::getLabel(std::vector<std::string> labels)
 		result=LLTrans::getString("AnimFlagStart");
 	}
 
-	// lets localize action value
-	std::string action = v_labels[1];
-	if ("None" == action)
-	{
-		action = LLTrans::getString("GestureActionNone");
-	}
-	else if ("until animations are done" == action)
-	{
-		action = LLFloaterReg::getInstance("preview_gesture")->getChild<LLCheckBoxCtrl>("wait_anim_check")->getLabel();
-	}
-	result.append(action);
+	result.append(v_labels[1]);
 	return result;
 	
 }
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index 2089beba267eebcaab78540d93eeff4b3e422f9c..75702dc8e52c1bf454e41729739316b55d8d41d5 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -2,25 +2,31 @@
  * @file llpreviewnotecard.cpp
  * @brief Implementation of the notecard editor
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -29,7 +35,6 @@
 #include "llpreviewnotecard.h"
 
 #include "llinventory.h"
-#include "llinventoryfunctions.h" // for change_item_parent()
 
 #include "llagent.h"
 #include "llassetuploadresponders.h"
@@ -87,17 +92,11 @@ BOOL LLPreviewNotecard::postBuild()
 	childSetAction("Save", onClickSave, this);
 	childSetVisible("lock", FALSE);	
 
-	childSetAction("Delete", onClickDelete, this);
-	childSetEnabled("Delete", false);
-
 	const LLInventoryItem* item = getItem();
 
 	childSetCommitCallback("desc", LLPreview::onText, this);
 	if (item)
-	{
 		childSetText("desc", item->getDescription());
-		childSetEnabled("Delete", true);
-	}
 	childSetPrevalidate("desc", &LLTextValidate::validateASCIIPrintableNoPipe);
 
 	return LLPreview::postBuild();
@@ -375,17 +374,6 @@ void LLPreviewNotecard::onClickSave(void* user_data)
 	}
 }
 
-
-// static
-void LLPreviewNotecard::onClickDelete(void* user_data)
-{
-	LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
-	if(preview)
-	{
-		preview->deleteNotecard();
-	}
-}
-
 struct LLSaveNotecardInfo
 {
 	LLPreviewNotecard* mSelf;
@@ -478,18 +466,6 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
 	return true;
 }
 
-void LLPreviewNotecard::deleteNotecard()
-{
-	LLViewerInventoryItem* item = gInventory.getItem(mItemUUID);
-	if (item != NULL)
-	{
-		const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-		change_item_parent(&gInventory, item, trash_id, FALSE);
-	}
-
-	closeFloater();
-}
-
 // static
 void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
 {
diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h
index b53c0da6bef0fa25a0e959c4d8c8e851e1eb6bf2..e0363eef548f8f9c79070744282dadaa75776f7b 100644
--- a/indra/newview/llpreviewnotecard.h
+++ b/indra/newview/llpreviewnotecard.h
@@ -2,25 +2,31 @@
  * @file llpreviewnotecard.h
  * @brief LLPreviewNotecard class header file
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -77,8 +83,6 @@ class LLPreviewNotecard : public LLPreview
 	virtual void loadAsset();
 	bool saveIfNeeded(LLInventoryItem* copyitem = NULL);
 
-	void deleteNotecard();
-
 	static void onLoadComplete(LLVFS *vfs,
 							   const LLUUID& asset_uuid,
 							   LLAssetType::EType type,
@@ -86,8 +90,6 @@ class LLPreviewNotecard : public LLPreview
 
 	static void onClickSave(void* data);
 
-	static void onClickDelete(void* data);
-
 	static void onSaveComplete(const LLUUID& asset_uuid,
 							   void* user_data,
 							   S32 status, LLExtStat ext_status);
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 5cb93e823dcb8bc607f024febed262447055ef19..6b0e524f8cbf05223a224be4971a88d2eef7cc0f 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -2,25 +2,31 @@
  * @file llpreviewscript.cpp
  * @brief LLPreviewScript class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -1817,7 +1823,7 @@ void LLLiveLSLEditor::saveIfNeeded()
 		return;
 	}
 
-	if(mItem.isNull() || !mItem->isFinished())
+	if(mItem.isNull() || !mItem->isComplete())
 	{
 		// $NOTE: While the error message may not be exactly correct,
 		// it's pretty close.
diff --git a/indra/newview/llrecentpeople.cpp b/indra/newview/llrecentpeople.cpp
index 959fd51bbfdf17f71231c301b2dd3146c4fab8b7..62c2ddfd9f77a76c60211ea8895f859e28970573 100644
--- a/indra/newview/llrecentpeople.cpp
+++ b/indra/newview/llrecentpeople.cpp
@@ -2,25 +2,31 @@
  * @file llrecentpeople.cpp
  * @brief List of people with which the user has recently interacted.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llrecentpeople.h b/indra/newview/llrecentpeople.h
index 852a92ff80796eac57dfce9b20c3ae20aa0c0bf8..c718997f7ef1714168a9a6de71d803b041956aa0 100644
--- a/indra/newview/llrecentpeople.h
+++ b/indra/newview/llrecentpeople.h
@@ -2,25 +2,31 @@
  * @file llrecentpeople.h
  * @brief List of people with which the user has recently interacted.
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 5c923a040950a02199f674e8ec36f914d9d62800..e9a80907b766bad2b8c656bb6e81f3418668422c 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -2,25 +2,31 @@
  * @file llscreenchannel.cpp
  * @brief Class implements a channel on a screen in which appropriate toasts may appear.
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -41,7 +47,7 @@
 #include "llsyswellwindow.h"
 #include "llimfloater.h"
 #include "llscriptfloater.h"
-#include "llsidetray.h"
+#include "llfontgl.h"
 
 #include <algorithm>
 
@@ -53,7 +59,6 @@ bool LLScreenChannel::mWasStartUpToastShown = false;
 //////////////////////
 // LLScreenChannelBase
 //////////////////////
-
 LLScreenChannelBase::LLScreenChannelBase(const LLUUID& id) :
 												mToastAlignment(NA_BOTTOM)
 												,mCanStoreToasts(true)
@@ -64,7 +69,6 @@ LLScreenChannelBase::LLScreenChannelBase(const LLUUID& id) :
 {	
 	mID = id;
 	mWorldViewRectConnection = gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLScreenChannelBase::updatePositionAndSize, this, _1, _2));
-
 	setMouseOpaque( false );
 	setVisible(FALSE);
 }
@@ -83,30 +87,11 @@ bool  LLScreenChannelBase::isHovering()
 	return mHoveredToast->isHovered();
 }
 
-bool LLScreenChannelBase::resetPositionAndSize(const LLSD& newvalue)
-{
-	LLRect rc = gViewerWindow->getWorldViewRectScaled();
-	updatePositionAndSize(rc, rc);
-	return true;
-}
-
 void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect)
 {
-	/*
-	take sidetray into account - screenchannel should not overlap sidetray
-	*/
-	S32 world_rect_padding = 0;
-	if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE
-		&& LLSideTray::instanceCreated	())
-	{
-		LLSideTray*	side_bar = LLSideTray::getInstance();
-
-		if (side_bar->getVisible() && !side_bar->getCollapsed())
-			world_rect_padding += side_bar->getRect().getWidth();
-	}
-
-
 	S32 top_delta = old_world_rect.mTop - new_world_rect.mTop;
+	S32 right_delta = old_world_rect.mRight - new_world_rect.mRight;
+
 	LLRect this_rect = getRect();
 
 	this_rect.mTop -= top_delta;
@@ -115,13 +100,11 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne
 	case CA_LEFT :
 		break;
 	case CA_CENTRE :
-		this_rect.setCenterAndSize( (new_world_rect.getWidth() - world_rect_padding) / 2, new_world_rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight());
+		this_rect.setCenterAndSize(new_world_rect.getWidth() / 2, new_world_rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight());
 		break;
 	case CA_RIGHT :
-		this_rect.setLeftTopAndSize(new_world_rect.mRight - world_rect_padding - this_rect.getWidth(),
-			this_rect.mTop,
-			this_rect.getWidth(),
-			this_rect.getHeight());
+		this_rect.mLeft -= right_delta;
+		this_rect.mRight -= right_delta;
 	}
 	setRect(this_rect);
 	redrawToasts();
@@ -130,12 +113,6 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne
 
 void LLScreenChannelBase::init(S32 channel_left, S32 channel_right)
 {
-	if(LLSideTray::instanceCreated())
-	{
-		LLSideTray*	side_bar = LLSideTray::getInstance();
-		side_bar->getCollapseSignal().connect(boost::bind(&LLScreenChannelBase::resetPositionAndSize, this, _2));
-	}
-
 	S32 channel_top = gViewerWindow->getWorldViewRectScaled().getHeight();
 	S32 channel_bottom = gViewerWindow->getWorldViewRectScaled().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
 	setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom));
@@ -197,20 +174,7 @@ std::list<LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
 //--------------------------------------------------------------------------
 void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect)
 {
-	/*
-	take sidetray into account - screenchannel should not overlap sidetray
-	*/
-	S32 world_rect_padding = 0;
-	if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE 
-		&& LLSideTray::instanceCreated	())
-	{
-		LLSideTray*	side_bar = LLSideTray::getInstance();
-
-		if (side_bar->getVisible() && !side_bar->getCollapsed())
-			world_rect_padding += side_bar->getRect().getWidth();
-	}
-
-
+	S32 right_delta = old_world_rect.mRight - new_world_rect.mRight;
 	LLRect this_rect = getRect();
 
 	switch(mChannelAlignment)
@@ -223,10 +187,8 @@ void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_wo
 		return;
 	case CA_RIGHT :
 		this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio());
-		this_rect.setLeftTopAndSize(new_world_rect.mRight - world_rect_padding - this_rect.getWidth(),
-			this_rect.mTop,
-			this_rect.getWidth(),
-			this_rect.getHeight());
+		this_rect.mLeft -= right_delta;
+		this_rect.mRight -= right_delta;
 	}
 	setRect(this_rect);
 	redrawToasts();
@@ -291,12 +253,6 @@ void LLScreenChannel::onToastDestroyed(LLToast* toast)
 	{
 		mStoredToastList.erase(it);
 	}
-
-	// if destroyed toast is hovered - reset hovered
-	if (mHoveredToast == toast)
-	{
-		mHoveredToast = NULL;
-	}
 }
 
 
@@ -626,6 +582,7 @@ void LLScreenChannel::showToastsTop()
 void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer)
 {
 	LLRect toast_rect;
+	LLRect tbox_rect;
 	LLToast::Params p;
 	p.lifetime_secs = timer;
 	p.enable_hide_btn = false;
@@ -636,26 +593,34 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer)
 
 	mStartUpToastPanel->setOnFadeCallback(boost::bind(&LLScreenChannel::onStartUpToastHide, this));
 
-	LLPanel* wrapper_panel = mStartUpToastPanel->getChild<LLPanel>("wrapper_panel");
 	LLTextBox* text_box = mStartUpToastPanel->getChild<LLTextBox>("toast_text");
 
 	std::string	text = LLTrans::getString("StartUpNotifications");
 
-	toast_rect = mStartUpToastPanel->getRect();
-	mStartUpToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true);
+	tbox_rect   = text_box->getRect();
+	S32 tbox_width  = tbox_rect.getWidth();
+	S32 tbox_vpad   = text_box->getVPad();
+	S32 text_width  = text_box->getDefaultFont()->getWidth(text);
+	S32 text_height = text_box->getTextPixelHeight();
 
-	text_box->setValue(text);
-	text_box->setVisible(TRUE);
+	// EXT - 3703 (Startup toast message doesn't fit toast width)
+	// Calculating TextBox HEIGHT needed to include the whole string according to the given WIDTH of the TextBox.
+	S32 new_tbox_height = (text_width/tbox_width + 1) * text_height;
+	// Calculating TOP position of TextBox
+	S32 new_tbox_top = new_tbox_height + tbox_vpad + gSavedSettings.getS32("ToastGap");
+	// Calculating toast HEIGHT according to the new TextBox size
+	S32 toast_height = new_tbox_height + tbox_vpad * 2;
 
-	S32 old_height = text_box->getRect().getHeight();
-	text_box->reshapeToFitText();
-	text_box->setOrigin(text_box->getRect().mLeft, (wrapper_panel->getRect().getHeight() - text_box->getRect().getHeight())/2);
-	S32 new_height = text_box->getRect().getHeight();
-	S32 height_delta = new_height - old_height;
+	tbox_rect.setLeftTopAndSize(tbox_rect.mLeft, new_tbox_top, tbox_rect.getWidth(), new_tbox_height);
+	text_box->setRect(tbox_rect);
 
-	toast_rect.setLeftTopAndSize(0, toast_rect.getHeight() + height_delta +gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight());
+	toast_rect = mStartUpToastPanel->getRect();
+	mStartUpToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true);
+	toast_rect.setLeftTopAndSize(0, toast_height + gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_height);
 	mStartUpToastPanel->setRect(toast_rect);
 
+	text_box->setValue(text);
+	text_box->setVisible(TRUE);
 	addChild(mStartUpToastPanel);
 	
 	mStartUpToastPanel->setVisible(TRUE);
@@ -751,31 +716,6 @@ void LLScreenChannel::hideToast(const LLUUID& notification_id)
 	}
 }
 
-void LLScreenChannel::closeHiddenToasts(const Matcher& matcher)
-{
-	// since we can't guarantee that close toast operation doesn't change mToastList
-	// we collect matched toasts that should be closed into separate list
-	std::list<ToastElem> toasts;
-	for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
-			!= mToastList.end(); it++)
-	{
-		LLToast * toast = it->toast;
-		// add to list valid toast that match to provided matcher criteria
-		if (toast != NULL && !toast->isDead() && toast->getNotification() != NULL
-				&& !toast->getVisible() && matcher.matches(toast->getNotification()))
-		{
-			toasts.push_back(*it);
-		}
-	}
-
-	// close collected toasts
-	for (std::list<ToastElem>::iterator it = toasts.begin(); it
-			!= toasts.end(); it++)
-	{
-		it->toast->closeFloater();
-	}
-}
-
 //--------------------------------------------------------------------------
 void LLScreenChannel::removeToastsFromChannel()
 {
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp
index 504115896a719838e2822063131864d3c85f80af..7980fe19459a132566f508ed5a3a40e33db19dc0 100644
--- a/indra/newview/llscrollingpanelparam.cpp
+++ b/indra/newview/llscrollingpanelparam.cpp
@@ -2,25 +2,31 @@
  * @file llscrollingpanelparam.cpp
  * @brief UI panel for a list of visual param panels
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -36,21 +42,24 @@
 #include "llbutton.h"
 #include "llsliderctrl.h"
 #include "llagent.h"
-#include "llviewborder.h"
 #include "llvoavatarself.h"
 
 // Constants for LLPanelVisualParam
 const F32 LLScrollingPanelParam::PARAM_STEP_TIME_THRESHOLD = 0.25f;
 
+const S32 LLScrollingPanelParam::BTN_BORDER = 2;
 const S32 LLScrollingPanelParam::PARAM_HINT_WIDTH = 128;
 const S32 LLScrollingPanelParam::PARAM_HINT_HEIGHT = 128;
+const S32 LLScrollingPanelParam::PARAM_HINT_LABEL_HEIGHT = 16;
+const S32 LLScrollingPanelParam::PARAM_PANEL_WIDTH = 2 * (3* BTN_BORDER + PARAM_HINT_WIDTH +  LLPANEL_BORDER_WIDTH);
+const S32 LLScrollingPanelParam::PARAM_PANEL_HEIGHT = 2 * BTN_BORDER + PARAM_HINT_HEIGHT + PARAM_HINT_LABEL_HEIGHT + 4 * LLPANEL_BORDER_WIDTH; 
 
 // LLScrollingPanelParam
 //static
 S32 LLScrollingPanelParam::sUpdateDelayFrames = 0;
 
 LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_params,
-											  LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp )
+											  LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable )
 	: LLScrollingPanel( panel_params ),
 	  mParam(param),
 	  mAllowModify(allow_modify),
@@ -58,18 +67,15 @@ LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_param
 {
 	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_scrolling_param.xml");
 
-	// *HACK To avoid hard coding texture position, lets use border's position for texture. 
-	LLViewBorder* left_border = getChild<LLViewBorder>("left_border");
-
 	static LLUICachedControl<S32> slider_ctrl_height ("UISliderctrlHeight", 0);
-	S32 pos_x = left_border->getRect().mLeft + left_border->getBorderWidth();
-	S32 pos_y = left_border->getRect().mBottom + left_border->getBorderWidth();
+	S32 pos_x = 2 * LLPANEL_BORDER_WIDTH;
+	S32 pos_y = 3 * LLPANEL_BORDER_WIDTH + slider_ctrl_height;
 	F32 min_weight = param->getMinWeight();
 	F32 max_weight = param->getMaxWeight();
 
-	mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable,  min_weight, jointp);
-	pos_x = getChild<LLViewBorder>("right_border")->getRect().mLeft + left_border->getBorderWidth();
-	mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, max_weight, jointp );
+	mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()),  min_weight);
+	pos_x += PARAM_HINT_WIDTH + 3 * BTN_BORDER;
+	mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), max_weight );
 	
 	mHintMin->setAllowsUpdates( FALSE );
 	mHintMax->setAllowsUpdates( FALSE );
@@ -156,10 +162,6 @@ void LLScrollingPanelParam::draw()
 	childSetVisible("less", mHintMin->getVisible());
 	childSetVisible("more", mHintMax->getVisible());
 
-	// hide borders if texture has been loaded
-	childSetVisible("left_border", !mHintMin->getVisible());
-	childSetVisible("right_border", !mHintMax->getVisible());
-
 	// Draw all the children except for the labels
 	childSetVisible( "min param text", FALSE );
 	childSetVisible( "max param text", FALSE );
@@ -169,7 +171,9 @@ void LLScrollingPanelParam::draw()
 	gGL.pushUIMatrix();
 	{
 		const LLRect& r = mHintMin->getRect();
-		gGL.translateUI((F32)r.mLeft, (F32)r.mBottom, 0.f);
+		F32 left = (F32)(r.mLeft + BTN_BORDER);
+		F32 bot  = (F32)(r.mBottom + BTN_BORDER);
+		gGL.translateUI(left, bot, 0.f);
 		mHintMin->draw();
 	}
 	gGL.popUIMatrix();
@@ -177,7 +181,9 @@ void LLScrollingPanelParam::draw()
 	gGL.pushUIMatrix();
 	{
 		const LLRect& r = mHintMax->getRect();
-		gGL.translateUI((F32)r.mLeft, (F32)r.mBottom, 0.f);
+		F32 left = (F32)(r.mLeft + BTN_BORDER);
+		F32 bot  = (F32)(r.mBottom + BTN_BORDER);
+		gGL.translateUI(left, bot, 0.f);
 		mHintMax->draw();
 	}
 	gGL.popUIMatrix();
@@ -185,10 +191,10 @@ void LLScrollingPanelParam::draw()
 
 	// Draw labels on top of the buttons
 	childSetVisible( "min param text", TRUE );
-	drawChild(getChild<LLView>("min param text"));
+	drawChild(getChild<LLView>("min param text"), BTN_BORDER, BTN_BORDER);
 
 	childSetVisible( "max param text", TRUE );
-	drawChild(getChild<LLView>("max param text"));
+	drawChild(getChild<LLView>("max param text"), BTN_BORDER, BTN_BORDER);
 }
 
 // static
@@ -203,7 +209,6 @@ void LLScrollingPanelParam::onSliderMoved(LLUICtrl* ctrl, void* userdata)
 	if (current_weight != new_weight )
 	{
 		self->mWearable->setVisualParamWeight( param->getID(), new_weight, FALSE );
-		self->mWearable->writeToAvatar();
 		gAgentAvatarp->updateVisualParams();
 	}
 }
@@ -293,7 +298,6 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint )
 				&& new_percent < slider->getMaxValue())
 			{
 				mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight, FALSE);
-				mWearable->writeToAvatar();
 				gAgentAvatarp->updateVisualParams();
 
 				slider->setValue( weightToPercent( new_weight ) );
@@ -326,7 +330,6 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata )
 				&& new_percent < slider->getMaxValue())
 			{
 				self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight, FALSE);
-				self->mWearable->writeToAvatar();
 				slider->setValue( self->weightToPercent( new_weight ) );
 			}
 		}
@@ -360,7 +363,6 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata )
 					&& new_percent < slider->getMaxValue())
 				{
 					self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight, FALSE);
-					self->mWearable->writeToAvatar();
 					slider->setValue( self->weightToPercent( new_weight ) );
 				}
 			}
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 85ae37f9a83a20256504cdaf505865953d33fbc0..d03a492cd1002146da0a6ecc2b074f254bf95836 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2,25 +2,31 @@
  * @file llselectmgr.cpp
  * @brief A manager for selected objects and faces.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -2429,7 +2435,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
 	
 	if (identical)
 	{
-		name = LLSLURL("agent", first_id, "inspect").getSLURLString();
+		name = LLSLURL::buildCommand("agent", first_id, "inspect");
 	}
 	else
 	{
@@ -2488,11 +2494,11 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
 		BOOL public_owner = (first_id.isNull() && !first_group_owned);
 		if (first_group_owned)
 		{
-			name = LLSLURL("group", first_id, "inspect").getSLURLString();
+			name = LLSLURL::buildCommand("group", first_id, "inspect");
 		}
 		else if(!public_owner)
 		{
-			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
+			name = LLSLURL::buildCommand("agent", first_id, "inspect");
 		}
 		else
 		{
@@ -2552,7 +2558,7 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
 		BOOL public_owner = (first_id.isNull());
 		if(!public_owner)
 		{
-			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
+			name = LLSLURL::buildCommand("agent", first_id, "inspect");
 		}
 		else
 		{
@@ -3618,15 +3624,14 @@ void LLSelectMgr::sendAttach(U8 attachment_point)
 		return;
 	}
 
+#if ENABLE_MULTIATTACHMENTS
+	attachment_point |= ATTACHMENT_ADD;
+#endif
 	BOOL build_mode = LLToolMgr::getInstance()->inEdit();
 	// Special case: Attach to default location for this object.
 	if (0 == attachment_point ||
 		get_if_there(gAgentAvatarp->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL))
 	{
-
-		if (gSavedSettings.getBOOL("MultipleAttachments"))
-			attachment_point |= ATTACHMENT_ADD;
-
 		sendListToRegions(
 			"ObjectAttach",
 			packAgentIDAndSessionAndAttachment, 
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index fc9879b75aac41e1534b39ecc0073f158071cd04..d315f40ff3ba07da0865f523837bee111447674e 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -2,25 +2,31 @@
  * @file llselectmgr.h
  * @brief A manager for selected objects and TEs.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -251,6 +257,7 @@ class LLObjectSelection : public LLRefCount
 	LLObjectSelection();
 
 	void updateEffects();
+	void cleanupNodes();
 
 	BOOL isEmpty() const;
 
@@ -274,6 +281,11 @@ class LLObjectSelection : public LLRefCount
 	template <typename T> bool getSelectedTEValue(LLSelectedTEGetFunctor<T>* func, T& res);
 	template <typename T> bool isMultipleTEValue(LLSelectedTEGetFunctor<T>* func, const T& ignore_value);
 	
+	void addNode(LLSelectNode *nodep);
+	void addNodeAtEnd(LLSelectNode *nodep);
+	void moveNodeToFront(LLSelectNode *nodep);
+	void removeNode(LLSelectNode *nodep);
+	void deleteAllNodes();			// Delete all nodes
 	S32 getNumNodes();
 	LLSelectNode* findNode(LLViewerObject* objectp);
 
@@ -300,15 +312,6 @@ class LLObjectSelection : public LLRefCount
 
 	ESelectType getSelectType() const { return mSelectType; }
 
-private:
-	void addNode(LLSelectNode *nodep);
-	void addNodeAtEnd(LLSelectNode *nodep);
-	void moveNodeToFront(LLSelectNode *nodep);
-	void removeNode(LLSelectNode *nodep);
-	void deleteAllNodes();
-	void cleanupNodes();
-
-
 private:
 	list_t mList;
 	const LLObjectSelection &operator=(const LLObjectSelection &);
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index fe7950c058128d4ed7eb273e419e85cd9de5daa0..a084c93786336b27aa03f235172a5579f6b8259c 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -2,25 +2,30 @@
  * @file llsidepanelappearance.cpp
  * @brief Side Bar "Appearance" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2004-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -37,25 +42,20 @@
 #include "llfloaterreg.h"
 #include "llfloaterworldmap.h"
 #include "llfoldervieweventlistener.h"
-#include "lloutfitobserver.h"
 #include "llpaneleditwearable.h"
 #include "llpaneloutfitsinventory.h"
-#include "llsidetray.h"
 #include "lltextbox.h"
 #include "lluictrlfactory.h"
-#include "llviewercontrol.h"
 #include "llviewerregion.h"
 #include "llvoavatarself.h"
 #include "llwearable.h"
 
 static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
 
-class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver
+class LLCurrentlyWornFetchObserver : public LLInventoryFetchObserver
 {
 public:
-	LLCurrentlyWornFetchObserver(const uuid_vec_t &ids,
-								 LLSidepanelAppearance *panel) :
-		LLInventoryFetchItemsObserver(ids),
+	LLCurrentlyWornFetchObserver(LLSidepanelAppearance *panel) :
 		mPanel(panel)
 	{}
 	~LLCurrentlyWornFetchObserver() {}
@@ -69,25 +69,39 @@ class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver
 	LLSidepanelAppearance *mPanel;
 };
 
+class LLWatchForOutfitRenameObserver : public LLInventoryObserver
+{
+public:
+	LLWatchForOutfitRenameObserver(LLSidepanelAppearance *panel) :
+		mPanel(panel)
+	{}
+	virtual void changed(U32 mask);
+	
+private:
+	LLSidepanelAppearance *mPanel;
+};
+
+void LLWatchForOutfitRenameObserver::changed(U32 mask)
+{
+	if (mask & LABEL)
+	{
+		mPanel->refreshCurrentOutfitName();
+	}
+}
+
 LLSidepanelAppearance::LLSidepanelAppearance() :
 	LLPanel(),
 	mFilterSubString(LLStringUtil::null),
 	mFilterEditor(NULL),
 	mOutfitEdit(NULL),
-	mCurrOutfitPanel(NULL),
-	mOpened(false)
+	mCurrOutfitPanel(NULL)
 {
-	LLOutfitObserver& outfit_observer =  LLOutfitObserver::instance();
-	outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
-	outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
-	outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
-
-	gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true));
-	gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false));
 }
 
 LLSidepanelAppearance::~LLSidepanelAppearance()
 {
+	gInventory.removeObserver(mOutfitRenameWatcher);
+	delete mOutfitRenameWatcher;
 }
 
 // virtual
@@ -99,7 +113,8 @@ BOOL LLSidepanelAppearance::postBuild()
 	mEditAppearanceBtn = getChild<LLButton>("editappearance_btn");
 	mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this));
 
-	childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this));
+	mEditBtn = getChild<LLButton>("edit_btn");
+	mEditBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditButtonClicked, this));
 
 	mNewOutfitBtn = getChild<LLButton>("newlook_btn");
 	mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this));
@@ -112,6 +127,7 @@ BOOL LLSidepanelAppearance::postBuild()
 	}
 
 	mPanelOutfitsInventory = dynamic_cast<LLPanelOutfitsInventory *>(getChild<LLPanel>("panel_outfits_inventory"));
+	mPanelOutfitsInventory->setParent(this);
 
 	mOutfitEdit = dynamic_cast<LLPanelOutfitEdit*>(getChild<LLPanel>("panel_outfit_edit"));
 	if (mOutfitEdit)
@@ -119,7 +135,7 @@ BOOL LLSidepanelAppearance::postBuild()
 		LLButton* back_btn = mOutfitEdit->getChild<LLButton>("back_btn");
 		if (back_btn)
 		{
-			back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this));
+			back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onBackButtonClicked, this));
 		}
 
 	}
@@ -130,18 +146,18 @@ BOOL LLSidepanelAppearance::postBuild()
 		LLButton* edit_wearable_back_btn = mEditWearable->getChild<LLButton>("back_btn");
 		if (edit_wearable_back_btn)
 		{
-			edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this));
+			edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditWearBackClicked, this));
 		}
 	}
 
 	mCurrentLookName = getChild<LLTextBox>("currentlook_name");
 
-	mOutfitStatus = getChild<LLTextBox>("currentlook_status");
+	mOutfitDirtyTag = getChild<LLTextBox>("currentlook_title");
 	
 	mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook");
 
-
-	setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2));
+	mOutfitRenameWatcher = new LLWatchForOutfitRenameObserver(this);
+	gInventory.addObserver(mOutfitRenameWatcher);
 
 	return TRUE;
 }
@@ -149,74 +165,26 @@ BOOL LLSidepanelAppearance::postBuild()
 // virtual
 void LLSidepanelAppearance::onOpen(const LLSD& key)
 {
-	if (!key.has("type"))
+	fetchInventory();
+	refreshCurrentOutfitName();
+	updateVerbs();
+
+	if (mPanelOutfitsInventory)
 	{
-		// No specific panel requested.
-		// If we're opened for the first time then show My Outfits.
-		// Else do nothing.
-		if (!mOpened)
-		{
-			showOutfitsInventoryPanel();
-		}
+		mPanelOutfitsInventory->onOpen(key);
 	}
-	else
-	{
-		// Switch to the requested panel.
-		// *TODO: replace this crap with LLSideTrayPanelContainer
-		std::string type = key["type"].asString();
-		if (type == "my_outfits")
-		{
-			showOutfitsInventoryPanel();
-		}
-		else if (type == "edit_outfit")
-		{
-			showOutfitEditPanel();
-		}
-		else if (type == "edit_shape")
-		{
-			showWearableEditPanel();
-		}
-	}
-
-	mOpened = true;
-}
 
-void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility)
-{
-	if (new_visibility.asBoolean())
-	{
-		bool is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible();
-		bool is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible();
+	if(key.size() == 0)
+		return;
 
-		if (is_outfit_edit_visible || is_wearable_edit_visible)
-		{
-			if (!gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement"))
-			{
-				gAgentCamera.changeCameraToCustomizeAvatar();
-			}
-			if (is_wearable_edit_visible)
-			{
-				LLWearable *wearable_ptr = mEditWearable->getWearable();
-				if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE)
-				{
-					// we're no longer wearing the wearable we were last editing, switch back to outfit editor
-					showOutfitEditPanel();
-				}
-			}
+	toggleOutfitEditPanel(TRUE);
+	updateVerbs();
+	
+	mLookInfoType = key["type"].asString();
 
-			if (is_outfit_edit_visible)
-			{
-				mOutfitEdit->resetAccordionState();
-			}
-		}
-	}
-	else
+	if (mLookInfoType == "edit_outfit")
 	{
-		if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement"))
-		{
-			gAgentCamera.changeCameraToDefault();
-			gAgentCamera.resetView();
-		}
+		mOutfitEdit->displayCurrentOutfit();
 	}
 }
 
@@ -227,7 +195,8 @@ void LLSidepanelAppearance::onFilterEdit(const std::string& search_string)
 		mFilterSubString = search_string;
 
 		// Searches are case-insensitive
-		// but we don't convert the typed string to upper-case so that it can be fed to the web search as-is.
+		LLStringUtil::toUpper(mFilterSubString);
+		LLStringUtil::trimHead(mFilterSubString);
 
 		mPanelOutfitsInventory->onSearchEdit(mFilterSubString);
 	}
@@ -260,7 +229,6 @@ void LLSidepanelAppearance::onOpenOutfitButtonClicked()
 	}
 }
 
-// *TODO: obsolete?
 void LLSidepanelAppearance::onEditAppearanceButtonClicked()
 {
 	if (gAgentWearables.areWearablesLoaded())
@@ -269,6 +237,19 @@ void LLSidepanelAppearance::onEditAppearanceButtonClicked()
 	}
 }
 
+void LLSidepanelAppearance::onEditButtonClicked()
+{
+	toggleOutfitEditPanel(FALSE);
+	toggleWearableEditPanel(TRUE, NULL);
+	/*if (mOutfitEdit->getVisible())
+	  {
+	  }
+	  else
+	  {
+	  mPanelOutfitsInventory->onEdit();
+	  }*/
+}
+
 void LLSidepanelAppearance::onNewOutfitButtonClicked()
 {
 	if (!mOutfitEdit->getVisible())
@@ -277,131 +258,69 @@ void LLSidepanelAppearance::onNewOutfitButtonClicked()
 	}
 }
 
-void LLSidepanelAppearance::showOutfitsInventoryPanel()
+
+void LLSidepanelAppearance::onBackButtonClicked()
 {
-	toggleWearableEditPanel(FALSE);
 	toggleOutfitEditPanel(FALSE);
-	togglMyOutfitsPanel(TRUE);
 }
 
-void LLSidepanelAppearance::showOutfitEditPanel()
+void LLSidepanelAppearance::onEditWearBackClicked()
 {
-	// Accordion's state must be reset in all cases except the one when user
-	// is returning back to the mOutfitEdit panel from the mEditWearable panel.
-	// The simplest way to control this is to check the visibility state of the mEditWearable
-	// BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE).
-	if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL)
-	{
-		mOutfitEdit->resetAccordionState();
-	}
-
-	togglMyOutfitsPanel(FALSE);
-	toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode
+	mEditWearable->saveChanges();
+	toggleWearableEditPanel(FALSE, NULL);
 	toggleOutfitEditPanel(TRUE);
 }
 
-void LLSidepanelAppearance::showWearableEditPanel(LLWearable *wearable /* = NULL*/)
-{
-	togglMyOutfitsPanel(FALSE);
-	toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode
-	toggleWearableEditPanel(TRUE, wearable);
-}
-
-void LLSidepanelAppearance::togglMyOutfitsPanel(BOOL visible)
+void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible)
 {
-	if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible)
-	{
-		// visibility isn't changing, hence nothing to do
+	if (!mOutfitEdit)
 		return;
-	}
-
-	mPanelOutfitsInventory->setVisible(visible);
-
-	// *TODO: Move these controls to panel_outfits_inventory.xml
-	// so that we don't need to toggle them explicitly.
-	mFilterEditor->setVisible(visible);
-	mNewOutfitBtn->setVisible(visible);
-	mCurrOutfitPanel->setVisible(visible);
-
-	if (visible)
-	{
-		mPanelOutfitsInventory->onOpen(LLSD());
-	}
-}
-
-void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch)
-{
-	if (!mOutfitEdit || mOutfitEdit->getVisible() == visible)
-	{
-		// visibility isn't changing, hence nothing to do
-		return;
-	}
 
 	mOutfitEdit->setVisible(visible);
-
-	if (visible)
-	{
-		mOutfitEdit->onOpen(LLSD());
-		if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") )
-		{
-			gAgentCamera.changeCameraToCustomizeAvatar();
-		}
-	}
-	else if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") )
-	{
-		gAgentCamera.changeCameraToDefault();
-		gAgentCamera.resetView();
-	}
+	if (mPanelOutfitsInventory) mPanelOutfitsInventory->setVisible(!visible);
+	mFilterEditor->setVisible(!visible);
+	mEditBtn->setVisible(!visible);
+	mNewOutfitBtn->setVisible(!visible);
+	mCurrOutfitPanel->setVisible(!visible);
 }
 
-void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *wearable, BOOL disable_camera_switch)
+void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *wearable)
 {
-	if (!mEditWearable || mEditWearable->getVisible() == visible)
-	{
-		// visibility isn't changing, hence nothing to do
-		return;
-	}
-
 	if (!wearable)
 	{
-		wearable = gAgentWearables.getWearable(LLWearableType::WT_SHAPE, 0);
+		wearable = gAgentWearables.getWearable(WT_SHAPE, 0);
 	}
-	if (!wearable)
+	if (!mEditWearable || !wearable)
 	{
 		return;
 	}
 
-	// Toggle panel visibility.
+	mCurrOutfitPanel->setVisible(!visible);
+
 	mEditWearable->setVisible(visible);
+	mEditWearable->setWearable(wearable);
+	mFilterEditor->setVisible(!visible);
+	mPanelOutfitsInventory->setVisible(!visible);
+}
+
+void LLSidepanelAppearance::updateVerbs()
+{
+	bool is_look_info_visible = mOutfitEdit->getVisible();
 
-	if (visible)
+	if (mPanelOutfitsInventory && !is_look_info_visible)
 	{
-		if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") )
-		{
-			gAgentCamera.changeCameraToCustomizeAvatar();
-		}
-		mEditWearable->setWearable(wearable);
-		mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency
+		const bool is_correct_type = (mPanelOutfitsInventory->getCorrectListenerForAction() != NULL);
+		mEditBtn->setEnabled(is_correct_type);
 	}
 	else
 	{
-		// Save changes if closing.
-		mEditWearable->saveChanges();
-		if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") )
-		{
-			gAgentCamera.changeCameraToDefault();
-			gAgentCamera.resetView();
-		}
+		mEditBtn->setEnabled(FALSE);
 	}
 }
 
 void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
 {
-	// Set current outfit status (wearing/unsaved).
-	bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
-	std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing");
-	mOutfitStatus->setText(cof_status_str);
-
+	mOutfitDirtyTag->setVisible(LLAppearanceMgr::getInstance()->isOutfitDirty());
 	if (name == "")
 	{
 		std::string outfit_name;
@@ -410,9 +329,7 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
 				mCurrentLookName->setText(outfit_name);
 				return;
 		}
-
-		std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit";
-		mCurrentLookName->setText(getString(string_name));
+		mCurrentLookName->setText(getString("No Outfit"));
 		mOpenOutfitBtn->setEnabled(FALSE);
 	}
 	else
@@ -424,15 +341,11 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
 }
 
 //static
-void LLSidepanelAppearance::editWearable(LLWearable *wearable, LLView *data)
+void LLSidepanelAppearance::editWearable(LLWearable *wearable, void *data)
 {
-	LLSideTray::getInstance()->showPanel("sidepanel_appearance");
-
-	LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(data);
-	if (panel)
-	{
-		panel->showWearableEditPanel(wearable);
-	}
+	LLSidepanelAppearance *panel = (LLSidepanelAppearance*) data;
+	panel->toggleOutfitEditPanel(FALSE);
+	panel->toggleWearableEditPanel(TRUE, wearable);
 }
 
 // Fetch currently worn items and only enable the New Look button after everything's been
@@ -443,11 +356,11 @@ void LLSidepanelAppearance::fetchInventory()
 	mNewOutfitBtn->setEnabled(false);
 	uuid_vec_t ids;
 	LLUUID item_id;
-	for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type)
+	for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type)
 	{
-		for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index)
+		for (U32 index = 0; index < gAgentWearables.getWearableCount((EWearableType)type); ++index)
 		{
-			item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index);
+			item_id = gAgentWearables.getWearableItemID((EWearableType)type, index);
 			if(item_id.notNull())
 			{
 				ids.push_back(item_id);
@@ -475,11 +388,11 @@ void LLSidepanelAppearance::fetchInventory()
 		}
 	}
 
-	LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this);
-	fetch_worn->startFetch();
+	LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(this);
+	fetch_worn->fetch(ids);
 	// If no items to be fetched, done will never be triggered.
-	// TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition.
-	if (fetch_worn->isFinished())
+	// TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition.
+	if (fetch_worn->isEverythingComplete())
 	{
 		fetch_worn->done();
 	}
@@ -493,31 +406,3 @@ void LLSidepanelAppearance::inventoryFetched()
 {
 	mNewOutfitBtn->setEnabled(true);
 }
-
-void LLSidepanelAppearance::setWearablesLoading(bool val)
-{
-	childSetVisible("wearables_loading_indicator", val);
-	childSetVisible("edit_outfit_btn", !val);
-
-	if (!val)
-	{
-		// refresh outfit name when COF is already changed.
-		refreshCurrentOutfitName();
-	}
-}
-
-void LLSidepanelAppearance::showDefaultSubpart()
-{
-	if (mEditWearable->getVisible())
-	{
-		mEditWearable->showDefaultSubpart();
-	}
-}
-
-void LLSidepanelAppearance::updateScrollingPanelList()
-{
-	if (mEditWearable->getVisible())
-	{
-		mEditWearable->updateScrollingPanelList();
-	}
-}
diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h
index f28cdfa49a2564a2b383b2bd5e8c85e8059c0a5b..1d78e92a84e755f2d2dc34aaf3f2cd8e5762e053 100644
--- a/indra/newview/llsidepanelappearance.h
+++ b/indra/newview/llsidepanelappearance.h
@@ -2,25 +2,30 @@
  * @file llsidepanelappearance.h
  * @brief Side Bar "Appearance" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -35,13 +40,13 @@
 
 class LLFilterEditor;
 class LLCurrentlyWornFetchObserver;
+class LLWatchForOutfitRenameObserver;
 class LLPanelEditWearable;
 class LLWearable;
 class LLPanelOutfitsInventory;
 
 class LLSidepanelAppearance : public LLPanel
 {
-	LOG_CLASS(LLSidepanelAppearance);
 public:
 	LLSidepanelAppearance();
 	virtual ~LLSidepanelAppearance();
@@ -51,29 +56,23 @@ class LLSidepanelAppearance : public LLPanel
 
 	void refreshCurrentOutfitName(const std::string& name = "");
 
-	static void editWearable(LLWearable *wearable, LLView *data);
+	static void editWearable(LLWearable *wearable, void *data);
 
 	void fetchInventory();
 	void inventoryFetched();
+	void updateVerbs();
 	void onNewOutfitButtonClicked();
 
-	void showOutfitsInventoryPanel();
-	void showOutfitEditPanel();
-	void showWearableEditPanel(LLWearable *wearable = NULL);
-	void setWearablesLoading(bool val);
-	void showDefaultSubpart();
-	void updateScrollingPanelList();
-
 private:
 	void onFilterEdit(const std::string& search_string);
-	void onVisibilityChange ( const LLSD& new_visibility );
 
 	void onOpenOutfitButtonClicked();
 	void onEditAppearanceButtonClicked();
-
-	void togglMyOutfitsPanel(BOOL visible);
-	void toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch = FALSE);
-	void toggleWearableEditPanel(BOOL visible, LLWearable* wearable = NULL, BOOL disable_camera_switch = FALSE);
+	void onEditButtonClicked();
+	void onBackButtonClicked();
+	void onEditWearBackClicked();
+	void toggleOutfitEditPanel(BOOL visible);
+	void toggleWearableEditPanel(BOOL visible, LLWearable* wearable);
 
 	LLFilterEditor*			mFilterEditor;
 	LLPanelOutfitsInventory* mPanelOutfitsInventory;
@@ -82,21 +81,26 @@ class LLSidepanelAppearance : public LLPanel
 
 	LLButton*					mOpenOutfitBtn;
 	LLButton*					mEditAppearanceBtn;
+	LLButton*					mEditBtn;
 	LLButton*					mNewOutfitBtn;
 	LLPanel*					mCurrOutfitPanel;
 
 	LLTextBox*					mCurrentLookName;
-	LLTextBox*					mOutfitStatus;
+	LLTextBox*					mOutfitDirtyTag;
 
 	// Used to make sure the user's inventory is in memory.
 	LLCurrentlyWornFetchObserver* mFetchWorn;
 
+	// Used to update title when currently worn outfit gets renamed.
+	LLWatchForOutfitRenameObserver* mOutfitRenameWatcher;
+
 	// Search string for filtering landmarks and teleport
 	// history locations
 	std::string					mFilterSubString;
 
-	// Gets set to true when we're opened for the first time.
-	bool mOpened;
+	// Information type currently shown in Look Information panel
+	std::string					mLookInfoType;
+
 };
 
 #endif //LL_LLSIDEPANELAPPEARANCE_H
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index b4c1516f71bc630f0e000989a42dfb2c2262f015..18e56a9c017b7ae5071d5427a3de155cc35010b2 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -2,25 +2,30 @@
  * @file LLSidepanelInventory.cpp
  * @brief Side Bar "Inventory" panel
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2004-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -28,19 +33,14 @@
 #include "llsidepanelinventory.h"
 
 #include "llagent.h"
-#include "llappearancemgr.h"
-#include "llavataractions.h"
 #include "llbutton.h"
 #include "llinventorybridge.h"
-#include "llinventoryfunctions.h"
 #include "llinventorypanel.h"
-#include "lloutfitobserver.h"
 #include "llpanelmaininventory.h"
 #include "llsidepaneliteminfo.h"
 #include "llsidepaneltaskinfo.h"
 #include "lltabcontainer.h"
 #include "llselectmgr.h"
-#include "llweb.h"
 
 static LLRegisterPanelClassWrapper<LLSidepanelInventory> t_inventory("sidepanel_inventory");
 
@@ -69,9 +69,6 @@ BOOL LLSidepanelInventory::postBuild()
 		mShareBtn = mInventoryPanel->getChild<LLButton>("share_btn");
 		mShareBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShareButtonClicked, this));
 		
-		mShopBtn = mInventoryPanel->getChild<LLButton>("shop_btn");
-		mShopBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShopButtonClicked, this));
-
 		mWearBtn = mInventoryPanel->getChild<LLButton>("wear_btn");
 		mWearBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onWearButtonClicked, this));
 		
@@ -86,8 +83,6 @@ BOOL LLSidepanelInventory::postBuild()
 		
 		mPanelMainInventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
 		mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2));
-		LLTabContainer* tabs = mPanelMainInventory->getChild<LLTabContainer>("inventory filter tabs");
-		tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
 
 		/* 
 		   EXT-4846 : "Can we suppress the "Landmarks" and "My Favorites" folder since they have their own Task Panel?"
@@ -96,8 +91,6 @@ BOOL LLSidepanelInventory::postBuild()
 		my_inventory_panel->addHideFolderType(LLFolderType::FT_LANDMARK);
 		my_inventory_panel->addHideFolderType(LLFolderType::FT_FAVORITE);
 		*/
-
-		LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
 	}
 
 	// UI elements from item panel
@@ -158,12 +151,6 @@ void LLSidepanelInventory::onInfoButtonClicked()
 
 void LLSidepanelInventory::onShareButtonClicked()
 {
-	LLAvatarActions::shareWithAvatars();
-}
-
-void LLSidepanelInventory::onShopButtonClicked()
-{
-	LLWeb::loadURLExternal(gSavedSettings.getString("MarketplaceURL"));
 }
 
 void LLSidepanelInventory::performActionOnSelection(const std::string &action)
@@ -265,10 +252,7 @@ void LLSidepanelInventory::updateVerbs()
 	mPlayBtn->setEnabled(FALSE);
  	mTeleportBtn->setVisible(FALSE);
  	mTeleportBtn->setEnabled(FALSE);
- 	mShopBtn->setVisible(TRUE);
-
-	mShareBtn->setEnabled(canShare());
-
+	
 	const LLInventoryItem *item = getSelectedItem();
 	if (!item)
 		return;
@@ -276,6 +260,7 @@ void LLSidepanelInventory::updateVerbs()
 	bool is_single_selection = getSelectedCount() == 1;
 
 	mInfoBtn->setEnabled(is_single_selection);
+	mShareBtn->setEnabled(is_single_selection);
 
 	switch(item->getInventoryType())
 	{
@@ -283,45 +268,23 @@ void LLSidepanelInventory::updateVerbs()
 		case LLInventoryType::IT_OBJECT:
 		case LLInventoryType::IT_ATTACHMENT:
 			mWearBtn->setVisible(TRUE);
-			mWearBtn->setEnabled(get_can_item_be_worn(item->getLinkedUUID()));
-		 	mShopBtn->setVisible(FALSE);
+			mWearBtn->setEnabled(TRUE);
 			break;
 		case LLInventoryType::IT_SOUND:
 		case LLInventoryType::IT_GESTURE:
 		case LLInventoryType::IT_ANIMATION:
 			mPlayBtn->setVisible(TRUE);
 			mPlayBtn->setEnabled(TRUE);
-		 	mShopBtn->setVisible(FALSE);
 			break;
 		case LLInventoryType::IT_LANDMARK:
 			mTeleportBtn->setVisible(TRUE);
 			mTeleportBtn->setEnabled(TRUE);
-		 	mShopBtn->setVisible(FALSE);
 			break;
 		default:
 			break;
 	}
 }
 
-bool LLSidepanelInventory::canShare()
-{
-	LLPanelMainInventory* panel_main_inventory =
-		mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
-
-	LLFolderView* root_folder =
-		panel_main_inventory->getActivePanel()->getRootFolder();
-
-	LLFolderViewItem* current_item = root_folder->hasVisibleChildren()
-		? root_folder->getCurSelectedItem()
-		: NULL;
-
-	LLInvFVBridge* bridge = current_item
-		? dynamic_cast <LLInvFVBridge*> (current_item->getListener())
-		: NULL;
-
-	return bridge ? bridge->canShare() : false;
-}
-
 LLInventoryItem *LLSidepanelInventory::getSelectedItem()
 {
 	LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
@@ -338,7 +301,8 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem()
 U32 LLSidepanelInventory::getSelectedCount()
 {
 	LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
-	std::set<LLUUID> selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();
+	std::set<LLUUID> selection_list;
+	panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(selection_list);
 	return selection_list.size();
 }
 
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index d98398c48459224fc01b06e66187e10bbb821084..9b073943b434fc83cb1a4a1ac2c1c5e887daf843 100644
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -2,25 +2,31 @@
  * @file llsidepaneliteminfo.cpp
  * @brief A floater which shows an inventory item's properties.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -125,6 +131,7 @@ BOOL LLSidepanelItemInfo::postBuild()
 	getChild<LLUICtrl>("CheckNextOwnerTransfer")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this));
 	// Mark for sale or not, and sale info
 	getChild<LLUICtrl>("CheckPurchase")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this));
+	getChild<LLUICtrl>("RadioSaleType")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleType, this));
 	// "Price" label for edit
 	getChild<LLUICtrl>("Edit Cost")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this));
 	refresh();
@@ -182,6 +189,7 @@ void LLSidepanelItemInfo::refresh()
 			"CheckNextOwnerCopy",
 			"CheckNextOwnerTransfer",
 			"CheckPurchase",
+			"RadioSaleType",
 			"Edit Cost"
 		};
 
@@ -228,7 +236,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 	if (!item) return;
 
 	// do not enable the UI for incomplete items.
-	BOOL is_complete = item->isFinished();
+	BOOL is_complete = item->isComplete();
 	const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(item->getInventoryType());
 	const BOOL is_calling_card = (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD);
 	const LLPermissions& perm = item->getPermissions();
@@ -317,19 +325,6 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 		childSetText("LabelOwnerName",getString("public"));
 	}
 	
-	////////////
-	// ORIGIN //
-	////////////
-
-	if (object)
-	{
-		childSetText("origin",getString("origin_inworld"));
-	}
-	else
-	{
-		childSetText("origin",getString("origin_inventory"));
-	}
-
 	//////////////////
 	// ACQUIRE DATE //
 	//////////////////
@@ -348,9 +343,9 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 		childSetText ("LabelAcquiredDate", timeStr);
 	}
 	
-	//////////////////////////////////////
-	// PERMISSIONS AND SALE ITEM HIDING //
-	//////////////////////////////////////
+	/////////////////////////////////////
+	// PERMISSIONS AND SALE ITEM HIDING
+	/////////////////////////////////////
 	
 	const std::string perm_and_sale_items[]={
 		"perms_inv",
@@ -369,6 +364,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 		"CheckNextOwnerTransfer",
 		"CheckPurchase",
 		"SaleLabel",
+		"RadioSaleType",
 		"combobox sale copy",
 		"Edit Cost",
 		"TextPrice"
@@ -563,6 +559,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 		childSetEnabled("CheckNextOwnerCopy",(base_mask & PERM_COPY) && !cannot_restrict_permissions);
 		childSetEnabled("CheckNextOwnerTransfer",(next_owner_mask & PERM_COPY) && !cannot_restrict_permissions);
 
+		childSetEnabled("RadioSaleType",is_complete && is_for_sale);
 		childSetEnabled("TextPrice",is_complete && is_for_sale);
 		childSetEnabled("Edit Cost",is_complete && is_for_sale);
 	}
@@ -576,6 +573,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 		childSetEnabled("CheckNextOwnerCopy",FALSE);
 		childSetEnabled("CheckNextOwnerTransfer",FALSE);
 
+		childSetEnabled("RadioSaleType",FALSE);
 		childSetEnabled("TextPrice",FALSE);
 		childSetEnabled("Edit Cost",FALSE);
 	}
@@ -588,14 +586,17 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 	childSetValue("CheckNextOwnerCopy",LLSD(BOOL(next_owner_mask & PERM_COPY)));
 	childSetValue("CheckNextOwnerTransfer",LLSD(BOOL(next_owner_mask & PERM_TRANSFER)));
 
+	LLRadioGroup* radioSaleType = getChild<LLRadioGroup>("RadioSaleType");
 	if (is_for_sale)
 	{
+		radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1);
 		S32 numerical_price;
 		numerical_price = sale_info.getSalePrice();
 		childSetText("Edit Cost",llformat("%d",numerical_price));
 	}
 	else
 	{
+		radioSaleType->setSelectedIndex(-1);
 		childSetText("Edit Cost",llformat("%d",0));
 	}
 }
@@ -742,7 +743,7 @@ void LLSidepanelItemInfo::onCommitPermissions()
 							CheckNextOwnerTransfer->get(), PERM_TRANSFER);
 	}
 	if(perm != item->getPermissions()
-		&& item->isFinished())
+		&& item->isComplete())
 	{
 		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
 		new_item->setPermissions(perm);
@@ -872,7 +873,7 @@ void LLSidepanelItemInfo::updateSaleInfo()
 		sale_info.setSaleType(LLSaleInfo::FS_NOT);
 	}
 	if(sale_info != item->getSaleInfo()
-		&& item->isFinished())
+		&& item->isComplete())
 	{
 		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
 
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index 0308f5e632a3e0e35c1648337bf55c206a1c646a..5d20e280b5f23308601a75d0f0c455eeefde3a71 100644
--- a/indra/newview/llslurl.cpp
+++ b/indra/newview/llslurl.cpp
@@ -1,27 +1,32 @@
 /** 
- * @file llurlsimstring.cpp (was llsimurlstring.cpp)
- * @brief Handles "SLURL fragments" like Ahern/123/45 for
- * startup processing, login screen, prefs, etc.
+ * @file llslurl.cpp
+ * @brief SLURL manipulation
  *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -29,453 +34,155 @@
 
 #include "llslurl.h"
 
-#include "llpanellogin.h"
-#include "llviewercontrol.h"
-#include "llviewernetwork.h"
-#include "llfiltersd2xmlrpc.h"
-#include "curl/curl.h"
-const char* LLSLURL::SLURL_HTTP_SCHEME		 = "http";
-const char* LLSLURL::SLURL_HTTPS_SCHEME		 = "https";
-const char* LLSLURL::SLURL_SECONDLIFE_SCHEME	 = "secondlife";
-const char* LLSLURL::SLURL_SECONDLIFE_PATH	 = "secondlife";
-const char* LLSLURL::SLURL_COM		         = "slurl.com";
-// For DnD - even though www.slurl.com redirects to slurl.com in a browser, you  can copy and drag
+#include "llweb.h"
+
+#include "llurlregistry.h"
+
+const std::string LLSLURL::PREFIX_SL_HELP		= "secondlife://app.";
+const std::string LLSLURL::PREFIX_SL			= "sl://";
+const std::string LLSLURL::PREFIX_SECONDLIFE	= "secondlife://";
+const std::string LLSLURL::PREFIX_SLURL_OLD		= "http://slurl.com/secondlife/";
+
+// For DnD - even though www.slurl.com redirects to slurl.com in a browser, you can copy and drag
 // text with www.slurl.com or a link explicitly pointing at www.slurl.com so testing for this
 // version is required also.
+const std::string LLSLURL::PREFIX_SLURL_WWW		= "http://www.slurl.com/secondlife/";
+
+const std::string LLSLURL::PREFIX_SLURL			= "http://maps.secondlife.com/secondlife/";
 
-const char* LLSLURL::WWW_SLURL_COM				 = "www.slurl.com";
-const char* LLSLURL::SECONDLIFE_COM				 = "secondlife.com";
-const char* LLSLURL::MAPS_SECONDLIFE_COM		 = "maps.secondlife.com";
-const char* LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME = "x-grid-location-info";
-const char* LLSLURL::SLURL_APP_PATH              = "app";
-const char* LLSLURL::SLURL_REGION_PATH           = "region";
-const char* LLSLURL::SIM_LOCATION_HOME           = "home";
-const char* LLSLURL::SIM_LOCATION_LAST           = "last";
+const std::string LLSLURL::APP_TOKEN = "app/";
 
-// resolve a simstring from a slurl
-LLSLURL::LLSLURL(const std::string& slurl)
+// static
+std::string LLSLURL::stripProtocol(const std::string& url)
 {
-	// by default we go to agni.
-	mType = INVALID;
-	LL_INFOS("AppInit") << "SLURL: " << slurl << LL_ENDL;
-	if(slurl == SIM_LOCATION_HOME)
+	std::string stripped = url;
+	if (matchPrefix(stripped, PREFIX_SL_HELP))
 	{
-		mType = HOME_LOCATION;
+		stripped.erase(0, PREFIX_SL_HELP.length());
 	}
-	else if(slurl.empty() || (slurl == SIM_LOCATION_LAST))
+	else if (matchPrefix(stripped, PREFIX_SL))
 	{
-
-		mType = LAST_LOCATION;
+		stripped.erase(0, PREFIX_SL.length());
 	}
-	else
+	else if (matchPrefix(stripped, PREFIX_SECONDLIFE))
 	{
-		LLURI slurl_uri;
-		// parse the slurl as a uri
-		if(slurl.find(':') == std::string::npos)
-		{
-			// There may be no scheme ('secondlife:' etc.) passed in.  In that case
-			// we want to normalize the slurl by putting the appropriate scheme
-			// in front of the slurl.  So, we grab the appropriate slurl base
-			// from the grid manager which may be http://slurl.com/secondlife/ for maingrid, or
-			// https://<hostname>/region/ for Standalone grid (the word region, not the region name)
-			// these slurls are typically passed in from the 'starting location' box on the login panel,
-			// where the user can type in <regionname>/<x>/<y>/<z>
-			std::string fixed_slurl = LLGridManager::getInstance()->getSLURLBase();
-			// the slurl that was passed in might have a prepended /, or not.  So,
-			// we strip off the prepended '/' so we don't end up with http://slurl.com/secondlife/<region>/<x>/<y>/<z>
-			// or some such.
-			
-			if(slurl[0] == '/')
-		    {
-				fixed_slurl += slurl.substr(1);
-		    }
-			else
-		    {
-				fixed_slurl += slurl;
-		    }
-			// We then load the slurl into a LLURI form
-			slurl_uri = LLURI(fixed_slurl);
-		}
-		else
-		{
-		    // as we did have a scheme, implying a URI style slurl, we
-		    // simply parse it as a URI
-		    slurl_uri = LLURI(slurl);
-		}
-		
-		LLSD path_array = slurl_uri.pathArray();
-		
-		// determine whether it's a maingrid URI or an Standalone/open style URI
-		// by looking at the scheme.  If it's a 'secondlife:' slurl scheme or
-		// 'sl:' scheme, we know it's maingrid
-		
-		// At the end of this if/else block, we'll have determined the grid,
-		// and the slurl type (APP or LOCATION)
-		if(slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME)
-		{
-			// parse a maingrid style slurl.  We know the grid is maingrid
-			// so grab it.
-			// A location slurl for maingrid (with the special schemes) can be in the form
-			// secondlife://<regionname>/<x>/<y>/<z>
-			// or
-			// secondlife://<Grid>/secondlife/<region>/<x>/<y>/<z>
-			// where if grid is empty, it specifies Agni
-			
-			// An app style slurl for maingrid can be
-			// secondlife://<Grid>/app/<app parameters>
-			// where an empty grid implies Agni
-			
-			// we'll start by checking the top of the 'path' which will be 
-			// either 'app', 'secondlife', or <x>.
-			
-			// default to maingrid
-			
-			mGrid = MAINGRID;
-			
-			if ((path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH) ||
-				(path_array[0].asString() == LLSLURL::SLURL_APP_PATH))
-		    {
-				// it's in the form secondlife://<grid>/(app|secondlife)
-				// so parse the grid name to derive the grid ID
-				if (!slurl_uri.hostName().empty())
-				{
-					mGrid = LLGridManager::getInstance()->getGridByLabel(slurl_uri.hostName());
-				}
-				else if(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH)
-				{
-					// If the slurl is in the form secondlife:///secondlife/<region> form, 
-					// then we are in fact on maingrid.  
-					mGrid = MAINGRID;
-				}
-				else if(path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
-				{
-					// for app style slurls, where no grid name is specified, assume the currently
-					// selected or logged in grid.
-					mGrid =  LLGridManager::getInstance()->getGrid();
-				}
-
-				if(mGrid.empty())
-				{
-					// we couldn't find the grid in the grid manager, so bail
-					return;
-				}
-				// set the type as appropriate.
-				if(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH)
-				{
-					mType = LOCATION;
-				}
-				else
-				{
-					mType = APP;
-				}
-				path_array.erase(0);
-		    }
-			else
-		    {
-				// it wasn't a /secondlife/<region> or /app/<params>, so it must be secondlife://<region>
-				// therefore the hostname will be the region name, and it's a location type
-				mType = LOCATION;
-				// 'normalize' it so the region name is in fact the head of the path_array
-				path_array.insert(0, slurl_uri.hostName());
-		    }
-		}
-		else if((slurl_uri.scheme() == LLSLURL::SLURL_HTTP_SCHEME) ||
-		   (slurl_uri.scheme() == LLSLURL::SLURL_HTTPS_SCHEME) || 
-		   (slurl_uri.scheme() == LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME))
-		{
-			// *HACK: ignore http://secondlife.com/ URLs so that we can use
-			// http://secondlife.com/app/ redirect URLs
-			// This is only necessary while the server returns Release Note
-			// urls using this format rather that pointing to the wiki
-			if ((slurl_uri.scheme() == LLSLURL::SLURL_HTTP_SCHEME ||
-				 slurl_uri.scheme() == LLSLURL::SLURL_HTTPS_SCHEME) &&
-				slurl_uri.hostName() == LLSLURL::SECONDLIFE_COM)
-			  return;
-
-		    // We're dealing with either a Standalone style slurl or slurl.com slurl
-		  if ((slurl_uri.hostName() == LLSLURL::SLURL_COM) ||
-		      (slurl_uri.hostName() == LLSLURL::WWW_SLURL_COM) || 
-		      (slurl_uri.hostName() == LLSLURL::MAPS_SECONDLIFE_COM))
-			{
-				// slurl.com implies maingrid
-				mGrid = MAINGRID;
-			}
-		    else
-			{
-				// As it's a Standalone grid/open, we will always have a hostname, as Standalone/open  style
-				// urls are properly formed, unlike the stinky maingrid style
-				mGrid = slurl_uri.hostName();
-			}
-		    if (path_array.size() == 0)
-			{
-				// um, we need a path...
-				return;
-			}
-			
-			// we need to normalize the urls so
-			// the path portion starts with the 'command' that we want to do
-			// it can either be region or app.  
-		    if ((path_array[0].asString() == LLSLURL::SLURL_REGION_PATH) ||
-				(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH))
-			{
-				// strip off 'region' or 'secondlife'
-				path_array.erase(0);
-				// it's a location
-				mType = LOCATION;
-			}
-			else if (path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
-			{
-				mType = APP;
-				path_array.erase(0);
-				// leave app appended.  
-			}
-			else
-			{
-				// not a valid https/http/x-grid-location-info slurl, so it'll likely just be a URL
-				return;
-			}
-		}
-		else
-		{
-		    // invalid scheme, so bail
-		    return;
-		}
-		
-		
-		if(path_array.size() == 0)
-		{
-			// we gotta have some stuff after the specifier as to whether it's a region or command
-			return;
-		}
-		
-		// now that we know whether it's an app slurl or a location slurl,
-		// parse the slurl into the proper data structures.
-		if(mType == APP)
-		{		
-			// grab the app command type and strip it (could be a command to jump somewhere, 
-			// or whatever )
-			mAppCmd = path_array[0].asString();
-			path_array.erase(0);
-			
-			// Grab the parameters
-			mAppPath = path_array;
-			// and the query
-			mAppQuery = slurl_uri.query();
-			mAppQueryMap = slurl_uri.queryMap();
-			return;
-		}
-		else if(mType == LOCATION)
-		{
-			// at this point, head of the path array should be [ <region>, <x>, <y>, <z> ] where x, y and z 
-			// are collectively optional
-			// are optional
-			mRegion = LLURI::unescape(path_array[0].asString());
-			path_array.erase(0);
-			
-			// parse the x, y, z
-			if(path_array.size() >= 3)
-			{	
-			  
-			  mPosition = LLVector3(path_array);
-			  if((F32(mPosition[VX]) < 0.f) || 
-                             (mPosition[VX] > REGION_WIDTH_METERS) ||
-			     (F32(mPosition[VY]) < 0.f) || 
-                             (mPosition[VY] > REGION_WIDTH_METERS) ||
-			     (F32(mPosition[VZ]) < 0.f) || 
-                             (mPosition[VZ] > REGION_HEIGHT_METERS))
-			    {
-			      mType = INVALID;
-			      return;
-			    }
- 
-			}
-			else
-			{
-				// if x, y and z were not fully passed in, go to the middle of the region.
-				// teleport will adjust the actual location to make sure you're on the ground
-				// and such
-				mPosition = LLVector3(REGION_WIDTH_METERS/2, REGION_WIDTH_METERS/2, 0);
-			}
-		}
+		stripped.erase(0, PREFIX_SECONDLIFE.length());
+	}
+	else if (matchPrefix(stripped, PREFIX_SLURL))
+	{
+		stripped.erase(0, PREFIX_SLURL.length());
+	}
+	else if (matchPrefix(stripped, PREFIX_SLURL_OLD))
+	{
+		stripped.erase(0, PREFIX_SLURL_OLD.length());
 	}
+	else if (matchPrefix(stripped, PREFIX_SLURL_WWW))
+	{
+		stripped.erase(0, PREFIX_SLURL_WWW.length());
+	}
+	
+	return stripped;
 }
 
-
-// Create a slurl for the middle of the region
-LLSLURL::LLSLURL(const std::string& grid, 
-				 const std::string& region)
+// static
+bool LLSLURL::isSLURL(const std::string& url)
 {
-	mGrid = grid;
-	mRegion = region;
-	mType = LOCATION;
-	mPosition = LLVector3((F64)REGION_WIDTH_METERS/2, (F64)REGION_WIDTH_METERS/2, 0);
+	if (matchPrefix(url, PREFIX_SL_HELP))		return true;
+	if (matchPrefix(url, PREFIX_SL))			return true;
+	if (matchPrefix(url, PREFIX_SECONDLIFE))	return true;
+	if (matchPrefix(url, PREFIX_SLURL))			return true;
+	if (matchPrefix(url, PREFIX_SLURL_OLD))		return true;
+	if (matchPrefix(url, PREFIX_SLURL_WWW))		return true;
+	
+	return false;
 }
 
-
-
-// create a slurl given the position.  The position will be modded with the region
-// width handling global positions as well
-LLSLURL::LLSLURL(const std::string& grid, 
-		 const std::string& region, 
-		 const LLVector3& position)
+bool LLSLURL::isValidSLURL(const std::string& url)
 {
-	mGrid = grid;
-	mRegion = region;
-	S32 x = llround( (F32)fmod( position[VX], (F32)REGION_WIDTH_METERS ) );
-	S32 y = llround( (F32)fmod( position[VY], (F32)REGION_WIDTH_METERS ) );
-	S32 z = llround( (F32)position[VZ] );
-	mType = LOCATION;
-	mPosition = LLVector3(x, y, z);
+	std::string temp_url(url);
+	//"www." may appear in DnD- see description of PREFIX_SLURL_WWW.
+	// If it is found, we remove it because it isn't expected in regexp.
+	if (matchPrefix(url, PREFIX_SLURL_WWW))
+	{
+		size_t position = url.find("www.");
+		temp_url.erase(position,4);
+	}
+	
+	return LLUrlRegistry::getInstance()->isUrl(temp_url);
 }
 
+// static
+bool LLSLURL::isSLURLCommand(const std::string& url)
+{ 
+	if (matchPrefix(url, PREFIX_SL + APP_TOKEN) ||
+		matchPrefix(url, PREFIX_SECONDLIFE + "/" + APP_TOKEN) ||
+		matchPrefix(url, PREFIX_SLURL + APP_TOKEN) ||
+		matchPrefix(url, PREFIX_SLURL_WWW + APP_TOKEN) ||
+		matchPrefix(url, PREFIX_SLURL_OLD + APP_TOKEN) )
+	{
+		return true;
+	}
 
-// create a simstring
-LLSLURL::LLSLURL(const std::string& region, 
-		 const LLVector3& position)
-{
-  *this = LLSLURL(LLGridManager::getInstance()->getGrid(),
-		  region, position);
+	return false;
 }
 
-// create a slurl from a global position
-LLSLURL::LLSLURL(const std::string& grid, 
-		 const std::string& region, 
-		 const LLVector3d& global_position)
+// static
+bool LLSLURL::isSLURLHelp(const std::string& url)
 {
-  *this = LLSLURL(grid,
-		  region, LLVector3(global_position.mdV[VX],
-				    global_position.mdV[VY],
-				    global_position.mdV[VZ]));
+	return matchPrefix(url, PREFIX_SL_HELP);
 }
 
-// create a slurl from a global position
-LLSLURL::LLSLURL(const std::string& region, 
-		 const LLVector3d& global_position)
+// static
+std::string LLSLURL::buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z)
 {
-  *this = LLSLURL(LLGridManager::getInstance()->getGrid(),
-		  region, global_position);
+	std::string slurl = PREFIX_SLURL + regionname + llformat("/%d/%d/%d",x,y,z); 
+	slurl = LLWeb::escapeURL( slurl );
+	return slurl;
 }
 
-LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb)
+// static
+std::string LLSLURL::buildCommand(const char* noun, const LLUUID& id, const char* verb)
 {
-  mType = APP;
-  mAppCmd = command;
-  mAppPath = LLSD::emptyArray();
-  mAppPath.append(LLSD(id));
-  mAppPath.append(LLSD(verb));
+	std::string slurl = llformat("secondlife:///app/%s/%s/%s",
+		noun, id.asString().c_str(), verb);
+	return slurl;
 }
 
-
-std::string LLSLURL::getSLURLString() const
+// static
+std::string LLSLURL::buildUnescapedSLURL(const std::string& regionname, S32 x, S32 y, S32 z)
 {
-	switch(mType)
-	{
-		case HOME_LOCATION:
-			return SIM_LOCATION_HOME;
-		case LAST_LOCATION:
-			return SIM_LOCATION_LAST;
-		case LOCATION:
-			{
-				// lookup the grid
-				S32 x = llround( (F32)mPosition[VX] );
-				S32 y = llround( (F32)mPosition[VY] );
-				S32 z = llround( (F32)mPosition[VZ] );	
-				return LLGridManager::getInstance()->getSLURLBase(mGrid) + 
-				LLURI::escape(mRegion) + llformat("/%d/%d/%d",x,y,z); 
-			}
-		case APP:
-		{
-			std::ostringstream app_url;
-			app_url << LLGridManager::getInstance()->getAppSLURLBase() << "/" << mAppCmd;
-			for(LLSD::array_const_iterator i = mAppPath.beginArray();
-				i != mAppPath.endArray();
-				i++)
-			{
-				app_url << "/" << i->asString();
-			}
-			if(mAppQuery.length() > 0)
-			{
-				app_url << "?" << mAppQuery;
-			}
-			return app_url.str();
-		}	
-		default:
-			LL_WARNS("AppInit") << "Unexpected SLURL type for SLURL string" << (int)mType << LL_ENDL;			
-			return std::string();
-	}
+	std::string unescapedslurl = PREFIX_SLURL + regionname + llformat("/%d/%d/%d",x,y,z);
+	return unescapedslurl;
 }
 
-std::string LLSLURL::getLoginString() const
+// static
+std::string LLSLURL::buildSLURLfromPosGlobal(const std::string& regionname,
+											 const LLVector3d& global_pos,
+											 bool escaped /*= true*/)
 {
-	
-	std::stringstream unescaped_start;
-	switch(mType)
+	S32 x, y, z;
+	globalPosToXYZ(global_pos, x, y, z);
+	if(escaped)
 	{
-		case LOCATION:
-			unescaped_start << "uri:" 
-			<< mRegion << "&" 
-			<< llround(mPosition[0]) << "&" 
-			<< llround(mPosition[1]) << "&" 
-			<< llround(mPosition[2]);
-			break;
-		case HOME_LOCATION:
-			unescaped_start << "home";
-			break;
-		case LAST_LOCATION:
-			unescaped_start << "last";
-			break;
-		default:
-			LL_WARNS("AppInit") << "Unexpected SLURL type for login string" << (int)mType << LL_ENDL;
-			break;
+		return buildSLURL(regionname, x, y, z);
 	}
-	return  xml_escape_string(unescaped_start.str());
-}
-
-bool LLSLURL::operator==(const LLSLURL& rhs)
-{
-	if(rhs.mType != mType) return false;
-	switch(mType)
+	else
 	{
-		case LOCATION:
-			return ((mGrid == rhs.mGrid) &&
-					(mRegion == rhs.mRegion) &&
-					(mPosition == rhs.mPosition));
-		case APP:
-			return getSLURLString() == rhs.getSLURLString();
-			
-		case HOME_LOCATION:
-		case LAST_LOCATION:
-			return true;
-		default:
-			return false;
+		return buildUnescapedSLURL(regionname, x, y, z);
 	}
 }
 
-bool LLSLURL::operator !=(const LLSLURL& rhs)
+// static
+bool LLSLURL::matchPrefix(const std::string& url, const std::string& prefix)
 {
-	return !(*this == rhs);
+	std::string test_prefix = url.substr(0, prefix.length());
+	LLStringUtil::toLower(test_prefix);
+	return test_prefix == prefix;
 }
 
-std::string LLSLURL::getLocationString() const
-{
-	return llformat("%s/%d/%d/%d",
-					mRegion.c_str(),
-					(int)llround(mPosition[0]),
-					(int)llround(mPosition[1]),
-					(int)llround(mPosition[2]));						 
-}
-std::string LLSLURL::asString() const
+void LLSLURL::globalPosToXYZ(const LLVector3d& pos, S32& x, S32& y, S32& z)
 {
-    std::ostringstream result;
-    result << "   mAppCmd:"  << getAppCmd() <<
-              "   mAppPath:" + getAppPath().asString() <<
-              "   mAppQueryMap:" + getAppQueryMap().asString() <<
-              "   mAppQuery: " + getAppQuery() <<
-              "   mGrid: " + getGrid() <<
-              "   mRegion: " + getRegion() <<
-              "   mPosition: "  <<
-              "   mType: " << mType <<
-              "   mPosition: " << mPosition;
-    return result.str();
+	x = llround((F32)fmod(pos.mdV[VX], (F64)REGION_WIDTH_METERS));
+	y = llround((F32)fmod(pos.mdV[VY], (F64)REGION_WIDTH_METERS));
+	z = llround((F32)pos.mdV[VZ]);
 }
-
diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h
index 1a3f0543dd09163e133e8fe7c80ad1af65486938..a79a8fc97cac7efe6e1ac251fce73a14c809b1df 100644
--- a/indra/newview/llslurl.h
+++ b/indra/newview/llslurl.h
@@ -1,108 +1,113 @@
-/**
+/** 
  * @file llslurl.h
- * @brief Handles "SLURL fragments" like Ahern/123/45 for
- * startup processing, login screen, prefs, etc.
+ * @brief SLURL manipulation
  *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
-#ifndef LLSLURL_H
-#define LLSLURL_H
 
-#include "llstring.h"
+#ifndef LL_SLURL_H
+#define LL_SLURL_H
 
+#include <string>
 
-// represents a location in a grid
+// IAN BUG: where should this live?
+// IAN BUG: are static utility functions right?  See LLUUID.
+// question of whether to have a LLSLURL object or a 
+// some of this was moved from LLURLDispatcher
 
+/**
+ * SLURL manipulation
+ */
 class LLSLURL
 {
 public:
-	static const char* SLURL_HTTPS_SCHEME;
-	static const char* SLURL_HTTP_SCHEME;
-	static const char* SLURL_SL_SCHEME;
-	static const char* SLURL_SECONDLIFE_SCHEME;
-	static const char* SLURL_SECONDLIFE_PATH;
-	static const char* SLURL_COM;
-	static const char* WWW_SLURL_COM;
-	static const char* SECONDLIFE_COM;
-	static const char* MAPS_SECONDLIFE_COM;
-	static const char* SLURL_X_GRID_LOCATION_INFO_SCHEME;
-	static LLSLURL START_LOCATION;
-	static const char* SIM_LOCATION_HOME;
-	static const char* SIM_LOCATION_LAST;
-	static const char* SLURL_APP_PATH;
-	static const char* SLURL_REGION_PATH;	
-	
-	enum SLURL_TYPE { 
-		INVALID, 
-		LOCATION,
-		HOME_LOCATION,
-		LAST_LOCATION,
-		APP,
-		HELP 
-	};
-		
-	
-	LLSLURL(): mType(INVALID)  { }
-	LLSLURL(const std::string& slurl);
-	LLSLURL(const std::string& grid, const std::string& region);
-	LLSLURL(const std::string& region, const LLVector3& position);
-	LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position);
-	LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position);
-	LLSLURL(const std::string& region, const LLVector3d& global_position);
-	LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
-	
-	SLURL_TYPE getType() const { return mType; }
-	
-	std::string getSLURLString() const;
-	std::string getLoginString() const;
-	std::string getLocationString() const; 
-	std::string getGrid() const { return mGrid; }
-	std::string getRegion() const { return mRegion; }
-	LLVector3   getPosition() const { return mPosition; }
-	std::string getAppCmd() const { return mAppCmd; }
-	std::string getAppQuery() const { return mAppQuery; }
-	LLSD        getAppQueryMap() const { return mAppQueryMap; }
-	LLSD        getAppPath() const { return mAppPath; }
-	
-	bool        isValid() const { return mType != INVALID; }
-	bool        isSpatial() const { return (mType == LAST_LOCATION) || (mType == HOME_LOCATION) || (mType == LOCATION); }
-	
-	bool operator==(const LLSLURL& rhs);
-	bool operator!=(const LLSLURL&rhs);
-
-    std::string asString() const ;
-
-protected:
-	SLURL_TYPE mType;
-	
-	// used for Apps and Help
-	std::string mAppCmd;
-	LLSD        mAppPath;
-	LLSD        mAppQueryMap;
-	std::string mAppQuery;
-	
-	std::string mGrid;  // reference to grid manager grid
-	std::string mRegion;
-	LLVector3  mPosition;
+	static const std::string PREFIX_SL_HELP;
+	static const std::string PREFIX_SL;
+	static const std::string PREFIX_SECONDLIFE;
+	static const std::string PREFIX_SLURL;
+	static const std::string PREFIX_SLURL_OLD;
+	static const std::string PREFIX_SLURL_WWW;
+
+	static const std::string APP_TOKEN;
+
+	/**
+	 * Is this any sort of secondlife:// or sl:// URL?
+	 */
+	static bool isSLURL(const std::string& url);
+
+	/**
+	 * Returns true if url is proven valid by regexp check from LLUrlRegistry
+	 */
+	static bool isValidSLURL(const std::string& url);
+
+	/**
+	 * Is this a special secondlife://app/ URL?
+	 */
+	static bool isSLURLCommand(const std::string& url);
+
+	/**
+	 * Not sure what it is.
+	 */
+	static bool isSLURLHelp(const std::string& url);
+
+	/**
+	 * builds: http://slurl.com/secondlife/Region%20Name/x/y/z/ escaping result url.
+	 */
+	static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
+
+	/// Build a SLURL like secondlife:///app/agent/<uuid>/inspect
+	static std::string buildCommand(const char* noun, const LLUUID& id, const char* verb);
+
+	/**
+	 * builds: http://slurl.com/secondlife/Region Name/x/y/z/ without escaping result url.
+	 */
+	static std::string buildUnescapedSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
+
+	/**
+	 * builds SLURL from global position. Returns escaped or unescaped url.
+	 * Returns escaped url by default.
+	 */
+	static std::string buildSLURLfromPosGlobal(const std::string& regionname,
+											   const LLVector3d& global_pos,
+											   bool escaped = true);
+	/**
+	 * Strip protocol part from the URL.
+	 */
+	static std::string stripProtocol(const std::string& url);
+
+	/**
+	 * Convert global position to X, Y Z
+	 */
+	static void globalPosToXYZ(const LLVector3d& pos, S32& x, S32& y, S32& z);
+
+private:
+	static bool matchPrefix(const std::string& url, const std::string& prefix);
+
 };
 
-#endif // LLSLURL_H
+#endif
diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp
index b8838346d06a7e265bb80b333dbf80a8c436c60d..c5c311ed33cb678ce357ca9420da2d2ef92aab03 100644
--- a/indra/newview/llspeakbutton.cpp
+++ b/indra/newview/llspeakbutton.cpp
@@ -2,25 +2,31 @@
 * @file llspeakbutton.cpp
 * @brief LLSpeakButton class implementation
 *
-* $LicenseInfo:firstyear=2002&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2002&license=viewergpl$
+* 
+* Copyright (c) 2002-2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 
@@ -53,9 +59,9 @@ LLSpeakButton::Params::Params()
 
 void LLSpeakButton::draw()
 {
-	// LLVoiceClient::getInstance() is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
-	bool openmic = LLVoiceClient::getInstance()->getUserPTTState();
-	bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled();
+	// gVoiceClient is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
+	bool openmic = gVoiceClient->getUserPTTState();
+	bool voiceenabled = gVoiceClient->voiceEnabled();
 	mSpeakBtn->setToggleState(openmic && voiceenabled);
 	mOutputMonitor->setIsMuted(!voiceenabled);
 	LLUICtrl::draw();
@@ -170,11 +176,11 @@ void LLSpeakButton::setLabelVisible(bool visible)
 void LLSpeakButton::onMouseDown_SpeakBtn()
 {
 	bool down = true;
-	LLVoiceClient::getInstance()->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk
+	gVoiceClient->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk
 }
 void LLSpeakButton::onMouseUp_SpeakBtn()
 {
 	bool down = false;
-	LLVoiceClient::getInstance()->inputUserControlState(down);
+	gVoiceClient->inputUserControlState(down);
 }
 
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 1c418feabd924fbe9d6298a79394a6da88fec081..4573520647b390b06c8c97f3f3de9dde2a00cf50 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -2,25 +2,31 @@
  * @file llspeakers.cpp
  * @brief Management interface for muting and controlling volume of residents currently speaking
  *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ * 
+ * Copyright (c) 2005-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -78,7 +84,7 @@ void LLSpeaker::onAvatarNameLookup(const LLUUID& id, const std::string& first, c
 
 bool LLSpeaker::isInVoiceChannel()
 {
-	return mStatus <= LLSpeaker::STATUS_VOICE_ACTIVE || mStatus == LLSpeaker::STATUS_MUTED;
+	return mStatus == LLSpeaker::STATUS_VOICE_ACTIVE || mStatus == LLSpeaker::STATUS_MUTED;
 }
 
 LLSpeakerUpdateModeratorEvent::LLSpeakerUpdateModeratorEvent(LLSpeaker* source)
@@ -245,8 +251,6 @@ bool LLSpeakersDelayActionsStorage::onTimerActionCallback(const LLUUID& speaker_
 
 LLSpeakerMgr::LLSpeakerMgr(LLVoiceChannel* channelp) : 
 	mVoiceChannel(channelp)
-, mVoiceModerated(false)
-, mModerateModeHandledFirstTime(false)
 {
 	static LLUICachedControl<F32> remove_delay ("SpeakerParticipantRemoveDelay", 10.0);
 
@@ -293,36 +297,9 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
 	return speakerp;
 }
 
-// *TODO: Once way to request the current voice channel moderation mode is implemented
-// this method with related code should be removed.
-/*
- Initializes "moderate_mode" of voice session on first join.
- 
- This is WORKAROUND because a way to request the current voice channel moderation mode exists
- but is not implemented in viewer yet. See EXT-6937.
-*/
-void LLSpeakerMgr::initVoiceModerateMode()
-{
-	if (!mModerateModeHandledFirstTime && (mVoiceChannel && mVoiceChannel->isActive()))
-	{
-		LLPointer<LLSpeaker> speakerp;
-
-		if (mSpeakers.find(gAgentID) != mSpeakers.end())
-		{
-			speakerp = mSpeakers[gAgentID];
-		}
-
-		if (speakerp.notNull())
-		{
-			mVoiceModerated = speakerp->mModeratorMutedVoice;
-			mModerateModeHandledFirstTime = true;
-		}
-	}
-}
-
 void LLSpeakerMgr::update(BOOL resort_ok)
 {
-	if (!LLVoiceClient::getInstance())
+	if (!gVoiceClient)
 	{
 		return;
 	}
@@ -336,7 +313,7 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 	}
 
 	// update status of all current speakers
-	BOOL voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
+	BOOL voice_channel_active = (!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
 	for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end();)
 	{
 		LLUUID speaker_id = speaker_it->first;
@@ -344,21 +321,21 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 		
 		speaker_map_t::iterator  cur_speaker_it = speaker_it++;
 
-		if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id))
+		if (voice_channel_active && gVoiceClient->getVoiceEnabled(speaker_id))
 		{
-			speakerp->mSpeechVolume = LLVoiceClient::getInstance()->getCurrentPower(speaker_id);
-			BOOL moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id);
+			speakerp->mSpeechVolume = gVoiceClient->getCurrentPower(speaker_id);
+			BOOL moderator_muted_voice = gVoiceClient->getIsModeratorMuted(speaker_id);
 			if (moderator_muted_voice != speakerp->mModeratorMutedVoice)
 			{
 				speakerp->mModeratorMutedVoice = moderator_muted_voice;
 				speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp));
 			}
 
-			if (LLVoiceClient::getInstance()->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
+			if (gVoiceClient->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
 			{
 				speakerp->mStatus = LLSpeaker::STATUS_MUTED;
 			}
-			else if (LLVoiceClient::getInstance()->getIsSpeaking(speaker_id))
+			else if (gVoiceClient->getIsSpeaking(speaker_id))
 			{
 				// reset inactivity expiration
 				if (speakerp->mStatus != LLSpeaker::STATUS_SPEAKING)
@@ -440,21 +417,19 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 void LLSpeakerMgr::updateSpeakerList()
 {
 	// are we bound to the currently active voice channel?
-	if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
-	{
-	        std::set<LLUUID> participants;
-	        LLVoiceClient::getInstance()->getParticipantList(participants);
-		// add new participants to our list of known speakers
-		for (std::set<LLUUID>::iterator participant_it = participants.begin();
-			 participant_it != participants.end(); 
-			 ++participant_it)
+	if ((!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
+	{
+		LLVoiceClient::participantMap* participants = gVoiceClient->getParticipantList();
+		if(participants)
 		{
-				setSpeaker(*participant_it, 
-						   LLVoiceClient::getInstance()->getDisplayName(*participant_it),
-						   LLSpeaker::STATUS_VOICE_ACTIVE, 
-						   (LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
-
+			LLVoiceClient::participantMap::iterator participant_it;
 
+			// add new participants to our list of known speakers
+			for (participant_it = participants->begin(); participant_it != participants->end(); ++participant_it)
+			{
+				LLVoiceClient::participantState* participantp = participant_it->second;
+				setSpeaker(participantp->mAvatarID, participantp->mDisplayName, LLSpeaker::STATUS_VOICE_ACTIVE, (participantp->isAvatar()?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
+			}
 		}
 	}
 }
@@ -544,7 +519,7 @@ void LLSpeakerMgr::speakerChatted(const LLUUID& speaker_id)
 BOOL LLSpeakerMgr::isVoiceActive()
 {
 	// mVoiceChannel = NULL means current voice channel, whatever it is
-	return LLVoiceClient::getInstance()->voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
+	return LLVoiceClient::voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
 }
 
 
@@ -784,26 +759,43 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu
 		new ModerationResponder(getSessionID()));
 }
 
-void LLIMSpeakerMgr::moderateVoiceAllParticipants( bool unmute_everyone )
+void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute_everyone_else)
 {
-	if (mVoiceModerated == !unmute_everyone)
-	{
-		// session already in requested state. Just force participants which do not match it.
-		forceVoiceModeratedMode(mVoiceModerated);
-	}
-	else
-	{
-		// otherwise set moderated mode for a whole session.
-		moderateVoiceSession(getSessionID(), !unmute_everyone);
-	}
+	// *TODO: mantipov: add more intellectual processing of several following requests if it is needed.
+	/*
+		Such situation should be tested:
+		 "Moderator sends the same second request before first response is come"
+		Moderator sends "mute everyone else" for A and then for B
+			two requests to disallow voice chat are sent
+			UUID of B is stored.
+		Then first response (to disallow voice chat) is come
+			request to allow voice for stored avatar (B)
+		Then second response (to disallow voice chat) is come
+			have nothing to do, the latest selected speaker is already enabled
+
+			What can happen?
+		If request to allow voice for stored avatar (B) is processed on server BEFORE 
+		second request to disallow voice chat all speakers will be disabled on voice.
+		But I'm not sure such situation is possible. 
+		See EXT-3431.
+	*/
+
+	mReverseVoiceModeratedAvatarID = excluded_avatar_id;
+	moderateVoiceSession(getSessionID(), !unmute_everyone_else);
 }
 
 void LLIMSpeakerMgr::processSessionUpdate(const LLSD& session_update)
 {
+	if (mReverseVoiceModeratedAvatarID.isNull()) return;
+
 	if (session_update.has("moderated_mode") &&
 		session_update["moderated_mode"].has("voice"))
 	{
-		mVoiceModerated = session_update["moderated_mode"]["voice"];
+		BOOL voice_moderated = session_update["moderated_mode"]["voice"];
+
+		moderateVoiceParticipant(mReverseVoiceModeratedAvatarID, voice_moderated);
+
+		mReverseVoiceModeratedAvatarID = LLUUID::null;
 	}
 }
 
@@ -823,20 +815,6 @@ void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallo
 	LLHTTPClient::post(url, data, new ModerationResponder(session_id));
 }
 
-void LLIMSpeakerMgr::forceVoiceModeratedMode(bool should_be_muted)
-{
-	for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
-	{
-		LLUUID speaker_id = speaker_it->first;
-		LLSpeaker* speakerp = speaker_it->second;
-
-		// participant does not match requested state
-		if (should_be_muted != (bool)speakerp->mModeratorMutedVoice)
-		{
-			moderateVoiceParticipant(speaker_id, !should_be_muted);
-		}
-	}
-}
 
 //
 // LLActiveSpeakerMgr
diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp
index ede1d6bebee7c02795af170fd95b01dffd54f34c..cc06179481696c0afb0d36aa4eb24e0aad6a23f4 100644
--- a/indra/newview/llspeakingindicatormanager.cpp
+++ b/indra/newview/llspeakingindicatormanager.cpp
@@ -4,25 +4,31 @@
  * @brief Implementation of SpeackerIndicatorManager class to process registered LLSpeackerIndicator
  * depend on avatars are in the same voice channel.
  *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * 
+ * Copyright (c) 2010, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -101,7 +107,7 @@ class SpeakingIndicatorManager : public LLSingleton<SpeakingIndicatorManager>, L
 	 * So, method does not calculate difference between these list it only switches off already 
 	 * switched on indicators and switches on indicators of voice channel participants
 	 */
-	void onParticipantsChanged();
+	void onChange();
 
 	/**
 	 * Changes state of indicators specified by LLUUIDs
@@ -152,7 +158,7 @@ void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_i
 	mSpeakingIndicators.insert(value_type);
 
 	speaker_ids_t speakers_uuids;
-	BOOL is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id);
+	BOOL is_in_same_voice = LLVoiceClient::getInstance()->findParticipantByID(speaker_id) != NULL;
 
 	speakers_uuids.insert(speaker_id);
 	switchSpeakerIndicators(speakers_uuids, is_in_same_voice);
@@ -199,12 +205,12 @@ void SpeakingIndicatorManager::sOnCurrentChannelChanged(const LLUUID& /*session_
 	mSwitchedIndicatorsOn.clear();
 }
 
-void SpeakingIndicatorManager::onParticipantsChanged()
+void SpeakingIndicatorManager::onChange()
 {
 	LL_DEBUGS("SpeakingIndicator") << "Voice participant list was changed, updating indicators" << LL_ENDL;
 
 	speaker_ids_t speakers_uuids;
-	LLVoiceClient::getInstance()->getParticipantList(speakers_uuids);
+	LLVoiceClient::getInstance()->getParticipantsUUIDSet(speakers_uuids);
 
 	LL_DEBUGS("SpeakingIndicator") << "Switching all OFF, count: " << mSwitchedIndicatorsOn.size() << LL_ENDL;
 	// switch all indicators off
diff --git a/indra/newview/llspeakingindicatormanager.h b/indra/newview/llspeakingindicatormanager.h
index b0a147865b8eaf3e660e4cd5798f18853435cec9..8d7aba1d6c56315801bda6f91451a37a3486f4ac 100644
--- a/indra/newview/llspeakingindicatormanager.h
+++ b/indra/newview/llspeakingindicatormanager.h
@@ -4,25 +4,31 @@
  * @brief Interfeace of LLSpeackerIndicator class to be processed depend on avatars are in the same voice channel.
  * Also register/unregister methods for this class are declared
  *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * 
+ * Copyright (c) 2010, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index e6f93d34ac82ebc7e92b8be149e41698724b78b7..94a32873ecfb9165169d5e6ab5eaa76ddcfe1223 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2,25 +2,31 @@
  * @file llstartup.cpp
  * @brief startup routines.
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -141,7 +147,7 @@
 #include "lltrans.h"
 #include "llui.h"
 #include "llurldispatcher.h"
-#include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llurlhistory.h"
 #include "llurlwhitelist.h"
 #include "llvieweraudio.h"
@@ -186,13 +192,13 @@
 #include "llinventorybridge.h"
 #include "llappearancemgr.h"
 #include "llavatariconctrl.h"
-#include "llvoicechannel.h"
 
 #include "lllogin.h"
 #include "llevents.h"
 #include "llstartuplistener.h"
 
 #if LL_WINDOWS
+#include "llwindebug.h"
 #include "lldxhardware.h"
 #endif
 
@@ -218,16 +224,15 @@ extern S32 gStartImageHeight;
 static bool gGotUseCircuitCodeAck = false;
 static std::string sInitialOutfit;
 static std::string sInitialOutfitGender;	// "male" or "female"
-static boost::signals2::connection sWearablesLoadedCon;
 
 static bool gUseCircuitCallbackCalled = false;
 
 EStartupState LLStartUp::gStartupState = STATE_FIRST;
-LLSLURL LLStartUp::sStartSLURL;
 
-static LLPointer<LLCredential> gUserCredential;
-static std::string gDisplayName;
-static BOOL gRememberPassword = TRUE;     
+// *NOTE:Mani - to reconcile with giab changes...
+static std::string gFirstname;
+static std::string gLastname;
+static std::string gPassword;
 
 static U64 gFirstSimHandle = 0;
 static LLHost gFirstSim;
@@ -244,6 +249,7 @@ boost::scoped_ptr<LLStartupListener> LLStartUp::sListener(new LLStartupListener(
 
 void login_show();
 void login_callback(S32 option, void* userdata);
+bool is_hex_string(U8* str, S32 len);
 void show_first_run_dialog();
 bool first_run_dialog_callback(const LLSD& notification, const LLSD& response);
 void set_startup_status(const F32 frac, const std::string& string, const std::string& msg);
@@ -256,9 +262,6 @@ bool callback_choose_gender(const LLSD& notification, const LLSD& response);
 void init_start_screen(S32 location_id);
 void release_start_screen();
 void reset_login();
-LLSD transform_cert_args(LLPointer<LLCertificate> cert);
-void general_cert_done(const LLSD& notification, const LLSD& response);
-void trust_cert_done(const LLSD& notification, const LLSD& response);
 void apply_udp_blacklist(const std::string& csv);
 bool process_login_success_response();
 void transition_back_to_login_panel(const std::string& emsg);
@@ -361,7 +364,7 @@ bool idle_startup()
 
 	if ( STATE_FIRST == LLStartUp::getStartupState() )
 	{
-		gViewerWindow->showCursor(); 
+		gViewerWindow->showCursor();
 		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
 
 		/////////////////////////////////////////////////
@@ -378,22 +381,13 @@ bool idle_startup()
 		{
 			LLNotificationsUtil::add("DisplaySetToRecommended");
 		}
-		else if ((gSavedSettings.getS32("LastGPUClass") != LLFeatureManager::getInstance()->getGPUClass()) &&
-				 (gSavedSettings.getS32("LastGPUClass") != -1))
-		{
-			LLNotificationsUtil::add("DisplaySetToRecommended");
-		}
 		else if (!gViewerWindow->getInitAlert().empty())
 		{
 			LLNotificationsUtil::add(gViewerWindow->getInitAlert());
 		}
 			
 		gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
-		gSavedSettings.setS32("LastGPUClass", LLFeatureManager::getInstance()->getGPUClass());
 
-		// load dynamic GPU/feature tables from website (S3)
-		LLFeatureManager::getInstance()->fetchHTTPTables();
-		
 		std::string xml_file = LLUI::locateSkin("xui_version.xml");
 		LLXMLNodePtr root;
 		bool xml_ok = false;
@@ -570,7 +564,7 @@ bool idle_startup()
 				gXferManager->setUseAckThrottling(TRUE);
 				gXferManager->setAckThrottleBPS(xfer_throttle_bps);
 			}
-			gAssetStorage = new LLViewerAssetStorage(msg, gXferManager, gVFS, gStaticVFS);
+			gAssetStorage = new LLViewerAssetStorage(msg, gXferManager, gVFS);
 
 
 			F32 dropPercent = gSavedSettings.getF32("PacketDropPercentage");
@@ -668,25 +662,69 @@ bool idle_startup()
 		//
 		// Log on to system
 		//
-		if (gUserCredential.isNull())
-		{
-			gUserCredential = gLoginHandler.initializeLoginInfo();
-		}
-		if (gUserCredential.isNull())
-		{
-			show_connect_box = TRUE;
-		}
-		else if (gSavedSettings.getBOOL("AutoLogin"))  
-		{
-			gRememberPassword = TRUE;
-			gSavedSettings.setBOOL("RememberPassword", TRUE);                                                      
-			show_connect_box = false;    			
+		if (!LLStartUp::sSLURLCommand.empty())
+		{
+			// this might be a secondlife:///app/login URL
+			gLoginHandler.parseDirectLogin(LLStartUp::sSLURLCommand);
+		}
+		if (!gLoginHandler.getFirstName().empty()
+			|| !gLoginHandler.getLastName().empty()
+			/*|| !gLoginHandler.getWebLoginKey().isNull()*/ )
+		{
+			// We have at least some login information on a SLURL
+			gFirstname = gLoginHandler.getFirstName();
+			gLastname = gLoginHandler.getLastName();
+			LL_DEBUGS("LLStartup") << "STATE_FIRST: setting gFirstname, gLastname from gLoginHandler: '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+
+			// Show the login screen if we don't have everything
+			show_connect_box = 
+				gFirstname.empty() || gLastname.empty();
+		}
+        else if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
+        {
+            LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
+			gFirstname = cmd_line_login[0].asString();
+			gLastname = cmd_line_login[1].asString();
+			LL_DEBUGS("LLStartup") << "Setting gFirstname, gLastname from gSavedSettings(\"UserLoginInfo\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+
+			LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
+			char md5pass[33];               /* Flawfinder: ignore */
+			pass.hex_digest(md5pass);
+			gPassword = md5pass;
+			
+#ifdef USE_VIEWER_AUTH
+			show_connect_box = true;
+#else
+			show_connect_box = false;
+#endif
+			gSavedSettings.setBOOL("AutoLogin", TRUE);
+        }
+		else if (gSavedSettings.getBOOL("AutoLogin"))
+		{
+			gFirstname = gSavedSettings.getString("FirstName");
+			gLastname = gSavedSettings.getString("LastName");
+			LL_DEBUGS("LLStartup") << "AutoLogin: setting gFirstname, gLastname from gSavedSettings(\"First|LastName\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+			gPassword = LLStartUp::loadPasswordFromDisk();
+			gSavedSettings.setBOOL("RememberPassword", TRUE);
+			
+#ifdef USE_VIEWER_AUTH
+			show_connect_box = true;
+#else
+			show_connect_box = false;
+#endif
 		}
-		else 
+		else
 		{
-			gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
-			show_connect_box = TRUE;
+			// if not automatically logging in, display login dialog
+			// a valid grid is selected
+			gFirstname = gSavedSettings.getString("FirstName");
+			gLastname = gSavedSettings.getString("LastName");
+			LL_DEBUGS("LLStartup") << "normal login: setting gFirstname, gLastname from gSavedSettings(\"First|LastName\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+			gPassword = LLStartUp::loadPasswordFromDisk();
+			show_connect_box = true;
 		}
+
+
 		// Go to the next startup state
 		LLStartUp::setStartupState( STATE_BROWSER_INIT );
 		return FALSE;
@@ -718,10 +756,8 @@ bool idle_startup()
 			// Load all the name information out of the login view
 			// NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't
 			// show the login view until login_show() is called below.  
-			if (gUserCredential.isNull())                                                                          
-			{                                                                                                      
-				gUserCredential = gLoginHandler.initializeLoginInfo();                 
-			}     
+			// LLPanelLogin::getFields(gFirstname, gLastname, gPassword);
+
 			if (gNoRender)
 			{
 				LL_ERRS("AppInit") << "Need to autologin or use command line with norender!" << LL_ENDL;
@@ -729,15 +765,11 @@ bool idle_startup()
 			// Make sure the process dialog doesn't hide things
 			gViewerWindow->setShowProgress(FALSE);
 
-			initialize_edit_menu();
-
 			// Show the login dialog
 			login_show();
 			// connect dialog is already shown, so fill in the names
-			if (gUserCredential.notNull())                                                                         
-			{                                                                                                      
-				LLPanelLogin::setFields( gUserCredential, gRememberPassword);                                  
-			}     
+			LLPanelLogin::setFields( gFirstname, gLastname, gPassword);
+
 			LLPanelLogin::giveFocus();
 
 			gSavedSettings.setBOOL("FirstRunThisInstall", FALSE);
@@ -774,6 +806,9 @@ bool idle_startup()
 		gViewerWindow->getWindow()->show();
 		display_startup();
 
+		//DEV-10530.  do cleanup.  remove at some later date.  jan-2009
+		LLFloaterPreference::cleanupBadSetting();
+
 		// DEV-16927.  The following code removes errant keystrokes that happen while the window is being 
 		// first made visible.
 #ifdef _WIN32
@@ -801,39 +836,42 @@ bool idle_startup()
 		gViewerWindow->moveProgressViewToFront();
 
 		//reset the values that could have come in from a slurl
-		// DEV-42215: Make sure they're not empty -- gUserCredential
+		// DEV-42215: Make sure they're not empty -- gFirstname and gLastname
 		// might already have been set from gSavedSettings, and it's too bad
 		// to overwrite valid values with empty strings.
+		if (! gLoginHandler.getFirstName().empty() && ! gLoginHandler.getLastName().empty())
+		{
+			gFirstname = gLoginHandler.getFirstName();
+			gLastname = gLoginHandler.getLastName();
+			LL_DEBUGS("LLStartup") << "STATE_LOGIN_CLEANUP: setting gFirstname, gLastname from gLoginHandler: '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+		}
 
 		if (show_connect_box)
 		{
 			// TODO if not use viewer auth
 			// Load all the name information out of the login view
-			LLPanelLogin::getFields(gUserCredential, gRememberPassword); 
+			LLPanelLogin::getFields(&gFirstname, &gLastname, &gPassword);
 			// end TODO
 	 
 			// HACK: Try to make not jump on login
 			gKeyboard->resetKeys();
 		}
 
-		// save the credentials                                                                                        
-		std::string userid = "unknown";                                                                                
-		if(gUserCredential.notNull())                                                                                  
-		{  
-			userid = gUserCredential->userID();                                                                    
-			gSecAPIHandler->saveCredential(gUserCredential, gRememberPassword);  
+		if (!gFirstname.empty() && !gLastname.empty())
+		{
+			gSavedSettings.setString("FirstName", gFirstname);
+			gSavedSettings.setString("LastName", gLastname);
+
+			LL_INFOS("AppInit") << "Attempting login as: " << gFirstname << " " << gLastname << LL_ENDL;
+			gDebugInfo["LoginName"] = gFirstname + " " + gLastname;	
 		}
-		gSavedSettings.setBOOL("RememberPassword", gRememberPassword);                                                 
-		LL_INFOS("AppInit") << "Attempting login as: " << userid << LL_ENDL;                                           
-		gDebugInfo["LoginName"] = userid;                                                                              
-         
+
 		// create necessary directories
 		// *FIX: these mkdir's should error check
-		gDirUtilp->setLindenUserDir(userid);
+		gDirUtilp->setLindenUserDir(gFirstname, gLastname);
 		LLFile::mkdir(gDirUtilp->getLindenUserDir());
-
+		
 		// Set PerAccountSettingsFile to the default value.
-		std::string per_account_settings_file = LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount");
 		gSavedSettings.setString("PerAccountSettingsFile",
 			gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, 
 				LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount")));
@@ -851,19 +889,21 @@ bool idle_startup()
 		}
 
 		//Default the path if one isn't set.
-		// *NOTE: unable to check variable differ from "InstantMessageLogPath" because it was
-		// provided in pre 2.0 viewer. See EXT-6661
-		if (gSavedPerAccountSettings.getString("InstantMessageLogPath").empty())
+		if (gSavedPerAccountSettings.getString("InstantMessageLogFolder").empty())
 		{
 			gDirUtilp->setChatLogsDir(gDirUtilp->getOSUserAppDir());
-			gSavedPerAccountSettings.setString("InstantMessageLogPath", gDirUtilp->getChatLogsDir());
+			std::string chat_log_dir = gDirUtilp->getChatLogsDir();
+			std::string chat_log_top_folder=gDirUtilp->getBaseFileName(chat_log_dir);
+			gSavedPerAccountSettings.setString("InstantMessageLogPath",chat_log_dir);
+			gSavedPerAccountSettings.setString("InstantMessageLogFolder",chat_log_top_folder);
 		}
 		else
 		{
 			gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath"));		
 		}
-		gDirUtilp->setPerAccountChatLogsDir(userid);  
 		
+		gDirUtilp->setPerAccountChatLogsDir(gFirstname, gLastname);
+
 		LLFile::mkdir(gDirUtilp->getChatLogsDir());
 		LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
 
@@ -884,7 +924,11 @@ bool idle_startup()
 
 		if (show_connect_box)
 		{
-			LLSLURL slurl;
+			std::string location;
+			LLPanelLogin::getLocation( location );
+			LLURLSimString::setString( location );
+
+			// END TODO
 			LLPanelLogin::closePanel();
 		}
 
@@ -908,21 +952,26 @@ bool idle_startup()
 		// their last location, or some URL "-url //sim/x/y[/z]"
 		// All accounts have both a home and a last location, and we don't support
 		// more locations than that.  Choose the appropriate one.  JC
-		switch (LLStartUp::getStartSLURL().getType())
-		  {
-		  case LLSLURL::LOCATION:
-		    agent_location_id = START_LOCATION_ID_URL;
-		    location_which = START_LOCATION_ID_LAST;
-		    break;
-		  case LLSLURL::LAST_LOCATION:
-		    agent_location_id = START_LOCATION_ID_LAST;
-		    location_which = START_LOCATION_ID_LAST;
-		    break;
-		  default:
-		    agent_location_id = START_LOCATION_ID_HOME;
-		    location_which = START_LOCATION_ID_HOME;
-		    break;
-		  }
+		if (LLURLSimString::parse())
+		{
+			// a startup URL was specified
+			agent_location_id = START_LOCATION_ID_URL;
+
+			// doesn't really matter what location_which is, since
+			// gAgentStartLookAt will be overwritten when the
+			// UserLoginLocationReply arrives
+			location_which = START_LOCATION_ID_LAST;
+		}
+		else if (gSavedSettings.getString("LoginLocation") == "last" )
+		{
+			agent_location_id = START_LOCATION_ID_LAST;	// last location
+			location_which = START_LOCATION_ID_LAST;
+		}
+		else
+		{
+			agent_location_id = START_LOCATION_ID_HOME;	// home
+			location_which = START_LOCATION_ID_HOME;
+		}
 
 		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
 
@@ -949,7 +998,7 @@ bool idle_startup()
 
 	if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
 	{
-		gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
+		gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
 
 		// Update progress status and the display loop.
 		auth_desc = LLTrans::getString("LoginInProgress");
@@ -973,7 +1022,11 @@ bool idle_startup()
 
 		// This call to LLLoginInstance::connect() starts the 
 		// authentication process.
-		login->connect(gUserCredential);
+		LLSD credentials;
+		credentials["first"] = gFirstname;
+		credentials["last"] = gLastname;
+		credentials["passwd"] = gPassword;
+		login->connect(credentials);
 
 		LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK );
 		return FALSE;
@@ -998,11 +1051,10 @@ bool idle_startup()
 		{
 			LL_INFOS("LLStartup") << "Login failed, LLLoginInstance::getResponse(): "
 			                      << LLLoginInstance::getInstance()->getResponse() << LL_ENDL;
-			LLSD response = LLLoginInstance::getInstance()->getResponse();
 			// Still have error conditions that may need some 
 			// sort of handling.
-			std::string reason_response = response["reason"];
-			std::string message_response = response["message"];
+			std::string reason_response = LLLoginInstance::getInstance()->getResponse("reason");
+			std::string message_response = LLLoginInstance::getInstance()->getResponse("message");
 	
 			if(!message_response.empty())
 			{
@@ -1022,8 +1074,8 @@ bool idle_startup()
 			if(reason_response == "key")
 			{
 				// Couldn't login because user/password is wrong
-				// Clear the credential
-				gUserCredential->clearAuthenticator();
+				// Clear the password
+				gPassword = "";
 			}
 
 			if(reason_response == "update" 
@@ -1036,65 +1088,18 @@ bool idle_startup()
 				LLLoginInstance::getInstance()->disconnect();
 				LLAppViewer::instance()->forceQuit();
 			}
-			else 
+			else
 			{
-				if (reason_response != "tos") 
+				// Don't pop up a notification in the TOS case because
+				// LLFloaterTOS::onCancel() already scolded the user.
+				if (reason_response != "tos")
 				{
-					// Don't pop up a notification in the TOS case because
-					// LLFloaterTOS::onCancel() already scolded the user.
-					std::string error_code;
-					if(response.has("errorcode"))
-					{
-						error_code = response["errorcode"].asString();
-					}
-					if ((reason_response == "CURLError") && 
-						(error_code == "SSL_CACERT" || error_code == "SSL_PEER_CERTIFICATE") && 
-						response.has("certificate"))
-					{
-						// This was a certificate error, so grab the certificate
-						// and throw up the appropriate dialog.
-						LLPointer<LLCertificate> certificate = gSecAPIHandler->getCertificate(response["certificate"]);
-						if(certificate)
-						{
-							LLSD args = transform_cert_args(certificate);
-
-							if(error_code == "SSL_CACERT")
-							{
-								// if we are handling an untrusted CA, throw up the dialog                             
-								// with the 'trust this CA' button.                                                    
-								LLNotificationsUtil::add("TrustCertificateError", args, response,
-														trust_cert_done);
-								
-								show_connect_box = true;
-							}
-							else
-							{
-								// the certificate exception returns a unique string for each type of exception.       
-								// we grab this string via the LLUserAuth object, and use that to grab the localized   
-								// string.                                                                             
-								args["REASON"] = LLTrans::getString(message_response);
-								
-								LLNotificationsUtil::add("GeneralCertificateError", args, response,
-														 general_cert_done);
-								
-								reset_login();
-								gSavedSettings.setBOOL("AutoLogin", FALSE);
-								show_connect_box = true;
-								
-							}
-
-						}
-					}
-					else 
-					{
-						// This wasn't a certificate error, so throw up the normal
-						// notificatioin message.
-						LLSD args;
-						args["ERROR_MESSAGE"] = emsg.str();
-						LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
-						LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
-					}
+					LLSD args;
+					args["ERROR_MESSAGE"] = emsg.str();
+					LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
+					LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
 				}
+
 				//setup map of datetime strings to codes and slt & local time offset from utc
 				// *TODO: Does this need to be here?
 				LLStringOps::setupDatetimeInfo (false);
@@ -1107,10 +1112,7 @@ bool idle_startup()
 			if(process_login_success_response())
 			{
 				// Pass the user information to the voice chat server interface.
-				LLVoiceClient::getInstance()->userAuthorized(gUserCredential->userID(), gAgentID);
-				// create the default proximal channel
-				LLVoiceChannel::initClass();
-				LLGridManager::getInstance()->setFavorite(); 
+				gVoiceClient->userAuthorized(gFirstname, gLastname, gAgentID);
 				LLStartUp::setStartupState( STATE_WORLD_INIT);
 			}
 			else
@@ -1121,7 +1123,6 @@ bool idle_startup()
 				LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
 				transition_back_to_login_panel(emsg.str());
 				show_connect_box = true;
-				return FALSE;
 			}
 		}
 		return FALSE;
@@ -1292,10 +1293,6 @@ bool idle_startup()
             LLAppViewer::instance()->loadNameCache();
 		}
 
-		// update the voice settings *after* gCacheName initialization
-		// so that we can construct voice UI that relies on the name cache
-		LLVoiceClient::getInstance()->updateSettings();
-
 		//gCacheName is required for nearby chat history loading
 		//so I just moved nearby history loading a few states further
 		if (!gNoRender && gSavedPerAccountSettings.getBOOL("LogShowHistory"))
@@ -1774,8 +1771,7 @@ bool idle_startup()
 					}
 				}
 				// no need to add gesture to inventory observer, it's already made in constructor 
-				LLGestureMgr::instance().setFetchIDs(item_ids);
-				LLGestureMgr::instance().startFetch();
+				LLGestureMgr::instance().fetch(item_ids);
 			}
 		}
 		gDisplaySwapBuffers = TRUE;
@@ -1811,12 +1807,9 @@ bool idle_startup()
 		// thus, do not show this alert.
 		if (!gAgent.isFirstLogin())
 		{
-			llinfos << "gAgentStartLocation : " << gAgentStartLocation << llendl;
-			LLSLURL start_slurl = LLStartUp::getStartSLURL();
-			
-			if (((start_slurl.getType() == LLSLURL::LOCATION) && (gAgentStartLocation == "url")) ||
-				((start_slurl.getType() == LLSLURL::LAST_LOCATION) && (gAgentStartLocation == "last")) ||
-				((start_slurl.getType() == LLSLURL::HOME_LOCATION) && (gAgentStartLocation == "home")))
+			bool url_ok = LLURLSimString::sInstance.parse();
+			if ((url_ok && gAgentStartLocation == "url") ||
+				(!url_ok && ((gAgentStartLocation == gSavedSettings.getString("LoginLocation")))))
 			{
 				// Start location is OK
 				// Disabled code to restore camera location and focus if logging in to default location
@@ -1838,23 +1831,17 @@ bool idle_startup()
 			else
 			{
 				std::string msg;
-				switch(start_slurl.getType())
+				if (url_ok)
 				{
-					case LLSLURL::LOCATION:
-					{
-						
-						msg = "AvatarMovedDesired";
-						break;
-					}
-					case LLSLURL::HOME_LOCATION:
-					{
-						msg = "AvatarMovedHome";
-						break;
-					}
-					default:
-					{
-						msg = "AvatarMovedLast";
-					}
+					msg = "AvatarMovedDesired";
+				}
+				else if (gSavedSettings.getString("LoginLocation") == "home")
+				{
+					msg = "AvatarMovedHome";
+				}
+				else
+				{
+					msg = "AvatarMovedLast";
 				}
 				LLNotificationsUtil::add(msg);
 			}
@@ -2070,9 +2057,20 @@ void login_show()
 #endif
 
 	LLPanelLogin::show(	gViewerWindow->getWindowRectScaled(),
-						bUseDebugLogin || gSavedSettings.getBOOL("SecondLifeEnterprise"),
+						bUseDebugLogin,
 						login_callback, NULL );
 
+	// UI textures have been previously loaded in doPreloadImages()
+	
+	LL_DEBUGS("AppInit") << "Setting Servers" << LL_ENDL;
+
+	LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel(), LLViewerLogin::getInstance()->getGridChoice());
+
+	LLViewerLogin* vl = LLViewerLogin::getInstance();
+	for(int grid_index = GRID_INFO_ADITI; grid_index < GRID_INFO_OTHER; ++grid_index)
+	{
+		LLPanelLogin::addServer(vl->getKnownGridLabel((EGridInfo)grid_index), grid_index);
+	}
 }
 
 // Callback for when login screen is closed.  Option 0 = connect, option 1 = quit.
@@ -2088,6 +2086,9 @@ void login_callback(S32 option, void *userdata)
 	}
 	else if (QUIT_OPTION == option) // *TODO: THIS CODE SEEMS TO BE UNREACHABLE!!!!! login_callback is never called with option equal to QUIT_OPTION
 	{
+		// Make sure we don't save the password if the user is trying to clear it.
+		std::string first, last, password;
+		LLPanelLogin::getFields(&first, &last, &password);
 		if (!gSavedSettings.getBOOL("RememberPassword"))
 		{
 			// turn off the setting and write out to disk
@@ -2110,6 +2111,142 @@ void login_callback(S32 option, void *userdata)
 	}
 }
 
+
+// static
+std::string LLStartUp::loadPasswordFromDisk()
+{
+	// Only load password if we also intend to save it (otherwise the user
+	// wonders what we're doing behind his back).  JC
+	BOOL remember_password = gSavedSettings.getBOOL("RememberPassword");
+	if (!remember_password)
+	{
+		return std::string("");
+	}
+
+	std::string hashed_password("");
+
+	// Look for legacy "marker" password from settings.ini
+	hashed_password = gSavedSettings.getString("Marker");
+	if (!hashed_password.empty())
+	{
+		// Stomp the Marker entry.
+		gSavedSettings.setString("Marker", "");
+
+		// Return that password.
+		return hashed_password;
+	}
+
+	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+													   "password.dat");
+	LLFILE* fp = LLFile::fopen(filepath, "rb");		/* Flawfinder: ignore */
+	if (!fp)
+	{
+		return hashed_password;
+	}
+
+	// UUID is 16 bytes, written into ASCII is 32 characters
+	// without trailing \0
+	const S32 HASHED_LENGTH = 32;
+	U8 buffer[HASHED_LENGTH+1];
+
+	if (1 != fread(buffer, HASHED_LENGTH, 1, fp))
+	{
+		return hashed_password;
+	}
+
+	fclose(fp);
+
+	// Decipher with MAC address
+	LLXORCipher cipher(gMACAddress, 6);
+	cipher.decrypt(buffer, HASHED_LENGTH);
+
+	buffer[HASHED_LENGTH] = '\0';
+
+	// Check to see if the mac address generated a bad hashed
+	// password. It should be a hex-string or else the mac adress has
+	// changed. This is a security feature to make sure that if you
+	// get someone's password.dat file, you cannot hack their account.
+	if(is_hex_string(buffer, HASHED_LENGTH))
+	{
+		hashed_password.assign((char*)buffer);
+	}
+
+	return hashed_password;
+}
+
+
+// static
+void LLStartUp::savePasswordToDisk(const std::string& hashed_password)
+{
+	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+													   "password.dat");
+	LLFILE* fp = LLFile::fopen(filepath, "wb");		/* Flawfinder: ignore */
+	if (!fp)
+	{
+		return;
+	}
+
+	// Encipher with MAC address
+	const S32 HASHED_LENGTH = 32;
+	U8 buffer[HASHED_LENGTH+1];
+
+	LLStringUtil::copy((char*)buffer, hashed_password.c_str(), HASHED_LENGTH+1);
+
+	LLXORCipher cipher(gMACAddress, 6);
+	cipher.encrypt(buffer, HASHED_LENGTH);
+
+	if (fwrite(buffer, HASHED_LENGTH, 1, fp) != 1)
+	{
+		LL_WARNS("AppInit") << "Short write" << LL_ENDL;
+	}
+
+	fclose(fp);
+}
+
+
+// static
+void LLStartUp::deletePasswordFromDisk()
+{
+	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+														  "password.dat");
+	LLFile::remove(filepath);
+}
+
+
+bool is_hex_string(U8* str, S32 len)
+{
+	bool rv = true;
+	U8* c = str;
+	while(rv && len--)
+	{
+		switch(*c)
+		{
+		case '0':
+		case '1':
+		case '2':
+		case '3':
+		case '4':
+		case '5':
+		case '6':
+		case '7':
+		case '8':
+		case '9':
+		case 'a':
+		case 'b':
+		case 'c':
+		case 'd':
+		case 'e':
+		case 'f':
+			++c;
+			break;
+		default:
+			rv = false;
+			break;
+		}
+	}
+	return rv;
+}
+
 void show_first_run_dialog()
 {
 	LLNotificationsUtil::add("FirstRun", LLSD(), LLSD(), first_run_dialog_callback);
@@ -2151,7 +2288,7 @@ bool login_alert_status(const LLSD& notification, const LLSD& response)
       //      break;
         case 2:     // Teleport
             // Restart the login process, starting at our home locaton
-	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+            LLURLSimString::setString("home");
             LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
             break;
         default:
@@ -2368,93 +2505,31 @@ void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S3
 }
 
 // *HACK: Must match name in Library or agent inventory
-const std::string ROOT_GESTURES_FOLDER = "Gestures";
 const std::string COMMON_GESTURES_FOLDER = "Common Gestures";
 const std::string MALE_GESTURES_FOLDER = "Male Gestures";
 const std::string FEMALE_GESTURES_FOLDER = "Female Gestures";
-const std::string SPEECH_GESTURES_FOLDER = "Speech Gestures";
-const std::string OTHER_GESTURES_FOLDER = "Other Gestures";
+const std::string MALE_OUTFIT_FOLDER = "Male Shape & Outfit";
+const std::string FEMALE_OUTFIT_FOLDER = "Female Shape & Outfit";
 const S32 OPT_CLOSED_WINDOW = -1;
 const S32 OPT_MALE = 0;
 const S32 OPT_FEMALE = 1;
-const S32 OPT_TRUST_CERT = 0;
-const S32 OPT_CANCEL_TRUST = 1;
-	
+
 bool callback_choose_gender(const LLSD& notification, const LLSD& response)
-{
-	
-    // These defaults are returned from the server on login.  They are set in login.xml.                  
-    // If no default is returned from the server, they are retrieved from settings.xml.                   
-	
-	S32 option = LLNotification::getSelectedOption(notification, response);
+{	
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 	switch(option)
 	{
-		case OPT_MALE:
-			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultMaleAvatar"), "male" );
-			break;
-			
-        case OPT_FEMALE:
-        case OPT_CLOSED_WINDOW:
-        default:
-			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultFemaleAvatar"), "female" );
-			break;
-	}
-	return false;
-}
+	case OPT_MALE:
+		LLStartUp::loadInitialOutfit( MALE_OUTFIT_FOLDER, "male" );
+		break;
 
-void LLStartUp::copyLibraryGestures(const std::string& same_gender_gestures)
-{
-	llinfos << "Copying library gestures" << llendl;
-
-	// Copy gestures
-	LLUUID lib_gesture_cat_id =
-		gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE,false,true);
-	if (lib_gesture_cat_id.isNull())
-	{
-		llwarns << "Unable to copy gestures, source category not found" << llendl;
-	}
-	LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
-
-	std::vector<std::string> gesture_folders_to_copy;
-	gesture_folders_to_copy.push_back(MALE_GESTURES_FOLDER);
-	gesture_folders_to_copy.push_back(FEMALE_GESTURES_FOLDER);
-	gesture_folders_to_copy.push_back(COMMON_GESTURES_FOLDER);
-	gesture_folders_to_copy.push_back(SPEECH_GESTURES_FOLDER);
-	gesture_folders_to_copy.push_back(OTHER_GESTURES_FOLDER);
-
-	for(std::vector<std::string>::iterator it = gesture_folders_to_copy.begin();
-		it != gesture_folders_to_copy.end();
-		++it)
-	{
-		std::string& folder_name = *it;
-
-		LLPointer<LLInventoryCallback> cb(NULL);
-
-		if (folder_name == same_gender_gestures ||
-			folder_name == COMMON_GESTURES_FOLDER ||
-			folder_name == OTHER_GESTURES_FOLDER)
-		{
-			cb = new ActivateGestureCallback;
-		}
-
-
-		LLUUID cat_id = findDescendentCategoryIDByName(lib_gesture_cat_id,folder_name);
-		if (cat_id.isNull())
-		{
-			llwarns << "failed to find gesture folder for " << folder_name << llendl;
-		}
-		else
-		{
-			llinfos << "initiating fetch and copy for " << folder_name << " cat_id " << cat_id << llendl;
-			LLAppearanceMgr* app_mgr = LLAppearanceMgr::getInstance();
-			callAfterCategoryFetch(cat_id,
-								   boost::bind(&LLAppearanceMgr::shallowCopyCategory,
-											   app_mgr,
-											   cat_id,
-											   dst_id,
-											   cb));
-		}
+	case OPT_FEMALE:
+	case OPT_CLOSED_WINDOW:
+	default:
+		LLStartUp::loadInitialOutfit( FEMALE_OUTFIT_FOLDER, "female" );
+		break;
 	}
+	return false;
 }
 
 void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
@@ -2468,16 +2543,16 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 	gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
 	
 	S32 gender = 0;
-	std::string same_gender_gestures;
+	std::string gestures;
 	if (gender_name == "male")
 	{
 		gender = OPT_MALE;
-		same_gender_gestures = MALE_GESTURES_FOLDER;
+		gestures = MALE_GESTURES_FOLDER;
 	}
 	else
 	{
 		gender = OPT_FEMALE;
-		same_gender_gestures = FEMALE_GESTURES_FOLDER;
+		gestures = FEMALE_GESTURES_FOLDER;
 	}
 
 	// try to find the outfit - if not there, create some default
@@ -2491,8 +2566,6 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 	}
 	else
 	{
-		sWearablesLoadedCon = gAgentWearables.addLoadedCallback(LLStartUp::saveInitialOutfit);
-
 		bool do_copy = true;
 		bool do_append = false;
 		LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
@@ -2500,29 +2573,42 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 	}
 
 	// Copy gestures
-	copyLibraryGestures(same_gender_gestures);
-	
-	// This is really misnamed -- it means we have started loading
-	// an outfit/shape that will give the avatar a gender eventually. JC
-	gAgent.setGenderChosen(TRUE);
+	LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
+	LLPointer<LLInventoryCallback> cb(NULL);
+	LLAppearanceMgr *app_mgr = &(LLAppearanceMgr::instance());
 
-}
+	// - Copy gender-specific gestures.
+	LLUUID gestures_cat_id = findDescendentCategoryIDByName( 
+		gInventory.getLibraryRootFolderID(),
+		gestures);
+	if (gestures_cat_id.notNull())
+	{
+		callAfterCategoryFetch(gestures_cat_id,
+							   boost::bind(&LLAppearanceMgr::shallowCopyCategory,
+										   app_mgr,
+										   gestures_cat_id,
+										   dst_id,
+										   cb));
+	}
 
-//static
-void LLStartUp::saveInitialOutfit()
-{
-	if (sInitialOutfit.empty()) return;
-	
-	if (sWearablesLoadedCon.connected())
+	// - Copy common gestures.
+	LLUUID common_gestures_cat_id = findDescendentCategoryIDByName( 
+		gInventory.getLibraryRootFolderID(),
+		COMMON_GESTURES_FOLDER);
+	if (common_gestures_cat_id.notNull())
 	{
-		sWearablesLoadedCon.disconnect();
+		callAfterCategoryFetch(common_gestures_cat_id,
+							   boost::bind(&LLAppearanceMgr::shallowCopyCategory,
+										   app_mgr,
+										   common_gestures_cat_id,
+										   dst_id,
+										   cb));
 	}
-	LLAppearanceMgr::getInstance()->makeNewOutfitLinks(sInitialOutfit,false);
-}
 
-std::string& LLStartUp::getInitialOutfitName()
-{
-	return sInitialOutfit;
+	// This is really misnamed -- it means we have started loading
+	// an outfit/shape that will give the avatar a gender eventually. JC
+	gAgent.setGenderChosen(TRUE);
+
 }
 
 // Loads a bitmap to display during load
@@ -2660,6 +2746,13 @@ void reset_login()
 
 //---------------------------------------------------------------------------
 
+std::string LLStartUp::sSLURLCommand;
+
+bool LLStartUp::canGoFullscreen()
+{
+	return gStartupState >= STATE_WORLD_INIT;
+}
+
 // Initialize all plug-ins except the web browser (which was initialized
 // early, before the login screen). JC
 void LLStartUp::multimediaInit()
@@ -2686,146 +2779,41 @@ void LLStartUp::fontInit()
 bool LLStartUp::dispatchURL()
 {
 	// ok, if we've gotten this far and have a startup URL
-        if (!getStartSLURL().isValid())
+	if (!sSLURLCommand.empty())
 	{
-	  return false;
+		LLMediaCtrl* web = NULL;
+		const bool trusted_browser = false;
+		LLURLDispatcher::dispatch(sSLURLCommand, web, trusted_browser);
 	}
-        if(getStartSLURL().getType() != LLSLURL::APP)
-	  {
-	    
+	else if (LLURLSimString::parse())
+	{
 		// If we started with a location, but we're already
 		// at that location, don't pop dialogs open.
 		LLVector3 pos = gAgent.getPositionAgent();
-		LLVector3 slurlpos = getStartSLURL().getPosition();
-		F32 dx = pos.mV[VX] - slurlpos.mV[VX];
-		F32 dy = pos.mV[VY] - slurlpos.mV[VY];
+		F32 dx = pos.mV[VX] - (F32)LLURLSimString::sInstance.mX;
+		F32 dy = pos.mV[VY] - (F32)LLURLSimString::sInstance.mY;
 		const F32 SLOP = 2.f;	// meters
 
-		if( getStartSLURL().getRegion() != gAgent.getRegion()->getName()
+		if( LLURLSimString::sInstance.mSimName != gAgent.getRegion()->getName()
 			|| (dx*dx > SLOP*SLOP)
 			|| (dy*dy > SLOP*SLOP) )
 		{
-			LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), 
-						  NULL, false);
+			std::string url = LLURLSimString::getURL();
+			LLMediaCtrl* web = NULL;
+			const bool trusted_browser = false;
+			LLURLDispatcher::dispatch(url, web, trusted_browser);
 		}
 		return true;
 	}
 	return false;
 }
 
-void LLStartUp::setStartSLURL(const LLSLURL& slurl) 
-{
-  sStartSLURL = slurl;
-  switch(slurl.getType())
-    {
-    case LLSLURL::HOME_LOCATION:
-      {
-		  gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_HOME);
-	break;
-      }
-    case LLSLURL::LAST_LOCATION:
-      {
-	gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_LAST);
-	break;
-      }
-    default:
-			LLGridManager::getInstance()->setGridChoice(slurl.getGrid());
-			break;
-    }
-}
-
 bool login_alert_done(const LLSD& notification, const LLSD& response)
 {
 	LLPanelLogin::giveFocus();
 	return false;
 }
 
-// parse the certificate information into args for the 
-// certificate notifications
-LLSD transform_cert_args(LLPointer<LLCertificate> cert)
-{
-	LLSD args = LLSD::emptyMap();
-	std::string value;
-	LLSD cert_info;
-	cert->getLLSD(cert_info);
-	// convert all of the elements in the cert into                                        
-	// args for the xml dialog, so we have flexability to                                  
-	// display various parts of the cert by only modifying                                 
-	// the cert alert dialog xml.                                                          
-	for(LLSD::map_iterator iter = cert_info.beginMap();
-		iter != cert_info.endMap();
-		iter++)
-	{
-		// key usage and extended key usage                                            
-		// are actually arrays, and we want to format them as comma separated          
-		// strings, so special case those.                                             
-		LLSDSerialize::toXML(cert_info[iter->first], std::cout);
-		if((iter->first== std::string(CERT_KEY_USAGE)) |
-		   (iter->first == std::string(CERT_EXTENDED_KEY_USAGE)))
-		{
-			value = "";
-			LLSD usage = cert_info[iter->first];
-			for (LLSD::array_iterator usage_iter = usage.beginArray();
-				 usage_iter != usage.endArray();
-				 usage_iter++)
-			{
-				
-				if(usage_iter != usage.beginArray())
-				{
-					value += ", ";
-				}
-				
-				value += (*usage_iter).asString();
-			}
-			
-		}
-		else
-		{
-			value = iter->second.asString();
-		}
-		
-		std::string name = iter->first;
-		std::transform(name.begin(), name.end(), name.begin(),
-					   (int(*)(int))toupper);
-		args[name.c_str()] = value;
-	}
-	return args;
-}
-
-
-// when we handle a cert error, give focus back to the login panel
-void general_cert_done(const LLSD& notification, const LLSD& response)
-{
-	LLStartUp::setStartupState( STATE_LOGIN_SHOW );			
-	LLPanelLogin::giveFocus();
-}
-
-// check to see if the user wants to trust the cert.
-// if they do, add it to the cert store and 
-void trust_cert_done(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotification::getSelectedOption(notification, response);	
-	switch(option)
-	{
-		case OPT_TRUST_CERT:
-		{
-			LLPointer<LLCertificate> cert = gSecAPIHandler->getCertificate(notification["payload"]["certificate"]);
-			LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(gSavedSettings.getString("CertStore"));			
-			store->add(cert);
-			store->save();
-			LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );	
-			break;
-		}
-		case OPT_CANCEL_TRUST:
-			reset_login();
-			gSavedSettings.setBOOL("AutoLogin", FALSE);			
-			LLStartUp::setStartupState( STATE_LOGIN_SHOW );				
-		default:
-			LLPanelLogin::giveFocus();
-			break;
-	}
-
-}
 
 void apply_udp_blacklist(const std::string& csv)
 {
@@ -2873,45 +2861,33 @@ bool process_login_success_response()
 	text = response["secure_session_id"].asString();
 	if(!text.empty()) gAgent.mSecureSessionID.set(text);
 
-	// if the response contains a display name, use that,
-	// otherwise if the response contains a first and/or last name,
-	// use those.  Otherwise use the credential identifier
-
-	gDisplayName = "";
-	if (response.has("display_name"))
+	text = response["first_name"].asString();
+	if(!text.empty()) 
 	{
-		gDisplayName.assign(response["display_name"].asString());
-		if(!gDisplayName.empty())
-		{
-			// Remove quotes from string.  Login.cgi sends these to force
-			// names that look like numbers into strings.
-			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
-			LLStringUtil::trim(gDisplayName);
-		}
+		// Remove quotes from string.  Login.cgi sends these to force
+		// names that look like numbers into strings.
+		gFirstname.assign(text);
+		LLStringUtil::replaceChar(gFirstname, '"', ' ');
+		LLStringUtil::trim(gFirstname);
 	}
-	if(gDisplayName.empty())
+	text = response["last_name"].asString();
+	if(!text.empty()) 
 	{
-		if(response.has("first_name"))
-		{
-			gDisplayName.assign(response["first_name"].asString());
-			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
-			LLStringUtil::trim(gDisplayName);
-		}
-		if(response.has("last_name"))
-		{
-			text.assign(response["last_name"].asString());
-			LLStringUtil::replaceChar(text, '"', ' ');
-			LLStringUtil::trim(text);
-			if(!gDisplayName.empty())
-			{
-				gDisplayName += " ";
-			}
-			gDisplayName += text;
-		}
+		gLastname.assign(text);
 	}
-	if(gDisplayName.empty())
+	gSavedSettings.setString("FirstName", gFirstname);
+	gSavedSettings.setString("LastName", gLastname);
+
+	if (gSavedSettings.getBOOL("RememberPassword"))
+	{
+		// Successful login means the password is valid, so save it.
+		LLStartUp::savePasswordToDisk(gPassword);
+	}
+	else
 	{
-		gDisplayName.assign(gUserCredential->asString());
+		// Don't leave password from previous session sitting around
+		// during this login session.
+		LLStartUp::deletePasswordFromDisk();
 	}
 
 	// this is their actual ability to access content
@@ -3005,7 +2981,7 @@ bool process_login_success_response()
 		// replace the default help URL format
 		gSavedSettings.setString("HelpURLFormat",text);
 		
-		// don't fall back to Standalone's pre-connection static help
+		// don't fall back to Nebraska's pre-connection static help
 		gSavedSettings.setBOOL("HelpUseLocal", false);
 	}
 			
@@ -3068,37 +3044,6 @@ bool process_login_success_response()
 		LLStringOps::setupDatetimeInfo(pacific_daylight_time);
 	}
 
-	// set up the voice configuration.  Ultimately, we should pass this up as part of each voice
-	// channel if we need to move to multiple voice servers per grid.
-	LLSD voice_config_info = response["voice-config"];
-	if(voice_config_info.has("VoiceServerType"))
-	{
-		gSavedSettings.setString("VoiceServerType", voice_config_info["VoiceServerType"].asString()); 
-	}
-
-	// Request the map server url
-	std::string map_server_url = response["map-server-url"];
-	if(!map_server_url.empty())
-	{
-		gSavedSettings.setString("MapServerURL", map_server_url); 
-	}
-	
-	// Default male and female avatars allowing the user to choose their avatar on first login.
-	// These may be passed up by SLE to allow choice of enterprise avatars instead of the standard
-	// "new ruth."  Not to be confused with 'initial-outfit' below 
-	LLSD newuser_config = response["newuser-config"][0];
-	if(newuser_config.has("DefaultFemaleAvatar"))
-	{
-		gSavedSettings.setString("DefaultFemaleAvatar", newuser_config["DefaultFemaleAvatar"].asString()); 		
-	}
-	if(newuser_config.has("DefaultMaleAvatar"))
-	{
-		gSavedSettings.setString("DefaultMaleAvatar", newuser_config["DefaultMaleAvatar"].asString()); 		
-	}
-	
-	// Initial outfit for the user.
-	// QUESTION: Why can't we simply simply set the users outfit directly
-	// from a web page into the user info on the server? - Roxie
 	LLSD initial_outfit = response["initial-outfit"][0];
 	if(initial_outfit.size())
 	{
@@ -3152,7 +3097,7 @@ bool process_login_success_response()
 
 	bool success = false;
 	// JC: gesture loading done below, when we have an asset system
-	// in place.  Don't delete/clear gUserCredentials until then.
+	// in place.  Don't delete/clear user_credentials until then.
 	if(gAgentID.notNull()
 	   && gAgentSessionID.notNull()
 	   && gMessageSystem->mOurCircuitCode
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index e79aa0dbee296a4715db4a9c6865496cfeec3dc0..92fe9521d3eb31b3ca8f2f99e618bc34a5e1c3ad 100644
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -2,25 +2,31 @@
  * @file llstartup.h
  * @brief startup routines and logic declaration
  *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,7 +38,6 @@
 class LLViewerTexture ;
 class LLEventPump;
 class LLStartupListener;
-class LLSLURL;
 
 // functions
 bool idle_startup();
@@ -75,6 +80,9 @@ extern LLPointer<LLViewerTexture> gStartTexture;
 class LLStartUp
 {
 public:
+	static bool canGoFullscreen();
+		// returns true if we are far enough along in startup to allow
+		// going full screen
 
 	// Always use this to set gStartupState so changes are logged
 	static void setStartupState( EStartupState state );
@@ -87,30 +95,32 @@ class LLStartUp
 	// Load default fonts not already loaded at start screen
 	static void fontInit();
 
-	static void copyLibraryGestures(const std::string& same_gender_gestures);
-
 	// outfit_folder_name can be a folder anywhere in your inventory, 
 	// but the name must be a case-sensitive exact match.
 	// gender_name is either "male" or "female"
 	static void loadInitialOutfit( const std::string& outfit_folder_name,
 								   const std::string& gender_name );
 
-	//save loaded initial outfit into My Outfits category
-	static void saveInitialOutfit();
-
-	static std::string& getInitialOutfitName();
+	// Load MD5 of user's password from local disk file.
+	static std::string loadPasswordFromDisk();
+	
+	// Record MD5 of user's password for subsequent login.
+	static void savePasswordToDisk(const std::string& hashed_password);
+	
+	// Delete the saved password local disk file.
+	static void deletePasswordFromDisk();
 	
 	static bool dispatchURL();
 		// if we have a SLURL or sim string ("Ahern/123/45") that started
 		// the viewer, dispatch it
 
+	static std::string sSLURLCommand;
+		// *HACK: On startup, if we were passed a secondlife://app/do/foo
+		// command URL, store it for later processing.
+
 	static void postStartupState();
-	static void setStartSLURL(const LLSLURL& slurl); 
-	static LLSLURL& getStartSLURL() { return sStartSLURL; } 
 
 private:
-	static LLSLURL sStartSLURL;
-
 	static std::string startupStateToString(EStartupState state);
 	static EStartupState gStartupState; // Do not set directly, use LLStartup::setStartupState
 	static boost::scoped_ptr<LLEventPump> sStateWatcher;
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index af011d8599d7849b34b890b47f80552d5f74c567..b660a2b8eaaac611d77e6d86d4233a006f735378 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -2,25 +2,31 @@
 * @file llstatusbar.cpp
 * @brief LLStatusBar class implementation
 *
-* $LicenseInfo:firstyear=2002&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
+* $LicenseInfo:firstyear=2002&license=viewergpl$
+* 
+* Copyright (c) 2002-2009, Linden Research, Inc.
 * 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab.  Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 * 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
 * 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
 * 
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
 * $/LicenseInfo$
 */
 
@@ -35,7 +41,6 @@
 #include "llcommandhandler.h"
 #include "llviewercontrol.h"
 #include "llfloaterbuycurrency.h"
-#include "llbuycurrencyhtml.h"
 #include "llfloaterlagmeter.h"
 #include "llpanelnearbymedia.h"
 #include "llpanelvolumepulldown.h"
@@ -115,6 +120,7 @@ const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000;
 
 LLStatusBar::LLStatusBar(const LLRect& rect)
 :	LLPanel(),
+	mTextHealth(NULL),
 	mTextTime(NULL),
 	mSGBandwidth(NULL),
 	mSGPacketLoss(NULL),
@@ -174,8 +180,11 @@ BOOL LLStatusBar::postBuild()
 	// build date necessary data (must do after panel built)
 	setupDate();
 
+	mTextHealth = getChild<LLTextBox>("HealthText" );
 	mTextTime = getChild<LLTextBox>("TimeText" );
 	
+	getChild<LLUICtrl>("buycurrency")->setCommitCallback( 
+		boost::bind(&LLStatusBar::onClickBuyCurrency, this));
 	getChild<LLUICtrl>("buyL")->setCommitCallback(
 		boost::bind(&LLStatusBar::onClickBuyCurrency, this));
 
@@ -318,12 +327,24 @@ void LLStatusBar::refresh()
 			BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1;
 			childSetVisible("health", flash);
 		}
+		mTextHealth->setVisible(TRUE);
 
 		// Health
 		childGetRect( "health", buttonRect );
 		r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
 		childSetRect("health", r);
 		x += buttonRect.getWidth();
+
+		const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) );
+		r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y);
+		mTextHealth->setRect(r);
+		x += health_width;
+	}
+	else
+	{
+		// invisible if region doesn't allow damage
+		childSetVisible("health", false);
+		mTextHealth->setVisible(FALSE);
 	}
 
 	mSGBandwidth->setVisible(net_stats_visible);
@@ -349,7 +370,8 @@ void LLStatusBar::refresh()
 void LLStatusBar::setVisibleForMouselook(bool visible)
 {
 	mTextTime->setVisible(visible);
-	getChild<LLUICtrl>("balance_bg")->setVisible(visible);
+	getChild<LLUICtrl>("buycurrency")->setVisible(visible);
+	getChild<LLUICtrl>("buyL")->setVisible(visible);
 	mBtnVolume->setVisible(visible);
 	mMediaToggle->setVisible(visible);
 	mSGBandwidth->setVisible(visible);
@@ -371,21 +393,18 @@ void LLStatusBar::setBalance(S32 balance)
 {
 	std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance );
 
-	LLTextBox* balance_box = getChild<LLTextBox>("balance");
+	LLButton* btn_buy_currency = getChild<LLButton>("buycurrency");
 	LLStringUtil::format_map_t string_args;
 	string_args["[AMT]"] = llformat("%s", money_str.c_str());
 	std::string label_str = getString("buycurrencylabel", string_args);
-	balance_box->setValue(label_str);
+	btn_buy_currency->setLabel(label_str);
 
-	// Resize the L$ balance background to be wide enough for your balance plus the buy button
+	// Resize the balance button so that the label fits it, and the button expands to the left.
+	// *TODO: LLButton should have an option where to expand.
 	{
-		const S32 HPAD = 24;
-		LLRect balance_rect = balance_box->getTextBoundingRect();
-		LLRect buy_rect = getChildView("buyL")->getRect();
-		LLView* balance_bg_view = getChildView("balance_bg");
-		LLRect balance_bg_rect = balance_bg_view->getRect();
-		balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + balance_rect.getWidth() + HPAD);
-		balance_bg_view->setShape(balance_bg_rect);
+		S32 saved_right = btn_buy_currency->getRect().mRight;
+		btn_buy_currency->autoResize();
+		btn_buy_currency->translate(saved_right - btn_buy_currency->getRect().mRight, 0);
 	}
 
 	if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold")))
@@ -422,6 +441,8 @@ void LLStatusBar::sendMoneyBalanceRequest()
 void LLStatusBar::setHealth(S32 health)
 {
 	//llinfos << "Setting health to: " << buffer << llendl;
+	mTextHealth->setText(llformat("%d%%", health));
+
 	if( mHealth > health )
 	{
 		if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold")))
@@ -488,9 +509,7 @@ S32 LLStatusBar::getSquareMetersLeft() const
 
 void LLStatusBar::onClickBuyCurrency()
 {
-	// open a currency floater - actual one open depends on 
-	// value specified in settings.xml
-	LLBuyCurrencyHTML::openCurrencyFloater();
+	LLFloaterBuyCurrency::buyCurrency();
 }
 
 static void onClickHealth(void* )
diff --git a/indra/newview/llstylemap.cpp b/indra/newview/llstylemap.cpp
index 6ef42e37f83f269171f4caf9c4db1ca852a57a6e..61705c4eb31390b527cb1efdf121fcd7a2c39b9b 100644
--- a/indra/newview/llstylemap.cpp
+++ b/indra/newview/llstylemap.cpp
@@ -2,25 +2,31 @@
  * @file llstylemap.cpp
  * @brief LLStyleMap class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -45,7 +51,7 @@ const LLStyle::Params &LLStyleMap::lookupAgent(const LLUUID &source)
 			style_params.color.control = "HTMLLinkColor";
 			style_params.readonly_color.control = "HTMLLinkColor";
 			style_params.link_href = 
-					LLSLURL("agent", source, "inspect").getSLURLString();
+					LLSLURL::buildCommand("agent", source, "inspect");
 		}
 		else
 		{
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index 750fbe54a725573949dcb62fb01e56f4e399a5ab..cbb030836e900057921971a6def51333fa3a4d0e 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file llsyswellwindow.cpp
  * @brief                                    // TODO
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -50,11 +56,14 @@ LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLTransientDockableFloater(N
 													mChannel(NULL),
 													mMessageList(NULL),
 													mSysWellChiclet(NULL),
+													mSeparator(NULL),
 													NOTIFICATION_WELL_ANCHOR_NAME("notification_well_panel"),
 													IM_WELL_ANCHOR_NAME("im_well_panel"),
 													mIsReshapedByUser(false)
 
 {
+	mTypedItemsCount[IT_NOTIFICATION] = 0;
+	mTypedItemsCount[IT_INSTANT_MESSAGE] = 0;
 	setOverlapsScreenChannel(true);
 }
 
@@ -66,6 +75,18 @@ BOOL LLSysWellWindow::postBuild()
 	// get a corresponding channel
 	initChannel();
 
+	LLPanel::Params params;
+	mSeparator = LLUICtrlFactory::create<LLPanel>(params);
+	LLUICtrlFactory::instance().buildPanel(mSeparator, "panel_separator.xml");
+
+	LLRect rc = mSeparator->getRect();
+	rc.setOriginAndSize(0, 0, mMessageList->getItemsRect().getWidth(), rc.getHeight());
+	mSeparator->setRect(rc);
+	mSeparator->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP);
+	mSeparator->setVisible(FALSE);
+
+	mMessageList->addItem(mSeparator);
+
 	// click on SysWell Window should clear "new message" state (and 'Lit' status). EXT-3147.
 	// mouse up callback is not called in this case.
 	setMouseDownCallback(boost::bind(&LLSysWellWindow::releaseNewMessagesState, this));
@@ -109,7 +130,7 @@ void LLSysWellWindow::removeItemByID(const LLUUID& id)
 {
 	if(mMessageList->removeItemByValue(id))
 	{
-		mSysWellChiclet->updateWidget(isWindowEmpty());
+		handleItemRemoved(IT_NOTIFICATION);
 		reshapeWindow();
 	}
 	else
@@ -237,7 +258,76 @@ void LLSysWellWindow::releaseNewMessagesState()
 //---------------------------------------------------------------------------------
 bool LLSysWellWindow::isWindowEmpty()
 {
-	return mMessageList->size() == 0;
+	// keep in mind, mSeparator is always in the list
+	return mMessageList->size() == 1;
+}
+
+// *TODO: mantipov: probably is deprecated
+void LLSysWellWindow::handleItemAdded(EItemType added_item_type)
+{
+	bool should_be_shown = ++mTypedItemsCount[added_item_type] == 1 && anotherTypeExists(added_item_type);
+
+	if (should_be_shown && !mSeparator->getVisible())
+	{
+		mSeparator->setVisible(TRUE);
+
+		// refresh list to recalculate mSeparator position
+		mMessageList->reshape(mMessageList->getRect().getWidth(), mMessageList->getRect().getHeight());
+	}
+
+	//fix for EXT-3254
+	//set limits for min_height. 
+	S32 parent_list_delta_height = getRect().getHeight() - mMessageList->getRect().getHeight();
+
+	std::vector<LLPanel*> items;
+	mMessageList->getItems(items);
+
+	if(items.size()>1)//first item is separator
+	{
+		S32 min_height;
+		S32 min_width;
+		getResizeLimits(&min_width,&min_height);
+
+		min_height = items[1]->getRect().getHeight() + 2 * mMessageList->getBorderWidth() + parent_list_delta_height;
+
+		setResizeLimits(min_width,min_height);
+	}
+	mSysWellChiclet->updateWidget(isWindowEmpty());
+}
+
+void LLSysWellWindow::handleItemRemoved(EItemType removed_item_type)
+{
+	bool should_be_hidden = --mTypedItemsCount[removed_item_type] == 0;
+
+	if (should_be_hidden && mSeparator->getVisible())
+	{
+		mSeparator->setVisible(FALSE);
+
+		// refresh list to recalculate mSeparator position
+		mMessageList->reshape(mMessageList->getRect().getWidth(), mMessageList->getRect().getHeight());
+	}
+	mSysWellChiclet->updateWidget(isWindowEmpty());
+}
+
+bool LLSysWellWindow::anotherTypeExists(EItemType item_type)
+{
+	bool exists = false;
+	switch(item_type)
+	{
+	case IT_INSTANT_MESSAGE:
+		if (mTypedItemsCount[IT_NOTIFICATION] > 0)
+		{
+			exists = true;
+		}
+		break;
+	case IT_NOTIFICATION:
+		if (mTypedItemsCount[IT_INSTANT_MESSAGE] > 0)
+		{
+			exists = true;
+		}
+		break;
+	}
+	return exists;
 }
 
 /************************************************************************/
@@ -365,7 +455,7 @@ LLIMWellWindow::ObjectRowPanel::~ObjectRowPanel()
 //---------------------------------------------------------------------------------
 void LLIMWellWindow::ObjectRowPanel::onClosePanel()
 {
-	LLScriptFloaterManager::getInstance()->removeNotification(mChiclet->getSessionId());
+	LLScriptFloaterManager::getInstance()->onRemoveNotification(mChiclet->getSessionId());
 }
 
 void LLIMWellWindow::ObjectRowPanel::initChiclet(const LLUUID& notification_id, bool new_message/* = false*/)
@@ -469,7 +559,8 @@ void LLNotificationWellWindow::addItem(LLSysWellItem::Params p)
 	LLSysWellItem* new_item = new LLSysWellItem(p);
 	if (mMessageList->addItem(new_item, value, ADD_TOP))
 	{
-		mSysWellChiclet->updateWidget(isWindowEmpty());
+		handleItemAdded(IT_NOTIFICATION);
+
 		reshapeWindow();
 
 		new_item->setOnItemCloseCallback(boost::bind(&LLNotificationWellWindow::onItemClose, this, _1));
@@ -576,6 +667,8 @@ LLIMWellWindow::LLIMWellWindow(const LLSD& key)
 : LLSysWellWindow(key)
 {
 	LLIMMgr::getInstance()->addSessionObserver(this);
+	LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findIMChiclet, this, _1));
+	LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findObjectChiclet, this, _1));
 }
 
 LLIMWellWindow::~LLIMWellWindow()
@@ -593,10 +686,6 @@ BOOL LLIMWellWindow::postBuild()
 {
 	BOOL rv = LLSysWellWindow::postBuild();
 	setTitle(getString("title_im_well_window"));
-
-	LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findIMChiclet, this, _1));
-	LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findObjectChiclet, this, _1));
-
 	return rv;
 }
 
@@ -637,8 +726,6 @@ void LLIMWellWindow::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID
 
 LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& notification_id)
 {
-	if (!mMessageList) return NULL;
-
 	LLChiclet* res = NULL;
 	ObjectRowPanel* panel = mMessageList->getTypedItemByValue<ObjectRowPanel>(notification_id);
 	if (panel != NULL)
@@ -653,8 +740,6 @@ LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& notification_id)
 // PRIVATE METHODS
 LLChiclet* LLIMWellWindow::findIMChiclet(const LLUUID& sessionId)
 {
-	if (!mMessageList) return NULL;
-
 	LLChiclet* res = NULL;
 	RowPanel* panel = mMessageList->getTypedItemByValue<RowPanel>(sessionId);
 	if (panel != NULL)
@@ -670,9 +755,9 @@ void LLIMWellWindow::addIMRow(const LLUUID& sessionId, S32 chicletCounter,
 							   const std::string& name, const LLUUID& otherParticipantId)
 {
 	RowPanel* item = new RowPanel(this, sessionId, chicletCounter, name, otherParticipantId);
-	if (mMessageList->addItem(item, sessionId))
+	if (mMessageList->insertItemAfter(mSeparator, item, sessionId))
 	{
-		mSysWellChiclet->updateWidget(isWindowEmpty());
+		handleItemAdded(IT_INSTANT_MESSAGE);
 	}
 	else
 	{
@@ -697,7 +782,7 @@ void LLIMWellWindow::delIMRow(const LLUUID& sessionId)
 
 	if (mMessageList->removeItemByValue(sessionId))
 	{
-		mSysWellChiclet->updateWidget(isWindowEmpty());
+		handleItemRemoved(IT_INSTANT_MESSAGE);
 	}
 	else
 	{
@@ -725,9 +810,9 @@ void LLIMWellWindow::addObjectRow(const LLUUID& notification_id, bool new_messag
 	if (mMessageList->getItemByValue(notification_id) == NULL)
 	{
 		ObjectRowPanel* item = new ObjectRowPanel(notification_id, new_message);
-		if (mMessageList->addItem(item, notification_id))
+		if (mMessageList->insertItemAfter(mSeparator, item, notification_id))
 		{
-			mSysWellChiclet->updateWidget(isWindowEmpty());
+			handleItemAdded(IT_INSTANT_MESSAGE);
 		}
 		else
 		{
@@ -742,7 +827,7 @@ void LLIMWellWindow::removeObjectRow(const LLUUID& notification_id)
 {
 	if (mMessageList->removeItemByValue(notification_id))
 	{
-		mSysWellChiclet->updateWidget(isWindowEmpty());
+		handleItemRemoved(IT_INSTANT_MESSAGE);
 	}
 	else
 	{
@@ -826,7 +911,7 @@ void LLIMWellWindow::closeAllImpl()
 		ObjectRowPanel* obj_panel = dynamic_cast <ObjectRowPanel*> (panel);
 		if (obj_panel)
 		{
-			LLScriptFloaterManager::instance().removeNotification(*iter);
+			LLScriptFloaterManager::instance().onRemoveNotification(*iter);
 		}
 	}
 }
diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h
index 5854deb840af3d58749c1383e9b6edaa980d3096..296bdf7482dd5d2796068ee94e75267020183638 100644
--- a/indra/newview/llsyswellwindow.h
+++ b/indra/newview/llsyswellwindow.h
@@ -2,25 +2,31 @@
  * @file llsyswellwindow.h
  * @brief                                    // TODO
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -76,12 +82,20 @@ class LLSysWellWindow : public LLTransientDockableFloater
 
 protected:
 
+	typedef enum{
+		IT_NOTIFICATION,
+		IT_INSTANT_MESSAGE
+	}EItemType; 
+
 	// gets a rect that bounds possible positions for the SysWellWindow on a screen (EXT-1111)
 	void getAllowedRect(LLRect& rect);
 
 
 	// init Window's channel
 	virtual void initChannel();
+	void handleItemAdded(EItemType added_item_type);
+	void handleItemRemoved(EItemType removed_item_type);
+	bool anotherTypeExists(EItemType item_type) ;
 
 	const std::string NOTIFICATION_WELL_ANCHOR_NAME;
 	const std::string IM_WELL_ANCHOR_NAME;
@@ -99,6 +113,15 @@ class LLSysWellWindow : public LLTransientDockableFloater
 	 */
 	LLSysWellChiclet* mSysWellChiclet;
 
+	/**
+	 *	Special panel which is used as separator of Notifications & IM Rows.
+	 *	It is always presents in the list and shown when it is necessary.
+	 *	It should be taken into account when reshaping and checking list size
+	 */
+	LLPanel* mSeparator;
+
+	typedef std::map<EItemType, S32> typed_items_count_t;
+	typed_items_count_t mTypedItemsCount;
 	bool mIsReshapedByUser;
 };
 
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index 0d7b67d31d2120b1b7b4a7f3bdfd3219490cc8c0..3f4dab4feac46f93a98025f7d2c261f95cb01484 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -2,25 +2,31 @@
  * @file lltexlayer.cpp
  * @brief A texture layer. Used for avatars.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -31,7 +37,6 @@
 #include "llagent.h"
 #include "llimagej2c.h"
 #include "llimagetga.h"
-#include "llnotificationsutil.h"
 #include "llvfile.h"
 #include "llvfs.h"
 #include "llviewerstats.h"
@@ -44,50 +49,12 @@
 #include "llui.h"
 #include "llagentwearables.h"
 #include "llwearable.h"
-#include "llviewercontrol.h"
 #include "llviewervisualparam.h"
 
 //#include "../tools/imdebug/imdebug.h"
 
 using namespace LLVOAvatarDefines;
 
-class LLTexLayerInfo
-{
-	friend class LLTexLayer;
-	friend class LLTexLayerTemplate;
-	friend class LLTexLayerInterface;
-public:
-	LLTexLayerInfo();
-	~LLTexLayerInfo();
-
-	BOOL parseXml(LLXmlTreeNode* node);
-	BOOL createVisualParams(LLVOAvatar *avatar);
-	BOOL isUserSettable() { return mLocalTexture != -1;	}
-	S32  getLocalTexture() const { return mLocalTexture; }
-	BOOL getOnlyAlpha() const { return mUseLocalTextureAlphaOnly; }
-	std::string getName() const { return mName;	}
-
-private:
-	std::string				mName;
-	
-	BOOL					mWriteAllChannels; // Don't use masking.  Just write RGBA into buffer,
-	LLTexLayerInterface::ERenderPass mRenderPass;
-
-	std::string				mGlobalColor;
-	LLColor4				mFixedColor;
-
-	S32						mLocalTexture;
-	std::string				mStaticImageFileName;
-	BOOL					mStaticImageIsMask;
-	BOOL					mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture.  Use alpha as a mask
-	BOOL					mIsVisibilityMask;
-
-	typedef std::vector< std::pair< std::string,BOOL > > morph_name_list_t;
-	morph_name_list_t		    mMorphNameList;
-	param_color_info_list_t		mParamColorInfoList;
-	param_alpha_info_list_t		mParamAlphaInfoList;
-};
-
 //-----------------------------------------------------------------------------
 // LLBakedUploadData()
 //-----------------------------------------------------------------------------
@@ -113,16 +80,12 @@ LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLTexLayerSet* const owner,
 										 S32 width, S32 height) :
 	// ORDER_LAST => must render these after the hints are created.
 	LLViewerDynamicTexture( width, height, 4, LLViewerDynamicTexture::ORDER_LAST, TRUE ), 
-	mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates
-	mNeedsUpload(FALSE),
-	mNumLowresUploads(0),
-	mNeedsUpdate(TRUE),
-	mNumLowresUpdates(0),
+	mNeedsUpdate( TRUE ),
+	mNeedsUpload( FALSE ),
+	mUploadPending( FALSE ), // Not used for any logic here, just to sync sending of updates
 	mTexLayerSet(owner)
 {
 	LLTexLayerSetBuffer::sGLByteCount += getSize();
-	mNeedsUploadTimer.start();
-	mNeedsUpdateTimer.start();
 }
 
 LLTexLayerSetBuffer::~LLTexLayerSetBuffer()
@@ -135,12 +98,6 @@ LLTexLayerSetBuffer::~LLTexLayerSetBuffer()
 	}
 }
 
-//virtual 
-S8 LLTexLayerSetBuffer::getType() const 
-{
-	return LLViewerDynamicTexture::LL_TEX_LAYER_SET_BUFFER ;
-}
-
 //virtual 
 void LLTexLayerSetBuffer::restoreGLTexture() 
 {	
@@ -161,9 +118,8 @@ void LLTexLayerSetBuffer::dumpTotalByteCount()
 
 void LLTexLayerSetBuffer::requestUpdate()
 {
-	restartUpdateTimer();
 	mNeedsUpdate = TRUE;
-	mNumLowresUpdates = 0;
+
 	// If we're in the middle of uploading a baked texture, we don't care about it any more.
 	// When it's downloaded, ignore it.
 	mUploadID.setNull();
@@ -171,39 +127,20 @@ void LLTexLayerSetBuffer::requestUpdate()
 
 void LLTexLayerSetBuffer::requestUpload()
 {
-	conditionalRestartUploadTimer();
-	mNeedsUpload = TRUE;
-	mNumLowresUploads = 0;
-	mUploadPending = TRUE;
-}
-
-void LLTexLayerSetBuffer::conditionalRestartUploadTimer()
-{
-	// If we requested a new upload but haven't even uploaded
-	// a low res version of our last upload request, then
-	// keep the timer ticking instead of resetting it.
-	if (mNeedsUpload && (mNumLowresUploads == 0))
+	if (!mNeedsUpload)
 	{
-		mNeedsUploadTimer.unpause();
-	}
-	else
-	{
-		mNeedsUploadTimer.reset();
-		mNeedsUploadTimer.start();
+		mNeedsUpload = TRUE;
+		mUploadPending = TRUE;
 	}
 }
 
-void LLTexLayerSetBuffer::restartUpdateTimer()
-{
-	mNeedsUpdateTimer.reset();
-	mNeedsUpdateTimer.start();
-}
-
 void LLTexLayerSetBuffer::cancelUpload()
 {
-	mNeedsUpload = FALSE;
+	if (mNeedsUpload)
+	{
+		mNeedsUpload = FALSE;
+	}
 	mUploadPending = FALSE;
-	mNeedsUploadTimer.pause();
 }
 
 void LLTexLayerSetBuffer::pushProjection() const
@@ -229,34 +166,26 @@ void LLTexLayerSetBuffer::popProjection() const
 
 BOOL LLTexLayerSetBuffer::needsRender()
 {
-	llassert(mTexLayerSet->getAvatar() == gAgentAvatarp);
-	if (!isAgentAvatarValid()) return FALSE;
-
-	const BOOL upload_now = mNeedsUpload && isReadyToUpload();
-	const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
-
-	// Don't render if we don't want to (or aren't ready to) upload or update.
-	if (!(update_now || upload_now))
-	{
-		return FALSE;
-	}
-
-	// Don't render if we're animating our appearance.
-	if (gAgentAvatarp->getIsAppearanceAnimating())
-	{
-		return FALSE;
-	}
-
-	// Don't render if we are trying to create a shirt texture but aren't wearing a skirt.
-	if (gAgentAvatarp->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && 
-		!gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
+	const LLVOAvatarSelf* avatar = mTexLayerSet->getAvatar();
+	BOOL upload_now = mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal() && gAgentQueryManager.hasNoPendingQueries();
+	BOOL needs_update = (mNeedsUpdate || upload_now) && !avatar->mAppearanceAnimating;
+	if (needs_update)
 	{
-		cancelUpload();
-		return FALSE;
+		BOOL invalid_skirt = avatar->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && !avatar->isWearingWearableType(WT_SKIRT);
+		if (invalid_skirt)
+		{
+			// we were trying to create a skirt texture
+			// but we're no longer wearing a skirt...
+			needs_update = FALSE;
+			cancelUpload();
+		}
+		else
+		{
+			needs_update &= (avatar->isSelf() || (avatar->isVisible() && !avatar->isCulled()));
+			needs_update &= mTexLayerSet->isLocalTextureDataAvailable();
+		}
 	}
-
-	// Render if we have at least minimal level of detail for each local texture.
-	return mTexLayerSet->isLocalTextureDataAvailable();
+	return needs_update;
 }
 
 void LLTexLayerSetBuffer::preRender(BOOL clear_depth)
@@ -281,45 +210,37 @@ BOOL LLTexLayerSetBuffer::render()
 	gGL.setColorMask(true, true);
 
 	// do we need to upload, and do we have sufficient data to create an uploadable composite?
-	// TODO: When do we upload the texture if gAgent.mNumPendingQueries is non-zero?
-	const BOOL upload_now = mNeedsUpload && isReadyToUpload();
-	const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
-	
+	// When do we upload the texture if gAgent.mNumPendingQueries is non-zero?
+	BOOL upload_now = (gAgentQueryManager.hasNoPendingQueries() && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal());
 	BOOL success = TRUE;
 
+
 	// Composite the color data
 	LLGLSUIDefault gls_ui;
 	success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight );
 	gGL.flush();
 
-	if(upload_now)
+	if( upload_now )
 	{
 		if (!success)
 		{
-			llinfos << "Failed attempt to bake " << mTexLayerSet->getBodyRegionName() << llendl;
+			llinfos << "Failed attempt to bake " << mTexLayerSet->getBodyRegion() << llendl;
 			mUploadPending = FALSE;
 		}
 		else
 		{
 			if (mTexLayerSet->isVisible())
 			{
-				mTexLayerSet->getAvatar()->debugBakedTextureUpload(mTexLayerSet->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish.
-				doUpload();
+				readBackAndUpload();
 			}
 			else
 			{
 				mUploadPending = FALSE;
 				mNeedsUpload = FALSE;
-				mNeedsUploadTimer.pause();
 				mTexLayerSet->getAvatar()->setNewBakedTexture(mTexLayerSet->getBakedTexIndex(),IMG_INVISIBLE);
 			}
 		}
 	}
-	
-	if (update_now)
-	{
-		doUpdate();
-	}
 
 	// reset GL state
 	gGL.setColorMask(true, true);
@@ -327,79 +248,17 @@ BOOL LLTexLayerSetBuffer::render()
 
 	// we have valid texture data now
 	mGLTexturep->setGLTextureCreated(true);
+	mNeedsUpdate = FALSE;
 
 	return success;
 }
 
-BOOL LLTexLayerSetBuffer::isInitialized(void) const
+bool LLTexLayerSetBuffer::isInitialized(void) const
 {
 	return mGLTexturep.notNull() && mGLTexturep->isGLTextureCreated();
 }
 
-BOOL LLTexLayerSetBuffer::uploadPending() const
-{
-	return mUploadPending;
-}
-
-BOOL LLTexLayerSetBuffer::uploadNeeded() const
-{
-	return mNeedsUpload;
-}
-
-BOOL LLTexLayerSetBuffer::uploadInProgress() const
-{
-	return !mUploadID.isNull();
-}
-
-BOOL LLTexLayerSetBuffer::isReadyToUpload() const
-{
-	if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries.
-	if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) return FALSE; // Don't upload if avatar is using composites.
-
-	// If we requested an upload and have the final LOD ready, then upload.
-	if (mTexLayerSet->isLocalTextureDataFinal()) return TRUE;
-
-	// Upload if we've hit a timeout.  Upload is a pretty expensive process so we need to make sure
-	// we aren't doing uploads too frequently.
-	const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout");
-	if (texture_timeout != 0)
-	{
-		// The timeout period increases exponentially between every lowres upload in order to prevent
-		// spamming the server with frequent uploads.
-		const U32 texture_timeout_threshold = texture_timeout*(1 << mNumLowresUploads);
-
-		// If we hit our timeout and have textures available at even lower resolution, then upload.
-		const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold;
-		const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable();
-		if (has_lower_lod && is_upload_textures_timeout) return TRUE; 
-	}
-
-	return FALSE;
-}
-
-BOOL LLTexLayerSetBuffer::isReadyToUpdate() const
-{
-	// If we requested an update and have the final LOD ready, then update.
-	if (mTexLayerSet->isLocalTextureDataFinal()) return TRUE;
-
-	// If we haven't done an update yet, then just do one now regardless of state of textures.
-	if (mNumLowresUpdates == 0) return TRUE;
-
-	// Update if we've hit a timeout.  Unlike for uploads, we can make this timeout fairly small
-	// since render unnecessarily doesn't cost much.
-	const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedLocalTextureUpdateTimeout");
-	if (texture_timeout != 0)
-	{
-		// If we hit our timeout and have textures available at even lower resolution, then update.
-		const BOOL is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= texture_timeout;
-		const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable();
-		if (has_lower_lod && is_update_textures_timeout) return TRUE; 
-	}
-
-	return FALSE;
-}
-
-BOOL LLTexLayerSetBuffer::requestUpdateImmediate()
+BOOL LLTexLayerSetBuffer::updateImmediate()
 {
 	mNeedsUpdate = TRUE;
 	BOOL result = FALSE;
@@ -414,37 +273,42 @@ BOOL LLTexLayerSetBuffer::requestUpdateImmediate()
 	return result;
 }
 
-// Create the baked texture, send it out to the server, then wait for it to come
-// back so we can switch to using it.
-void LLTexLayerSetBuffer::doUpload()
+void LLTexLayerSetBuffer::readBackAndUpload()
 {
-	llinfos << "Uploading baked " << mTexLayerSet->getBodyRegionName() << llendl;
-	LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES);
-
-	// Don't need caches since we're baked now.  (note: we won't *really* be baked 
-	// until this image is sent to the server and the Avatar Appearance message is received.)
-	mTexLayerSet->deleteCaches();
-
-	// Get the COLOR information from our texture
+	// pointers for storing data to upload
 	U8* baked_color_data = new U8[ mFullWidth * mFullHeight * 4 ];
+	
 	glReadPixels(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, GL_RGBA, GL_UNSIGNED_BYTE, baked_color_data );
 	stop_glerror();
 
-	// Get the MASK information from our texture
+	llinfos << "Baked " << mTexLayerSet->getBodyRegion() << llendl;
+	LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES);
+
+	// We won't need our caches since we're baked now.  (Techically, we won't 
+	// really be baked until this image is sent to the server and the Avatar
+	// Appearance message is received.)
+	mTexLayerSet->deleteCaches();
+
 	LLGLSUIDefault gls_ui;
+
 	LLPointer<LLImageRaw> baked_mask_image = new LLImageRaw(mFullWidth, mFullHeight, 1 );
 	U8* baked_mask_data = baked_mask_image->getData(); 
+	
 	mTexLayerSet->gatherMorphMaskAlpha(baked_mask_data, mFullWidth, mFullHeight);
 
+	// writes into baked_color_data
+	const char* comment_text = NULL;
 
-	// Create the baked image from our color and mask information
-	const S32 baked_image_components = 5; // red green blue [bump] clothing
+	S32 baked_image_components = 5; // red green blue [bump] clothing
 	LLPointer<LLImageRaw> baked_image = new LLImageRaw( mFullWidth, mFullHeight, baked_image_components );
 	U8* baked_image_data = baked_image->getData();
+	
+	comment_text = LINDEN_J2C_COMMENT_PREFIX "RGBHM"; // 5 channels: rgb, heightfield/alpha, mask
+
 	S32 i = 0;
-	for (S32 u=0; u < mFullWidth; u++)
+	for( S32 u = 0; u < mFullWidth; u++ )
 	{
-		for (S32 v=0; v < mFullHeight; v++)
+		for( S32 v = 0; v < mFullHeight; v++ )
 		{
 			baked_image_data[5*i + 0] = baked_color_data[4*i + 0];
 			baked_image_data[5*i + 1] = baked_color_data[4*i + 1];
@@ -457,19 +321,21 @@ void LLTexLayerSetBuffer::doUpload()
 	
 	LLPointer<LLImageJ2C> compressedImage = new LLImageJ2C;
 	compressedImage->setRate(0.f);
-	const char* comment_text = LINDEN_J2C_COMMENT_PREFIX "RGBHM"; // writes into baked_color_data. 5 channels (rgb, heightfield/alpha, mask)
-	if (compressedImage->encode(baked_image, comment_text))
+	LLTransactionID tid;
+	LLAssetID asset_id;
+	tid.generate();
+	asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
+
+	BOOL res = false;
+	if( compressedImage->encode(baked_image, comment_text))
 	{
-		LLTransactionID tid;
-		tid.generate();
-		const LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
-		if (LLVFile::writeFile(compressedImage->getData(), compressedImage->getDataSize(),
-							   gVFS, asset_id, LLAssetType::AT_TEXTURE))
+		res = LLVFile::writeFile(compressedImage->getData(), compressedImage->getDataSize(),
+								 gVFS, asset_id, LLAssetType::AT_TEXTURE);
+		if (res)
 		{
-			// Read back the file and validate.
-			BOOL valid = FALSE;
 			LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
-			S32 file_size = 0;
+			BOOL valid = FALSE;
+			S32 file_size;
 			U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size);
 			if (data)
 			{
@@ -480,27 +346,29 @@ void LLTexLayerSetBuffer::doUpload()
 				integrity_test->setLastError("Unable to read entire file");
 			}
 			
-			if (valid)
+			if( valid )
 			{
-				// Baked_upload_data is owned by the responder and deleted after the request completes.
-				LLBakedUploadData* baked_upload_data = new LLBakedUploadData(gAgentAvatarp, 
-																			 this->mTexLayerSet, 
-																			 asset_id);
-				// upload ID is used to avoid overlaps, e.g. when the user rapidly makes two changes outside of Face Edit.
+				// baked_upload_data is owned by the responder and deleted after the request completes
+				LLBakedUploadData* baked_upload_data =
+					new LLBakedUploadData(gAgentAvatarp, this->mTexLayerSet, asset_id);
 				mUploadID = asset_id;
+				
+				// upload the image
+				std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture");
 
-				// Upload the image
-				const std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture");
 				if(!url.empty()
-					&& !LLPipeline::sForceOldBakedUpload) // toggle debug setting UploadBakedTexOld to change between the new caps method and old method
+					&& !LLPipeline::sForceOldBakedUpload) // Toggle the debug setting UploadBakedTexOld to change between the new caps method and old method
 				{
+					llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl;
+
 					LLSD body = LLSD::emptyMap();
-					// The responder will call LLTexLayerSetBuffer::onTextureUploadComplete()
 					LLHTTPClient::post(url, body, new LLSendTexLayerResponder(body, mUploadID, LLAssetType::AT_TEXTURE, baked_upload_data));
-					llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl;
+					// Responder will call LLTexLayerSetBuffer::onTextureUploadComplete()
 				} 
 				else
 				{
+					llinfos << "Baked texture upload via Asset Store." <<  llendl;
+					// gAssetStorage->storeAssetData(mTransactionID, LLAssetType::AT_IMAGE_JPEG, &uploadCallback, (void *)this, FALSE);
 					gAssetStorage->storeAssetData(tid,
 												  LLAssetType::AT_TEXTURE,
 												  LLTexLayerSetBuffer::onTextureUploadComplete,
@@ -508,88 +376,28 @@ void LLTexLayerSetBuffer::doUpload()
 												  TRUE,		// temp_file
 												  TRUE,		// is_priority
 												  TRUE);	// store_local
-					llinfos << "Baked texture upload via Asset Store." <<  llendl;
-				}
-
-				const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal();	
-				if (highest_lod)
-				{
-					// Sending the final LOD for the baked texture.  All done, pause 
-					// the upload timer so we know how long it took.
-					mNeedsUpload = FALSE;
-					mNeedsUploadTimer.pause();
-				}
-				else
-				{
-					// Sending a lower level LOD for the baked texture.  Restart the upload timer.
-					mNumLowresUploads++;
-					mNeedsUploadTimer.unpause();
-					mNeedsUploadTimer.reset();
-				}
-
-				// Print out notification that we uploaded this texture.
-				if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
-				{
-					const std::string lod_str = highest_lod ? "HighRes" : "LowRes";
-					LLSD args;
-					args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32());
-					args["TIME"] = llformat("%d",(U32)mNeedsUploadTimer.getElapsedTimeF32());
-					args["BODYREGION"] = mTexLayerSet->getBodyRegionName();
-					args["RESOLUTION"] = lod_str;
-					LLNotificationsUtil::add("AvatarRezSelfBakedTextureUploadNotification",args);
-					llinfos << "Uploading [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUploadTimer.getElapsedTimeF32() << " ]" << llendl;
 				}
+		
+				mNeedsUpload = FALSE;
 			}
 			else
 			{
-				// The read back and validate operation failed.  Remove the uploaded file.
 				mUploadPending = FALSE;
+				llinfos << "unable to create baked upload file: corrupted" << llendl;
 				LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE, LLVFile::WRITE);
 				file.remove();
-				llinfos << "Unable to create baked upload file (reason: corrupted)." << llendl;
 			}
 		}
 	}
-	else
+	if (!res)
 	{
-		// The VFS write file operation failed.
 		mUploadPending = FALSE;
-		llinfos << "Unable to create baked upload file (reason: failed to write file)" << llendl;
+		llinfos << "unable to create baked upload file" << llendl;
 	}
 
 	delete [] baked_color_data;
 }
 
-// Mostly bookkeeping; don't need to actually "do" anything since
-// render() will actually do the update.
-void LLTexLayerSetBuffer::doUpdate()
-{
-	const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal();
-	if (highest_lod)
-	{
-		mNeedsUpdate = FALSE;
-	}
-	else
-	{
-		mNumLowresUpdates++;
-	}
-
-	restartUpdateTimer();
-	
-	// Print out notification that we uploaded this texture.
-	if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
-	{
-		const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal();
-		const std::string lod_str = highest_lod ? "HighRes" : "LowRes";
-		LLSD args;
-		args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32());
-		args["TIME"] = llformat("%d",(U32)mNeedsUpdateTimer.getElapsedTimeF32());
-		args["BODYREGION"] = mTexLayerSet->getBodyRegionName();
-		args["RESOLUTION"] = lod_str;
-		LLNotificationsUtil::add("AvatarRezSelfBakedTextureUpdateNotification",args);
-		llinfos << "Locally updating [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUpdateTimer.getElapsedTimeF32() << " ]" << llendl;
-	}
-}
 
 // static
 void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
@@ -599,11 +407,12 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
 {
 	LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata;
 
-	if ((result == 0) &&
+	if (0 == result &&
 		isAgentAvatarValid() &&
 		!gAgentAvatarp->isDead() &&
-		(baked_upload_data->mAvatar == gAgentAvatarp) && // Sanity check: only the user's avatar should be uploading textures.
-		(baked_upload_data->mTexLayerSet->hasComposite()))
+		baked_upload_data->mAvatar == gAgentAvatarp && // Sanity check: only the user's avatar should be uploading textures.
+		baked_upload_data->mTexLayerSet->hasComposite()
+		)
 	{
 		LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getComposite();
 			
@@ -622,9 +431,10 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
 		{
 			// This is the upload we're currently waiting for.
 			layerset_buffer->mUploadID.setNull();
+			layerset_buffer->mUploadPending = FALSE;
+
 			if (result >= 0)
 			{
-				layerset_buffer->mUploadPending = FALSE;
 				LLVOAvatarDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet);
 				// Update baked texture info with the new UUID
 				U64 now = LLFrameTimer::getTotalTime();		// Record starting time
@@ -941,7 +751,7 @@ BOOL LLTexLayerSet::isBodyRegion(const std::string& region) const
 	return mInfo->mBodyRegion == region; 
 }
 
-const std::string LLTexLayerSet::getBodyRegionName() const 
+const std::string LLTexLayerSet::getBodyRegion() const 
 { 
 	return mInfo->mBodyRegion; 
 }
@@ -971,7 +781,7 @@ void LLTexLayerSet::cancelUpload()
 
 void LLTexLayerSet::createComposite()
 {
-	if(!mComposite)
+	if( !mComposite )
 	{
 		S32 width = mInfo->mWidth;
 		S32 height = mInfo->mHeight;
@@ -1001,20 +811,12 @@ void LLTexLayerSet::setUpdatesEnabled( BOOL b )
 void LLTexLayerSet::updateComposite()
 {
 	createComposite();
-	mComposite->requestUpdateImmediate();
+	mComposite->updateImmediate();
 }
 
 LLTexLayerSetBuffer* LLTexLayerSet::getComposite()
 {
-	if (!mComposite)
-	{
-		createComposite();
-	}
-	return mComposite;
-}
-
-const LLTexLayerSetBuffer* LLTexLayerSet::getComposite() const
-{
+	createComposite();
 	return mComposite;
 }
 
@@ -1097,11 +899,11 @@ void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_
 	mAvatar->applyMorphMask(tex_data, width, height, num_components, mBakedTexIndex);
 }
 
-BOOL LLTexLayerSet::isMorphValid() const
+BOOL LLTexLayerSet::isMorphValid()
 {
-	for(layer_list_t::const_iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+	for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
 	{
-		const LLTexLayerInterface* layer = *iter;
+		LLTexLayerInterface* layer = *iter;
 		if (layer && !layer->isMorphValid())
 		{
 			return FALSE;
@@ -1222,7 +1024,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
 			}
 			if (mLocalTexture == TEX_NUM_INDICES)
 			{
-				llwarns << "<texture> element has invalid local_texture attribute: " << mName << " " << local_texture_name << llendl;
+				llwarns << "<texture> element has invalid local_texure attribute: " << mName << " " << local_texture_name << llendl;
 				return FALSE;
 			}
 		}
@@ -1317,6 +1119,7 @@ BOOL LLTexLayerInfo::createVisualParams(LLVOAvatar *avatar)
 LLTexLayerInterface::LLTexLayerInterface(LLTexLayerSet* const layer_set):
 	mTexLayerSet( layer_set ),
 	mMorphMasksValid( FALSE ),
+	mStaticImageInvalid( FALSE ),
 	mInfo(NULL),
 	mHasMorph(FALSE)
 {
@@ -1430,17 +1233,17 @@ void LLTexLayerInterface::invalidateMorphMasks()
 	mMorphMasksValid = FALSE;
 }
 
-LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const
+LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index)
 {
 	LLViewerVisualParam *result = NULL;
-	for (param_color_list_t::const_iterator color_iter = mParamColorList.begin(); color_iter != mParamColorList.end() && !result; ++color_iter)
+	for (param_color_list_t::iterator color_iter = mParamColorList.begin(); color_iter != mParamColorList.end() && !result; ++color_iter)
 	{
 		if ((*color_iter)->getID() == index)
 		{
 			result = *color_iter;
 		}
 	}
-	for (param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin(); alpha_iter != mParamAlphaList.end() && !result; ++alpha_iter)
+	for (param_alpha_list_t::iterator alpha_iter = mParamAlphaList.begin(); alpha_iter != mParamAlphaList.end() && !result; ++alpha_iter)
 	{
 		if ((*alpha_iter)->getID() == index)
 		{
@@ -1694,7 +1497,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
 	return success;
 }
 
-const U8*	LLTexLayer::getAlphaData() const
+U8*	LLTexLayer::getAlphaData()
 {
 	LLCRC alpha_mask_crc;
 	const LLUUID& uuid = getUUID();
@@ -1710,7 +1513,7 @@ const U8*	LLTexLayer::getAlphaData() const
 
 	U32 cache_index = alpha_mask_crc.getCRC();
 
-	alpha_cache_t::const_iterator iter2 = mAlphaCache.find(cache_index);
+	alpha_cache_t::iterator iter2 = mAlphaCache.find(cache_index);
 	return (iter2 == mAlphaCache.end()) ? 0 : iter2->second;
 }
 
@@ -1933,7 +1736,7 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
 void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height)
 {
 	S32 size = width * height;
-	const U8* alphaData = getAlphaData();
+	U8* alphaData = getAlphaData();
 	if (!alphaData && hasAlphaParams())
 	{
 		LLColor4 net_color;
@@ -1956,7 +1759,7 @@ void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32
 	}
 }
 
-/*virtual*/ BOOL LLTexLayer::isInvisibleAlphaMask() const
+/*virtual*/ BOOL LLTexLayer::isInvisibleAlphaMask()
 {
 	if (mLocalTextureObject)
 	{
@@ -1969,7 +1772,8 @@ void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32
 	return FALSE;
 }
 
-LLUUID LLTexLayer::getUUID() const
+// private helper function
+LLUUID LLTexLayer::getUUID()
 {
 	LLUUID uuid;
 	if( getInfo()->mLocalTexture != -1 )
@@ -2028,7 +1832,7 @@ LLTexLayerTemplate::~LLTexLayerTemplate()
 	return LLTexLayerInterface::setInfo(info, wearable);
 }
 
-U32 LLTexLayerTemplate::updateWearableCache() const
+U32 LLTexLayerTemplate::updateWearableCache()
 {
 	mWearableCache.clear();
 
@@ -2038,7 +1842,7 @@ U32 LLTexLayerTemplate::updateWearableCache() const
 		//this isn't a cloneable layer 
 		return 0;
 	}
-	LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te);
+	EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te);
 	U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
 	U32 added = 0;
 	for (U32 i = 0; i < num_wearables; i++)
@@ -2053,7 +1857,7 @@ U32 LLTexLayerTemplate::updateWearableCache() const
 	}
 	return added;
 }
-LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
+LLTexLayer* LLTexLayerTemplate::getLayer(U32 i)
 {
 	if (mWearableCache.size() <= i)
 	{
@@ -2162,7 +1966,7 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
 	}
 }
 
-/*virtual*/ BOOL LLTexLayerTemplate::isInvisibleAlphaMask() const
+/*virtual*/ BOOL LLTexLayerTemplate::isInvisibleAlphaMask()
 {
 	U32 num_wearables = updateWearableCache();
 	for (U32 i = 0; i < num_wearables; i++)
@@ -2186,17 +1990,19 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
 //-----------------------------------------------------------------------------
 LLTexLayerInterface*  LLTexLayerSet::findLayerByName(const std::string& name)
 {
-	for (layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+	for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
 	{
 		LLTexLayerInterface* layer = *iter;
+
 		if (layer->getName() == name)
 		{
 			return layer;
 		}
 	}
-	for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ )
+	for( layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ )
 	{
 		LLTexLayerInterface* layer = *iter;
+
 		if (layer->getName() == name)
 		{
 			return layer;
@@ -2241,7 +2047,7 @@ LLTexLayerStaticImageList::~LLTexLayerStaticImageList()
 	deleteCachedImages();
 }
 
-void LLTexLayerStaticImageList::dumpByteCount() const
+void LLTexLayerStaticImageList::dumpByteCount()
 {
 	llinfos << "Avatar Static Textures " <<
 		"KB GL:" << (mGLBytes / 1024) <<
@@ -2356,23 +2162,4 @@ BOOL LLTexLayerStaticImageList::loadImageRaw(const std::string& file_name, LLIma
 	return success;
 }
 
-const std::string LLTexLayerSetBuffer::dumpTextureInfo() const
-{
-	if (!isAgentAvatarValid()) return "";
-
-	const BOOL is_high_res = !mNeedsUpload;
-	const U32 num_low_res = mNumLowresUploads;
-	const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32();
-	const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet);
 
-	std::string status 				= "CREATING ";
-	if (!uploadNeeded()) status 	= "DONE     ";
-	if (uploadInProgress()) status 	= "UPLOADING";
-
-	std::string text = llformat("[%s] [HiRes:%d LoRes:%d] [Elapsed:%d] %s",
-								status.c_str(),
-								is_high_res, num_low_res,
-								upload_time, 
-								local_texture_info.c_str());
-	return text;
-}
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 2fd0a22f809d056d3a261bc3e1af031b2f688255..651070a2eab9d32b62b28052aff6da2e90edce50 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -2,25 +2,31 @@
  * @file lltexturecache.cpp
  * @brief Object which handles local texture caching
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -385,7 +391,6 @@ bool LLTextureCacheRemoteWorker::doRead()
 		}
 		else
 		{
-			//llinfos << "texture " << mID.asString() << " found in local_assets" << llendl;
 			mImageSize = local_size;
 			mImageLocal = TRUE;
 		}
@@ -396,8 +401,7 @@ bool LLTextureCacheRemoteWorker::doRead()
 	// Second state / stage : identify the cache or not...
 	if (!done && (mState == CACHE))
 	{
-		LLTextureCache::Entry entry ;
-		idx = mCache->getHeaderCacheEntry(mID, entry);
+		idx = mCache->getHeaderCacheEntry(mID, mImageSize);
 		if (idx < 0)
 		{
 			// The texture is *not* cached. We're done here...
@@ -406,7 +410,6 @@ bool LLTextureCacheRemoteWorker::doRead()
 		}
 		else
 		{
-			mImageSize = entry.mImageSize ;
 			// If the read offset is bigger than the header cache, we read directly from the body
 			// Note that currently, we *never* read with offset from the cache, so the result is *always* HEADER
 			mState = mOffset < TEXTURE_CACHE_ENTRY_SIZE ? HEADER : BODY;
@@ -528,14 +531,13 @@ bool LLTextureCacheRemoteWorker::doRead()
 bool LLTextureCacheRemoteWorker::doWrite()
 {
 	bool done = false;
-	S32 idx = -1;	
+	S32 idx = -1;
 
 	// First state / stage : check that what we're trying to cache is in an OK shape
 	if (mState == INIT)
 	{
 		llassert_always(mOffset == 0);	// We currently do not support write offsets
 		llassert_always(mDataSize > 0); // Things will go badly wrong if mDataSize is nul or negative...
-		llassert_always(mImageSize >= mDataSize);
 		mState = CACHE;
 	}
 	
@@ -545,19 +547,14 @@ bool LLTextureCacheRemoteWorker::doWrite()
 	if (!done && (mState == CACHE))
 	{
 		bool alreadyCached = false;
-		LLTextureCache::Entry entry ;
-
+		S32 cur_imagesize = 0;
 		// Checks if this image is already in the entry list
-		idx = mCache->getHeaderCacheEntry(mID, entry);
-		if(idx < 0)
-		{
-			idx = mCache->setHeaderCacheEntry(mID, entry, mImageSize, mDataSize); // create the new entry.
-		}
-		else
+		idx = mCache->getHeaderCacheEntry(mID, cur_imagesize);
+		if (idx >= 0 && (cur_imagesize > 0))
 		{
-			alreadyCached = mCache->updateEntry(idx, entry, mImageSize, mDataSize); // update the existing entry.
+			alreadyCached = true;	// already there and non empty
 		}
-
+		idx = mCache->setHeaderCacheEntry(mID, mImageSize); // create or touch the entry
 		if (idx < 0)
 		{
 			llwarns << "LLTextureCacheWorker: "  << mID
@@ -567,6 +564,10 @@ bool LLTextureCacheRemoteWorker::doWrite()
 		}
 		else
 		{
+			if (cur_imagesize > 0 && (mImageSize != cur_imagesize))
+			{
+				alreadyCached = false; // re-write the header if the size changed in all cases
+			}
 			if (alreadyCached && (mDataSize <= TEXTURE_CACHE_ENTRY_SIZE))
 			{
 				// Small texture already cached case: we're done with writing
@@ -629,7 +630,7 @@ bool LLTextureCacheRemoteWorker::doWrite()
 	{
 		llassert(mDataSize > TEXTURE_CACHE_ENTRY_SIZE);	// wouldn't make sense to be here otherwise...
 		S32 file_size = mDataSize - TEXTURE_CACHE_ENTRY_SIZE;
-		
+		if ((file_size > 0) && mCache->updateTextureEntryList(mID, file_size))
 		{
 			// build the cache file name from the UUID
 			std::string filename = mCache->getTextureFileName(mID);			
@@ -647,7 +648,10 @@ bool LLTextureCacheRemoteWorker::doWrite()
 				done = true;
 			}
 		}
-		
+		else
+		{
+			mDataSize = 0; // no data written
+		}
 		// Nothing else to do at that point...
 		done = true;
 	}
@@ -738,7 +742,7 @@ LLTextureCache::LLTextureCache(bool threaded)
 	  mHeaderMutex(NULL),
 	  mListMutex(NULL),
 	  mHeaderAPRFile(NULL),
-	  mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called.
+	  mReadOnly(FALSE),
 	  mTexturesSizeTotal(0),
 	  mDoPurge(FALSE)
 {
@@ -821,6 +825,53 @@ std::string LLTextureCache::getTextureFileName(const LLUUID& id)
 	return filename;
 }
 
+bool LLTextureCache::updateTextureEntryList(const LLUUID& id, S32 bodysize)
+{
+	bool res = false;
+	bool purge = false;
+	{
+		LLMutexLock lock(&mHeaderMutex);
+		size_map_t::iterator iter1 = mTexturesSizeMap.find(id);
+		if (iter1 == mTexturesSizeMap.end() || iter1->second < bodysize)
+		{
+			llassert_always(bodysize > 0);
+
+			S32 oldbodysize = 0;
+			if (iter1 != mTexturesSizeMap.end())
+			{
+				oldbodysize = iter1->second;
+			}
+						
+			Entry entry;
+			S32 idx = openAndReadEntry(id, entry, false);
+			if (idx < 0)
+			{
+				llwarns << "Failed to open entry: " << id << llendl;
+				removeCachedTexture(id) ;
+				return false;
+			}			
+			else if (oldbodysize != entry.mBodySize)
+			{
+				// only happens to 64 bits systems, do not know why.
+				llwarns << "Entry mismatch in mTextureSizeMap / mHeaderIDMap"
+					   << " idx=" << idx << " oldsize=" << oldbodysize << " entrysize=" << entry.mBodySize << llendl;
+			}
+			updateEntry(idx, entry, entry.mImageSize, bodysize);			
+			
+			if (mTexturesSizeTotal > sCacheMaxTexturesSize)
+			{
+				purge = true;
+			}
+			res = true;
+		}
+	}
+	if (purge)
+	{
+		mDoPurge = TRUE;
+	}
+	return res;
+}
+
 //debug
 BOOL LLTextureCache::isInCache(const LLUUID& id) 
 {
@@ -878,16 +929,13 @@ U32 LLTextureCache::sCacheMaxEntries = MAX_REASONABLE_FILE_SIZE / TEXTURE_CACHE_
 S64 LLTextureCache::sCacheMaxTexturesSize = 0; // no limit
 const char* entries_filename = "texture.entries";
 const char* cache_filename = "texture.cache";
-const char* old_textures_dirname = "textures";
-//change the location of the texture cache to prevent from being deleted by old version viewers.
-const char* textures_dirname = "texturecache";
+const char* textures_dirname = "textures";
 
 void LLTextureCache::setDirNames(ELLPath location)
 {
 	std::string delem = gDirUtilp->getDirDelimiter();
-
-	mHeaderEntriesFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, entries_filename);
-	mHeaderDataFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, cache_filename);
+	mHeaderEntriesFileName = gDirUtilp->getExpandedFilename(location, entries_filename);
+	mHeaderDataFileName = gDirUtilp->getExpandedFilename(location, cache_filename);
 	mTexturesDirName = gDirUtilp->getExpandedFilename(location, textures_dirname);
 }
 
@@ -899,38 +947,16 @@ void LLTextureCache::purgeCache(ELLPath location)
 	{
 		setDirNames(location);
 		llassert_always(mHeaderAPRFile == NULL);
-
-		//remove the legacy cache if exists
-		std::string texture_dir = mTexturesDirName ;
-		mTexturesDirName = gDirUtilp->getExpandedFilename(location, old_textures_dirname);
-		if(LLFile::isdir(mTexturesDirName))
-		{
-			std::string file_name = gDirUtilp->getExpandedFilename(location, entries_filename);
-			LLAPRFile::remove(file_name, getLocalAPRFilePool());
-
-			file_name = gDirUtilp->getExpandedFilename(location, cache_filename);
-			LLAPRFile::remove(file_name, getLocalAPRFilePool());
-
-			purgeAllTextures(true);
-		}
-		mTexturesDirName = texture_dir ;
+		LLAPRFile::remove(mHeaderEntriesFileName, getLocalAPRFilePool());
+		LLAPRFile::remove(mHeaderDataFileName, getLocalAPRFilePool());
 	}
-
-	//remove the current texture cache.
 	purgeAllTextures(true);
 }
 
-//is called in the main thread before initCache(...) is called.
-void LLTextureCache::setReadOnly(BOOL read_only)
-{
-	mReadOnly = read_only ;
-}
-
-//called in the main thread.
-S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL disable_texture_cache)
+S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL read_only)
 {
-	llassert_always(getPending() == 0) ; //should not start accessing the texture cache before initialized.
-
+	mReadOnly = read_only;
+	
 	S64 header_size = (max_size * 2) / 10;
 	S64 max_entries = header_size / TEXTURE_CACHE_ENTRY_SIZE;
 	sCacheMaxEntries = (S32)(llmin((S64)sCacheMaxEntries, max_entries));
@@ -942,15 +968,6 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL disable_textu
 		sCacheMaxTexturesSize = max_size;
 	max_size -= sCacheMaxTexturesSize;
 	
-	if(disable_texture_cache) //the texture cache is disabled
-	{
-		llinfos << "The texture cache is disabled!" << llendl ;
-		setReadOnly(TRUE) ;
-		purgeAllTextures(true); 
-
-		return max_size ;
-	}
-
 	LL_INFOS("TextureCache") << "Headers: " << sCacheMaxEntries
 			<< " Textures size: " << sCacheMaxTexturesSize/(1024*1024) << " MB" << LL_ENDL;
 
@@ -959,7 +976,6 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL disable_textu
 	if (!mReadOnly)
 	{
 		LLFile::mkdir(mTexturesDirName);
-		
 		const char* subdirs = "0123456789abcdef";
 		for (S32 i=0; i<16; i++)
 		{
@@ -970,8 +986,6 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL disable_textu
 	readHeaderCache();
 	purgeTextures(true); // calc mTexturesSize and make some room in the texture cache if we need it
 
-	llassert_always(getPending() == 0) ; //should not start accessing the texture cache before initialized.
-
 	return max_size; // unused cache space
 }
 
@@ -992,11 +1006,7 @@ LLAPRFile* LLTextureCache::openHeaderEntriesFile(bool readonly, S32 offset)
 
 void LLTextureCache::closeHeaderEntriesFile()
 {
-	if(!mHeaderAPRFile)
-	{
-		return ;
-	}
-
+	llassert_always(mHeaderAPRFile != NULL);
 	delete mHeaderAPRFile;
 	mHeaderAPRFile = NULL;
 }
@@ -1113,7 +1123,7 @@ S32 LLTextureCache::openAndReadEntry(const LLUUID& id, Entry& entry, bool create
 }
 
 //mHeaderMutex is locked before calling this.
-void LLTextureCache::writeEntryToHeaderImmediately(S32& idx, Entry& entry, bool write_header)
+void LLTextureCache::writeEntryToHeaderImmediately(S32 idx, Entry& entry, bool write_header)
 {	
 	LLAPRFile* aprfile ;
 	S32 bytes_written ;
@@ -1122,13 +1132,7 @@ void LLTextureCache::writeEntryToHeaderImmediately(S32& idx, Entry& entry, bool
 	{
 		aprfile = openHeaderEntriesFile(false, 0);		
 		bytes_written = aprfile->write((U8*)&mHeaderEntriesInfo, sizeof(EntriesInfo)) ;
-		if(bytes_written != sizeof(EntriesInfo))
-		{
-			clearCorruptedCache() ; //clear the cache.
-			idx = -1 ;//mark the idx invalid.
-			return ;
-		}
-
+		llassert_always(bytes_written == sizeof(EntriesInfo));
 		mHeaderAPRFile->seek(APR_SET, offset);
 	}
 	else
@@ -1136,31 +1140,19 @@ void LLTextureCache::writeEntryToHeaderImmediately(S32& idx, Entry& entry, bool
 		aprfile = openHeaderEntriesFile(false, offset);
 	}
 	bytes_written = aprfile->write((void*)&entry, (S32)sizeof(Entry));
-	if(bytes_written != sizeof(Entry))
-	{
-		clearCorruptedCache() ; //clear the cache.
-		idx = -1 ;//mark the idx invalid.
-
-		return ;
-	}
-
+	llassert_always(bytes_written == sizeof(Entry));
 	closeHeaderEntriesFile();
 	mUpdatedEntryMap.erase(idx) ;
 }
 
 //mHeaderMutex is locked before calling this.
-void LLTextureCache::readEntryFromHeaderImmediately(S32& idx, Entry& entry)
+void LLTextureCache::readEntryFromHeaderImmediately(S32 idx, Entry& entry)
 {
 	S32 offset = sizeof(EntriesInfo) + idx * sizeof(Entry);
 	LLAPRFile* aprfile = openHeaderEntriesFile(true, offset);
 	S32 bytes_read = aprfile->read((void*)&entry, (S32)sizeof(Entry));
+	llassert_always(bytes_read == sizeof(Entry));			
 	closeHeaderEntriesFile();
-
-	if(bytes_read != sizeof(Entry))
-	{
-		clearCorruptedCache() ; //clear the cache.
-		idx = -1 ;//mark the idx invalid.
-	}
 }
 
 //mHeaderMutex is locked before calling this.
@@ -1178,64 +1170,55 @@ void LLTextureCache::updateEntryTimeStamp(S32 idx, Entry& entry)
 	{
 		if (!mReadOnly)
 		{
+			llassert_always(entry.mImageSize > entry.mBodySize);
+
 			entry.mTime = time(NULL);			
 			mUpdatedEntryMap[idx] = entry ;
 		}
 	}
 }
 
+//mHeaderMutex is locked before calling this.
 //update an existing entry, write to header file immediately.
-bool LLTextureCache::updateEntry(S32& idx, Entry& entry, S32 new_image_size, S32 new_data_size)
+void LLTextureCache::updateEntry(S32 idx, Entry& entry, S32 new_image_size, S32 new_body_size)
 {
-	S32 new_body_size = llmax(0, new_data_size - TEXTURE_CACHE_ENTRY_SIZE) ;
-	
+	llassert_always(new_image_size > -1) ;
+
 	if(new_image_size == entry.mImageSize && new_body_size == entry.mBodySize)
 	{
-		return true ; //nothing changed.
+		updateEntryTimeStamp(idx, entry) ; //nothing changed.
 	}
-	else 
+	else if (idx >= 0)
 	{
-		bool purge = false ;
-
-		lockHeaders() ;
-
-		bool update_header = false ;
-		if(entry.mImageSize < 0) //is a brand-new entry
-		{
-			mHeaderIDMap[entry.mID] = idx;
-			mTexturesSizeMap[entry.mID] = new_body_size ;
-			mTexturesSizeTotal += new_body_size ;
-			
-			// Update Header
-			update_header = true ;
-		}				
-		else if (entry.mBodySize != new_body_size)
-		{
-			//already in mHeaderIDMap.
-			mTexturesSizeMap[entry.mID] = new_body_size ;
-			mTexturesSizeTotal -= entry.mBodySize ;
-			mTexturesSizeTotal += new_body_size ;
-		}
-		entry.mTime = time(NULL);
-		entry.mImageSize = new_image_size ; 
-		entry.mBodySize = new_body_size ;
-		
-		writeEntryToHeaderImmediately(idx, entry, update_header) ;
-	
-		if (mTexturesSizeTotal > sCacheMaxTexturesSize)
+		if (!mReadOnly)
 		{
-			purge = true;
-		}
-		
-		unlockHeaders() ;
+			llassert_always(new_image_size > new_body_size) ;
 
-		if (purge)
-		{
-			mDoPurge = TRUE;
+			bool update_header = false ;
+			if(entry.mImageSize < 0) //is a brand-new entry
+			{
+				mHeaderIDMap[entry.mID] = idx;
+				mTexturesSizeMap[entry.mID] = new_body_size ;
+				mTexturesSizeTotal += new_body_size ;
+				
+				// Update Header
+				update_header = true ;
+			}				
+			else if (entry.mBodySize != new_body_size)
+			{
+				//already in mHeaderIDMap.
+				mTexturesSizeMap[entry.mID] = new_body_size ;
+				mTexturesSizeTotal -= entry.mBodySize ;
+				mTexturesSizeTotal += new_body_size ;
+			}
+			entry.mTime = time(NULL);
+			entry.mImageSize = new_image_size ; 
+			entry.mBodySize = new_body_size ;
+			
+// 			llinfos << "Updating TE: " << idx << ": " << id << " Size: " << entry.mBodySize << " Time: " << entry.mTime << llendl;			
+			writeEntryToHeaderImmediately(idx, entry, update_header) ;
 		}
 	}
-
-	return false ;
 }
 
 U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
@@ -1256,10 +1239,6 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
 	{
 		aprfile = openHeaderEntriesFile(false, 0);
 		updatedHeaderEntriesFile() ;
-		if(!aprfile)
-		{
-			return 0;
-		}
 		aprfile->seek(APR_SET, (S32)sizeof(EntriesInfo));
 	}
 	for (U32 idx=0; idx<num_entries; idx++)
@@ -1301,11 +1280,7 @@ void LLTextureCache::writeEntriesAndClose(const std::vector<Entry>& entries)
 		for (S32 idx=0; idx<num_entries; idx++)
 		{
 			S32 bytes_written = aprfile->write((void*)(&entries[idx]), (S32)sizeof(Entry));
-			if(bytes_written != sizeof(Entry))
-			{
-				clearCorruptedCache() ; //clear the cache.
-				return ;
-			}
+			llassert_always(bytes_written == sizeof(Entry));
 		}
 		closeHeaderEntriesFile();
 	}
@@ -1331,11 +1306,7 @@ void LLTextureCache::updatedHeaderEntriesFile()
 		//entriesInfo
 		mHeaderAPRFile->seek(APR_SET, 0);
 		S32 bytes_written = mHeaderAPRFile->write((U8*)&mHeaderEntriesInfo, sizeof(EntriesInfo)) ;
-		if(bytes_written != sizeof(EntriesInfo))
-		{
-			clearCorruptedCache() ; //clear the cache.
-			return ;
-		}
+		llassert_always(bytes_written == sizeof(EntriesInfo));
 		
 		//write each updated entry
 		S32 entry_size = (S32)sizeof(Entry) ;
@@ -1351,11 +1322,7 @@ void LLTextureCache::updatedHeaderEntriesFile()
 			}
 			
 			bytes_written = mHeaderAPRFile->write((void*)(&iter->second), entry_size);
-			if(bytes_written != entry_size)
-			{
-				clearCorruptedCache() ; //clear the cache.
-				return ;
-			}
+			llassert_always(bytes_written == entry_size);
 		}
 		mUpdatedEntryMap.clear() ;
 	}
@@ -1476,29 +1443,6 @@ void LLTextureCache::readHeaderCache()
 
 //////////////////////////////////////////////////////////////////////////////
 
-//the header mutex is locked before calling this.
-void LLTextureCache::clearCorruptedCache()
-{
-	llwarns << "the texture cache is corrupted, need to be cleared." << llendl ;
-
-	closeHeaderEntriesFile();//close possible file handler
-	purgeAllTextures(false) ; //clear the cache.
-	
-	if (!mReadOnly) //regenerate the directory tree if not exists.
-	{
-		LLFile::mkdir(mTexturesDirName);
-		
-		const char* subdirs = "0123456789abcdef";
-		for (S32 i=0; i<16; i++)
-		{
-			std::string dirname = mTexturesDirName + gDirUtilp->getDirDelimiter() + subdirs[i];
-			LLFile::mkdir(dirname);
-		}
-	}
-
-	return ;
-}
-
 void LLTextureCache::purgeAllTextures(bool purge_directories)
 {
 	if (!mReadOnly)
@@ -1518,23 +1462,20 @@ void LLTextureCache::purgeAllTextures(bool purge_directories)
 		}
 		if (purge_directories)
 		{
-			gDirUtilp->deleteFilesInDir(mTexturesDirName, mask);
+			gDirUtilp->deleteFilesInDir(mTexturesDirName,mask);
 			LLFile::rmdir(mTexturesDirName);
-		}		
+		}
 	}
 	mHeaderIDMap.clear();
 	mTexturesSizeMap.clear();
 	mTexturesSizeTotal = 0;
 	mFreeList.clear();
 	mTexturesSizeTotal = 0;
-	mUpdatedEntryMap.clear();
 
 	// Info with 0 entries
 	mHeaderEntriesInfo.mVersion = sHeaderCacheVersion;
 	mHeaderEntriesInfo.mEntries = 0;
 	writeEntriesHeader();
-
-	llinfos << "The entire texture cache is cleared." << llendl ;
 }
 
 void LLTextureCache::purgeTextures(bool validate)
@@ -1680,38 +1621,39 @@ LLTextureCacheWorker* LLTextureCache::getWriter(handle_t handle)
 // Called from work thread
 
 // Reads imagesize from the header, updates timestamp
-S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, Entry& entry)
+S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, S32& imagesize)
 {
-	LLMutexLock lock(&mHeaderMutex);	
+	LLMutexLock lock(&mHeaderMutex);
+	Entry entry;
 	S32 idx = openAndReadEntry(id, entry, false);
 	if (idx >= 0)
-	{		
+	{
+		imagesize = entry.mImageSize;
 		updateEntryTimeStamp(idx, entry); // updates time
 	}
 	return idx;
 }
 
 // Writes imagesize to the header, updates timestamp
-S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imagesize, S32 datasize)
+S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, S32 imagesize)
 {
 	mHeaderMutex.lock();
+	llassert_always(imagesize >= 0);
+	Entry entry;
 	S32 idx = openAndReadEntry(id, entry, true);
-	mHeaderMutex.unlock();
-
 	if (idx >= 0)
 	{
-		updateEntry(idx, entry, imagesize, datasize);				
+		updateEntry(idx, entry, imagesize, entry.mBodySize);
+		mHeaderMutex.unlock();
 	}
-
-	if(idx < 0) // retry
+	else // retry
 	{
+		mHeaderMutex.unlock();
 		readHeaderCache(); // We couldn't write an entry, so refresh the LRU
-	
 		mHeaderMutex.lock();
 		llassert_always(!mLRU.empty() || mHeaderEntriesInfo.mEntries < sCacheMaxEntries);
 		mHeaderMutex.unlock();
-
-		idx = setHeaderCacheEntry(id, entry, imagesize, datasize); // assert above ensures no inf. recursion
+		idx = setHeaderCacheEntry(id, imagesize); // assert above ensures no inf. recursion
 	}
 	return idx;
 }
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 1056b93e3c82f3097be388830d43e8d155f2ea88..a1b3c8dabd5e52c50a1093e87564206e08c5d611 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -3,25 +3,31 @@
  * @author Richard Nelson, James Cook
  * @brief LLTextureCtrl class implementation including related functions
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -94,7 +100,7 @@ class LLFloaterTexturePicker : public LLFloater
 		PermissionMask immediate_filter_perm_mask,
 		PermissionMask non_immediate_filter_perm_mask,
 		BOOL can_apply_immediately,
-		LLUIImagePtr fallback_image_name);
+		const std::string& fallback_image_name);
 
 	virtual ~LLFloaterTexturePicker();
 
@@ -147,7 +153,7 @@ class LLFloaterTexturePicker : public LLFloater
 	LLTextureCtrl*		mOwner;
 
 	LLUUID				mImageAssetID; // Currently selected texture
-	LLUIImagePtr		mFallbackImage; // What to show if currently selected texture is null.
+	std::string			mFallbackImageName; // What to show if currently selected texture is null.
 
 	LLUUID				mWhiteImageAssetID;
 	LLUUID				mSpecialCurrentImageAssetID;  // Used when the asset id has no corresponding texture in the user's inventory.
@@ -169,8 +175,6 @@ class LLFloaterTexturePicker : public LLFloater
 	BOOL				mNoCopyTextureSelected;
 	F32					mContextConeOpacity;
 	LLSaveFolderState	mSavedFolderState;
-
-	BOOL				mSelectedItemPinned;
 };
 
 LLFloaterTexturePicker::LLFloaterTexturePicker(	
@@ -179,11 +183,11 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
 	PermissionMask immediate_filter_perm_mask,
 	PermissionMask non_immediate_filter_perm_mask,
 	BOOL can_apply_immediately,
-	LLUIImagePtr fallback_image)
+	const std::string& fallback_image_name)
 :	LLFloater(LLSD()),
 	mOwner( owner ),
 	mImageAssetID( owner->getImageAssetID() ),
-	mFallbackImage( fallback_image ),
+	mFallbackImageName( fallback_image_name ),
 	mWhiteImageAssetID( gSavedSettings.getString( "UIImgWhiteUUID" ) ),
 	mOriginalImageAssetID(owner->getImageAssetID()),
 	mLabel(label),
@@ -193,8 +197,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
 	mFilterEdit(NULL),
 	mImmediateFilterPermMask(immediate_filter_perm_mask),
 	mNonImmediateFilterPermMask(non_immediate_filter_perm_mask),
-	mContextConeOpacity(0.f),
-	mSelectedItemPinned( FALSE )
+	mContextConeOpacity(0.f)
 {
 	mCanApplyImmediately = can_apply_immediately;
 	LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml",NULL);
@@ -420,13 +423,8 @@ BOOL LLFloaterTexturePicker::postBuild()
 		mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
 		mInventoryPanel->setAllowMultiSelect(FALSE);
 
-		// Disable auto selecting first filtered item because it takes away
-		// selection from the item set by LLTextureCtrl owning this floater.
-		mInventoryPanel->getRootFolder()->setAutoSelectOverride(TRUE);
-
-		// Commented out to scroll to currently selected texture. See EXT-5403.
-		// // store this filter as the default one
-		// mInventoryPanel->getRootFolder()->getFilter()->markDefault();
+		// store this filter as the default one
+		mInventoryPanel->getRootFolder()->getFilter()->markDefault();
 
 		// Commented out to stop opening all folders with textures
 		// mInventoryPanel->openDefaultFolderForType(LLFolderType::FT_TEXTURE);
@@ -535,6 +533,11 @@ void LLFloaterTexturePicker::draw()
 			mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, MIPMAP_YES);
 			mTexturep->setBoostLevel(LLViewerTexture::BOOST_PREVIEW);
 		}
+		else if (!mFallbackImageName.empty())
+		{
+			mTexturep = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName);
+			mTexturep->setBoostLevel(LLViewerTexture::BOOST_PREVIEW);
+		}
 
 		if (mTentativeLabel)
 		{
@@ -575,10 +578,13 @@ void LLFloaterTexturePicker::draw()
 
 			// Pump the priority
 			mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
-		}
-		else if (!mFallbackImage.isNull())
-		{
-			mFallbackImage->draw(interior);
+
+			// Draw Tentative Label over the image
+			if( mOwner->getTentative() && !mViewModel->isDirty() )
+			{
+				mTentativeLabel->setVisible( TRUE );
+				drawChild(mTentativeLabel);
+			}
 		}
 		else
 		{
@@ -587,38 +593,6 @@ void LLFloaterTexturePicker::draw()
 			// Draw X
 			gl_draw_x(interior, LLColor4::black );
 		}
-
-		// Draw Tentative Label over the image
-		if( mOwner->getTentative() && !mViewModel->isDirty() )
-		{
-			mTentativeLabel->setVisible( TRUE );
-			drawChild(mTentativeLabel);
-		}
-
-		if (mSelectedItemPinned) return;
-
-		LLFolderView* folder_view = mInventoryPanel->getRootFolder();
-		if (!folder_view) return;
-
-		LLInventoryFilter* filter = folder_view->getFilter();
-		if (!filter) return;
-
-		bool is_filter_active = folder_view->getCompletedFilterGeneration() < filter->getCurrentGeneration() &&
-				filter->isNotDefault();
-
-		// After inventory panel filter is applied we have to update
-		// constraint rect for the selected item because of folder view
-		// AutoSelectOverride set to TRUE. We force PinningSelectedItem
-		// flag to FALSE state and setting filter "dirty" to update
-		// scroll container to show selected item (see LLFolderView::doIdle()).
-		if (!is_filter_active && !mSelectedItemPinned)
-		{
-			folder_view->setPinningSelectedItem(mSelectedItemPinned);
-			folder_view->dirtyFilter();
-			folder_view->arrangeFromRoot();
-
-			mSelectedItemPinned = TRUE;
-		}
 	}
 }
 
@@ -852,7 +826,7 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string )
 		}
 	}
 
-	mInventoryPanel->setFilterSubString(search_string);
+	mInventoryPanel->setFilterSubString(upper_case_search_string);
 }
 
 void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
@@ -901,8 +875,7 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
 	mShowLoadingPlaceholder( TRUE ),
 	mImageAssetID(p.image_id),
 	mDefaultImageAssetID(p.default_image_id),
-	mDefaultImageName(p.default_image_name),
-	mFallbackImage(p.fallback_image)
+	mDefaultImageName(p.default_image_name)
 {
 	setAllowNoTexture(p.allow_no_texture);
 	setCanApplyImmediately(p.can_apply_immediately);
@@ -1046,7 +1019,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
 			mImmediateFilterPermMask,
 			mNonImmediateFilterPermMask,
 			mCanApplyImmediately,
-			mFallbackImage);
+			mFallbackImageName);
 
 		mFloaterHandle = floaterp->getHandle();
 
@@ -1164,20 +1137,6 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op)
 	}
 }
 
-void	LLTextureCtrl::setImageAssetName(const std::string& name)
-{
-	LLPointer<LLUIImage> imagep = LLUI::getUIImage(name);
-	if(imagep)
-	{
-		LLViewerFetchedTexture* pTexture = dynamic_cast<LLViewerFetchedTexture*>(imagep->getImage().get());
-		if(pTexture)
-		{
-			LLUUID id = pTexture->getID();
-			setImageAssetID(id);
-		}
-	}
-}
-
 void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id )
 {
 	if( mImageAssetID != asset_id )
@@ -1250,6 +1209,12 @@ void LLTextureCtrl::draw()
 
 		mTexturep = texture;
 	}
+	else if (!mFallbackImageName.empty())
+	{
+		// Show fallback image.
+		mTexturep = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName);
+		mTexturep->setBoostLevel(LLViewerTexture::BOOST_PREVIEW);
+	}
 	else//mImageAssetID == LLUUID::null
 	{
 		mTexturep = NULL;
@@ -1273,10 +1238,6 @@ void LLTextureCtrl::draw()
 		gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep);
 		mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
 	}
-	else if (!mFallbackImage.isNull())
-	{
-		mFallbackImage->draw(interior);
-	}
 	else
 	{
 		gl_rect_2d( interior, LLColor4::grey, TRUE );
@@ -1287,52 +1248,25 @@ void LLTextureCtrl::draw()
 
 	mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() );
 	
+	
 	// Show "Loading..." string on the top left corner while this texture is loading.
 	// Using the discard level, do not show the string if the texture is almost but not 
 	// fully loaded.
-	if (mTexturep.notNull() &&
-		(!mTexturep->isFullyLoaded()) &&
-		(mShowLoadingPlaceholder == TRUE))
+	if ( mTexturep.notNull() &&
+		 (!mTexturep->isFullyLoaded()) &&
+		 (mShowLoadingPlaceholder == TRUE) && 
+		 (mTexturep->getDiscardLevel() != 1) &&
+		 (mTexturep->getDiscardLevel() != 0))
 	{
-		U32 v_offset = 25;
 		LLFontGL* font = LLFontGL::getFontSansSerif();
-
-		// Don't show as loaded if the texture is almost fully loaded (i.e. discard1) unless god
-		if ((mTexturep->getDiscardLevel() > 1) || gAgent.isGodlike())
-		{
-			font->renderUTF8(
-				mLoadingPlaceholderString, 
-				0,
-				llfloor(interior.mLeft+3), 
-				llfloor(interior.mTop-v_offset),
-				LLColor4::white,
-				LLFontGL::LEFT,
-				LLFontGL::BASELINE,
-				LLFontGL::DROP_SHADOW);
-		}
-
-		// Optionally show more detailed information.
-		if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
-		{
-			LLFontGL* font = LLFontGL::getFontSansSerif();
-			std::string tdesc;
-			// Show what % the texture has loaded (0 to 100%, 100 is highest), and what level of detail (5 to 0, 0 is best).
-
-			v_offset += 12;
-			tdesc = llformat("  PK  : %d%%", U32(mTexturep->getDownloadProgress()*100.0));
-			font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
-							 LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
-
-			v_offset += 12;
-			tdesc = llformat("  LVL: %d", mTexturep->getDiscardLevel());
-			font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
-							 LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
-
-			v_offset += 12;
-			tdesc = llformat("  ID  : %s...", (mImageAssetID.asString().substr(0,7)).c_str());
-			font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
-							 LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
-		}
+		font->renderUTF8(
+			mLoadingPlaceholderString, 0,
+			llfloor(interior.mLeft+3), 
+			llfloor(interior.mTop-25),
+			LLColor4::white,
+			LLFontGL::LEFT,
+			LLFontGL::BASELINE,
+			LLFontGL::DROP_SHADOW);
 	}
 
 	LLUICtrl::draw();
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 749cf2c948e184dab17d1cec618ec961fd40b1ca..60657d3fa7ee1eed2716da2882db8841594dcc52 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -2,25 +2,31 @@
  * @file lltoast.cpp
  * @brief This class implements a placeholder for any notification panel.
  *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -61,7 +67,6 @@ LLToast::Params::Params()
 LLToast::LLToast(const LLToast::Params& p) 
 :	LLModalDialog(LLSD(), p.is_modal),
 	mPanel(p.panel), 
-	mToastLifetime(p.lifetime_secs),
 	mToastFadingTime(p.fading_time_secs),
 	mNotificationID(p.notif_id),  
 	mSessionID(p.session_id),
@@ -106,14 +111,6 @@ LLToast::LLToast(const LLToast::Params& p)
 		mOnMouseEnterSignal.connect(p.on_mouse_enter());
 }
 
-void LLToast::reshape(S32 width, S32 height, BOOL called_from_parent)
-{
-	// We shouldn't  use reshape from LLModalDialog since it changes toasts position.
-	// Toasts position should be controlled only by toast screen channel, see LLScreenChannelBase.
-	// see EXT-8044
-	LLFloater::reshape(width, height, called_from_parent);
-}
-
 //--------------------------------------------------------------------------
 BOOL LLToast::postBuild()
 {
@@ -122,9 +119,29 @@ BOOL LLToast::postBuild()
 		mTimer->stop();
 	}
 
+	if (mIsTip)
+	{
+		mTextEditor = mPanel->getChild<LLTextEditor>("text_editor_box");
+
+		if (mTextEditor)
+		{
+			mTextEditor->setMouseUpCallback(boost::bind(&LLToast::hide,this));
+			mPanel->setMouseUpCallback(boost::bind(&LLToast::handleTipToastClick, this, _2, _3, _4));
+		}
+	}
+
 	return TRUE;
 }
 
+//--------------------------------------------------------------------------
+void LLToast::handleTipToastClick(S32 x, S32 y, MASK mask)
+{
+	if (!mTextEditor->getRect().pointInRect(x, y))
+	{
+		hide();
+	}
+}
+
 //--------------------------------------------------------------------------
 void LLToast::setHideButtonEnabled(bool enabled)
 {
@@ -244,13 +261,6 @@ void LLToast::draw()
 			drawChild(mHideBtn);
 		}
 	}
-
-	// if timer started and remaining time <= fading time
-	if (mTimer->getStarted() && (mToastLifetime
-			- mTimer->getEventTimer().getElapsedTimeF32()) <= mToastFadingTime)
-	{
-		setBackgroundOpaque(FALSE);
-	}
 }
 
 //--------------------------------------------------------------------------
@@ -273,16 +283,7 @@ void LLToast::setVisible(BOOL show)
 		{
 			mTimer->start();
 		}
-		if (!getVisible())
-		{
-			LLModalDialog::setFrontmost(FALSE);
-		}
-	}
-	else
-	{
-		//hide "hide" button in case toast was hidden without mouse_leave
-		if(mHideBtn)
-			mHideBtn->setVisible(show);
+		LLModalDialog::setFrontmost(FALSE);
 	}
 	LLFloater::setVisible(show);
 	if(mPanel)
@@ -414,13 +415,4 @@ bool LLToast::isNotificationValid()
 
 //--------------------------------------------------------------------------
 
-S32	LLToast::notifyParent(const LLSD& info)
-{
-	if (info.has("action") && "hide_toast" == info["action"].asString())
-	{
-		hide();
-		return 1;
-	}
 
-	return LLModalDialog::notifyParent(info);
-}
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index b22f3b9d093d8bfc783f578e1586a0ce27a17ae4..20198a9398461a69ae41e2a68dedcb60cbb018f4 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -2,25 +2,31 @@
  * @file lltoast.h
  * @brief This class implements a placeholder for any notification panel.
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -57,8 +63,6 @@ class LLToastLifeTimer: public LLEventTimer
 	void start() { mEventTimer.start(); }
 	void restart() {mEventTimer.reset(); }
 	BOOL getStarted() { return mEventTimer.getStarted(); }
-
-	LLTimer&  getEventTimer() { return mEventTimer;}
 private :
 	LLToast* mToast;
 };
@@ -100,8 +104,6 @@ class LLToast : public LLModalDialog
 	virtual ~LLToast();
 	BOOL postBuild();
 
-	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
-
 	// Toast handlers
 	virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
 
@@ -130,8 +132,6 @@ class LLToast : public LLModalDialog
 	//
 	void stopTimer() { mTimer->stop(); }
 	//
-	LLToastLifeTimer* getTimer() { return mTimer.get();}
-	//
 	virtual void draw();
 	//
 	virtual void setVisible(BOOL show);
@@ -186,14 +186,14 @@ class LLToast : public LLModalDialog
 	boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseEnterSignal.connect(cb); };
 	boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseLeaveSignal.connect(cb); };
 
-	virtual S32	notifyParent(const LLSD& info);
-
 private:
 
 	void onToastMouseEnter();
 
 	void onToastMouseLeave();
 
+	void handleTipToastClick(S32 x, S32 y, MASK mask);
+
 	void	expire();
 
 	LLUUID				mNotificationID;
@@ -205,11 +205,11 @@ class LLToast : public LLModalDialog
 	// timer counts a lifetime of a toast
 	std::auto_ptr<LLToastLifeTimer> mTimer;
 
-	F32			mToastLifetime; // in seconds
 	F32			mToastFadingTime; // in seconds
 
 	LLPanel*		mPanel;
 	LLButton*		mHideBtn;
+	LLTextEditor*	mTextEditor;
 
 	LLColor4	mBgColor;
 	bool		mCanFade;
diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp
index 2d0c36090546985aa6db079dfe63727054a7e088..986ccdf19bd113815e96b590dbba100c430639d1 100644
--- a/indra/newview/lltoastalertpanel.cpp
+++ b/indra/newview/lltoastalertpanel.cpp
@@ -2,25 +2,31 @@
  * @file lltoastalertpanel.cpp
  * @brief Panel for alert toasts.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -44,8 +50,6 @@
 #include "llnotifications.h"
 #include "llfunctorregistry.h"
 #include "llrootview.h"
-#include "lltransientfloatermgr.h"
-#include "llviewercontrol.h" // for gSavedSettings
 
 const S32 MAX_ALLOWED_MSG_WIDTH = 400;
 const F32 DEFAULT_BUTTON_DELAY = 0.5f;
@@ -166,7 +170,6 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
 	params.tab_stop(false);
 	params.wrap(true);
 	params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP);
-	params.allow_scroll(true);
 
 	LLTextBox * msg_box = LLUICtrlFactory::create<LLTextBox> (params);
 	// Compute max allowable height for the dialog text, so we can allocate
@@ -175,16 +178,9 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
 			gFloaterView->getRect().getHeight()
 			- LINE_HEIGHT			// title bar
 			- 3*VPAD - BTN_HEIGHT;
-	// reshape to calculate real text width and height
 	msg_box->reshape( MAX_ALLOWED_MSG_WIDTH, max_allowed_msg_height );
 	msg_box->setValue(msg);
-
-	S32 pixel_width = msg_box->getTextPixelWidth();
-	S32 pixel_height = msg_box->getTextPixelHeight();
-
-	// We should use some space to prevent set textbox's scroller visible when it is unnecessary.
-	msg_box->reshape( llmin(MAX_ALLOWED_MSG_WIDTH,pixel_width + 2 * msg_box->getHPad() + HPAD),
-		llmin(max_allowed_msg_height,pixel_height + 2 * msg_box->getVPad())  ) ;
+	msg_box->reshapeToFitText();
 
 	const LLRect& text_rect = msg_box->getRect();
 	S32 dialog_width = llmax( btn_total_width, text_rect.getWidth() ) + 2 * HPAD;
@@ -241,72 +237,13 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
 	msg_box->setRect( rect );
 	LLToastPanel::addChild(msg_box);
 
-	// (Optional) Edit Box	
-	if (!edit_text_name.empty())
-	{
-		S32 y = VPAD + BTN_HEIGHT + VPAD/2;
-		mLineEditor = LLUICtrlFactory::getInstance()->createFromFile<LLLineEditor>("alert_line_editor.xml", this, LLPanel::child_registry_t::instance());
-	
-		if (mLineEditor)
-		{
-			LLRect leditor_rect = LLRect( HPAD, y+EDITOR_HEIGHT, dialog_width-HPAD, y);
-			mLineEditor->setName(edit_text_name);
-			mLineEditor->reshape(leditor_rect.getWidth(), leditor_rect.getHeight());
-			mLineEditor->setRect(leditor_rect);
-			mLineEditor->setText(edit_text_contents);
-
-			// decrease limit of line editor of teleport offer dialog to avoid truncation of
-			// location URL in invitation message, see EXT-6891
-			if ("OfferTeleport" == mNotification->getName())
-			{
-				mLineEditor->setMaxTextLength(gSavedSettings.getS32(
-						"teleport_offer_invitation_max_length"));
-			}
-			else
-			{
-				mLineEditor->setMaxTextLength(STD_STRING_STR_LEN - 1);
-			}
-
-			LLToastPanel::addChild(mLineEditor);
-
-			mLineEditor->setDrawAsterixes(is_password);
-
-			setEditTextArgs(notification->getSubstitutions());
-
-			mLineEditor->setFollowsLeft();
-			mLineEditor->setFollowsRight();
-
-			// find form text input field
-			LLSD form_text;
-			for (LLSD::array_const_iterator it = form_sd.beginArray(); it != form_sd.endArray(); ++it)
-			{
-				std::string type = (*it)["type"].asString();
-				if (type == "text")
-				{
-					form_text = (*it);
-				}
-			}
-
-			// if form text input field has width attribute
-			if (form_text.has("width"))
-			{
-				// adjust floater width to fit line editor
-				S32 editor_width = form_text["width"];
-				LLRect editor_rect =  mLineEditor->getRect();
-				U32 width_delta = editor_width  - editor_rect.getWidth();
-				LLRect toast_rect = getRect();
-				reshape(toast_rect.getWidth() +  width_delta, toast_rect.getHeight());
-			}
-		}
-	}
-
-	// Buttons
+	// Buttons	
 	S32 button_left = (LLToastPanel::getRect().getWidth() - btn_total_width) / 2;
-
+	
 	for( S32 i = 0; i < num_options; i++ )
 	{
 		LLRect button_rect;
-
+		
 		LLButton* btn = LLUICtrlFactory::getInstance()->createFromFile<LLButton>("alert_button.xml", this, LLPanel::child_registry_t::instance());
 		if(btn)
 		{
@@ -314,7 +251,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
 			btn->setRect(button_rect.setOriginAndSize( button_left, VPAD, button_width, BTN_HEIGHT ));
 			btn->setLabel(options[i].second);
 			btn->setFont(font);
-
+			
 			btn->setClickedCallback(boost::bind(&LLToastAlertPanel::onButtonPressed, this, _2, i));
 
 			mButtonData[i].mButton = btn;
@@ -329,6 +266,29 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
 		button_left += button_width + BTN_HPAD;
 	}
 
+	// (Optional) Edit Box	
+	if (!edit_text_name.empty())
+	{
+		S32 y = VPAD + BTN_HEIGHT + VPAD/2;
+		mLineEditor = LLUICtrlFactory::getInstance()->createFromFile<LLLineEditor>("alert_line_editor.xml", this, LLPanel::child_registry_t::instance());
+	
+		if (mLineEditor)
+		{
+			LLRect leditor_rect = LLRect( HPAD, y+EDITOR_HEIGHT, dialog_width-HPAD, y);
+			mLineEditor->setName(edit_text_name);
+			mLineEditor->reshape(leditor_rect.getWidth(), leditor_rect.getHeight());
+			mLineEditor->setRect(leditor_rect);
+			mLineEditor->setText(edit_text_contents);
+			mLineEditor->setMaxTextLength(STD_STRING_STR_LEN - 1);
+
+			LLToastPanel::addChild(mLineEditor);
+
+			mLineEditor->setDrawAsterixes(is_password);
+
+			setEditTextArgs(notification->getSubstitutions());
+		}
+	}
+
 	std::string ignore_label;
 
 	if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE)
@@ -352,9 +312,6 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
 		mDefaultBtnTimer.start();
 		mDefaultBtnTimer.setTimerExpirySec(DEFAULT_BUTTON_DELAY);
 	}
-
-	LLTransientFloaterMgr::instance().addControlView(
-			LLTransientFloaterMgr::GLOBAL, this);
 }
 
 bool LLToastAlertPanel::setCheckBox( const std::string& check_title, const std::string& check_control )
@@ -408,8 +365,6 @@ void LLToastAlertPanel::setVisible( BOOL visible )
 
 LLToastAlertPanel::~LLToastAlertPanel()
 {
-	LLTransientFloaterMgr::instance().removeControlView(
-			LLTransientFloaterMgr::GLOBAL, this);
 }
 
 BOOL LLToastAlertPanel::hasTitleBar() const
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index ca6efa9d2fe484bb8815868d79cc3354466e221c..c9d2d404c0504edc4a9dedb650c89c79b7182970 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -2,25 +2,31 @@
  * @file lltoastnotifypanel.cpp
  * @brief Panel for notify toasts.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -285,10 +291,7 @@ LLToastNotifyPanel::~LLToastNotifyPanel()
 	{
 		// let reusable notification be deleted
 		mNotification->setReusable(false);
-		if (!mNotification->isPersistent())
-		{
-			LLNotifications::getInstance()->cancel(mNotification);
-		}
+		LLNotifications::getInstance()->cancel(mNotification);
 	}
 }
 
@@ -489,6 +492,12 @@ void LLToastNotifyPanel::onClickButton(void* data)
 	if(is_reusable)
 	{
 		sButtonClickSignal(self->mNotification->getID(), button_name);
+
+		if(new_info)
+		{
+			self->mNotification->setResponseFunctor(
+				boost::bind(&LLOfferInfo::inventory_offer_callback, new_info, _1, _2));
+		}
 	}
 	else
 	{
diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h
index 9e1eac90b36ba86b096e7aebcb13d4747e9566d7..1c68e4c6b3dd61758b3ad013ab216ef3601731f1 100644
--- a/indra/newview/lltoastnotifypanel.h
+++ b/indra/newview/lltoastnotifypanel.h
@@ -2,25 +2,31 @@
  * @file lltoastnotifypanel.h
  * @brief Panel for notify toasts.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -43,9 +49,6 @@ class LLNotificationForm;
  * Notification panel should be used for notifications that require a response from the user.
  *
  * Replaces class LLNotifyBox.
- *
- * @deprecated this class will be removed after all toast panel types are
- *  implemented in separate classes.
  */
 class LLToastNotifyPanel: public LLToastPanel 
 {
@@ -57,8 +60,6 @@ class LLToastNotifyPanel: public LLToastPanel
 	 * @param rect an initial rectangle of the toast panel. 
 	 * If it is null then a loaded from xml rectangle will be used. 
 	 * @see LLNotification
-	 * @deprecated if you intend to instantiate LLToastNotifyPanel - it's point to
-	 * implement right class for desired toast panel. @see LLGenericTipPanel as example.
 	 */
 	LLToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null);
 	virtual ~LLToastNotifyPanel();
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 54484a1dbb523821d12699e07a1fc2d47a5b1ad8..1e81e675e601130c5ffe6ebdce55e1b082dab90a 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -2,25 +2,31 @@
  * @file lltooldraganddrop.cpp
  * @brief LLToolDragAndDrop class implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,6 +38,7 @@
 // project headers
 #include "llagent.h"
 #include "llagentcamera.h"
+#include "llagentui.h"
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
 #include "lldictionary.h"
@@ -39,26 +46,31 @@
 #include "llfloaterreg.h"
 #include "llfloatertools.h"
 #include "llgesturemgr.h"
-#include "llgiveinventory.h"
 #include "llhudmanager.h"
 #include "llhudeffecttrail.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
 #include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
+#include "llmutelist.h"
 #include "llpreviewnotecard.h"
+#include "llrecentpeople.h"
 #include "llrootview.h"
 #include "llselectmgr.h"
 #include "lltoolmgr.h"
 #include "lltooltip.h"
 #include "lltrans.h"
 #include "llviewerobjectlist.h"
-#include "llviewerregion.h"
 #include "llviewerstats.h"
 #include "llviewerwindow.h"
 #include "llvoavatarself.h"
 #include "llworld.h"
 
+// MAX ITEMS is based on (sizeof(uuid)+2) * count must be < MTUBYTES
+// or 18 * count < 1200 => count < 1200/18 => 66. I've cut it down a
+// bit from there to give some pad.
+const S32 MAX_ITEMS = 42;
+
 // syntactic sugar
 #define callMemberFunction(object,ptrToMember)  ((object).*(ptrToMember))
 
@@ -133,6 +145,29 @@ bool LLDroppableItem::operator()(LLInventoryCategory* cat,
 	return allowed;
 }
 
+class LLUncopyableItems : public LLInventoryCollectFunctor
+{
+public:
+	LLUncopyableItems() {}
+	virtual ~LLUncopyableItems() {}
+	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+};
+
+bool LLUncopyableItems::operator()(LLInventoryCategory* cat,
+				   LLInventoryItem* item)
+{
+	bool uncopyable = false;
+	if (item)
+	{
+		if (itemTransferCommonlyAllowed(item) &&
+		   !item->getPermissions().allowCopyBy(gAgent.getID()))
+		{
+			uncopyable = true;
+		}
+	}
+	return uncopyable;
+}
+
 class LLDropCopyableItems : public LLInventoryCollectFunctor
 {
 public:
@@ -160,16 +195,47 @@ bool LLDropCopyableItems::operator()(
 	return allowed;
 }
 
-// Starts a fetch on folders and items.  This is really not used 
-// as an observer in the traditional sense; we're just using it to
-// request a fetch and we don't care about when/if the response arrives.
+class LLGiveable : public LLInventoryCollectFunctor
+{
+public:
+	LLGiveable() : mCountLosing(0) {}
+	virtual ~LLGiveable() {}
+	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+
+	S32 countNoCopy() const { return mCountLosing; }
+protected:
+	S32 mCountLosing;
+};
+
+bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	// All categories can be given.
+	if (cat)
+		return true;
+
+	bool allowed = false;
+	if (item)
+	{
+		allowed = itemTransferCommonlyAllowed(item);
+		if (allowed &&
+		   !item->getPermissions().allowOperationBy(PERM_TRANSFER,
+							    gAgent.getID()))
+		{
+			allowed = FALSE;
+		}
+		if (allowed &&
+		   !item->getPermissions().allowCopyBy(gAgent.getID()))
+		{
+			++mCountLosing;
+		}
+	}
+	return allowed;
+}
+
 class LLCategoryFireAndForget : public LLInventoryFetchComboObserver
 {
 public:
-	LLCategoryFireAndForget(const uuid_vec_t& folder_ids,
-							const uuid_vec_t& item_ids) :
-		LLInventoryFetchComboObserver(folder_ids, item_ids)
-	{}
+	LLCategoryFireAndForget() {}
 	~LLCategoryFireAndForget() {}
 	virtual void done()
 	{
@@ -178,13 +244,11 @@ class LLCategoryFireAndForget : public LLInventoryFetchComboObserver
 	}
 };
 
-class LLCategoryDropObserver : public LLInventoryFetchItemsObserver
+class LLCategoryDropObserver : public LLInventoryFetchObserver
 {
 public:
 	LLCategoryDropObserver(
-		const uuid_vec_t& ids,
 		const LLUUID& obj_id, LLToolDragAndDrop::ESource src) :
-		LLInventoryFetchItemsObserver(ids),
 		mObjectID(obj_id),
 		mSource(src)
 	{}
@@ -221,7 +285,7 @@ void LLCategoryDropObserver::done()
 	}
 	delete this;
 }
-/* Doesn't seem to be used anymore.
+
 class LLCategoryDropDescendentsObserver : public LLInventoryFetchDescendentsObserver
 {
 public:
@@ -267,9 +331,9 @@ void LLCategoryDropDescendentsObserver::done()
 		std::back_insert_iterator<uuid_vec_t> copier(ids);
 		std::copy(unique_ids.begin(), unique_ids.end(), copier);
 		LLCategoryDropObserver* dropper;
-		dropper = new LLCategoryDropObserver(ids, mObjectID, mSource);
-		dropper->startFetch();
-		if (dropper->isDone())
+		dropper = new LLCategoryDropObserver(mObjectID, mSource);
+		dropper->fetch(ids);
+		if (dropper->isEverythingComplete())
 		{
 			dropper->done();
 		}
@@ -280,7 +344,6 @@ void LLCategoryDropDescendentsObserver::done()
 	}
 	delete this;
 }
-*/
 
 LLToolDragAndDrop::DragAndDropEntry::DragAndDropEntry(dragOrDrop3dImpl f_none,
 													  dragOrDrop3dImpl f_self,
@@ -416,9 +479,8 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
 			}
 			if (!folder_ids.empty() || !item_ids.empty())
 			{
-				LLCategoryFireAndForget *fetcher = new LLCategoryFireAndForget(folder_ids, item_ids);
-				fetcher->startFetch();
-				delete fetcher;
+				LLCategoryFireAndForget fetcher;
+				fetcher.fetch(folder_ids, item_ids);
 			}
 		}
 	}
@@ -487,7 +549,8 @@ void LLToolDragAndDrop::beginMultiDrag(
 			uuid_vec_t item_ids;
 			std::back_insert_iterator<uuid_vec_t> copier(folder_ids);
 			std::copy(cat_ids.begin(), cat_ids.end(), copier);
-			LLCategoryFireAndForget fetcher(folder_ids, item_ids);
+			LLCategoryFireAndForget fetcher;
+			fetcher.fetch(folder_ids, item_ids);
 		}
 	}
 }
@@ -1140,7 +1203,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return;
+	if (!item || !item->isComplete()) return;
 	
 	//if (regionp
 	//	&& (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
@@ -1347,6 +1410,422 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
 	gFloaterTools->dirty();
 }
 
+void LLToolDragAndDrop::giveInventory(const LLUUID& to_agent,
+									  LLInventoryItem* item,
+									  const LLUUID& im_session_id)
+									  
+{
+	llinfos << "LLToolDragAndDrop::giveInventory()" << llendl;
+	if (!isInventoryGiveAcceptable(item))
+	{
+		return;
+	}
+	if (item->getPermissions().allowCopyBy(gAgent.getID()))
+	{
+		// just give it away.
+		LLToolDragAndDrop::commitGiveInventoryItem(to_agent, item, im_session_id);
+	}
+	else
+	{
+		// ask if the agent is sure.
+		LLSD payload;
+		payload["agent_id"] = to_agent;
+		payload["item_id"] = item->getUUID();
+		LLNotificationsUtil::add("CannotCopyWarning", LLSD(), payload, 
+		        &LLToolDragAndDrop::handleCopyProtectedItem);
+	}
+}
+// static
+bool LLToolDragAndDrop::handleCopyProtectedItem(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	LLInventoryItem* item = NULL;
+	switch(option)
+	{
+	case 0:  // "Yes"
+		item = gInventory.getItem(notification["payload"]["item_id"].asUUID());
+		if (item)
+		{
+			LLToolDragAndDrop::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(),
+													   item);
+			// delete it for now - it will be deleted on the server
+			// quickly enough.
+			gInventory.deleteObject(notification["payload"]["item_id"].asUUID());
+			gInventory.notifyObservers();
+		}
+		else
+		{
+			LLNotificationsUtil::add("CannotGiveItem");		
+		}
+		break;
+
+	default: // no, cancel, whatever, who cares, not yes.
+		LLNotificationsUtil::add("TransactionCancelled");
+		break;
+	}
+	return false;
+}
+
+// static
+void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent,
+												LLInventoryItem* item,
+												const LLUUID& im_session_id)
+{
+	if (!item) return;
+	std::string name;
+	LLAgentUI::buildFullname(name);
+	LLUUID transaction_id;
+	transaction_id.generate();
+	const S32 BUCKET_SIZE = sizeof(U8) + UUID_BYTES;
+	U8 bucket[BUCKET_SIZE];
+	bucket[0] = (U8)item->getType();
+	memcpy(&bucket[1], &(item->getUUID().mData), UUID_BYTES);		/* Flawfinder: ignore */
+	pack_instant_message(
+		gMessageSystem,
+		gAgent.getID(),
+		FALSE,
+		gAgent.getSessionID(),
+		to_agent,
+		name,
+		item->getName(),
+		IM_ONLINE,
+		IM_INVENTORY_OFFERED,
+		transaction_id,
+		0,
+		LLUUID::null,
+		gAgent.getPositionAgent(),
+		NO_TIMESTAMP,
+		bucket,
+		BUCKET_SIZE);
+	gAgent.sendReliableMessage(); 
+
+	// VEFFECT: giveInventory
+	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+	effectp->setSourceObject(gAgentAvatarp);
+	effectp->setTargetObject(gObjectList.findObject(to_agent));
+	effectp->setDuration(LL_HUD_DUR_SHORT);
+	effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+	gFloaterTools->dirty();
+
+	LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY);
+
+	logInventoryOffer(to_agent, im_session_id);	
+
+	// add buddy to recent people list
+	LLRecentPeople::instance().add(to_agent);
+}
+
+//static
+void LLToolDragAndDrop::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im_session_id)
+{
+	// compute id of possible IM session with agent that has "to_agent" id
+	LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, to_agent);
+	// If this item was given by drag-and-drop into an IM panel, log this action in the IM panel chat.
+	if (im_session_id.notNull())
+	{
+		LLSD args;
+		gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args);
+	}
+	// If this item was given by drag-and-drop on avatar while IM panel was open, log this action in the IM panel chat.
+	else if (LLIMModel::getInstance()->findIMSession(session_id))
+	{
+		LLSD args;
+		gIMMgr->addSystemMessage(session_id, "inventory_item_offered", args);
+	}
+	// If this item was given by drag-and-drop on avatar while IM panel wasn't open, log this action to IM history.
+	else
+	{
+		std::string full_name;
+		if (gCacheName->getFullName(to_agent, full_name))
+		{
+			LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, LLTrans::getString("inventory_item_offered-im"));
+		}
+	}
+}
+
+void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
+											  LLInventoryCategory* cat,
+											  const LLUUID& im_session_id)
+
+{
+	if (!cat) return;
+	llinfos << "LLToolDragAndDrop::giveInventoryCategory() - "
+			<< cat->getUUID() << llendl;
+
+	if (!isAgentAvatarValid()) return;
+
+	// Test out how many items are being given.
+	LLViewerInventoryCategory::cat_array_t cats;
+	LLViewerInventoryItem::item_array_t items;
+	LLGiveable giveable;
+	gInventory.collectDescendentsIf (cat->getUUID(),
+									cats,
+									items,
+									LLInventoryModel::EXCLUDE_TRASH,
+									giveable);
+	S32 count = cats.count();
+	bool complete = true;
+	for(S32 i = 0; i < count; ++i)
+	{
+		if (!gInventory.isCategoryComplete(cats.get(i)->getUUID()))
+		{
+			complete = false;
+			break;
+		}
+	}
+	if (!complete)
+	{
+		LLNotificationsUtil::add("IncompleteInventory");
+		return;
+	}
+ 	count = items.count() + cats.count();
+ 	if (count > MAX_ITEMS)
+  	{
+		LLNotificationsUtil::add("TooManyItems");
+  		return;
+  	}
+ 	else if (count == 0)
+  	{
+		LLNotificationsUtil::add("NoItems");
+  		return;
+  	}
+	else
+	{
+		if (0 == giveable.countNoCopy())
+		{
+			LLToolDragAndDrop::commitGiveInventoryCategory(to_agent, cat, im_session_id);
+		}
+		else 
+		{
+			LLSD args;
+			args["COUNT"] = llformat("%d",giveable.countNoCopy());
+			LLSD payload;
+			payload["agent_id"] = to_agent;
+			payload["folder_id"] = cat->getUUID();
+			LLNotificationsUtil::add("CannotCopyCountItems", args, payload, &LLToolDragAndDrop::handleCopyProtectedCategory);
+		}
+	}
+}
+
+
+// static
+bool LLToolDragAndDrop::handleCopyProtectedCategory(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	LLInventoryCategory* cat = NULL;
+	switch(option)
+	{
+	case 0:  // "Yes"
+		cat = gInventory.getCategory(notification["payload"]["folder_id"].asUUID());
+		if (cat)
+		{
+			LLToolDragAndDrop::commitGiveInventoryCategory(notification["payload"]["agent_id"].asUUID(),
+														   cat);
+			LLViewerInventoryCategory::cat_array_t cats;
+			LLViewerInventoryItem::item_array_t items;
+			LLUncopyableItems remove;
+			gInventory.collectDescendentsIf (cat->getUUID(),
+											cats,
+											items,
+											LLInventoryModel::EXCLUDE_TRASH,
+											remove);
+			S32 count = items.count();
+			for(S32 i = 0; i < count; ++i)
+			{
+				gInventory.deleteObject(items.get(i)->getUUID());
+			}
+			gInventory.notifyObservers();
+		}
+		else
+		{
+			LLNotificationsUtil::add("CannotGiveCategory");
+		}
+		break;
+
+	default: // no, cancel, whatever, who cares, not yes.
+		LLNotificationsUtil::add("TransactionCancelled");
+		break;
+	}
+	return false;
+}
+
+// static
+void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
+													LLInventoryCategory* cat,
+													const LLUUID& im_session_id)
+
+{
+	if (!cat) return;
+	llinfos << "LLToolDragAndDrop::commitGiveInventoryCategory() - "
+			<< cat->getUUID() << llendl;
+
+	// add buddy to recent people list
+	LLRecentPeople::instance().add(to_agent);
+
+	// Test out how many items are being given.
+	LLViewerInventoryCategory::cat_array_t cats;
+	LLViewerInventoryItem::item_array_t items;
+	LLGiveable giveable;
+	gInventory.collectDescendentsIf (cat->getUUID(),
+									cats,
+									items,
+									LLInventoryModel::EXCLUDE_TRASH,
+									giveable);
+
+	// MAX ITEMS is based on (sizeof(uuid)+2) * count must be <
+	// MTUBYTES or 18 * count < 1200 => count < 1200/18 =>
+	// 66. I've cut it down a bit from there to give some pad.
+ 	S32 count = items.count() + cats.count();
+ 	if (count > MAX_ITEMS)
+  	{
+		LLNotificationsUtil::add("TooManyItems");
+  		return;
+  	}
+ 	else if (count == 0)
+  	{
+		LLNotificationsUtil::add("NoItems");
+  		return;
+  	}
+	else
+	{
+		std::string name;
+		LLAgentUI::buildFullname(name);
+		LLUUID transaction_id;
+		transaction_id.generate();
+		S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (count + 1);
+		U8* bucket = new U8[bucket_size];
+		U8* pos = bucket;
+		U8 type = (U8)cat->getType();
+		memcpy(pos, &type, sizeof(U8));		/* Flawfinder: ignore */
+		pos += sizeof(U8);
+		memcpy(pos, &(cat->getUUID()), UUID_BYTES);		/* Flawfinder: ignore */
+		pos += UUID_BYTES;
+		S32 i;
+		count = cats.count();
+		for(i = 0; i < count; ++i)
+		{
+			memcpy(pos, &type, sizeof(U8));		/* Flawfinder: ignore */
+			pos += sizeof(U8);
+			memcpy(pos, &(cats.get(i)->getUUID()), UUID_BYTES);		/* Flawfinder: ignore */
+			pos += UUID_BYTES;
+		}
+		count = items.count();
+		for(i = 0; i < count; ++i)
+		{
+			type = (U8)items.get(i)->getType();
+			memcpy(pos, &type, sizeof(U8));		/* Flawfinder: ignore */
+			pos += sizeof(U8);
+			memcpy(pos, &(items.get(i)->getUUID()), UUID_BYTES);		/* Flawfinder: ignore */
+			pos += UUID_BYTES;
+		}
+		pack_instant_message(
+			gMessageSystem,
+			gAgent.getID(),
+			FALSE,
+			gAgent.getSessionID(),
+			to_agent,
+			name,
+			cat->getName(),
+			IM_ONLINE,
+			IM_INVENTORY_OFFERED,
+			transaction_id,
+			0,
+			LLUUID::null,
+			gAgent.getPositionAgent(),
+			NO_TIMESTAMP,
+			bucket,
+			bucket_size);
+		gAgent.sendReliableMessage();
+		delete[] bucket;
+
+		// VEFFECT: giveInventoryCategory
+		LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+		effectp->setSourceObject(gAgentAvatarp);
+		effectp->setTargetObject(gObjectList.findObject(to_agent));
+		effectp->setDuration(LL_HUD_DUR_SHORT);
+		effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+		gFloaterTools->dirty();
+
+		LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY);
+
+		logInventoryOffer(to_agent, im_session_id);
+	}
+}
+
+// static
+BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item)
+{
+	if (!item)
+	{
+		return FALSE;
+	}
+	if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+	{
+		return FALSE;
+	}
+	BOOL copyable = FALSE;
+	if (item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE;
+
+	if (!isAgentAvatarValid()) return FALSE;
+
+	BOOL acceptable = TRUE;
+	switch(item->getType())
+	{
+	case LLAssetType::AT_OBJECT:
+		if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
+		{
+			acceptable = FALSE;
+		}
+		break;
+	case LLAssetType::AT_BODYPART:
+	case LLAssetType::AT_CLOTHING:
+		if (!copyable && gAgentWearables.isWearingItem(item->getUUID()))
+		{
+			acceptable = FALSE;
+		}
+		break;
+	default:
+		break;
+	}
+	return acceptable;
+}
+
+// Static
+BOOL LLToolDragAndDrop::isInventoryGroupGiveAcceptable(LLInventoryItem* item)
+{
+	if (!item)
+	{
+		return FALSE;
+	}
+
+	// These permissions are double checked in the simulator in
+	// LLGroupNoticeInventoryItemFetch::result().
+	if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+	{
+		return FALSE;
+	}
+	if (!item->getPermissions().allowCopyBy(gAgent.getID()))
+	{
+		return FALSE;
+	}
+
+	if (!isAgentAvatarValid()) return FALSE;
+
+	BOOL acceptable = TRUE;
+	switch(item->getType())
+	{
+	case LLAssetType::AT_OBJECT:
+		if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
+		{
+			acceptable = FALSE;
+		}
+		break;
+	default:
+		break;
+	}
+	return acceptable;
+}
+
 // accessor that looks at permissions, copyability, and names of
 // inventory items to determine if a drop would be ok.
 EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LLInventoryItem* item)
@@ -1355,7 +1834,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 	if (!item || !obj) return ACCEPT_NO;
 	// HACK: downcast
 	LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item;
-	if (!vitem->isFinished()) return ACCEPT_NO;
+	if (!vitem->isComplete()) return ACCEPT_NO;
 	if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links
 
 	// deny attempts to drop from an object onto itself. This is to
@@ -1416,42 +1895,12 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 }
 
 
-static void give_inventory_cb(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	// if Cancel pressed
-	if (option == 1)
-	{
-		return;
-	}
-
-	LLSD payload = notification["payload"];
-	const LLUUID& session_id = payload["session_id"];
-	const LLUUID& agent_id = payload["agent_id"];
-	LLViewerInventoryItem * inv_item =  gInventory.getItem(payload["item_id"]);
-	if (NULL == inv_item)
-	{
-		llassert(NULL != inv_item);
-		return;
-	}
-
-	if (LLGiveInventory::doGiveInventoryItem(agent_id, inv_item, session_id))
-	{
-		if ("avatarpicker" == payload["d&d_dest"].asString())
-		{
-			LLFloaterReg::hideInstance("avatar_picker");
-		}
-		LLNotificationsUtil::add("ItemsShared");
-	}
-}
-
 // function used as drag-and-drop handler for simple agent give inventory requests
 //static
 bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_id, BOOL drop,
 											  EDragAndDropType cargo_type,
 											  void* cargo_data,
-											  EAcceptance* accept,
-											  const LLSD& dest)
+											  EAcceptance* accept)
 {
 	// check the type
 	switch(cargo_type)
@@ -1470,27 +1919,13 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
 	{
 		LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
 		if (gInventory.getItem(inv_item->getUUID())
-			&& LLGiveInventory::isInventoryGiveAcceptable(inv_item))
+		   && LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item))
 		{
 			// *TODO: get multiple object transfers working
 			*accept = ACCEPT_YES_COPY_SINGLE;
 			if (drop)
 			{
-				LLIMModel::LLIMSession * session = LLIMModel::instance().findIMSession(session_id);
-				if (NULL == session)
-				{
-					llassert(NULL != session);
-					return false;
-				}
-				LLSD substitutions;
-				substitutions["RESIDENTS"] = session->mName;
-				substitutions["ITEMS"] = inv_item->getName();
-				LLSD payload;
-				payload["agent_id"] = dest_agent;
-				payload["item_id"] = inv_item->getUUID();
-				payload["session_id"] = session_id;
-				payload["d&d_dest"] = dest.asString();
-				LLNotificationsUtil::add("ShareItemsConfirmation", substitutions, payload, &give_inventory_cb);
+				LLToolDragAndDrop::giveInventory(dest_agent, inv_item, session_id);
 			}
 		}
 		else
@@ -1512,7 +1947,7 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
 			*accept = ACCEPT_YES_COPY_SINGLE;
 			if (drop)
 			{
-				LLGiveInventory::doGiveInventoryCategory(dest_agent, inv_cat, session_id);
+				LLToolDragAndDrop::giveInventoryCategory(dest_agent, inv_cat, session_id);
 			}
 		}
 		else
@@ -1559,7 +1994,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
 	// must not be in the trash
 	const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
@@ -1608,7 +2043,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
 	if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID()))
 	{
@@ -1670,7 +2105,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 	if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
@@ -1749,7 +2184,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 	EAcceptance rv = willObjectAcceptInventory(obj, item);
 	if (drop && (ACCEPT_YES_SINGLE <= rv))
 	{
@@ -1787,7 +2222,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 	EAcceptance rv = willObjectAcceptInventory(obj, item);
 	if ((mask & MASK_CONTROL))
 	{
@@ -1852,7 +2287,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
 	if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
 	{
@@ -1865,9 +2300,31 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem(
 
 		if (drop)
 		{
-			// TODO: investigate wearables may not be loaded at this point EXT-8231
+			// Don't wear anything until initial wearables are loaded, can
+			// destroy clothing items.
+			if (!gAgentWearables.areWearablesLoaded()) 
+			{
+				LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
+				return ACCEPT_NO;
+			}
 
-			LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(),true, !(mask & MASK_CONTROL));
+			if (mSource == SOURCE_LIBRARY)
+			{
+				// create item based on that one, and put it on if that
+				// was a success.
+				LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+				copy_inventory_item(
+					gAgent.getID(),
+					item->getPermissions().getOwner(),
+					item->getUUID(),
+					LLUUID::null,
+					std::string(),
+					cb);
+			}
+			else
+			{
+				wear_inventory_item_on_avatar( item );
+			}
 		}
 		return ACCEPT_YES_MULTI;
 	}
@@ -1885,7 +2342,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
 	if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
 	{
@@ -1938,7 +2395,13 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
 
 	if (drop)
 	{
-		// TODO: investigate wearables may not be loaded at this point EXT-8231
+		// Don't wear anything until initial wearables are loaded, can
+		// destroy clothing items.
+		if (!gAgentWearables.areWearablesLoaded()) 
+		{
+			LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
+			return ACCEPT_NO;
+		}
 	}
 
 	if (mSource == SOURCE_AGENT)
@@ -1987,7 +2450,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 	LLViewerObject* root_object = obj;
 	if (obj && obj->getParent())
 	{
@@ -2113,9 +2576,9 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
 			const LLViewerInventoryItem *item = (*item_iter);
 			ids.push_back(item->getUUID());
 		}
-		LLCategoryDropObserver* dropper = new LLCategoryDropObserver(ids, obj->getID(), mSource);
-		dropper->startFetch();
-		if (dropper->isFinished())
+		LLCategoryDropObserver* dropper = new LLCategoryDropObserver(obj->getID(), mSource);
+		dropper->fetch(ids);
+		if (dropper->isEverythingComplete())
 		{
 			dropper->done();
 		}
@@ -2146,7 +2609,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 	if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
 	{
 		// cannot give away no-transfer objects
@@ -2161,7 +2624,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
 	{
 		if (drop)
 		{
-			LLGiveInventory::doGiveInventoryItem(obj->getID(), item );
+			giveInventory(obj->getID(), item );
 		}
 		// *TODO: deal with all the issues surrounding multi-object
 		// inventory transfers.
@@ -2180,14 +2643,14 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventory(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
-	if (!LLGiveInventory::isInventoryGiveAcceptable(item))
+	if (!item || !item->isComplete()) return ACCEPT_NO;
+	if (!isInventoryGiveAcceptable(item))
 	{
 		return ACCEPT_NO;
 	}
 	if (drop && obj)
 	{
-		LLGiveInventory::doGiveInventoryItem(obj->getID(), item);
+		giveInventory(obj->getID(), item);
 	}
 	// *TODO: deal with all the issues surrounding multi-object
 	// inventory transfers.
@@ -2204,7 +2667,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory(
 		LLViewerInventoryCategory* cat;
 		locateInventory(item, cat);
 		if (!cat) return ACCEPT_NO;
-		LLGiveInventory::doGiveInventoryCategory(obj->getID(), cat);
+		giveInventoryCategory(obj->getID(), cat);
 	}
 	// *TODO: deal with all the issues surrounding multi-object
 	// inventory transfers.
@@ -2219,7 +2682,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand(
 	LLViewerInventoryItem* item = NULL;
 	LLViewerInventoryCategory* cat = NULL;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
 	if (!gAgent.allowOperation(PERM_COPY, item->getPermissions())
 		|| !item->getPermissions().allowTransferTo(LLUUID::null))
@@ -2240,7 +2703,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if (!item || !item->isFinished()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 	if ((mask & MASK_CONTROL))
 	{
 		// *HACK: In order to resolve SL-22177, we need to block drags
diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h
index a13b775699cebde6a6d7878ea22329fd95ef40a1..85d003e5fccb94094eba1533a89d997e9df44e0a 100644
--- a/indra/newview/lltooldraganddrop.h
+++ b/indra/newview/lltooldraganddrop.h
@@ -2,25 +2,31 @@
  * @file lltooldraganddrop.h
  * @brief LLToolDragAndDrop class header file
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -208,10 +214,32 @@ class LLToolDragAndDrop : public LLTool, public LLSingleton<LLToolDragAndDrop>
 						 LLToolDragAndDrop::ESource source,
 						 const LLUUID& src_id);
 
+
+	// give inventory item functionality
+	static bool handleCopyProtectedItem(const LLSD& notification, const LLSD& response);
+	static void commitGiveInventoryItem(const LLUUID& to_agent,
+										LLInventoryItem* item,
+										const LLUUID &im_session_id = LLUUID::null);
+
+	// give inventory category functionality
+	static bool handleCopyProtectedCategory(const LLSD& notification, const LLSD& response);
+	static void commitGiveInventoryCategory(const LLUUID& to_agent,
+											LLInventoryCategory* cat,
+											const LLUUID &im_session_id = LLUUID::null);
+
+	// log "Inventory item offered" to IM
+	static void logInventoryOffer(const LLUUID& to_agent, 
+									const LLUUID &im_session_id = LLUUID::null);
+
 public:
 	// helper functions
 	static BOOL isInventoryDropAcceptable(LLViewerObject* obj, LLInventoryItem* item) { return (ACCEPT_YES_COPY_SINGLE <= willObjectAcceptInventory(obj, item)); }
 
+	// This simple helper function assumes you are attempting to
+	// transfer item. returns true if you can give, otherwise false.
+	static BOOL isInventoryGiveAcceptable(LLInventoryItem* item);
+	static BOOL isInventoryGroupGiveAcceptable(LLInventoryItem* item);
+
 	BOOL dadUpdateInventory(LLViewerObject* obj, BOOL drop);
 	BOOL dadUpdateInventoryCategory(LLViewerObject* obj, BOOL drop);
 
@@ -237,11 +265,17 @@ class LLToolDragAndDrop : public LLTool, public LLSingleton<LLToolDragAndDrop>
 							  ESource source,
 							  const LLUUID& src_id);
 
+	static void giveInventory(const LLUUID& to_agent, 
+							  LLInventoryItem* item,
+							  const LLUUID &session_id = LLUUID::null);
+	static void giveInventoryCategory(const LLUUID& to_agent,
+									  LLInventoryCategory* item,
+									  const LLUUID &session_id = LLUUID::null);
+
 	static bool handleGiveDragAndDrop(LLUUID agent, LLUUID session, BOOL drop,
 									  EDragAndDropType cargo_type,
 									  void* cargo_data,
-									  EAcceptance* accept,
-									  const LLSD& dest = LLSD());
+									  EAcceptance* accept);
 
 	// Classes used for determining 3d drag and drop types.
 private:
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index a754d8ee7ee63c68307382fbdcf16ea7a240c147..032714cabfdde8bbd35098434d65d0140f5cdf0f 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -2,25 +2,31 @@
  * @file lltoolfocus.cpp
  * @brief A tool to set the build focus point.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -230,6 +236,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
 		gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
 		
 		LLVector3d cam_pos = gAgentCamera.getCameraPositionGlobal();
+		cam_pos -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * gAgentCamera.calcCustomizeAvatarUIOffset( cam_pos ));
 
 		gAgentCamera.setCameraPosAndFocusGlobal( cam_pos, pick_info.mPosGlobal, pick_info.mObjectID);
 	}
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp
index b6c0f662e5a8e7cfbd1ce096ddb603842a633c7a..04d873f91bd5bfcb6366c1ba5aa0cc98a54f943d 100644
--- a/indra/newview/lltoolgrab.cpp
+++ b/indra/newview/lltoolgrab.cpp
@@ -2,25 +2,31 @@
  * @file lltoolgrab.cpp
  * @brief LLToolGrab class implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -880,6 +886,28 @@ void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask)
 // Not dragging.  Just showing affordances
 void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask)
 {
+	const F32 ROTATE_ANGLE_PER_SECOND = 40.f * DEG_TO_RAD;
+	const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
+
+	// Look for cursor against the edge of the screen
+	// Only works in fullscreen
+	if (gSavedSettings.getBOOL("WindowFullScreen"))
+	{
+		if (gAgentCamera.cameraThirdPerson() )
+		{
+			if (x == 0)
+			{
+				gAgent.yaw(rotate_angle);
+				//gAgent.setControlFlags(AGENT_CONTROL_YAW_POS);
+			}
+			else if (x == (gViewerWindow->getWorldViewWidthScaled() - 1) )
+			{
+				gAgent.yaw(-rotate_angle);
+				//gAgent.setControlFlags(AGENT_CONTROL_YAW_NEG);
+			}
+		}
+	}
+
 	// JC - TODO - change cursor based on gGrabBtnVertical, gGrabBtnSpin
 	lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (inactive-not over editable object)" << llendl;		
 	gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index ca80a1db795752f7439e45b9e16e37df007840aa..969049ee657c3403e72afa2d66109a02c9733669 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -2,25 +2,31 @@
  * @file lltoolmorph.cpp
  * @brief A tool to manipulate faces..
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -43,6 +49,7 @@
 #include "lldrawable.h"
 #include "lldrawpoolavatar.h"
 #include "llface.h"
+#include "llfloatercustomize.h"
 #include "llmorphview.h"
 #include "llresmgr.h"
 #include "llselectmgr.h"
@@ -72,25 +79,22 @@ LLVisualParamHint::LLVisualParamHint(
 	S32 width, S32 height, 
 	LLViewerJointMesh *mesh, 
 	LLViewerVisualParam *param,
-	LLWearable *wearable,
-	F32 param_weight,
-	LLJoint* jointp)
+	F32 param_weight)
 	:
 	LLViewerDynamicTexture(width, height, 3, LLViewerDynamicTexture::ORDER_MIDDLE, TRUE ),
 	mNeedsUpdate( TRUE ),
 	mIsVisible( FALSE ),
 	mJointMesh( mesh ),
 	mVisualParam( param ),
-	mWearablePtr( wearable ),
 	mVisualParamWeight( param_weight ),
 	mAllowsUpdates( TRUE ),
 	mDelayFrames( 0 ),
 	mRect( pos_x, pos_y + height, pos_x + width, pos_y ),
-	mLastParamWeight(0.f),
-	mCamTargetJoint(jointp)
+	mLastParamWeight(0.f)
 {
 	LLVisualParamHint::sInstances.insert( this );
-	mBackgroundp = LLUI::getUIImage("avatar_thumb_bkgrnd.png");
+	mBackgroundp = LLUI::getUIImage("avatar_thumb_bkgrnd.j2c");
+
 
 	llassert(width != 0);
 	llassert(height != 0);
@@ -104,12 +108,6 @@ LLVisualParamHint::~LLVisualParamHint()
 	LLVisualParamHint::sInstances.erase( this );
 }
 
-//virtual
-S8 LLVisualParamHint::getType() const
-{
-	return LLViewerDynamicTexture::LL_VISUAL_PARAM_HINT ;
-}
-
 //-----------------------------------------------------------------------------
 // static
 // requestHintUpdates()
@@ -141,13 +139,13 @@ void LLVisualParamHint::requestHintUpdates( LLVisualParamHint* exception1, LLVis
 
 BOOL LLVisualParamHint::needsRender()
 {
-	return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatarp->getIsAppearanceAnimating() && mAllowsUpdates;
+	return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatarp->mAppearanceAnimating && mAllowsUpdates;
 }
 
 void LLVisualParamHint::preRender(BOOL clear_depth)
 {
 	mLastParamWeight = mVisualParam->getWeight();
-	mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
+	mVisualParam->setWeight(mVisualParamWeight, FALSE);
 	gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
 	gAgentAvatarp->setVisualParamWeight("Blink_Left", 0.f);
 	gAgentAvatarp->setVisualParamWeight("Blink_Right", 0.f);
@@ -191,6 +189,21 @@ BOOL LLVisualParamHint::render()
 	mNeedsUpdate = FALSE;
 	mIsVisible = TRUE;
 
+	LLViewerJointMesh* cam_target_joint = NULL;
+	const std::string& cam_target_mesh_name = mVisualParam->getCameraTargetName();
+	if( !cam_target_mesh_name.empty() )
+	{
+		cam_target_joint = (LLViewerJointMesh*)gAgentAvatarp->getJoint( cam_target_mesh_name );
+	}
+	if( !cam_target_joint )
+	{
+		cam_target_joint = (LLViewerJointMesh*)gMorphView->getCameraTargetJoint();
+	}
+	if( !cam_target_joint )
+	{
+		cam_target_joint = (LLViewerJointMesh*)gAgentAvatarp->getJoint("mHead");
+	}
+
 	LLQuaternion avatar_rotation;
 	LLJoint* root_joint = gAgentAvatarp->getRootJoint();
 	if( root_joint )
@@ -198,7 +211,7 @@ BOOL LLVisualParamHint::render()
 		avatar_rotation = root_joint->getWorldRotation();
 	}
 
-	LLVector3 target_joint_pos = mCamTargetJoint->getWorldPosition();
+	LLVector3 target_joint_pos = cam_target_joint->getWorldPosition();
 
 	LLVector3 target_offset( 0, 0, mVisualParam->getCameraElevation() );
 	LLVector3 target_pos = target_joint_pos + (target_offset * avatar_rotation);
@@ -214,9 +227,9 @@ BOOL LLVisualParamHint::render()
 	
 	LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / (F32)mFullHeight);
 	LLViewerCamera::getInstance()->setOriginAndLookAt(
-		camera_pos,			// camera
-		LLVector3::z_axis,	// up
-		target_pos );		// point of interest
+		camera_pos,		// camera
+		LLVector3(0.f, 0.f, 1.f),						// up
+		target_pos );	// point of interest
 
 	LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
 
@@ -231,12 +244,10 @@ BOOL LLVisualParamHint::render()
 		gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
 	}
 	gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
-	mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight, FALSE);
-	gAgentAvatarp->updateVisualParams();
+	mVisualParam->setWeight(mLastParamWeight, FALSE);
 	gGL.color4f(1,1,1,1);
 	mGLTexturep->setGLTextureCreated(true);
 	gGL.popUIMatrix();
-
 	return TRUE;
 }
 
@@ -276,12 +287,6 @@ LLVisualParamReset::LLVisualParamReset() : LLViewerDynamicTexture(1, 1, 1, ORDER
 {	
 }
 
-//virtual
-S8 LLVisualParamReset::getType() const
-{
-	return LLViewerDynamicTexture::LL_VISUAL_PARAM_RESET ;
-}
-
 //-----------------------------------------------------------------------------
 // render()
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 60df98ee99a7042692ff7f8c44944aeef0e38086..84c463495bddf31d557a36e97ca627502099d00f 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -2,25 +2,31 @@
  * @file lltoolpie.cpp
  * @brief LLToolPie class implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -47,7 +53,6 @@
 #include "llmediaentry.h"
 #include "llmenugl.h"
 #include "llmutelist.h"
-#include "llresmgr.h"  // getMonetaryString
 #include "llselectmgr.h"
 #include "lltoolfocus.h"
 #include "lltoolgrab.h"
@@ -176,10 +181,10 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
 		parent = object->getRootEdit();
 	}
 
-	if (handleMediaClick(mPick))
-	{
-		return TRUE;
-	}
+
+	BOOL touchable = (object && object->flagHandleTouch()) 
+					 || (parent && parent->flagHandleTouch());
+
 
 	// If it's a left-click, and we have a special action, do it.
 	if (useClickAction(mask, object, parent))
@@ -281,12 +286,14 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
 		}
 	}
 
+	if (handleMediaClick(mPick))
+	{
+		return TRUE;
+	}
+
 	// put focus back "in world"
 	gFocusMgr.setKeyboardFocus(NULL);
 
-	BOOL touchable = (object && object->flagHandleTouch()) 
-					 || (parent && parent->flagHandleTouch());
-
 	// Switch to grab tool if physical or triggerable
 	if (object && 
 		!object->isAvatar() && 
@@ -506,22 +513,21 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
 	}
 
 	LLViewerObject* click_action_object = click_action_pick.getObject();
-	if (handleMediaHover(mHoverPick))
+	if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit()))
 	{
-		// *NOTE: If you think the hover glow conflicts with the media outline, you
-		// could disable it here.
 		show_highlight = true;
-		// cursor set by media object
+		ECursorType cursor = cursor_from_object(click_action_object);
+		gViewerWindow->setCursor(cursor);
 		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
 	}
-	else if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit()))
+	else if (handleMediaHover(mHoverPick))
 	{
+		// *NOTE: If you think the hover glow conflicts with the media outline, you
+		// could disable it here.
 		show_highlight = true;
-		ECursorType cursor = cursor_from_object(click_action_object);
-		gViewerWindow->setCursor(cursor);
+		// cursor set by media object
 		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
 	}
-	
 	else if ((object && !object->isAvatar() && object->usePhysics()) 
 			 || (parent && !parent->isAvatar() && parent->usePhysics()))
 	{
@@ -803,8 +809,7 @@ BOOL LLToolPie::handleTooltipLand(std::string line, std::string tooltip_msg)
 	if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE))
 	{
 		LLStringUtil::format_map_t args;
-		S32 price = hover_parcel->getSalePrice();
-		args["[AMOUNT]"] = LLResMgr::getInstance()->getMonetaryString(price);
+		args["[AMOUNT]"] = llformat("%d", hover_parcel->getSalePrice());
 		line = LLTrans::getString("TooltipForSaleL$", args);
 		tooltip_msg.append(line);
 		tooltip_msg.push_back('\n');
@@ -902,14 +907,13 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l
 			 || !existing_inspector->getVisible()
 			 || existing_inspector->getKey()["object_id"].asUUID() != hover_object->getID()))
 		{
-
+						
 			// Add price to tooltip for items on sale
 			bool for_sale = for_sale_selection(nodep);
 			if(for_sale)
 			{
 				LLStringUtil::format_map_t args;
-				S32 price = nodep->mSaleInfo.getSalePrice();
-				args["[AMOUNT]"] = LLResMgr::getInstance()->getMonetaryString(price);
+				args["[PRICE]"] = llformat ("%d", nodep->mSaleInfo.getSalePrice());
 				tooltip_msg.append(LLTrans::getString("TooltipPrice", args) );
 			}
 
diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp
index 93ba3b25587c79ecd6334255ccd5bec27a1b467e..91f01f0b362a89f403b679f6a4cc0ae5527703ec 100644
--- a/indra/newview/lltoolplacer.cpp
+++ b/indra/newview/lltoolplacer.cpp
@@ -2,25 +2,31 @@
  * @file lltoolplacer.cpp
  * @brief Tool for placing new objects into the world
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp
index 7c604a04bf7b53f2e130028a5b0c3cc6c5c5a218..2065ba17912d78710c9846186d6719301d65c3cc 100644
--- a/indra/newview/lltoolselect.cpp
+++ b/indra/newview/lltoolselect.cpp
@@ -2,25 +2,31 @@
  * @file lltoolselect.cpp
  * @brief LLToolSelect class implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp
index 8391c0f832a5bff6d41bcf0ac3d21da6165d9423..cc074287c43aea129abc72e4077bee9ec62a9ff5 100644
--- a/indra/newview/lltracker.cpp
+++ b/indra/newview/lltracker.cpp
@@ -2,25 +2,31 @@
  * @file lltracker.cpp
  * @brief Container for objects user is tracking.
  *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp
index aa90d16c67f5848153f0511bdcfaac8be8610251..ab65ead4c51fa5a8c64fe471694e550224827556 100644
--- a/indra/newview/llurl.cpp
+++ b/indra/newview/llurl.cpp
@@ -2,25 +2,31 @@
  * @file llurl.cpp
  * @brief Text url class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -280,11 +286,5 @@ const char * LLURL::getFullPath()
 	return(sReturnString);
 }
 
-const char * LLURL::getAuthority()
-{
-	strncpy(LLURL::sReturnString,mAuthority, LL_MAX_PATH -1);               /* Flawfinder: ignore */
-	LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
-	return(sReturnString);
-}
 
 char LLURL::sReturnString[LL_MAX_PATH] = "";
diff --git a/indra/newview/llurl.h b/indra/newview/llurl.h
index 01ab3bdfc264aed70f990f8fa63db1c7902c3eae..9a089dd835a75dfb2573ec673733f64cc6ff258d 100644
--- a/indra/newview/llurl.h
+++ b/indra/newview/llurl.h
@@ -2,25 +2,31 @@
  * @file llurl.h
  * @brief Text url class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -73,7 +79,6 @@ class LLURL
 
 	virtual const char *getFQURL() const;
 	virtual const char *getFullPath();
-	virtual const char *getAuthority();
 
 	virtual const char *updateRelativePath(const LLURL &url);
 
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 123b47e97e9173b5d40ffe4309ab9f23f1534724..b88069cd48926d3fbebdb071438436e31a0063bb 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -2,25 +2,31 @@
  * @file llurldispatcher.cpp
  * @brief Central registry for all URL handlers
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 #include "llviewerprecompiledheaders.h"
@@ -39,10 +45,10 @@
 #include "llsidetray.h"
 #include "llslurl.h"
 #include "llstartup.h"			// gStartupState
+#include "llurlsimstring.h"
 #include "llweb.h"
 #include "llworldmapmessage.h"
 #include "llurldispatcherlistener.h"
-#include "llviewernetwork.h"
 
 // library includes
 #include "llnotificationsutil.h"
@@ -53,25 +59,25 @@ static LLURLDispatcherListener sURLDispatcherListener;
 class LLURLDispatcherImpl
 {
 public:
-	static bool dispatch(const LLSLURL& slurl,
+	static bool dispatch(const std::string& url,
 						 LLMediaCtrl* web,
 						 bool trusted_browser);
 		// returns true if handled or explicitly blocked.
 
-	static bool dispatchRightClick(const LLSLURL& slurl);
+	static bool dispatchRightClick(const std::string& url);
 
 private:
-	static bool dispatchCore(const LLSLURL& slurl, 
+	static bool dispatchCore(const std::string& url, 
 							 bool right_mouse,
 							 LLMediaCtrl* web,
 							 bool trusted_browser);
 		// handles both left and right click
 
-	static bool dispatchHelp(const LLSLURL& slurl, bool right_mouse);
+	static bool dispatchHelp(const std::string& url, bool right_mouse);
 		// Handles sl://app.floater.html.help by showing Help floater.
 		// Returns true if handled.
 
-	static bool dispatchApp(const LLSLURL& slurl,
+	static bool dispatchApp(const std::string& url,
 							bool right_mouse,
 							LLMediaCtrl* web,
 							bool trusted_browser);
@@ -79,16 +85,16 @@ class LLURLDispatcherImpl
 		// by showing panel in Search floater.
 		// Returns true if handled or explicitly blocked.
 
-	static bool dispatchRegion(const LLSLURL& slurl, bool right_mouse);
+	static bool dispatchRegion(const std::string& url, bool right_mouse);
 		// handles secondlife://Ahern/123/45/67/
 		// Returns true if handled.
 
-	static void regionHandleCallback(U64 handle, const LLSLURL& slurl,
+	static void regionHandleCallback(U64 handle, const std::string& url,
 		const LLUUID& snapshot_id, bool teleport);
 		// Called by LLWorldMap when a location has been resolved to a
 	    // region name
 
-	static void regionNameCallback(U64 handle, const LLSLURL& slurl,
+	static void regionNameCallback(U64 handle, const std::string& url,
 		const LLUUID& snapshot_id, bool teleport);
 		// Called by LLWorldMap when a region name has been resolved to a
 		// location in-world, used by places-panel display.
@@ -97,58 +103,65 @@ class LLURLDispatcherImpl
 };
 
 // static
-bool LLURLDispatcherImpl::dispatchCore(const LLSLURL& slurl,
+bool LLURLDispatcherImpl::dispatchCore(const std::string& url,
 									   bool right_mouse,
 									   LLMediaCtrl* web,
 									   bool trusted_browser)
 {
-	//if (dispatchHelp(slurl, right_mouse)) return true;
-	switch(slurl.getType())
-	{
-		case LLSLURL::APP: 
-			return dispatchApp(slurl, right_mouse, web, trusted_browser);
-		case LLSLURL::LOCATION:
-			return dispatchRegion(slurl, right_mouse);
-		default:
-			return false;
-	}
+	if (url.empty()) return false;
+	//if (dispatchHelp(url, right_mouse)) return true;
+	if (dispatchApp(url, right_mouse, web, trusted_browser)) return true;
+	if (dispatchRegion(url, right_mouse)) return true;
 
 	/*
 	// Inform the user we can't handle this
 	std::map<std::string, std::string> args;
-	args["SLURL"] = slurl;
+	args["SLURL"] = url;
 	r;
 	*/
+	
+	return false;
 }
 
 // static
-bool LLURLDispatcherImpl::dispatch(const LLSLURL& slurl,
+bool LLURLDispatcherImpl::dispatch(const std::string& url,
 								   LLMediaCtrl* web,
 								   bool trusted_browser)
 {
+	llinfos << "url: " << url << llendl;
 	const bool right_click = false;
-	return dispatchCore(slurl, right_click, web, trusted_browser);
+	return dispatchCore(url, right_click, web, trusted_browser);
 }
 
 // static
-bool LLURLDispatcherImpl::dispatchRightClick(const LLSLURL& slurl)
+bool LLURLDispatcherImpl::dispatchRightClick(const std::string& url)
 {
+	llinfos << "url: " << url << llendl;
 	const bool right_click = true;
 	LLMediaCtrl* web = NULL;
 	const bool trusted_browser = false;
-	return dispatchCore(slurl, right_click, web, trusted_browser);
+	return dispatchCore(url, right_click, web, trusted_browser);
 }
 
 // static
-bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl, 
+bool LLURLDispatcherImpl::dispatchApp(const std::string& url, 
 									  bool right_mouse,
 									  LLMediaCtrl* web,
 									  bool trusted_browser)
 {
-	llinfos << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << llendl;
-	const LLSD& query_map = LLURI::queryMap(slurl.getAppQuery());
+	// ensure the URL is in the secondlife:///app/ format
+	if (!LLSLURL::isSLURLCommand(url))
+	{
+		return false;
+	}
+
+	LLURI uri(url);
+	LLSD pathArray = uri.pathArray();
+	pathArray.erase(0); // erase "app"
+	std::string cmd = pathArray.get(0);
+	pathArray.erase(0); // erase "cmd"
 	bool handled = LLCommandDispatcher::dispatch(
-			slurl.getAppCmd(), slurl.getAppPath(), query_map, web, trusted_browser);
+			cmd, pathArray, uri.queryMap(), web, trusted_browser);
 
 	// alert if we didn't handle this secondlife:///app/ SLURL
 	// (but still return true because it is a valid app SLURL)
@@ -160,73 +173,81 @@ bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl,
 }
 
 // static
-bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, bool right_mouse)
+bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, bool right_mouse)
 {
-  if(slurl.getType() != LLSLURL::LOCATION)
-    {
-      return false;
-    }
+	if (!LLSLURL::isSLURL(url))
+	{
+		return false;
+	}
+
+	std::string sim_string = LLSLURL::stripProtocol(url);
+	std::string region_name;
+	S32 x = 128;
+	S32 y = 128;
+	S32 z = 0;
+	if (! LLURLSimString::parse(sim_string, &region_name, &x, &y, &z))
+	{
+		return false;
+	}
+
 	// Before we're logged in, need to update the startup screen
 	// to tell the user where they are going.
 	if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
 	{
+		// Parse it and stash in globals, it will be dispatched in
+		// STATE_CLEANUP.
+		LLURLSimString::setString(url);
 		// We're at the login screen, so make sure user can see
 		// the login location box to know where they are going.
 		
-		LLPanelLogin::setLocation(slurl);
+		LLPanelLogin::refreshLocation( true );
 		return true;
 	}
 
 	// LLFloaterURLDisplay functionality moved to LLPanelPlaces in Side Tray.
-	//LLFloaterURLDisplay* slurl_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
-	//if(slurl_displayp) slurl_displayp->setName(region_name);
+	//LLFloaterURLDisplay* url_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
+	//if(url_displayp) url_displayp->setName(region_name);
 
 	// Request a region handle by name
-	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
-									  LLURLDispatcherImpl::regionNameCallback,
-									  slurl.getSLURLString(),
-									  false);	// don't teleport
+	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
+								 LLURLDispatcherImpl::regionNameCallback,
+								 url,
+								 false);	// don't teleport
 	return true;
 }
 
 /*static*/
-void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
+void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
 {
-      
-  if(slurl.getType() == LLSLURL::LOCATION)
-    {        
-      regionHandleCallback(region_handle, slurl, snapshot_id, teleport);
-    }
+	std::string sim_string = LLSLURL::stripProtocol(url);
+	std::string region_name;
+	S32 x = 128;
+	S32 y = 128;
+	S32 z = 0;
+
+	if (LLURLSimString::parse(sim_string, &region_name, &x, &y, &z))
+	{
+		regionHandleCallback(region_handle, url, snapshot_id, teleport);
+	}
 }
 
 /* static */
-void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
+void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
 {
+	std::string sim_string = LLSLURL::stripProtocol(url);
+	std::string region_name;
+	S32 x = 128;
+	S32 y = 128;
+	S32 z = 0;
+	LLURLSimString::parse(sim_string, &region_name, &x, &y, &z);
+
+	LLVector3 local_pos;
+	local_pos.mV[VX] = (F32)x;
+	local_pos.mV[VY] = (F32)y;
+	local_pos.mV[VZ] = (F32)z;
 
-  // we can't teleport cross grid at this point
-	if((!LLGridManager::getInstance()->isSystemGrid(slurl.getGrid()) || !LLGridManager::getInstance()->isSystemGrid()) &&
-	   (slurl.getGrid() != LLGridManager::getInstance()->getGrid()))
-	{
-		LLSD args;
-		args["SLURL"] = slurl.getLocationString();
-		args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
-		LLSD grid_info;
-		LLGridManager::getInstance()->getGridInfo(slurl.getGrid(), grid_info);
-		
-		if(grid_info.has(GRID_LABEL_VALUE))
-		{
-			args["GRID"] = grid_info[GRID_LABEL_VALUE].asString();
-		}
-		else 
-		{
-			args["GRID"] = slurl.getGrid();
-		}
-		LLNotificationsUtil::add("CantTeleportToGrid", args);
-		return;
-	}
-	
 	LLVector3d global_pos = from_region_handle(region_handle);
-	global_pos += LLVector3d(slurl.getPosition());
+	global_pos += LLVector3d(local_pos);
 	
 	if (teleport)
 	{	
@@ -250,8 +271,8 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL&
 		// LLFloaterURLDisplay functionality moved to LLPanelPlaces in Side Tray.
 
 //		// display informational floater, allow user to click teleport btn
-//		LLFloaterURLDisplay* slurl_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
-//		if(slurl_displayp)
+//		LLFloaterURLDisplay* url_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
+//		if(url_displayp)
 //		{
 //			url_displayp->displayParcelInfo(region_handle, local_pos);
 //			if(snapshot_id.notNull())
@@ -266,7 +287,7 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL&
 
 //---------------------------------------------------------------------------
 // Teleportation links are handled here because they are tightly coupled
-// to SLURL parsing and sim-fragment parsing
+// to URL parsing and sim-fragment parsing
 class LLTeleportHandler : public LLCommandHandler
 {
 public:
@@ -282,21 +303,18 @@ class LLTeleportHandler : public LLCommandHandler
 		// a global position, and teleport to it
 		if (tokens.size() < 1) return false;
 
-		LLVector3 coords(128, 128, 0);
-		if (tokens.size() <= 4)
-		{
-			coords = LLVector3(tokens[1].asReal(), 
-							   tokens[2].asReal(), 
-							   tokens[3].asReal());
-		}
-		
 		// Region names may be %20 escaped.
-		
-		std::string region_name = LLURI::unescape(tokens[0]);
+		std::string region_name = LLURLSimString::unescapeRegionName(tokens[0]);
 
+		// build secondlife://De%20Haro/123/45/67 for use in callback
+		std::string url = LLSLURL::PREFIX_SECONDLIFE;
+		for (int i = 0; i < tokens.size(); ++i)
+		{
+			url += tokens[i].asString() + "/";
+		}
 		LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
 			LLURLDispatcherImpl::regionHandleCallback,
-			LLSLURL(region_name, coords).getSLURLString(),
+			url,
 			true);	// teleport
 		return true;
 	}
@@ -306,21 +324,21 @@ LLTeleportHandler gTeleportHandler;
 //---------------------------------------------------------------------------
 
 // static
-bool LLURLDispatcher::dispatch(const std::string& slurl,
+bool LLURLDispatcher::dispatch(const std::string& url,
 							   LLMediaCtrl* web,
 							   bool trusted_browser)
 {
-	return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), web, trusted_browser);
+	return LLURLDispatcherImpl::dispatch(url, web, trusted_browser);
 }
 
 // static
-bool LLURLDispatcher::dispatchRightClick(const std::string& slurl)
+bool LLURLDispatcher::dispatchRightClick(const std::string& url)
 {
-	return LLURLDispatcherImpl::dispatchRightClick(LLSLURL(slurl));
+	return LLURLDispatcherImpl::dispatchRightClick(url);
 }
 
 // static
-bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl)
+bool LLURLDispatcher::dispatchFromTextEditor(const std::string& url)
 {
 	// *NOTE: Text editors are considered sources of trusted URLs
 	// in order to make avatar profile links in chat history work.
@@ -330,7 +348,5 @@ bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl)
 	// *TODO: Make this trust model more refined.  JC
 	const bool trusted_browser = true;
 	LLMediaCtrl* web = NULL;
-	return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), web, trusted_browser);
+	return LLURLDispatcherImpl::dispatch(url, web, trusted_browser);
 }
-
-
diff --git a/indra/newview/llurldispatcher.h b/indra/newview/llurldispatcher.h
index b07db4da3f4591c3023c2f7f958aaab2968be1f3..ff8a3512539ca5542528c15c09f7cf537b93b035 100644
--- a/indra/newview/llurldispatcher.h
+++ b/indra/newview/llurldispatcher.h
@@ -2,39 +2,45 @@
  * @file llurldispatcher.h
  * @brief Central registry for all SL URL handlers
  *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 #ifndef LLURLDISPATCHER_H
 #define LLURLDISPATCHER_H
+
 class LLMediaCtrl;
 
 
 class LLURLDispatcher
 {
 public:
-	
-	static bool dispatch(const std::string& slurl,
+	static bool dispatch(const std::string& url,
 						 LLMediaCtrl* web,
-						 bool trusted_browser);	
+						 bool trusted_browser);
 		// At startup time and on clicks in internal web browsers,
 		// teleport, open map, or run requested command.
 		// @param url
@@ -48,9 +54,9 @@ class LLURLDispatcher
 		//   that navigates to trusted (Linden Lab) pages.
 		// Returns true if someone handled the URL.
 
-	static bool dispatchRightClick(const std::string& slurl);
+	static bool dispatchRightClick(const std::string& url);
 
-	static bool dispatchFromTextEditor(const std::string& slurl);
+	static bool dispatchFromTextEditor(const std::string& url);
 };
 
 #endif
diff --git a/indra/newview/llurldispatcherlistener.cpp b/indra/newview/llurldispatcherlistener.cpp
index d0441d7bfaa1a113ae93ca190567aac80828c138..fea6a769c518a4600c3755de031e12b34e7899d8 100644
--- a/indra/newview/llurldispatcherlistener.cpp
+++ b/indra/newview/llurldispatcherlistener.cpp
@@ -4,25 +4,8 @@
  * @date   2009-12-10
  * @brief  Implementation for llurldispatcherlistener.
  * 
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp
index 56b5bbf9420685965a9562183f83314dda4b2951..1d2687a8c269073c9893b2777ea99f3ea6922605 100644
--- a/indra/newview/llurllineeditorctrl.cpp
+++ b/indra/newview/llurllineeditorctrl.cpp
@@ -2,25 +2,31 @@
  * @file llurllineeditorctrl.cpp
  * @brief LLURLLineEditor base class
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -83,10 +89,9 @@ void LLURLLineEditor::copyEscapedURLToClipboard()
 
 	const std::string unescaped_text = wstring_to_utf8str(mText.getWString().substr(left_pos, length));
 	LLWString text_to_copy;
-	// *HACK: Because LLSLURL is currently broken we cannot use it to check if unescaped_text is a valid SLURL (see EXT-8335).
-	if (LLStringUtil::startsWith(unescaped_text, "http://")) // SLURL
+	if (LLSLURL::isSLURL(unescaped_text))
 		text_to_copy = utf8str_to_wstring(LLWeb::escapeURL(unescaped_text));
-	else // human-readable location
+	else
 		text_to_copy = utf8str_to_wstring(unescaped_text);
 		
 	gClipboard.copyFromString( text_to_copy );
diff --git a/indra/newview/llurllineeditorctrl.h b/indra/newview/llurllineeditorctrl.h
index b9540dd571344838bcc36801ae255307803c7ef8..ebe417e85549e916cb6307ff251a3e9bcb828c5f 100644
--- a/indra/newview/llurllineeditorctrl.h
+++ b/indra/newview/llurllineeditorctrl.h
@@ -2,25 +2,31 @@
  * @file llurllineeditorctrl.h
  * @brief Combobox-like location input control
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index 750bb224b1ddf05add1a3021fcd871afaa6159bd..2661c9f32b3b9e6aad1a228fdcfacb3c9c037bf6 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -2,25 +2,31 @@
  * @file llvieweraudio.cpp
  * @brief Audio functions that used to be in viewer.cpp
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -139,7 +145,7 @@ void audio_update_volume(bool force_update)
 	{		
 		F32 music_volume = gSavedSettings.getF32("AudioLevelMusic");
 		BOOL music_muted = gSavedSettings.getBOOL("MuteMusic");
-		music_volume = mute_volume * master_volume * music_volume;
+		music_volume = mute_volume * master_volume * (music_volume*music_volume);
 		gAudiop->setInternetStreamGain ( music_muted ? 0.f : music_volume );
 	
 	}
@@ -147,25 +153,25 @@ void audio_update_volume(bool force_update)
 	// Streaming Media
 	F32 media_volume = gSavedSettings.getF32("AudioLevelMedia");
 	BOOL media_muted = gSavedSettings.getBOOL("MuteMedia");
-	media_volume = mute_volume * master_volume * media_volume;
+	media_volume = mute_volume * master_volume * (media_volume*media_volume);
 	LLViewerMedia::setVolume( media_muted ? 0.0f : media_volume );
 
 	// Voice
-	if (LLVoiceClient::getInstance())
+	if (gVoiceClient)
 	{
 		F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice");
 		voice_volume = mute_volume * master_volume * voice_volume;
 		BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice");
-		LLVoiceClient::getInstance()->setVoiceVolume(voice_mute ? 0.f : voice_volume);
-		LLVoiceClient::getInstance()->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
+		gVoiceClient->setVoiceVolume(voice_mute ? 0.f : voice_volume);
+		gVoiceClient->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
 
 		if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized")))
 		{
-			LLVoiceClient::getInstance()->setMuteMic(true);
+			gVoiceClient->setMuteMic(true);
 		}
 		else
 		{
-			LLVoiceClient::getInstance()->setMuteMic(false);
+			gVoiceClient->setMuteMic(false);
 		}
 	}
 }
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index ac2037ef682bc233fa4491460617d631fda2e00a..6f037177fabccf8f5c8aa2249540237b2b89c4e3 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -3,25 +3,31 @@
  * @brief Viewer configuration
  * @author Richard Nelson
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -64,11 +70,11 @@
 #include "llvosurfacepatch.h"
 #include "llvowlsky.h"
 #include "llrender.h"
+#include "llbottomtray.h"
 #include "llnavigationbar.h"
 #include "llfloatertools.h"
 #include "llpaneloutfitsinventory.h"
 #include "llpanellogin.h"
-#include "llpaneltopinfobar.h"
 
 #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
 BOOL 				gHackGodmode = FALSE;
@@ -407,6 +413,7 @@ bool handleHighResSnapshotChanged(const LLSD& newvalue)
 
 bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
 {
+	if(LLVoiceClient::getInstance())
 	LLVoiceClient::getInstance()->updateSettings();
 	return true;
 }
@@ -437,7 +444,7 @@ bool handleVelocityInterpolate(const LLSD& newvalue)
 
 bool handleForceShowGrid(const LLSD& newvalue)
 {
-	LLPanelLogin::updateServer( );
+	LLPanelLogin::refreshLocation( false );
 	return true;
 }
 
@@ -454,29 +461,45 @@ bool toggle_agent_pause(const LLSD& newvalue)
 	return true;
 }
 
-bool toggle_show_navigation_panel(const LLSD& newvalue)
+bool toggle_show_gesture_button(const LLSD& newvalue)
 {
-	bool value = newvalue.asBoolean();
+	LLBottomTray::getInstance()->showGestureButton(newvalue.asBoolean());
+	return true;
+}
 
-	LLNavigationBar::getInstance()->showNavigationPanel(value);
-	gSavedSettings.setBOOL("ShowMiniLocationPanel", !value);
+bool toggle_show_move_button(const LLSD& newvalue)
+{
+	LLBottomTray::getInstance()->showMoveButton(newvalue.asBoolean());
+	return true;
+}
 
+bool toggle_show_camera_button(const LLSD& newvalue)
+{
+	LLBottomTray::getInstance()->showCameraButton(newvalue.asBoolean());
 	return true;
 }
 
-bool toggle_show_favorites_panel(const LLSD& newvalue)
+bool toggle_show_snapshot_button(const LLSD& newvalue)
 {
-	LLNavigationBar::getInstance()->showFavoritesPanel(newvalue.asBoolean());
+	LLBottomTray::getInstance()->showSnapshotButton(newvalue.asBoolean());
 	return true;
 }
 
-bool toggle_show_mini_location_panel(const LLSD& newvalue)
+bool toggle_show_navigation_panel(const LLSD& newvalue)
 {
-	bool value = newvalue.asBoolean();
+	LLNavigationBar::getInstance()->showNavigationPanel(newvalue.asBoolean());
+	return true;
+}
 
-	LLPanelTopInfoBar::getInstance()->setVisible(value);
-	gSavedSettings.setBOOL("ShowNavbarNavigationPanel", !value);
+bool toggle_show_favorites_panel(const LLSD& newvalue)
+{
+	LLNavigationBar::getInstance()->showFavoritesPanel(newvalue.asBoolean());
+	return true;
+}
 
+bool toggle_show_appearance_editor(const LLSD& newvalue)
+{
+	LLPanelOutfitsInventory::sShowDebugEditor = newvalue.asBoolean();
 	return true;
 }
 
@@ -553,7 +576,6 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("MuteAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
 	gSavedSettings.getControl("MuteUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
 	gSavedSettings.getControl("RenderVBOEnable")->getSignal()->connect(boost::bind(&handleRenderUseVBOChanged, _2));
-	gSavedSettings.getControl("RenderUseStreamVBO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
 	gSavedSettings.getControl("WLSkyDetail")->getSignal()->connect(boost::bind(&handleWLSkyDetailChanged, _2));
 	gSavedSettings.getControl("RenderLightingDetail")->getSignal()->connect(boost::bind(&handleRenderLightingDetailChanged, _2));
 	gSavedSettings.getControl("NumpadControl")->getSignal()->connect(boost::bind(&handleNumpadControlChanged, _2));
@@ -623,9 +645,13 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("QAMode")->getSignal()->connect(boost::bind(&show_debug_menus));
 	gSavedSettings.getControl("UseDebugMenus")->getSignal()->connect(boost::bind(&show_debug_menus));
 	gSavedSettings.getControl("AgentPause")->getSignal()->connect(boost::bind(&toggle_agent_pause, _2));
+	gSavedSettings.getControl("ShowGestureButton")->getSignal()->connect(boost::bind(&toggle_show_gesture_button, _2));
+	gSavedSettings.getControl("ShowMoveButton")->getSignal()->connect(boost::bind(&toggle_show_move_button, _2));
+	gSavedSettings.getControl("ShowCameraButton")->getSignal()->connect(boost::bind(&toggle_show_camera_button, _2));
+	gSavedSettings.getControl("ShowSnapshotButton")->getSignal()->connect(boost::bind(&toggle_show_snapshot_button, _2));
 	gSavedSettings.getControl("ShowNavbarNavigationPanel")->getSignal()->connect(boost::bind(&toggle_show_navigation_panel, _2));
 	gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2));
-	gSavedSettings.getControl("ShowMiniLocationPanel")->getSignal()->connect(boost::bind(&toggle_show_mini_location_panel, _2));
+	gSavedSettings.getControl("ShowDebugAppearanceEditor")->getSignal()->connect(boost::bind(&toggle_show_appearance_editor, _2));
 	gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2));
 	gSavedSettings.getControl("ForceShowGrid")->getSignal()->connect(boost::bind(&handleForceShowGrid, _2));
 }
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index f796fb545120fbdfc78b9953988e851c0c1f016b..8e2e2283bf1f5b89e3434f38412c7b93cf1dbd02 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -345,9 +345,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived.
 
 		S32 attach_count = 0;
-		if (gAgent.getAvatarObject())
+		if (isAgentAvatarValid())
 		{
-			attach_count = gAgent.getAvatarObject()->getAttachmentCount();
+			attach_count = gAgentAvatarp->getAttachmentCount();
 		}
 		F32 teleport_save_time = TELEPORT_EXPIRY + TELEPORT_EXPIRY_PER_ATTACHMENT * attach_count;
 		F32 teleport_elapsed = gTeleportDisplayTimer.getElapsedTimeF32();
@@ -1026,11 +1026,10 @@ LLRect get_whole_screen_region()
 
 bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model)
 {
-	LLVOAvatar* my_avatarp = gAgent.getAvatarObject();
-	if (my_avatarp && my_avatarp->hasHUDAttachment())
+	if (isAgentAvatarValid() && gAgentAvatarp->hasHUDAttachment())
 	{
 		F32 zoom_level = gAgentCamera.mHUDCurZoom;
-		LLBBox hud_bbox = my_avatarp->getHUDBBox();
+		LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
 		
 		F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
 		proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth);
@@ -1294,7 +1293,7 @@ void render_ui_2d()
 	gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
 
 	// render outline for HUD
-	if (gAgent.getAvatarObject() && gAgentCamera.mHUDCurZoom < 0.98f)
+	if (isAgentAvatarValid() && gAgentCamera.mHUDCurZoom < 0.98f)
 	{
 		glPushMatrix();
 		S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2);
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index efc5d87a53349152ccd5e1de4eb25fed2bd35576..8a891b1462906165ae41e95d121c70bbc2b7ffcc 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -2,25 +2,31 @@
  * @file llviewerinventory.cpp
  * @brief Implementation of the viewer side inventory objects.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -30,10 +36,10 @@
 #include "llnotificationsutil.h"
 #include "llsdserialize.h"
 #include "message.h"
+#include "indra_constants.h"
 
 #include "llagent.h"
 #include "llagentcamera.h"
-#include "llagentwearables.h"
 #include "llviewerfoldertype.h"
 #include "llfolderview.h"
 #include "llviewercontrol.h"
@@ -56,109 +62,9 @@
 #include "llviewerwindow.h"
 #include "lltrans.h"
 #include "llappearancemgr.h"
+#include "llfloatercustomize.h"
 #include "llcommandhandler.h"
 #include "llviewermessage.h"
-#include "llsidepanelappearance.h"
-
-///----------------------------------------------------------------------------
-/// Helper class to store special inventory item names and their localized values.
-///----------------------------------------------------------------------------
-class LLLocalizedInventoryItemsDictionary : public LLSingleton<LLLocalizedInventoryItemsDictionary>
-{
-public:
-	std::map<std::string, std::string> mInventoryItemsDict;
-
-	LLLocalizedInventoryItemsDictionary()
-	{
-		mInventoryItemsDict["New Shape"]		= LLTrans::getString("New Shape");
-		mInventoryItemsDict["New Skin"]			= LLTrans::getString("New Skin");
-		mInventoryItemsDict["New Hair"]			= LLTrans::getString("New Hair");
-		mInventoryItemsDict["New Eyes"]			= LLTrans::getString("New Eyes");
-		mInventoryItemsDict["New Shirt"]		= LLTrans::getString("New Shirt");
-		mInventoryItemsDict["New Pants"]		= LLTrans::getString("New Pants");
-		mInventoryItemsDict["New Shoes"]		= LLTrans::getString("New Shoes");
-		mInventoryItemsDict["New Socks"]		= LLTrans::getString("New Socks");
-		mInventoryItemsDict["New Jacket"]		= LLTrans::getString("New Jacket");
-		mInventoryItemsDict["New Gloves"]		= LLTrans::getString("New Gloves");
-		mInventoryItemsDict["New Undershirt"]	= LLTrans::getString("New Undershirt");
-		mInventoryItemsDict["New Underpants"]	= LLTrans::getString("New Underpants");
-		mInventoryItemsDict["New Skirt"]		= LLTrans::getString("New Skirt");
-		mInventoryItemsDict["New Alpha"]		= LLTrans::getString("New Alpha");
-		mInventoryItemsDict["New Tattoo"]		= LLTrans::getString("New Tattoo");
-		mInventoryItemsDict["Invalid Wearable"] = LLTrans::getString("Invalid Wearable");
-
-		mInventoryItemsDict["New Gesture"]		= LLTrans::getString("New Gesture");
-		mInventoryItemsDict["New Script"]		= LLTrans::getString("New Script");
-		mInventoryItemsDict["New Folder"]		= LLTrans::getString("New Folder");
-		mInventoryItemsDict["New Note"]			= LLTrans::getString("New Note");
-		mInventoryItemsDict["Contents"]			= LLTrans::getString("Contents");
-
-		mInventoryItemsDict["Gesture"]			= LLTrans::getString("Gesture");
-		mInventoryItemsDict["Male Gestures"]	= LLTrans::getString("Male Gestures");
-		mInventoryItemsDict["Female Gestures"]	= LLTrans::getString("Female Gestures");
-		mInventoryItemsDict["Other Gestures"]	= LLTrans::getString("Other Gestures");
-		mInventoryItemsDict["Speech Gestures"]	= LLTrans::getString("Speech Gestures");
-		mInventoryItemsDict["Common Gestures"]	= LLTrans::getString("Common Gestures");
-
-		//predefined gestures
-
-		//male
-		mInventoryItemsDict["Male - Excuse me"]			= LLTrans::getString("Male - Excuse me");
-		mInventoryItemsDict["Male  - Get lost"]			= LLTrans::getString("Male - Get lost"); // double space after Male. EXT-8319
-		mInventoryItemsDict["Male - Blow kiss"]			= LLTrans::getString("Male - Blow kiss");
-		mInventoryItemsDict["Male - Boo"]				= LLTrans::getString("Male - Boo");
-		mInventoryItemsDict["Male - Bored"]				= LLTrans::getString("Male - Bored");
-		mInventoryItemsDict["Male - Hey"]				= LLTrans::getString("Male - Hey");
-		mInventoryItemsDict["Male - Laugh"]				= LLTrans::getString("Male - Laugh");
-		mInventoryItemsDict["Male - Repulsed"]			= LLTrans::getString("Male - Repulsed");
-		mInventoryItemsDict["Male - Shrug"]				= LLTrans::getString("Male - Shrug");
-		mInventoryItemsDict["Male - Stick tougue out"]	= LLTrans::getString("Male - Stick tougue out");
-		mInventoryItemsDict["Male - Wow"]				= LLTrans::getString("Male - Wow");
-
-		//female
-		mInventoryItemsDict["Female - Chuckle"]			= LLTrans::getString("Female - Chuckle");
-		mInventoryItemsDict["Female - Cry"]				= LLTrans::getString("Female - Cry");
-		mInventoryItemsDict["Female - Embarrassed"]		= LLTrans::getString("Female - Embarrassed");
-		mInventoryItemsDict["Female - Excuse me"]		= LLTrans::getString("Female - Excuse me");
-		mInventoryItemsDict["Female  - Get lost"]		= LLTrans::getString("Female - Get lost"); // double space after Female. EXT-8319
-		mInventoryItemsDict["Female - Blow kiss"]		= LLTrans::getString("Female - Blow kiss");
-		mInventoryItemsDict["Female - Boo"]				= LLTrans::getString("Female - Boo");
-		mInventoryItemsDict["Female - Bored"]			= LLTrans::getString("Female - Bored");
-		mInventoryItemsDict["Female - Hey"]				= LLTrans::getString("Female - Hey");
-		mInventoryItemsDict["Female - Hey baby"]		= LLTrans::getString("Female - Hey baby");
-		mInventoryItemsDict["Female - Laugh"]			= LLTrans::getString("Female - Laugh");
-		mInventoryItemsDict["Female - Looking good"]	= LLTrans::getString("Female - Looking good");
-		mInventoryItemsDict["Female - Over here"]		= LLTrans::getString("Female - Over here");
-		mInventoryItemsDict["Female - Please"]			= LLTrans::getString("Female - Please");
-		mInventoryItemsDict["Female - Repulsed"]		= LLTrans::getString("Female - Repulsed");
-		mInventoryItemsDict["Female - Shrug"]			= LLTrans::getString("Female - Shrug");
-		mInventoryItemsDict["Female - Stick tougue out"]= LLTrans::getString("Female - Stick tougue out");
-		mInventoryItemsDict["Female - Wow"]				= LLTrans::getString("Female - Wow");
-		
-	}
-
-	/**
-	 * Finds passed name in dictionary and replaces it with found localized value.
-	 *
-	 * @param object_name - string to be localized.
-	 * @return true if passed name was found and localized, false otherwise.
-	 */
-	bool localizeInventoryObjectName(std::string& object_name)
-	{
-		LL_DEBUGS("InventoryLocalize") << "Searching for localization: " << object_name << LL_ENDL;
-
-		std::map<std::string, std::string>::const_iterator dictionary_iter = mInventoryItemsDict.find(object_name);
-
-		bool found = dictionary_iter != mInventoryItemsDict.end();
-		if(found)
-		{
-			object_name = dictionary_iter->second;
-			LL_DEBUGS("InventoryLocalize") << "Found, new name is: " << object_name << LL_ENDL;
-		}
-		return found;
-	}
-};
-
 
 ///----------------------------------------------------------------------------
 /// Local function declarations, constants, enums, and typedefs
@@ -359,14 +265,10 @@ void LLViewerInventoryItem::fetchFromServer(void) const
 		// we have to check region. It can be null after region was destroyed. See EXT-245
 		if (region)
 		{
-		  if(gAgent.getID() != mPermissions.getOwner())
-		    {
-		      url = region->getCapability("FetchLib");
-		    }
-		  else
-		    {	
-		      url = region->getCapability("FetchInventory");
-		    }
+			if( ALEXANDRIA_LINDEN_ID.getString() == mPermissions.getOwner().getString())
+				url = region->getCapability("FetchLib");
+			else	
+				url = region->getCapability("FetchInventory");
 		}
 		else
 		{
@@ -414,9 +316,6 @@ BOOL LLViewerInventoryItem::unpackMessage(LLSD item)
 BOOL LLViewerInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num)
 {
 	BOOL rv = LLInventoryItem::unpackMessage(msg, block, block_num);
-
-	LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName);
-
 	mIsComplete = TRUE;
 	return rv;
 }
@@ -622,7 +521,6 @@ bool LLViewerInventoryCategory::fetch()
 	if((VERSION_UNKNOWN == mVersion)
 	   && mDescendentsRequested.hasExpired())	//Expired check prevents multiple downloads.
 	{
-		LL_DEBUGS("InventoryFetch") << "Fetching category children: " << mName << ", UUID: " << mUUID << LL_ENDL;
 		const F32 FETCH_TIMER_EXPIRY = 10.0f;
 		mDescendentsRequested.reset();
 		mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY);
@@ -640,18 +538,10 @@ bool LLViewerInventoryCategory::fetch()
 		// AIS folks are aware of the issue and have a fix in process.
 		// see ticket for details.
 
-		std::string url;
-		if (gAgent.getRegion())
-		{
-			url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");
-		}
-		else
-		{
-			llwarns << "agent region is null" << llendl;
-		}
+		std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");
 		if (!url.empty()) //Capability found.  Build up LLSD and use it.
 		{
-			LLInventoryModelBackgroundFetch::instance().start(mUUID, false);			
+			LLInventoryModelBackgroundFetch::instance().start(mUUID);			
 		}
 		else
 		{	//Deprecated, but if we don't have a capability, use the old system.
@@ -788,8 +678,8 @@ void LLViewerInventoryCategory::determineFolderType()
 				return;
 			if (item->isWearableType())
 			{
-				const LLWearableType::EType wearable_type = item->getWearableType();
-				const std::string& wearable_name = LLWearableType::getTypeName(wearable_type);
+				const EWearableType wearable_type = item->getWearableType();
+				const std::string& wearable_name = LLWearableDictionary::getTypeName(wearable_type);
 				U64 valid_folder_types = LLViewerFolderType::lookupValidFolderTypes(wearable_name);
 				folder_valid |= valid_folder_types;
 				folder_invalid |= ~valid_folder_types;
@@ -835,11 +725,6 @@ void LLViewerInventoryCategory::changeType(LLFolderType::EType new_folder_type)
 	gInventory.addChangedMask(LLInventoryObserver::LABEL, folder_id);
 }
 
-void LLViewerInventoryCategory::localizeName()
-{
-	LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName);
-}
-
 ///----------------------------------------------------------------------------
 /// Local function definitions
 ///----------------------------------------------------------------------------
@@ -867,21 +752,6 @@ LLInventoryCallbackManager::~LLInventoryCallbackManager()
 	sInstance = NULL;
 }
 
-//static 
-void LLInventoryCallbackManager::destroyClass()
-{
-	if (sInstance)
-	{
-		for (callback_map_t::iterator it = sInstance->mMap.begin(), end_it = sInstance->mMap.end(); it != end_it; ++it)
-		{
-			// drop LLPointer reference to callback
-			it->second = NULL;
-		}
-		sInstance->mMap.clear();
-	}
-}
-
-
 U32 LLInventoryCallbackManager::registerCB(LLPointer<LLInventoryCallback> cb)
 {
 	if (cb.isNull())
@@ -918,25 +788,19 @@ void WearOnAvatarCallback::fire(const LLUUID& inv_item)
 	LLViewerInventoryItem *item = gInventory.getItem(inv_item);
 	if (item)
 	{
-		LLAppearanceMgr::instance().wearItemOnAvatar(inv_item, true, mReplace);
+		wear_inventory_item_on_avatar(item);
 	}
 }
 
 void ModifiedCOFCallback::fire(const LLUUID& inv_item)
 {
 	LLAppearanceMgr::instance().updateAppearanceFromCOF();
-
-	// Start editing the item if previously requested.
-	gAgentWearables.editWearableIfRequested(inv_item);
-
-	// TODO: camera mode may not be changed if a debug setting is tweaked
-	if(gAgentCamera.cameraCustomizeAvatar())
+	if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() )
 	{
 		// If we're in appearance editing mode, the current tab may need to be refreshed
-		LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
-		if (panel)
+		if (gFloaterCustomize)
 		{
-			panel->showDefaultSubpart();
+			gFloaterCustomize->switchToDefaultSubpart();
 		}
 	}
 }
@@ -965,11 +829,6 @@ void ActivateGestureCallback::fire(const LLUUID& inv_item)
 {
 	if (inv_item.isNull())
 		return;
-	LLViewerInventoryItem* item = gInventory.getItem(inv_item);
-	if (!item)
-		return;
-	if (item->getType() != LLAssetType::AT_GESTURE)
-		return;
 
 	LLGestureMgr::instance().activateGesture(inv_item);
 }
@@ -1004,29 +863,10 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
 						   const LLUUID& parent, const LLTransactionID& transaction_id,
 						   const std::string& name,
 						   const std::string& desc, LLAssetType::EType asset_type,
-						   LLInventoryType::EType inv_type, LLWearableType::EType wtype,
+						   LLInventoryType::EType inv_type, EWearableType wtype,
 						   U32 next_owner_perm,
 						   LLPointer<LLInventoryCallback> cb)
 {
-	//check if name is equal to one of special inventory items names
-	//EXT-5839
-	std::string server_name = name;
-
-	{
-		std::map<std::string, std::string>::const_iterator dictionary_iter;
-
-		for (dictionary_iter = LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.begin();
-			 dictionary_iter != LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.end();
-			 dictionary_iter++)
-		{
-			const std::string& localized_name = dictionary_iter->second;
-			if(localized_name == name)
-			{
-				server_name = dictionary_iter->first;
-			}
-		}
-	}
-
 	LLMessageSystem* msg = gMessageSystem;
 	msg->newMessageFast(_PREHASH_CreateInventoryItem);
 	msg->nextBlock(_PREHASH_AgentData);
@@ -1040,7 +880,7 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
 	msg->addS8Fast(_PREHASH_Type, (S8)asset_type);
 	msg->addS8Fast(_PREHASH_InvType, (S8)inv_type);
 	msg->addU8Fast(_PREHASH_WearableType, (U8)wtype);
-	msg->addStringFast(_PREHASH_Name, server_name);
+	msg->addStringFast(_PREHASH_Name, name);
 	msg->addStringFast(_PREHASH_Description, desc);
 	
 	gAgent.sendReliableMessage();
@@ -1083,7 +923,6 @@ void link_inventory_item(
 	const LLUUID& item_id,
 	const LLUUID& parent_id,
 	const std::string& new_name,
-	const std::string& new_description,
 	const LLAssetType::EType asset_type,
 	LLPointer<LLInventoryCallback> cb)
 {
@@ -1109,6 +948,7 @@ void link_inventory_item(
 	}
 	
 	LLUUID transaction_id;
+	std::string desc = "Broken link"; // This should only show if the object can't find its baseobj.
 	LLInventoryType::EType inv_type = LLInventoryType::IT_NONE;
 	if (dynamic_cast<const LLInventoryCategory *>(baseobj))
 	{
@@ -1139,7 +979,7 @@ void link_inventory_item(
 		msg->addS8Fast(_PREHASH_Type, (S8)asset_type);
 		msg->addS8Fast(_PREHASH_InvType, (S8)inv_type);
 		msg->addStringFast(_PREHASH_Name, new_name);
-		msg->addStringFast(_PREHASH_Description, new_description);
+		msg->addStringFast(_PREHASH_Description, desc);
 	}
 	gAgent.sendReliableMessage();
 }
@@ -1167,14 +1007,6 @@ void move_inventory_item(
 
 void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecard_inv_id, const LLInventoryItem *src, U32 callback_id)
 {
-	if (NULL == src)
-	{
-		LL_WARNS("copy_inventory_from_notecard") << "Null pointer to item was passed for object_id "
-												 << object_id << " and notecard_inv_id "
-												 << notecard_inv_id << LL_ENDL;
-		return;
-	}
-
 	LLViewerRegion* viewer_region = NULL;
     LLViewerObject* vo = NULL;
 	if (object_id.notNull() && (vo = gObjectList.findObject(object_id)) != NULL)
@@ -1197,16 +1029,6 @@ void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecar
         return;
     }
 
-	// check capability to prevent a crash while LL_ERRS in LLCapabilityListener::capListener. See EXT-8459.
-	std::string url = viewer_region->getCapability("CopyInventoryFromNotecard");
-	if (url.empty())
-	{
-        LL_WARNS("copy_inventory_from_notecard") << "There is no 'CopyInventoryFromNotecard' capability"
-												 << " for region: " << viewer_region->getName()
-                                                 << LL_ENDL;
-		return;
-	}
-
     LLSD request, body;
     body["notecard-id"] = notecard_inv_id;
     body["object-id"] = object_id;
@@ -1309,11 +1131,13 @@ void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, cons
 	else
 	{
 		// Use for all clothing and body parts.  Adding new wearable types requires updating LLWearableDictionary.
-		LLWearableType::EType wearable_type = LLWearableType::typeNameToType(type_name);
-		if (wearable_type >= LLWearableType::WT_SHAPE && wearable_type < LLWearableType::WT_COUNT)
+		EWearableType wearable_type = LLWearableDictionary::typeNameToType(type_name);
+		if (wearable_type >= WT_SHAPE && wearable_type < WT_COUNT)
 		{
-			const LLUUID parent_id = bridge ? bridge->getUUID() : LLUUID::null;
-			LLAgentWearables::createWearable(wearable_type, false, parent_id);
+			LLAssetType::EType asset_type = LLWearableDictionary::getAssetType(wearable_type);
+			LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(asset_type);
+			const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(folder_type);
+			LLFolderBridge::createWearable(parent_id, wearable_type);
 		}
 		else
 		{
@@ -1648,13 +1472,14 @@ bool LLViewerInventoryItem::isWearableType() const
 	return (getInventoryType() == LLInventoryType::IT_WEARABLE);
 }
 
-LLWearableType::EType LLViewerInventoryItem::getWearableType() const
+EWearableType LLViewerInventoryItem::getWearableType() const
 {
 	if (!isWearableType())
 	{
-		return LLWearableType::WT_INVALID;
+		llwarns << "item is not a wearable" << llendl;
+		return WT_INVALID;
 	}
-	return LLWearableType::EType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
+	return EWearableType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
 }
 
 
@@ -1760,20 +1585,6 @@ 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 7f5a92eeab2d638cd5013c2acb567fad072ef386..2db88c2ff88f6b996300ea196ba2b629cc7e63f6 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -2,25 +2,31 @@
  * @file llviewerinventory.h
  * @brief Declaration of the inventory bits that only used on the viewer.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -30,7 +36,6 @@
 #include "llinventory.h"
 #include "llframetimer.h"
 #include "llwearable.h"
-#include "llui.h" //for LLDestroyClass
 
 #include <boost/signals2.hpp>	// boost::signals2::trackable
 
@@ -69,7 +74,7 @@ class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::tr
 	virtual const LLSaleInfo& getSaleInfo() const;
 	virtual LLInventoryType::EType getInventoryType() const;
 	virtual bool isWearableType() const;
-	virtual LLWearableType::EType getWearableType() const;
+	virtual EWearableType getWearableType() const;
 	virtual U32 getFlags() const;
 	virtual time_t getCreationDate() const;
 	virtual U32 getCRC32() const; // really more of a checksum.
@@ -133,7 +138,7 @@ class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::tr
 	bool importFileLocal(LLFILE* fp);
 
 	// new methods
-	BOOL isFinished() const { return mIsComplete; }
+	BOOL isComplete() const { return mIsComplete; }
 	void setComplete(BOOL complete) { mIsComplete = complete; }
 	//void updateAssetOnServer() const;
 
@@ -154,7 +159,6 @@ 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);
@@ -223,11 +227,6 @@ class LLViewerInventoryCategory  : public LLInventoryCategory
 	bool importFileLocal(LLFILE* fp);
 	void determineFolderType();
 	void changeType(LLFolderType::EType new_folder_type);
-
-private:
-	friend class LLInventoryModel;
-	void localizeName(); // intended to be called from the LLInventoryModel
-
 protected:
 	LLUUID mOwnerID;
 	S32 mVersion;
@@ -243,13 +242,7 @@ class LLInventoryCallback : public LLRefCount
 
 class WearOnAvatarCallback : public LLInventoryCallback
 {
-public:
-	WearOnAvatarCallback(bool do_replace = false) : mReplace(do_replace) {}
-	
 	void fire(const LLUUID& inv_item);
-
-protected:
-	bool mReplace;
 };
 
 class ModifiedCOFCallback : public LLInventoryCallback
@@ -299,9 +292,8 @@ class AddFavoriteLandmarkCallback : public LLInventoryCallback
 // misc functions
 //void inventory_reliable_callback(void**, S32 status);
 
-class LLInventoryCallbackManager : public LLDestroyClass<LLInventoryCallbackManager>
+class LLInventoryCallbackManager
 {
-	friend class LLDestroyClass<LLInventoryCallbackManager>;
 public:
 	LLInventoryCallbackManager();
 	~LLInventoryCallbackManager();
@@ -309,26 +301,23 @@ class LLInventoryCallbackManager : public LLDestroyClass<LLInventoryCallbackMana
 	void fire(U32 callback_id, const LLUUID& item_id);
 	U32 registerCB(LLPointer<LLInventoryCallback> cb);
 private:
-	typedef std::map<U32, LLPointer<LLInventoryCallback> > callback_map_t;
-	callback_map_t mMap;
+	std::map<U32, LLPointer<LLInventoryCallback> > mMap;
 	U32 mLastCallback;
 	static LLInventoryCallbackManager *sInstance;
-	static void destroyClass();
-
 public:
 	static bool is_instantiated() { return sInstance != NULL; }
 };
 extern LLInventoryCallbackManager gInventoryCallbacks;
 
 
-#define NOT_WEARABLE (LLWearableType::EType)0
+#define NOT_WEARABLE (EWearableType)0
 
 // *TODO: Find a home for these
 void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
 						   const LLUUID& parent, const LLTransactionID& transaction_id,
 						   const std::string& name,
 						   const std::string& desc, LLAssetType::EType asset_type,
-						   LLInventoryType::EType inv_type, LLWearableType::EType wtype,
+						   LLInventoryType::EType inv_type, EWearableType wtype,
 						   U32 next_owner_perm,
 						   LLPointer<LLInventoryCallback> cb);
 
@@ -350,7 +339,6 @@ void link_inventory_item(
 	const LLUUID& item_id,
 	const LLUUID& parent_id,
 	const std::string& new_name,
-	const std::string& new_description,
 	const LLAssetType::EType asset_type,
 	LLPointer<LLInventoryCallback> cb);
 
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index d7e15e7d6cda6bd87d41a9a581a41c5ab56e081f..dd7390a907b9d0bdcb26b7eacab06c0dbe43937e 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -2,25 +2,31 @@
  * @file llviewerkeyboard.cpp
  * @brief LLViewerKeyboard class implementation
  *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ * 
+ * Copyright (c) 2005-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 47a98ff8887412b397189d3dbfb409581cd61ccf..170eb7ae860b95b7abd81bc0643220e221125b29 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -2,32 +2,37 @@
  * @file llviewermedia.cpp
  * @brief Client interface to the media engine
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 
 #include "llagent.h"
-#include "llagentcamera.h"
 #include "llviewermedia.h"
 #include "llviewermediafocus.h"
 #include "llmimetypes.h"
@@ -727,17 +732,10 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi
 	}
 }
 
-static LLFastTimer::DeclareTimer FTM_MEDIA_UPDATE("Update Media");
-
 //////////////////////////////////////////////////////////////////////////////////////////
 // static
 void LLViewerMedia::updateMedia(void *dummy_arg)
 {
-	LLFastTimer t1(FTM_MEDIA_UPDATE);
-	
-	// Enable/disable the plugin read thread
-	LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread"));
-	
 	sAnyMediaShowing = false;
 	sUpdatedCookies = getCookieStore()->getChangedCookies();
 	if(!sUpdatedCookies.empty())
@@ -757,7 +755,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
 	}
 		
 	// Sort the static instance list using our interest criteria
-	sViewerMediaImplList.sort(priorityComparitor);
+	std::stable_sort(sViewerMediaImplList.begin(), sViewerMediaImplList.end(), priorityComparitor);
 
 	// Go through the list again and adjust according to priority.
 	iter = sViewerMediaImplList.begin();
@@ -1288,30 +1286,7 @@ void LLViewerMedia::setOpenIDCookie()
 {
 	if(!sOpenIDCookie.empty())
 	{
-		// The LLURL can give me the 'authority', which is of the form: [username[:password]@]hostname[:port]
-		// We want just the hostname for the cookie code, but LLURL doesn't seem to have a way to extract that.
-		// We therefore do it here.
-		std::string authority = sOpenIDURL.mAuthority;
-		std::string::size_type host_start = authority.find('@'); 
-		if(host_start == std::string::npos)
-		{
-			// no username/password
-			host_start = 0;
-		}
-		else
-		{
-			// Hostname starts after the @. 
-			// (If the hostname part is empty, this may put host_start at the end of the string.  In that case, it will end up passing through an empty hostname, which is correct.)
-			++host_start;
-		}
-		std::string::size_type host_end = authority.rfind(':'); 
-		if((host_end == std::string::npos) || (host_end < host_start))
-		{
-			// no port
-			host_end = authority.size();
-		}
-		
-		getCookieStore()->setCookiesFromHost(sOpenIDCookie, authority.substr(host_start, host_end - host_start));
+		getCookieStore()->setCookiesFromHost(sOpenIDCookie, sOpenIDURL.mAuthority);
 	}
 }
 
@@ -1580,7 +1555,6 @@ void LLViewerMediaImpl::destroyMediaSource()
 	
 	if(mMediaSource)
 	{
-		mMediaSource->setDeleteOK(true) ;
 		delete mMediaSource;
 		mMediaSource = NULL;
 	}	
@@ -1732,7 +1706,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
 		}
 				
 		mMediaSource = media_source;
-		mMediaSource->setDeleteOK(false) ;
+
 		updateVolume();
 
 		return true;
@@ -1770,22 +1744,29 @@ void LLViewerMediaImpl::loadURI()
 		llinfos << "Asking media source to load URI: " << uri << llendl;
 		
 		mMediaSource->loadURI( uri );
-		
-		// A non-zero mPreviousMediaTime means that either this media was previously unloaded by the priority code while playing/paused, 
-		// or a seek happened before the media loaded.  In either case, seek to the saved time.
-		if(mPreviousMediaTime != 0.0f)
-		{
-			seek(mPreviousMediaTime);
-		}
-			
+
 		if(mPreviousMediaState == MEDIA_PLAYING)
 		{
 			// This media was playing before this instance was unloaded.
+
+			if(mPreviousMediaTime != 0.0f)
+			{
+				// Seek back to where we left off, if possible.
+				seek(mPreviousMediaTime);
+			}
+			
 			start();
 		}
 		else if(mPreviousMediaState == MEDIA_PAUSED)
 		{
 			// This media was paused before this instance was unloaded.
+
+			if(mPreviousMediaTime != 0.0f)
+			{
+				// Seek back to where we left off, if possible.
+				seek(mPreviousMediaTime);
+			}
+			
 			pause();
 		}
 		else
@@ -1844,10 +1825,6 @@ void LLViewerMediaImpl::pause()
 	{
 		mMediaSource->pause();
 	}
-	else
-	{
-		mPreviousMediaState = MEDIA_PAUSED;
-	}
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -1857,10 +1834,6 @@ void LLViewerMediaImpl::start()
 	{
 		mMediaSource->start();
 	}
-	else
-	{
-		mPreviousMediaState = MEDIA_PLAYING;
-	}
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -1870,11 +1843,6 @@ void LLViewerMediaImpl::seek(F32 time)
 	{
 		mMediaSource->seek(time);
 	}
-	else
-	{
-		// Save the seek time to be set when the media is loaded.
-		mPreviousMediaTime = time;
-	}
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -1923,28 +1891,7 @@ void LLViewerMediaImpl::updateVolume()
 {
 	if(mMediaSource)
 	{
-		// always scale the volume by the global media volume 
-		F32 volume = mRequestedVolume * LLViewerMedia::getVolume();
-
-		if (mProximityCamera > 0) 
-		{
-			if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMax"))
-			{
-				volume = 0;
-			}
-			else if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMin"))
-			{
-				// attenuated_volume = 1 / (roll_off_rate * (d - min))^2
-				// the +1 is there so that for distance 0 the volume stays the same
-				F64 adjusted_distance = mProximityCamera - gSavedSettings.getF32("MediaRollOffMin");
-				F64 attenuation = 1.0 + (gSavedSettings.getF32("MediaRollOffRate") * adjusted_distance);
-				attenuation = 1.0 / (attenuation * attenuation);
-				// the attenuation multiplier should never be more than one since that would increase volume
-				volume = volume * llmin(1.0, attenuation);
-			}
-		}
-
-		mMediaSource->setVolume(volume);
+		mMediaSource->setVolume(mRequestedVolume * LLViewerMedia::getVolume());
 	}
 }
 
@@ -2275,7 +2222,7 @@ void LLViewerMediaImpl::navigateInternal()
 	// This helps in supporting legacy media content where the server the media resides on returns a bogus MIME type
 	// but the parcel owner has correctly set the MIME type in the parcel media settings.
 	
-	if(!mMimeType.empty() && (mMimeType != LLMIMETypes::getDefaultMimeType()))
+	if(!mMimeType.empty() && (mMimeType != "none/none"))
 	{
 		std::string plugin_basename = LLMIMETypes::implType(mMimeType);
 		if(!plugin_basename.empty())
@@ -2457,8 +2404,6 @@ void LLViewerMediaImpl::update()
 	}
 	else
 	{
-		updateVolume();
-
 		// If we didn't just create the impl, it may need to get cookie updates.
 		if(!sUpdatedCookies.empty())
 		{
@@ -2808,33 +2753,6 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
 
 		}
 		break;
-		case MEDIA_EVENT_CLICK_LINK_HREF:
-		{
-			LL_DEBUGS("Media") <<  "Media event:  MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << plugin->getClickTarget() << "\", uri is " << plugin->getClickURL() << LL_ENDL;
-			// retrieve the event parameters
-			std::string url = plugin->getClickURL();
-			U32 target_type = plugin->getClickTargetType();
-			
-			switch (target_type)
-			{
-			case LLPluginClassMedia::TARGET_EXTERNAL:
-				// force url to external browser
-				LLWeb::loadURLExternal(url);
-				break;
-			case LLPluginClassMedia::TARGET_BLANK:
-				// open in SL media browser or external browser based on user pref
-				LLWeb::loadURL(url);
-				break;
-			case LLPluginClassMedia::TARGET_NONE:
-				// ignore this click and let media plugin handle it
-				break;
-			case LLPluginClassMedia::TARGET_OTHER:
-				LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL;
-				break;
-			default: break;
-			}
-		};
-		break;
 		case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
 		{
 			// The plugin failed to load properly.  Make sure the timer doesn't retry.
@@ -3047,25 +2965,17 @@ void LLViewerMediaImpl::calculateInterest()
 	
 	// Calculate distance from the avatar, for use in the proximity calculation.
 	mProximityDistance = 0.0f;
-	mProximityCamera = 0.0f;
 	if(!mObjectList.empty())
 	{
 		// Just use the first object in the list.  We could go through the list and find the closest object, but this should work well enough.
 		std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
 		LLVOVolume* objp = *iter ;
 		llassert_always(objp != NULL) ;
-		
-		// The distance calculation is invalid for HUD attachments -- leave both mProximityDistance and mProximityCamera at 0 for them.
-		if(!objp->isHUDAttachment())
-		{
-			LLVector3d obj_global = objp->getPositionGlobal() ;
-			LLVector3d agent_global = gAgent.getPositionGlobal() ;
-			LLVector3d global_delta = agent_global - obj_global ;
-			mProximityDistance = global_delta.magVecSquared();  // use distance-squared because it's cheaper and sorts the same.
 
-			LLVector3d camera_delta = gAgentCamera.getCameraPositionGlobal() - obj_global;
-			mProximityCamera = camera_delta.magVec();
-		}
+		LLVector3d obj_global = objp->getPositionGlobal() ;
+		LLVector3d agent_global = gAgent.getPositionGlobal() ;
+		LLVector3d global_delta = agent_global - obj_global ;
+		mProximityDistance = global_delta.magVecSquared();  // use distance-squared because it's cheaper and sorts the same.
 	}
 	
 	if(mNeedsMuteCheck)
@@ -3342,9 +3252,8 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const
 	//	" outside = " << (!inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING)) << llendl;
 	
 	// If it has focus, we should show it
-	// This is incorrect, and causes EXT-6750 (disabled attachment media still plays)
-//	if (hasFocus())
-//		return true;
+	if (hasFocus())
+		return true;
 	
 	// If it is attached to an avatar and the pref is off, we shouldn't show it
 	if (attached_to_another_avatar)
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index fbd0358302d55f3268375c1d449b0ec2f0f41434..e829d7a5b47bb9f15e07d9bee4198f4d5c126d79 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -2,25 +2,31 @@
  * @file llviewermedia.h
  * @brief Client interface to the media engine
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ * 
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -78,7 +84,7 @@ class LLViewerMedia
 	static const char* SHOW_MEDIA_WITHIN_PARCEL_SETTING;
 	static const char* SHOW_MEDIA_OUTSIDE_PARCEL_SETTING;
 	
-	typedef std::list<LLViewerMediaImpl*> impl_list;
+	typedef std::vector<LLViewerMediaImpl*> impl_list;
 	
 	typedef std::map<LLUUID, LLViewerMediaImpl*> impl_id_map;
 	
@@ -425,7 +431,6 @@ class LLViewerMediaImpl
 	bool mIsParcelMedia;
 	S32 mProximity;
 	F64 mProximityDistance;
-	F64 mProximityCamera;
 	LLMimeDiscoveryResponder *mMimeTypeProbe;
 	bool mMediaAutoPlay;
 	std::string mMediaEntryURL;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 476e761c280ab58a8c70349bd666441e972b2a4c..64967466fbdaf81fda5e0d0d3cd86ea3edfd7fae 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2,25 +2,31 @@
  * @file llviewermenu.cpp
  * @brief Builds menus out of items.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -47,7 +53,8 @@
 //#include "llfirstuse.h"
 #include "llfloaterbuy.h"
 #include "llfloaterbuycontents.h"
-#include "llbuycurrencyhtml.h"
+#include "llfloaterbuycurrency.h"
+#include "llfloatercustomize.h"
 #include "llfloatergodtools.h"
 #include "llfloaterinventory.h"
 #include "llfloaterland.h"
@@ -101,13 +108,9 @@
 #include "lluilistener.h"
 #include "llappearancemgr.h"
 #include "lltrans.h"
-#include "lleconomy.h"
-#include "boost/unordered_map.hpp"
 
 using namespace LLVOAvatarDefines;
 
-static boost::unordered_map<std::string, LLStringExplicit> sDefaultItemLabels;
-
 BOOL enable_land_build(void*);
 BOOL enable_object_build(void*);
 
@@ -289,8 +292,8 @@ void handle_toggle_pg(void*);
 void handle_dump_attachments(void *);
 void handle_dump_avatar_local_textures(void*);
 void handle_debug_avatar_textures(void*);
-void handle_grab_baked_texture(void*);
-BOOL enable_grab_baked_texture(void*);
+void handle_grab_texture(void*);
+BOOL enable_grab_texture(void*);
 void handle_dump_region_object_cache(void*);
 
 BOOL enable_save_into_inventory(void*);
@@ -427,7 +430,7 @@ void init_menus()
 	gPopupMenuView->setBackgroundColor( color );
 
 	// If we are not in production, use a different color to make it apparent.
-	if (LLGridManager::getInstance()->isInProductionGrid())
+	if (LLViewerLogin::getInstance()->isInProductionGrid())
 	{
 		color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
 	}
@@ -443,7 +446,7 @@ void init_menus()
 	menu_bar_holder->addChild(gMenuBarView);
   
     gViewerWindow->setMenuBackgroundColor(false, 
-        LLGridManager::getInstance()->isInProductionGrid());
+        LLViewerLogin::getInstance()->isInProductionGrid());
 
 	// Assume L$10 for now, the server will tell us the real cost at login
 	// *TODO:Also fix cost in llfolderview.cpp for Inventory menus
@@ -1457,28 +1460,28 @@ class LLAdvancedGrabBakedTexture : public view_listener_t
 		std::string texture_type = userdata.asString();
 		if ("iris" == texture_type)
 		{
-			handle_grab_baked_texture( (void*)BAKED_EYES );
+			handle_grab_texture( (void*)TEX_EYES_BAKED );
 		}
 		else if ("head" == texture_type)
 		{
-			handle_grab_baked_texture( (void*)BAKED_HEAD );
+			handle_grab_texture( (void*)TEX_HEAD_BAKED );
 		}
 		else if ("upper" == texture_type)
 		{
-			handle_grab_baked_texture( (void*)BAKED_UPPER );
+			handle_grab_texture( (void*)TEX_UPPER_BAKED );
 		}
 		else if ("lower" == texture_type)
 		{
-			handle_grab_baked_texture( (void*)BAKED_LOWER );
+			handle_grab_texture( (void*)TEX_SKIRT_BAKED );
 		}
 		else if ("skirt" == texture_type)
 		{
-			handle_grab_baked_texture( (void*)BAKED_SKIRT );
+			handle_grab_texture( (void*)TEX_SKIRT_BAKED );
 		}
 		else if ("hair" == texture_type)
 		{
-			handle_grab_baked_texture( (void*)BAKED_HAIR );
-		}
+			handle_grab_texture( (void*)TEX_HAIR_BAKED );
+}
 
 		return true;
 	}
@@ -1493,27 +1496,23 @@ class LLAdvancedEnableGrabBakedTexture : public view_listener_t
 
 		if ("iris" == texture_type)
 		{
-			new_value = enable_grab_baked_texture( (void*)BAKED_EYES );
+			new_value = enable_grab_texture( (void*)TEX_EYES_BAKED );
 		}
 		else if ("head" == texture_type)
 		{
-			new_value = enable_grab_baked_texture( (void*)BAKED_HEAD );
+			new_value = enable_grab_texture( (void*)TEX_HEAD_BAKED );
 		}
 		else if ("upper" == texture_type)
 		{
-			new_value = enable_grab_baked_texture( (void*)BAKED_UPPER );
+			new_value = enable_grab_texture( (void*)TEX_UPPER_BAKED );
 		}
 		else if ("lower" == texture_type)
 		{
-			new_value = enable_grab_baked_texture( (void*)BAKED_LOWER );
+			new_value = enable_grab_texture( (void*)TEX_LOWER_BAKED );
 		}
 		else if ("skirt" == texture_type)
 		{
-			new_value = enable_grab_baked_texture( (void*)BAKED_SKIRT );
-		}
-		else if ("hair" == texture_type)
-		{
-			new_value = enable_grab_baked_texture( (void*)BAKED_HAIR );
+			new_value = enable_grab_texture( (void*)TEX_SKIRT_BAKED );
 		}
 	
 		return new_value;
@@ -2400,55 +2399,35 @@ void handle_object_touch()
 		msg->sendMessage(object->getRegion()->getHost());
 }
 
-static void init_default_item_label(const std::string& item_name)
+bool enable_object_touch()
 {
-	boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name);
-	if (it == sDefaultItemLabels.end())
-	{
-		// *NOTE: This will not work for items of type LLMenuItemCheckGL because they return boolean value
-		//       (doesn't seem to matter much ATM).
-		LLStringExplicit default_label = gMenuHolder->childGetValue(item_name).asString();
-		if (!default_label.empty())
-		{
-			sDefaultItemLabels.insert(std::pair<std::string, LLStringExplicit>(item_name, default_label));
-		}
-	}
+	LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+	return obj && obj->flagHandleTouch();
 }
 
-static LLStringExplicit get_default_item_label(const std::string& item_name)
+// One object must have touch sensor
+class LLObjectEnableTouch : public view_listener_t
 {
-	LLStringExplicit res("");
-	boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name);
-	if (it != sDefaultItemLabels.end())
+	bool handleEvent(const LLSD& userdata)
 	{
-		res = it->second;
-	}
-
-	return res;
-}
-
-
-bool enable_object_touch(LLUICtrl* ctrl)
-{
-	LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
-
-	bool new_value = obj && obj->flagHandleTouch();
+		bool new_value = enable_object_touch();
 
-	std::string item_name = ctrl->getName();
-	init_default_item_label(item_name);
+		// Update label based on the node touch name if available.
+		std::string touch_text;
+		LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+		if (node && node->mValid && !node->mTouchName.empty())
+		{
+			touch_text = node->mTouchName;
+		}
+		else
+		{
+			touch_text = userdata.asString();
+		}
+		gMenuHolder->childSetText("Object Touch", touch_text);
+		gMenuHolder->childSetText("Attachment Object Touch", touch_text);
 
-	// Update label based on the node touch name if available.
-	LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
-	if (node && node->mValid && !node->mTouchName.empty())
-	{
-		gMenuHolder->childSetText(item_name, node->mTouchName);
-	}
-	else
-	{
-		gMenuHolder->childSetText(item_name, get_default_item_label(item_name));
+		return new_value;
 	}
-
-	return new_value;
 };
 
 //void label_touch(std::string& label, void*)
@@ -3299,6 +3278,16 @@ void handle_buy_object(LLSaleInfo sale_info)
 		return;
 	}
 
+	S32 price = sale_info.getSalePrice();
+	
+	if (price > 0 && price > gStatusBar->getBalance())
+	{
+		LLStringUtil::format_map_t args;
+		args["AMOUNT"] = llformat("%d", price);
+		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_object_costs", args), price);
+		return;
+	}
+
 	LLFloaterBuy::show(sale_info);
 }
 
@@ -3479,7 +3468,7 @@ void set_god_level(U8 god_level)
         if(gViewerWindow)
         {
             gViewerWindow->setMenuBackgroundColor(god_level > GOD_NOT,
-            LLGridManager::getInstance()->isInProductionGrid());
+            LLViewerLogin::getInstance()->isInProductionGrid());
         }
     
         LLSD args;
@@ -3519,7 +3508,7 @@ BOOL check_toggle_hacked_godmode(void*)
 
 bool enable_toggle_hacked_godmode(void*)
 {
-  return !LLGridManager::getInstance()->isInProductionGrid();
+  return !LLViewerLogin::getInstance()->isInProductionGrid();
 }
 #endif
 
@@ -3640,15 +3629,7 @@ class LLEditEnableCustomizeAvatar : public view_listener_t
 	}
 };
 
-class LLEnableEditShape : public view_listener_t
-{
-	bool handleEvent(const LLSD& userdata)
-	{
-		return gAgentWearables.isWearableModifiable(LLWearableType::WT_SHAPE, 0);
-	}
-};
-
-bool is_object_sittable()
+bool enable_sit_object()
 {
 	LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
 
@@ -3742,15 +3723,17 @@ void reset_view_final( BOOL proceed );
 
 void handle_reset_view()
 {
-	if (gAgentCamera.cameraCustomizeAvatar())
+	if( (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode()) && gFloaterCustomize )
 	{
-		// switching to outfit selector should automagically save any currently edited wearable
-		LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits"));
+		// Show dialog box if needed.
+		gFloaterCustomize->askToSaveIfDirty( reset_view_final );
+	}
+	else
+	{
+		gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW);
+		reset_view_final( TRUE );
+		LLFloaterCamera::resetCameraMode();
 	}
-
-	gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW);
-	reset_view_final( TRUE );
-	LLFloaterCamera::resetCameraMode();
 }
 
 class LLViewResetView : public view_listener_t
@@ -3799,6 +3782,15 @@ class LLViewMouselook : public view_listener_t
 	}
 };
 
+class LLViewFullscreen : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		gViewerWindow->toggleFullscreen(TRUE);
+		return true;
+	}
+};
+
 class LLViewDefaultUISize : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
@@ -4387,7 +4379,7 @@ BOOL enable_take()
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid() 
+		if (!LLViewerLogin::getInstance()->isInProductionGrid() 
             && gAgent.isGodlike())
 		{
 			return TRUE;
@@ -4424,7 +4416,8 @@ void handle_buy_or_take()
 		{
 			LLStringUtil::format_map_t args;
 			args["AMOUNT"] = llformat("%d", total_price);
-			LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString( "BuyingCosts", args ), total_price );
+			LLFloaterBuyCurrency::buyCurrency(
+					LLTrans::getString("BuyingCosts", args), total_price);
 		}
 	}
 	else
@@ -4554,16 +4547,6 @@ void handle_buy()
 	BOOL valid = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
 	if (!valid) return;
 
-	S32 price = sale_info.getSalePrice();
-	
-	if (price > 0 && price > gStatusBar->getBalance())
-	{
-		LLStringUtil::format_map_t args;
-		args["AMOUNT"] = llformat("%d", price);
-		LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("this_object_costs", args), price );
-		return;
-	}
-
 	if (sale_info.getSaleType() == LLSaleInfo::FS_CONTENTS)
 	{
 		handle_buy_contents(sale_info);
@@ -5009,7 +4992,7 @@ bool enable_object_delete()
 	TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-	(!LLGridManager::getInstance()->isInProductionGrid()
+	(!LLViewerLogin::getInstance()->isInProductionGrid()
      && gAgent.isGodlike()) ||
 # endif
 	LLSelectMgr::getInstance()->canDoDelete();
@@ -5534,37 +5517,56 @@ bool enable_pay_object()
 	return false;
 }
 
-bool enable_object_stand_up()
+bool visible_object_stand_up()
 {
-	// 'Object Stand Up' menu item is enabled when agent is sitting on selection
+	// 'Object Stand Up' menu item is visible when agent is sitting on selection
 	return sitting_on_selection();
 }
 
-bool enable_object_sit(LLUICtrl* ctrl)
+bool visible_object_sit()
 {
-	// 'Object Sit' menu item is enabled when agent is not sitting on selection
-	bool sitting_on_sel = sitting_on_selection();
-	if (!sitting_on_sel)
+	// 'Object Sit' menu item is visible when agent is not sitting on selection
+	bool is_sit_visible = !sitting_on_selection();
+	if (is_sit_visible)
 	{
-		std::string item_name = ctrl->getName();
-
-		// init default labels
-		init_default_item_label(item_name);
-
+		LLMenuItemGL* sit_menu_item = gMenuHolder->getChild<LLMenuItemGL>("Object Sit");
+		// Init default 'Object Sit' menu item label
+		static const LLStringExplicit sit_text(sit_menu_item->getLabel());
 		// Update label
+		std::string label;
 		LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
 		if (node && node->mValid && !node->mSitName.empty())
 		{
-			gMenuHolder->childSetText(item_name, node->mSitName);
+			label.assign(node->mSitName);
 		}
 		else
 		{
-			gMenuHolder->childSetText(item_name, get_default_item_label(item_name));
+			label = sit_text;
 		}
+		sit_menu_item->setLabel(label);
 	}
-	return !sitting_on_sel && is_object_sittable();
+	return is_sit_visible;
 }
 
+class LLObjectEnableSitOrStand : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		bool new_value = false;
+		LLViewerObject* dest_object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+
+		if(dest_object)
+		{
+			if(dest_object->getPCode() == LL_PCODE_VOLUME)
+			{
+				new_value = true;
+			}
+		}
+
+		return new_value;
+	}
+};
+
 void dump_select_mgr(void*)
 {
 	LLSelectMgr::getInstance()->dump();
@@ -5593,17 +5595,10 @@ void handle_viewer_disable_message_log(void*)
 
 void handle_customize_avatar()
 {
-	LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits"));
-}
-
-void handle_edit_outfit()
-{
-	LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit"));
-}
-
-void handle_edit_shape()
-{
-	LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_shape"));
+	if (gAgentWearables.areWearablesLoaded())
+	{
+		gAgentCamera.changeCameraToCustomizeAvatar();
+	}
 }
 
 void handle_report_abuse()
@@ -5615,7 +5610,7 @@ void handle_report_abuse()
 
 void handle_buy_currency()
 {
-	LLBuyCurrencyHTML::openCurrencyFloater();
+	LLFloaterBuyCurrency::buyCurrency();
 }
 
 class LLFloaterVisible : public view_listener_t
@@ -6111,12 +6106,10 @@ class LLAttachmentDetach : public view_listener_t
 
 //Adding an observer for a Jira 2422 and needs to be a fetch observer
 //for Jira 3119
-class LLWornItemFetchedObserver : public LLInventoryFetchItemsObserver
+class LLWornItemFetchedObserver : public LLInventoryFetchObserver
 {
 public:
-	LLWornItemFetchedObserver(const LLUUID& worn_item_id) :
-		LLInventoryFetchItemsObserver(worn_item_id)
-	{}
+	LLWornItemFetchedObserver() {}
 	virtual ~LLWornItemFetchedObserver() {}
 
 protected:
@@ -6170,9 +6163,13 @@ class LLAttachmentEnableDrop : public view_listener_t
 						// when the item finishes fetching worst case scenario 
 						// if a fetch is already out there (being sent from a slow sim)
 						// we refetch and there are 2 fetches
-						LLWornItemFetchedObserver* worn_item_fetched = new LLWornItemFetchedObserver((*attachment_iter)->getItemID());		
-						worn_item_fetched->startFetch();
-						gInventory.addObserver(worn_item_fetched);
+						LLWornItemFetchedObserver* wornItemFetched = new LLWornItemFetchedObserver();
+						uuid_vec_t items; //add item to the inventory item to be fetched
+						
+						items.push_back((*attachment_iter)->getItemID());
+						
+						wornItemFetched->fetch(items);
+						gInventory.addObserver(wornItemFetched);
 					}
 				}
 			}
@@ -6641,7 +6638,7 @@ bool enable_object_take_copy()
 		all_valid = true;
 #ifndef HACKED_GODLIKE_VIEWER
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (LLGridManager::getInstance()->isInProductionGrid()
+		if (LLViewerLogin::getInstance()->isInProductionGrid()
             || !gAgent.isGodlike())
 # endif
 		{
@@ -6703,7 +6700,7 @@ BOOL enable_save_into_inventory(void*)
 	return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-	if (!LLGridManager::getInstance()->isInProductionGrid()
+	if (!LLViewerLogin::getInstance()->isInProductionGrid()
         && gAgent.isGodlike())
 	{
 		return TRUE;
@@ -6939,20 +6936,27 @@ void handle_debug_avatar_textures(void*)
 	}
 }
 
-void handle_grab_baked_texture(void* data)
+void handle_grab_texture(void* data)
 {
-	EBakedTextureIndex baked_tex_index = (EBakedTextureIndex)((intptr_t)data);
+	ETextureIndex tex_index = (ETextureIndex)((intptr_t)data);
 	if (!isAgentAvatarValid()) return;
 
-	const LLUUID& asset_id = gAgentAvatarp->grabBakedTexture(baked_tex_index);
+	// MULTI-WEARABLE: change to support an index
+	const LLUUID& asset_id = gAgentAvatarp->grabLocalTexture(tex_index, 0);
 	LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl;
 	LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
 	LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
 	const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type));
 	if(folder_id.notNull())
 	{
-		std::string name;
-		name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture";
+		std::string name = "Unknown";
+		const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(tex_index);
+		if (texture_dict->mIsBakedTexture)
+		{
+			EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+			name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mNameCapitalized;
+		}
+		name += " Texture";
 
 		LLUUID item_id;
 		item_id.generate();
@@ -7005,12 +7009,13 @@ void handle_grab_baked_texture(void* data)
 	}
 }
 
-BOOL enable_grab_baked_texture(void* data)
+BOOL enable_grab_texture(void* data)
 {
-	EBakedTextureIndex index = (EBakedTextureIndex)((intptr_t)data);
+	ETextureIndex index = (ETextureIndex)((intptr_t)data);
 	if (isAgentAvatarValid())
 	{
-		return gAgentAvatarp->canGrabBakedTexture(index);
+		// MULTI-WEARABLE:
+		return gAgentAvatarp->canGrabLocalTexture(index,0);
 	}
 	return FALSE;
 }
@@ -7200,7 +7205,7 @@ void handle_web_browser_test(const LLSD& param)
 	{
 		url = "about:blank";
 	}
-	LLWeb::loadURLInternal(url);
+	LLWeb::loadURL(url);
 }
 
 void handle_buy_currency_test(void*)
@@ -7469,8 +7474,8 @@ class LLEditEnableTakeOff : public view_listener_t
 	bool handleEvent(const LLSD& userdata)
 	{
 		std::string clothing = userdata.asString();
-		LLWearableType::EType type = LLWearableType::typeNameToType(clothing);
-		if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT)
+		EWearableType type = LLWearableDictionary::typeNameToType(clothing);
+		if (type >= WT_SHAPE && type < WT_COUNT)
 			return LLAgentWearables::selfHasWearable(type);
 		return false;
 	}
@@ -7485,14 +7490,11 @@ class LLEditTakeOff : public view_listener_t
 			LLWearableBridge::removeAllClothesFromAvatar();
 		else
 		{
-			LLWearableType::EType type = LLWearableType::typeNameToType(clothing);
-			if (type >= LLWearableType::WT_SHAPE 
-				&& type < LLWearableType::WT_COUNT
-				&& (gAgentWearables.getWearableCount(type) > 0))
+			EWearableType type = LLWearableDictionary::typeNameToType(clothing);
+			if (type >= WT_SHAPE && type < WT_COUNT)
 			{
-				// MULTI-WEARABLES: assuming user wanted to remove top shirt.
-				U32 wearable_index = gAgentWearables.getWearableCount(type) - 1;
-				LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(gAgentWearables.getWearableInventoryItem(type,wearable_index));
+				// MULTI-WEARABLES
+				LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(gAgentWearables.getWearableInventoryItem(type,0));
 				LLWearableBridge::removeItemFromAvatar(item);
 			}
 				
@@ -7646,42 +7648,6 @@ class LLWorldToggleCameraControls : public view_listener_t
 	}
 };
 
-class LLUploadCostCalculator : public view_listener_t
-{
-	std::string mCostStr;
-
-	bool handleEvent(const LLSD& userdata)
-	{
-		std::string menu_name = userdata.asString();
-		gMenuHolder->childSetLabelArg(menu_name, "[COST]", mCostStr);
-
-		return true;
-	}
-
-	void calculateCost();
-
-public:
-	LLUploadCostCalculator()
-	{
-		calculateCost();
-	}
-};
-
-void LLUploadCostCalculator::calculateCost()
-{
-	S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
-
-	// getPriceUpload() returns -1 if no data available yet.
-	if(upload_cost >= 0)
-	{
-		mCostStr = llformat("%d", upload_cost);
-	}
-	else
-	{
-		mCostStr = llformat("%d", gSavedSettings.getU32("DefaultUploadCost"));
-	}
-}
-
 void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y)
 {
 	static LLMenuGL*	show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml",
@@ -7695,55 +7661,6 @@ void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y)
 	LLMenuGL::showPopup(ctrl, show_navbar_context_menu, x, y);
 }
 
-void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y)
-{
-	static LLMenuGL* show_topbarinfo_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_topinfobar.xml",
-			gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-
-	LLMenuItemGL* landmark_item = show_topbarinfo_context_menu->getChild<LLMenuItemGL>("Landmark");
-	if (!LLLandmarkActions::landmarkAlreadyExists())
-	{
-		landmark_item->setLabel(LLTrans::getString("AddLandmarkNavBarMenu"));
-	}
-	else
-	{
-		landmark_item->setLabel(LLTrans::getString("EditLandmarkNavBarMenu"));
-	}
-
-	if(gMenuHolder->hasVisibleMenu())
-	{
-		gMenuHolder->hideMenus();
-	}
-
-	show_topbarinfo_context_menu->buildDrawLabels();
-	show_topbarinfo_context_menu->updateParent(LLMenuGL::sMenuContainer);
-	LLMenuGL::showPopup(ctrl, show_topbarinfo_context_menu, x, y);
-}
-
-void initialize_edit_menu()
-{
-	view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo");
-	view_listener_t::addMenu(new LLEditRedo(), "Edit.Redo");
-	view_listener_t::addMenu(new LLEditCut(), "Edit.Cut");
-	view_listener_t::addMenu(new LLEditCopy(), "Edit.Copy");
-	view_listener_t::addMenu(new LLEditPaste(), "Edit.Paste");
-	view_listener_t::addMenu(new LLEditDelete(), "Edit.Delete");
-	view_listener_t::addMenu(new LLEditSelectAll(), "Edit.SelectAll");
-	view_listener_t::addMenu(new LLEditDeselect(), "Edit.Deselect");
-	view_listener_t::addMenu(new LLEditDuplicate(), "Edit.Duplicate");
-	view_listener_t::addMenu(new LLEditTakeOff(), "Edit.TakeOff");
-	view_listener_t::addMenu(new LLEditEnableUndo(), "Edit.EnableUndo");
-	view_listener_t::addMenu(new LLEditEnableRedo(), "Edit.EnableRedo");
-	view_listener_t::addMenu(new LLEditEnableCut(), "Edit.EnableCut");
-	view_listener_t::addMenu(new LLEditEnableCopy(), "Edit.EnableCopy");
-	view_listener_t::addMenu(new LLEditEnablePaste(), "Edit.EnablePaste");
-	view_listener_t::addMenu(new LLEditEnableDelete(), "Edit.EnableDelete");
-	view_listener_t::addMenu(new LLEditEnableSelectAll(), "Edit.EnableSelectAll");
-	view_listener_t::addMenu(new LLEditEnableDeselect(), "Edit.EnableDeselect");
-	view_listener_t::addMenu(new LLEditEnableDuplicate(), "Edit.EnableDuplicate");
-
-}
-
 void initialize_menus()
 {
 	// A parameterized event handler used as ctrl-8/9/0 zoom controls below.
@@ -7770,8 +7687,7 @@ void initialize_menus()
 	// Generic enable and visible
 	// Don't prepend MenuName.Foo because these can be used in any menu.
 	enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service));
-
-	view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts");
+	enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service));
 
 	// Agent
 	commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying));
@@ -7780,12 +7696,30 @@ void initialize_menus()
 	// File menu
 	init_menu_file();
 
+	// Edit menu
+	view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo");
+	view_listener_t::addMenu(new LLEditRedo(), "Edit.Redo");
+	view_listener_t::addMenu(new LLEditCut(), "Edit.Cut");
+	view_listener_t::addMenu(new LLEditCopy(), "Edit.Copy");
+	view_listener_t::addMenu(new LLEditPaste(), "Edit.Paste");
+	view_listener_t::addMenu(new LLEditDelete(), "Edit.Delete");
+	view_listener_t::addMenu(new LLEditSelectAll(), "Edit.SelectAll");
+	view_listener_t::addMenu(new LLEditDeselect(), "Edit.Deselect");
+	view_listener_t::addMenu(new LLEditDuplicate(), "Edit.Duplicate");
+	view_listener_t::addMenu(new LLEditTakeOff(), "Edit.TakeOff");
+
+	view_listener_t::addMenu(new LLEditEnableUndo(), "Edit.EnableUndo");
+	view_listener_t::addMenu(new LLEditEnableRedo(), "Edit.EnableRedo");
+	view_listener_t::addMenu(new LLEditEnableCut(), "Edit.EnableCut");
+	view_listener_t::addMenu(new LLEditEnableCopy(), "Edit.EnableCopy");
+	view_listener_t::addMenu(new LLEditEnablePaste(), "Edit.EnablePaste");
+	view_listener_t::addMenu(new LLEditEnableDelete(), "Edit.EnableDelete");
+	view_listener_t::addMenu(new LLEditEnableSelectAll(), "Edit.EnableSelectAll");
+	view_listener_t::addMenu(new LLEditEnableDeselect(), "Edit.EnableDeselect");
+	view_listener_t::addMenu(new LLEditEnableDuplicate(), "Edit.EnableDuplicate");
 	view_listener_t::addMenu(new LLEditEnableTakeOff(), "Edit.EnableTakeOff");
 	view_listener_t::addMenu(new LLEditEnableCustomizeAvatar(), "Edit.EnableCustomizeAvatar");
-	view_listener_t::addMenu(new LLEnableEditShape(), "Edit.EnableEditShape");
 	commit.add("CustomizeAvatar", boost::bind(&handle_customize_avatar));
-	commit.add("EditOutfit", boost::bind(&handle_edit_outfit));
-	commit.add("EditShape", boost::bind(&handle_edit_shape));
 
 	// View menu
 	view_listener_t::addMenu(new LLViewMouselook(), "View.Mouselook");
@@ -7799,6 +7733,7 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLZoomer(1.2f), "View.ZoomOut");
 	view_listener_t::addMenu(new LLZoomer(1/1.2f), "View.ZoomIn");
 	view_listener_t::addMenu(new LLZoomer(DEFAULT_FIELD_OF_VIEW, false), "View.ZoomDefault");
+	view_listener_t::addMenu(new LLViewFullscreen(), "View.Fullscreen");
 	view_listener_t::addMenu(new LLViewDefaultUISize(), "View.DefaultUISize");
 
 	view_listener_t::addMenu(new LLViewEnableMouselook(), "View.EnableMouselook");
@@ -8064,11 +7999,13 @@ void initialize_menus()
 	
 	view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
 	enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2));
+	enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2));
 
 	// Object pie menu
 	view_listener_t::addMenu(new LLObjectBuild(), "Object.Build");
 	commit.add("Object.Touch", boost::bind(&handle_object_touch));
 	commit.add("Object.SitOrStand", boost::bind(&handle_object_sit_or_stand));
+	enable.add("Object.EnableSit", boost::bind(&enable_sit_object));
 	commit.add("Object.Delete", boost::bind(&handle_object_delete));
 	view_listener_t::addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar");
 	view_listener_t::addMenu(new LLObjectReturn(), "Object.Return");
@@ -8084,12 +8021,14 @@ void initialize_menus()
 	commit.add("Object.Open", boost::bind(&handle_object_open));
 	commit.add("Object.Take", boost::bind(&handle_take));
 	enable.add("Object.EnableOpen", boost::bind(&enable_object_open));
-	enable.add("Object.EnableTouch", boost::bind(&enable_object_touch, _1));
+	enable.add("Object.EnableTouch", boost::bind(&enable_object_touch));
+	view_listener_t::addMenu(new LLObjectEnableTouch(), "Object.EnableTouch");
+	view_listener_t::addMenu(new LLObjectEnableSitOrStand(), "Object.EnableSitOrStand");
 	enable.add("Object.EnableDelete", boost::bind(&enable_object_delete));
 	enable.add("Object.EnableWear", boost::bind(&object_selected_and_point_valid));
 
-	enable.add("Object.EnableStandUp", boost::bind(&enable_object_stand_up));
-	enable.add("Object.EnableSit", boost::bind(&enable_object_sit, _1));
+	enable.add("Object.StandUpVisible", boost::bind(&visible_object_stand_up));
+	enable.add("Object.SitVisible", boost::bind(&visible_object_sit));
 
 	view_listener_t::addMenu(new LLObjectEnableReturn(), "Object.EnableReturn");
 	view_listener_t::addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse");
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index 87cb4efbc44fd2411f550bd76b320d8af6518773..d72ea00077ad743de0fcb29d22eac4fdb37b1958 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -2,25 +2,31 @@
  * @file llviewermenu.h
  * @brief Builds menus out of objects
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -38,7 +44,6 @@ class LLParcelSelection;
 class LLObjectSelection;
 class LLSelectNode;
 
-void initialize_edit_menu();
 void init_menus();
 void cleanup_menus();
 
@@ -47,7 +52,6 @@ void toggle_debug_menus(void*);
 void show_context_menu( S32 x, S32 y, MASK mask );
 void show_build_mode_context_menu(S32 x, S32 y, MASK mask);
 void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y);
-void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y);
 BOOL enable_save_into_inventory(void*);
 void handle_reset_view();
 void handle_cut(void*);
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 237aa39e6e6ce4bf07ef63c533e5bae51f825b77..c415d89e9cb9b829d9c4c457fdb0bbf4588f35c2 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -2,25 +2,31 @@
  * @file llviewermenufile.cpp
  * @brief "File" menu in the main menu bar.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -33,7 +39,7 @@
 #include "llagentcamera.h"
 #include "llfilepicker.h"
 #include "llfloaterreg.h"
-#include "llbuycurrencyhtml.h"
+#include "llfloaterbuycurrency.h"
 #include "llfloatersnapshot.h"
 #include "llimage.h"
 #include "llimagebmp.h"
@@ -312,13 +318,11 @@ class LLFileUploadBulk : public view_listener_t
 			LLStringUtil::trim(asset_name);
 			
 			std::string display_name = LLStringUtil::null;
-			LLAssetStorage::LLStoreAssetCallback callback = NULL;
 			S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
-			void *userdata = NULL;
-			upload_new_resource(filename, asset_name, asset_name, 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
+			upload_new_resource(filename, asset_name, asset_name, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
 				LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
 					    display_name,
-					    callback, expected_upload_cost, userdata);
+					    NULL, expected_upload_cost);
 
 			// *NOTE: Ew, we don't iterate over the file list here,
 			// we handle the next files in upload_done_callback()
@@ -474,16 +478,15 @@ void handle_compress_image(void*)
 }
 
 void upload_new_resource(const std::string& src_filename, std::string name,
-			 std::string desc, S32 compression_info,
+			 std::string desc,
 			 LLFolderType::EType destination_folder_type,
 			 LLInventoryType::EType inv_type,
 			 U32 next_owner_perms,
 			 U32 group_perms,
 			 U32 everyone_perms,
 			 const std::string& display_name,
-			 LLAssetStorage::LLStoreAssetCallback callback,
-			 S32 expected_upload_cost,
-			 void *userdata)
+			 boost::function<void(const LLUUID& uuid)> callback,
+			 S32 expected_upload_cost)
 {	
 	// Generate the temporary UUID.
 	std::string filename = gDirUtilp->getTempFilename();
@@ -765,9 +768,9 @@ void upload_new_resource(const std::string& src_filename, std::string name,
 		{
 			t_disp_name = src_filename;
 		}
-		upload_new_resource(tid, asset_type, name, desc, compression_info, // tid
+		upload_new_resource(tid, asset_type, name, desc,
 				    destination_folder_type, inv_type, next_owner_perms, group_perms, everyone_perms,
-				    display_name, callback, expected_upload_cost, userdata);
+				    display_name, callback, expected_upload_cost);
 	}
 	else
 	{
@@ -808,7 +811,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
 					LLStringUtil::format_map_t args;
 					args["NAME"] = data->mAssetInfo.getName();
 					args["AMOUNT"] = llformat("%d", expected_upload_cost);
-					LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("UploadingCosts", args), expected_upload_cost );
+					LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("UploadingCosts", args), expected_upload_cost);
 					is_balance_sufficient = FALSE;
 				}
 				else if(region)
@@ -886,30 +889,28 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
 		LLStringUtil::trim(asset_name);
 
 		std::string display_name = LLStringUtil::null;
-		LLAssetStorage::LLStoreAssetCallback callback = NULL;
-		void *userdata = NULL;
 		upload_new_resource(next_file, asset_name, asset_name,	// file
-				    0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
+				    LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
 				    PERM_NONE, PERM_NONE, PERM_NONE,
 				    display_name,
-				    callback,
-				    expected_upload_cost, // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost
-				    userdata);
+				    NULL,
+				    expected_upload_cost); // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost
+				
 	}
 }
 
-void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type,
+void upload_new_resource(const LLTransactionID &tid, 
+			 LLAssetType::EType asset_type,
 			 std::string name,
-			 std::string desc, S32 compression_info,
+			 std::string desc, 
 			 LLFolderType::EType destination_folder_type,
 			 LLInventoryType::EType inv_type,
 			 U32 next_owner_perms,
 			 U32 group_perms,
 			 U32 everyone_perms,
 			 const std::string& display_name,
-			 LLAssetStorage::LLStoreAssetCallback callback,
-			 S32 expected_upload_cost,
-			 void *userdata)
+			 boost::function<void(const LLUUID& uuid)> callback,
+			 S32 expected_upload_cost)
 {
 	if(gDisconnected)
 	{
@@ -953,79 +954,26 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
 	upload_message.append(display_name);
 	LLUploadDialog::modalUploadDialog(upload_message);
 
-	llinfos << "*** Uploading: " << llendl;
-	llinfos << "Type: " << LLAssetType::lookup(asset_type) << llendl;
-	llinfos << "UUID: " << uuid << llendl;
-	llinfos << "Name: " << name << llendl;
-	llinfos << "Desc: " << desc << llendl;
-	llinfos << "Expected Upload Cost: " << expected_upload_cost << llendl;
-	lldebugs << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type) << llendl;
-	lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl;
 	std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory");
-	if (!url.empty())
-	{
-		llinfos << "New Agent Inventory via capability" << llendl;
-		LLSD body;
-		body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type);
-		body["asset_type"] = LLAssetType::lookup(asset_type);
-		body["inventory_type"] = LLInventoryType::lookup(inv_type);
-		body["name"] = name;
-		body["description"] = desc;
-		body["next_owner_mask"] = LLSD::Integer(next_owner_perms);
-		body["group_mask"] = LLSD::Integer(group_perms);
-		body["everyone_mask"] = LLSD::Integer(everyone_perms);
-		body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost);
-		
-		//std::ostringstream llsdxml;
-		//LLSDSerialize::toPrettyXML(body, llsdxml);
-		//llinfos << "posting body to capability: " << llsdxml.str() << llendl;
-
-		LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type));
+	
+	if (url.empty()) {
+		llwarns << "Could not get NewFileAgentInventory capability" << llendl;
+		return;
 	}
-	else
-	{
-		llinfos << "NewAgentInventory capability not found, new agent inventory via asset system." << llendl;
-		// check for adequate funds
-		// TODO: do this check on the sim
-		if (LLAssetType::AT_SOUND == asset_type ||
-			LLAssetType::AT_TEXTURE == asset_type ||
-			LLAssetType::AT_ANIMATION == asset_type)
-		{
-			S32 balance = gStatusBar->getBalance();
-			if (balance < expected_upload_cost)
-			{
-				LLStringUtil::format_map_t args;
-				args["NAME"] = name;
-				args["AMOUNT"] = llformat("%d", expected_upload_cost);
-				// insufficient funds, bail on this upload
-				LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("UploadingCosts", args), expected_upload_cost );
-				return;
-			}
-		}
 
-		LLResourceData* data = new LLResourceData;
-		data->mAssetInfo.mTransactionID = tid;
-		data->mAssetInfo.mUuid = uuid;
-		data->mAssetInfo.mType = asset_type;
-		data->mAssetInfo.mCreatorID = gAgentID;
-		data->mInventoryType = inv_type;
-		data->mNextOwnerPerm = next_owner_perms;
-		data->mExpectedUploadCost = expected_upload_cost;
-		data->mUserData = userdata;
-		data->mAssetInfo.setName(name);
-		data->mAssetInfo.setDescription(desc);
-		data->mPreferredLocation = destination_folder_type;
-
-		LLAssetStorage::LLStoreAssetCallback asset_callback = &upload_done_callback;
-		if (callback)
-		{
-			asset_callback = callback;
-		}
-		gAssetStorage->storeAssetData(data->mAssetInfo.mTransactionID, data->mAssetInfo.mType,
-										asset_callback,
-										(void*)data,
-										FALSE);
-	}
+	llinfos << "New Agent Inventory via capability" << llendl;
+	LLSD body;
+	body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type);
+	body["asset_type"] = LLAssetType::lookup(asset_type);
+	body["inventory_type"] = LLInventoryType::lookup(inv_type);
+	body["name"] = name;
+	body["description"] = desc;
+	body["next_owner_mask"] = LLSD::Integer(next_owner_perms);
+	body["group_mask"] = LLSD::Integer(group_perms);
+	body["everyone_mask"] = LLSD::Integer(everyone_perms);
+	body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost);
+
+	LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type, callback));
 }
 
 void init_menu_file()
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 2a6b2727417d0c6cde29b36fd628a3ce0d18c60f..c542459cdbd9d4d890714e63d8a75c1f220d09fd 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2,31 +2,36 @@
  * @file llviewermessage.cpp
  * @brief Dumping ground for viewer-side message system callbacks.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 #include "llviewermessage.h"
-#include "boost/lexical_cast.hpp"
 
 #include "llanimationstates.h"
 #include "llaudioengine.h" 
@@ -49,7 +54,8 @@
 #include "llagent.h"
 #include "llagentcamera.h"
 #include "llcallingcard.h"
-#include "llbuycurrencyhtml.h"
+//#include "llfirstuse.h"
+#include "llfloaterbuycurrency.h"
 #include "llfloaterbuyland.h"
 #include "llfloaterland.h"
 #include "llfloaterregioninfo.h"
@@ -65,6 +71,7 @@
 #include "llnotifications.h"
 #include "llnotificationsutil.h"
 #include "llpanelgrouplandmoney.h"
+#include "llpanelplaces.h"
 #include "llrecentpeople.h"
 #include "llscriptfloater.h"
 #include "llselectmgr.h"
@@ -103,13 +110,12 @@
 #include <boost/algorithm/string/split.hpp> //
 #include <boost/regex.hpp>
 
-#include "llnotificationmanager.h" //
-
-#if LL_MSVC
-// disable boost::lexical_cast warning
-#pragma warning (disable:4702)
+#if LL_WINDOWS // For Windows specific error handler
+#include "llwindebug.h"	// For the invalid message handler
 #endif
 
+#include "llnotificationmanager.h" //
+
 //
 // Constants
 //
@@ -272,7 +278,7 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_
 	{
 		LLStringUtil::format_map_t args;
 		args["AMOUNT"] = llformat("%d", amount);
-		LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("giving", args), amount );
+		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("giving", args), amount);
 	}
 }
 
@@ -686,52 +692,6 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
 
 	return false;
 }
-
-static void highlight_inventory_items_in_panel(const std::vector<LLUUID>& items, LLInventoryPanel *inventory_panel)
-{
-	if (NULL == inventory_panel) return;
-
-	for (std::vector<LLUUID>::const_iterator item_iter = items.begin();
-		item_iter != items.end();
-		++item_iter)
-	{
-		const LLUUID& item_id = (*item_iter);
-		if(!highlight_offered_object(item_id))
-		{
-			continue;
-		}
-
-		LLInventoryItem* item = gInventory.getItem(item_id);
-		llassert(item);
-		if (!item) {
-			continue;
-		}
-
-		LL_DEBUGS("Inventory_Move") << "Highlighting inventory item: " << item->getName() << ", " << item_id  << LL_ENDL;
-		LLFolderView* fv = inventory_panel->getRootFolder();
-		if (fv)
-		{
-			LLFolderViewItem* fv_item = fv->getItemByID(item_id);
-			if (fv_item)
-			{
-				LLFolderViewItem* fv_folder = fv_item->getParentFolder();
-				if (fv_folder)
-				{
-					// Parent folders can be different in case of 2 consecutive drag and drop
-					// operations when the second one is started before the first one completes.
-					LL_DEBUGS("Inventory_Move") << "Open folder: " << fv_folder->getName() << LL_ENDL;
-					fv_folder->setOpen(TRUE);
-					if (fv_folder->isSelected())
-					{
-						fv->changeSelection(fv_folder, FALSE);
-					}
-				}
-				fv->changeSelection(fv_item, TRUE);
-			}
-		}
-	}
-}
-
 static LLNotificationFunctorRegistration jgr_1("JoinGroup", join_group_response);
 static LLNotificationFunctorRegistration jgr_2("JoinedTooManyGroupsMember", join_group_response);
 static LLNotificationFunctorRegistration jgr_3("JoinGroupCanAfford", join_group_response);
@@ -740,25 +700,10 @@ static LLNotificationFunctorRegistration jgr_3("JoinGroupCanAfford", join_group_
 //-----------------------------------------------------------------------------
 // Instant Message
 //-----------------------------------------------------------------------------
-class LLOpenAgentOffer : public LLInventoryFetchItemsObserver
+class LLOpenAgentOffer : public LLInventoryFetchObserver
 {
 public:
-	LLOpenAgentOffer(const LLUUID& object_id,
-					 const std::string& from_name) : 
-		LLInventoryFetchItemsObserver(object_id),
-		mFromName(from_name) {}
-	/*virtual*/ void startFetch()
-	{
-		for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
-		{
-			LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
-			if (cat)
-			{
-				mComplete.push_back((*it));
-			}
-		}
-		LLInventoryFetchItemsObserver::startFetch();
-	}
+	LLOpenAgentOffer(const std::string& from_name) : mFromName(from_name) {}
 	/*virtual*/ void done()
 	{
 		open_inventory_offer(mComplete, mFromName);
@@ -769,110 +714,6 @@ class LLOpenAgentOffer : public LLInventoryFetchItemsObserver
 	std::string mFromName;
 };
 
-/**
- * Class to observe adding of new items moved from the world to user's inventory to select them in inventory.
- *
- * We can't create it each time items are moved because "drop" event is sent separately for each
- * element even while multi-dragging. We have to have the only instance of the observer. See EXT-4347.
- */
-class LLViewerInventoryMoveFromWorldObserver : public LLInventoryAddItemByAssetObserver
-{
-public:
-	LLViewerInventoryMoveFromWorldObserver()
-		: LLInventoryAddItemByAssetObserver()
-		, mActivePanel(NULL)
-	{
-
-	}
-
-	void setMoveIntoFolderID(const LLUUID& into_folder_uuid) {mMoveIntoFolderID = into_folder_uuid; }
-
-private:
-	/*virtual */void onAssetAdded(const LLUUID& asset_id)
-	{
-		// Store active Inventory panel.
-		mActivePanel = LLInventoryPanel::getActiveInventoryPanel();
-
-		// Store selected items (without destination folder)
-		mSelectedItems.clear();
-		if (mActivePanel)
-		{
-			mSelectedItems = mActivePanel->getRootFolder()->getSelectionList();
-		}
-		mSelectedItems.erase(mMoveIntoFolderID);
-	}
-
-	/**
-	 * Selects added inventory items watched by their Asset UUIDs if selection was not changed since
-	 * all items were started to watch (dropped into a folder).
-	 */
-	void done()
-	{
-		// if selection is not changed since watch started lets hightlight new items.
-		if (mActivePanel && !isSelectionChanged())
-		{
-			LL_DEBUGS("Inventory_Move") << "Selecting new items..." << LL_ENDL;
-			mActivePanel->clearSelection();
-			highlight_inventory_items_in_panel(mAddedItems, mActivePanel);
-		}
-	}
-
-	/**
-	 * Returns true if selected inventory items were changed since moved inventory items were started to watch.
-	 */
-	bool isSelectionChanged()
-	{
-		const LLInventoryPanel * const current_active_panel = LLInventoryPanel::getActiveInventoryPanel();
-
-		if (NULL == mActivePanel || current_active_panel != mActivePanel)
-		{
-			return true;
-		}
-
-		// get selected items (without destination folder)
-		selected_items_t selected_items = mActivePanel->getRootFolder()->getSelectionList();
-		selected_items.erase(mMoveIntoFolderID);
-
-		// compare stored & current sets of selected items
-		selected_items_t different_items;
-		std::set_symmetric_difference(mSelectedItems.begin(), mSelectedItems.end(),
-			selected_items.begin(), selected_items.end(), std::inserter(different_items, different_items.begin()));
-
-		LL_DEBUGS("Inventory_Move") << "Selected firstly: " << mSelectedItems.size()
-			<< ", now: " << selected_items.size() << ", difference: " << different_items.size() << LL_ENDL;
-
-		return different_items.size() > 0;
-	}
-
-	LLInventoryPanel *mActivePanel;
-	typedef std::set<LLUUID> selected_items_t;
-	selected_items_t mSelectedItems;
-
-	/**
-	 * UUID of FolderViewFolder into which watched items are moved.
-	 *
-	 * Destination FolderViewFolder becomes selected while mouse hovering (when dragged items are dropped).
-	 * 
-	 * If mouse is moved out it set unselected and number of selected items is changed 
-	 * even if selected items in Inventory stay the same.
-	 * So, it is used to update stored selection list.
-	 *
-	 * @see onAssetAdded()
-	 * @see isSelectionChanged()
-	 */
-	LLUUID mMoveIntoFolderID;
-};
-
-LLViewerInventoryMoveFromWorldObserver* gInventoryMoveObserver = NULL;
-
-void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid)
-{
-	start_new_inventory_observer();
-
-	gInventoryMoveObserver->setMoveIntoFolderID(into_folder_uuid);
-	gInventoryMoveObserver->watchAsset(inv_item->getAssetUUID());
-}
-
 //unlike the FetchObserver for AgentOffer, we only make one 
 //instance of the AddedObserver for TaskOffers
 //and it never dies.  We do this because we don't know the UUID of 
@@ -883,33 +724,6 @@ class LLOpenTaskOffer : public LLInventoryAddedObserver
 protected:
 	/*virtual*/ void done()
 	{
-		for (uuid_vec_t::iterator it = mAdded.begin(); it != mAdded.end();)
-		{
-			const LLUUID& item_uuid = *it;
-			bool was_moved = false;
-			LLInventoryObject* added_object = gInventory.getObject(item_uuid);
-			if (added_object)
-			{
-				// cast to item to get Asset UUID
-				LLInventoryItem* added_item = dynamic_cast<LLInventoryItem*>(added_object);
-				if (added_item)
-				{
-					const LLUUID& asset_uuid = added_item->getAssetUUID();
-					if (gInventoryMoveObserver->isAssetWatched(asset_uuid))
-					{
-						LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL;
-						was_moved = true;
-					}
-				}
-			}
-
-			if (was_moved)
-			{
-				it = mAdded.erase(it);
-			}
-			else ++it;
-		}
-
 		open_inventory_offer(mAdded, "");
 		mAdded.clear();
 	}
@@ -938,21 +752,13 @@ void start_new_inventory_observer()
 		gNewInventoryObserver = new LLOpenTaskOffer;
 		gInventory.addObserver(gNewInventoryObserver);
 	}
-
-	if (!gInventoryMoveObserver) //inventory move from the world observer 
-	{
-		// Observer is deleted by gInventory
-		gInventoryMoveObserver = new LLViewerInventoryMoveFromWorldObserver;
-		gInventory.addObserver(gInventoryMoveObserver);
-	}
 }
 
-class LLDiscardAgentOffer : public LLInventoryFetchItemsObserver
+class LLDiscardAgentOffer : public LLInventoryFetchComboObserver
 {
 	LOG_CLASS(LLDiscardAgentOffer);
 public:
 	LLDiscardAgentOffer(const LLUUID& folder_id, const LLUUID& object_id) :
-		LLInventoryFetchItemsObserver(object_id),
 		mFolderID(folder_id),
 		mObjectID(object_id) {}
 	virtual ~LLDiscardAgentOffer() {}
@@ -1035,26 +841,21 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
 			{
 				// Use the name of the last item giver, who is probably the person
 				// spamming you.
-
-				LLStringUtil::format_map_t arg;
-				std::string log_msg;
-				std::ostringstream time ;
-				time<<OFFER_THROTTLE_TIME;
-
-				arg["APP_NAME"] = LLAppViewer::instance()->getSecondLifeTitle();
-				arg["TIME"] = time.str();
-
+				std::ostringstream message;
+				message << LLAppViewer::instance()->getSecondLifeTitle();
 				if (!from_name.empty())
 				{
-					arg["FROM_NAME"] = from_name;
-					log_msg = LLTrans::getString("ItemsComingInTooFastFrom", arg);
+					message << ": Items coming in too fast from " << from_name;
 				}
 				else
 				{
-					log_msg = LLTrans::getString("ItemsComingInTooFast", arg);
+					message << ": Items coming in too fast";
 				}
+				message << ", automatic preview disabled for "
+					<< OFFER_THROTTLE_TIME << " seconds.";
 				
 				//this is kinda important, so actually put it on screen
+				std::string log_msg = message.str();
 				LLSD args;
 				args["MESSAGE"] = log_msg;
 				LLNotificationsUtil::add("SystemMessage", args);
@@ -1071,135 +872,130 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
 	}
 }
  
-void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name)
+void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name)
 {
-	for (uuid_vec_t::const_iterator obj_iter = objects.begin();
-		 obj_iter != objects.end();
-		 ++obj_iter)
+	for (uuid_vec_t::const_iterator item_iter = items.begin();
+		 item_iter != items.end();
+		 ++item_iter)
 	{
-		const LLUUID& obj_id = (*obj_iter);
-		if(!highlight_offered_object(obj_id))
+		const LLUUID& item_id = (*item_iter);
+		if(!highlight_offered_item(item_id))
 		{
 			continue;
 		}
 
-		const LLInventoryObject *obj = gInventory.getObject(obj_id);
-		if (!obj)
-		{
-			llwarns << "Cannot find object [ itemID:" << obj_id << " ] to open." << llendl;
+		LLInventoryItem* item = gInventory.getItem(item_id);
+		llassert(item);
+		if (!item) {
 			continue;
 		}
 
-		const LLAssetType::EType asset_type = obj->getActualType();
-
-		// Either an inventory item or a category.
-		const LLInventoryItem* item = dynamic_cast<const LLInventoryItem*>(obj);
-		if (item)
-		{
-			////////////////////////////////////////////////////////////////////////////////
-			// Special handling for various types.
-			if (check_offer_throttle(from_name, false)) // If we are throttled, don't display
+		////////////////////////////////////////////////////////////////////////////////
+		// Special handling for various types.
+		const LLAssetType::EType asset_type = item->getType();
+		if (check_offer_throttle(from_name, false)) // If we are throttled, don't display
+		{
+			LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID()  << LL_ENDL;
+			// If we opened this ourselves, focus it
+			const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
+			switch(asset_type)
 			{
-				LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID()  << LL_ENDL;
-				// If we opened this ourselves, focus it
-				const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
-				switch(asset_type)
-				{
-					case LLAssetType::AT_NOTECARD:
+			  case LLAssetType::AT_NOTECARD:
+			  {
+				  LLFloaterReg::showInstance("preview_notecard", LLSD(item_id), take_focus);
+				  break;
+			  }
+			  case LLAssetType::AT_LANDMARK:
+			  	{
+					LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID());
+					if ("inventory_handler" == from_name)
 					{
-						LLFloaterReg::showInstance("preview_notecard", LLSD(obj_id), take_focus);
-						break;
+						//we have to filter inventory_handler messages to avoid notification displaying
+						LLSideTray::getInstance()->showPanel("panel_places",
+								LLSD().with("type", "landmark").with("id", item->getUUID()));
 					}
-					case LLAssetType::AT_LANDMARK:
+					else if("group_offer" == from_name)
 					{
-						LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID());
-						if ("inventory_handler" == from_name)
-						{
-							//we have to filter inventory_handler messages to avoid notification displaying
-							LLSideTray::getInstance()->showPanel("panel_places",
-																 LLSD().with("type", "landmark").with("id", item->getUUID()));
-						}
-						else if("group_offer" == from_name)
-						{
-							// "group_offer" is passed by LLOpenTaskGroupOffer
-							// Notification about added landmark will be generated under the "from_name.empty()" called from LLOpenTaskOffer::done().
-							LLSD args;
-							args["type"] = "landmark";
-							args["id"] = obj_id;
-							LLSideTray::getInstance()->showPanel("panel_places", args);
-
-							continue;
-						}
-						else if(from_name.empty())
+						// do not open inventory when we open group notice attachment because 
+						// we already opened landmark info panel
+						// "group_offer" is passed by LLOpenTaskGroupOffer
+
+						continue;
+					}
+					else if(from_name.empty())
+					{
+						// we receive a message from LLOpenTaskOffer, it mean that new landmark has been added.
+						LLSD args;
+						args["LANDMARK_NAME"] = item->getName();
+						args["FOLDER_NAME"] = std::string(parent_folder ? parent_folder->getName() : "unknown");
+						LLNotificationsUtil::add("LandmarkCreated", args);
+						// Created landmark is passed to Places panel to allow its editing. In fact panel should be already displayed.
+						// If the panel is closed we don't reopen it until created landmark is loaded.
+						//TODO*:: dserduk(7/12/09) remove LLPanelPlaces dependency from here
+						LLPanelPlaces *places_panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->getPanel("panel_places"));
+						if (places_panel)
 						{
-							std::string folder_name;
-							if (parent_folder)
+							// Landmark creation handling is moved to LLPanelPlaces::showAddedLandmarkInfo()
+							// TODO* LLPanelPlaces dependency is going to be removed. See EXT-4347.
+							//if("create_landmark" == places_panel->getPlaceInfoType() && !places_panel->getItem())
+							//{
+							//	places_panel->setItem(item);
+							//}
+							//else
+							// we are opening a group notice attachment
+							if("create_landmark" != places_panel->getPlaceInfoType())
 							{
-								// Localize folder name.
-								// *TODO: share this code?
-								folder_name = parent_folder->getName();
-								if (LLFolderType::lookupIsProtectedType(parent_folder->getPreferredType()))
-								{
-									LLTrans::findString(folder_name, "InvFolder " + folder_name);
-								}
+								LLSD args;
+								args["type"] = "landmark";
+								args["id"] = item_id;
+								LLSideTray::getInstance()->showPanel("panel_places", args);
 							}
-							else
-							{
-								 folder_name = LLTrans::getString("Unknown");
-							}
-
-							// we receive a message from LLOpenTaskOffer, it mean that new landmark has been added.
-							LLSD args;
-							args["LANDMARK_NAME"] = item->getName();
-							args["FOLDER_NAME"] = folder_name;
-							LLNotificationsUtil::add("LandmarkCreated", args);
 						}
 					}
-					break;
-					case LLAssetType::AT_TEXTURE:
-					{
-						LLFloaterReg::showInstance("preview_texture", LLSD(obj_id), take_focus);
-						break;
-					}
-					case LLAssetType::AT_ANIMATION:
-						LLFloaterReg::showInstance("preview_anim", LLSD(obj_id), take_focus);
-						break;
-					case LLAssetType::AT_SCRIPT:
-						LLFloaterReg::showInstance("preview_script", LLSD(obj_id), take_focus);
-						break;
-					case LLAssetType::AT_SOUND:
-						LLFloaterReg::showInstance("preview_sound", LLSD(obj_id), take_focus);
-						break;
-					default:
-						break;
 				}
+				break;
+			  case LLAssetType::AT_TEXTURE:
+			  {
+				  LLFloaterReg::showInstance("preview_texture", LLSD(item_id), take_focus);
+				  break;
+			  }
+			  case LLAssetType::AT_ANIMATION:
+				  LLFloaterReg::showInstance("preview_anim", LLSD(item_id), take_focus);
+				  break;
+			  case LLAssetType::AT_SCRIPT:
+				  LLFloaterReg::showInstance("preview_script", LLSD(item_id), take_focus);
+				  break;
+			  case LLAssetType::AT_SOUND:
+				  LLFloaterReg::showInstance("preview_sound", LLSD(item_id), take_focus);
+				  break;
+			  default:
+				break;
 			}
 		}
-
+		
 		////////////////////////////////////////////////////////////////////////////////
-		// Highlight item
-		const BOOL auto_open = 
-			gSavedSettings.getBOOL("ShowInInventory") && // don't open if showininventory is false
-			!(asset_type == LLAssetType::AT_CALLINGCARD) && // don't open if it's a calling card
-			!(item && (item->getInventoryType() == LLInventoryType::IT_ATTACHMENT)) && // don't open if it's an item that's an attachment
-			!from_name.empty(); // don't open if it's not from anyone.
+		// Highlight item if it's not in the trash, lost+found, or COF
+		const BOOL auto_open = gSavedSettings.getBOOL("ShowInInventory") &&
+			(asset_type != LLAssetType::AT_CALLINGCARD) &&
+			(item->getInventoryType() != LLInventoryType::IT_ATTACHMENT) &&
+			!from_name.empty();
 		LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open);
 		if(active_panel)
 		{
-			LL_DEBUGS("Messaging") << "Highlighting" << obj_id  << LL_ENDL;
+			LL_DEBUGS("Messaging") << "Highlighting" << item_id  << LL_ENDL;
 			LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
-			active_panel->setSelection(obj_id, TAKE_FOCUS_NO);
+			active_panel->setSelection(item_id, TAKE_FOCUS_NO);
 			gFocusMgr.setKeyboardFocus(focus_ctrl);
 		}
 	}
 }
 
-bool highlight_offered_object(const LLUUID& obj_id)
+bool highlight_offered_item(const LLUUID& item_id)
 {
-	const LLInventoryObject* obj = gInventory.getObject(obj_id);
-	if(!obj)
+	LLInventoryItem* item = gInventory.getItem(item_id);
+	if(!item)
 	{
-		LL_WARNS("Messaging") << "Unable to show inventory item: " << obj_id << LL_ENDL;
+		LL_WARNS("Messaging") << "Unable to show inventory item: " << item_id << LL_ENDL;
 		return false;
 	}
 
@@ -1208,7 +1004,7 @@ bool highlight_offered_object(const LLUUID& obj_id)
 	// notification (e.g. trash, cof, lost-and-found).
 	if(!gAgent.getAFK())
 	{
-		const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(obj_id);
+		const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(item_id);
 		if (parent)
 		{
 			const LLFolderType::EType parent_type = parent->getPreferredType();
@@ -1225,9 +1021,8 @@ bool highlight_offered_object(const LLUUID& obj_id)
 void inventory_offer_mute_callback(const LLUUID& blocked_id,
 								   const std::string& first_name,
 								   const std::string& last_name,
-								   BOOL is_group, boost::shared_ptr<LLNotificationResponderInterface> offer_ptr)
+								   BOOL is_group, LLOfferInfo* offer = NULL)
 {
-	LLOfferInfo* offer =  dynamic_cast<LLOfferInfo*>(offer_ptr.get());
 	std::string from_name;
 	LLMute::EType type;
 	if (is_group)
@@ -1262,6 +1057,7 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id,
 		bool matches(const LLNotificationPtr notification) const
 		{
 			if(notification->getName() == "ObjectGiveItem" 
+				|| notification->getName() == "ObjectGiveItemUnknownUser"
 				|| notification->getName() == "UserGiveItem")
 			{
 				return (notification->getPayload()["from_id"].asUUID() == blocked_id);
@@ -1276,16 +1072,6 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id,
 			gSavedSettings.getString("NotificationChannelUUID")), OfferMatcher(blocked_id));
 }
 
-LLOfferInfo::LLOfferInfo()
- : LLNotificationResponderInterface()
- , mFromGroup(FALSE)
- , mFromObject(FALSE)
- , mIM(IM_NOTHING_SPECIAL)
- , mType(LLAssetType::AT_NONE)
- , mPersist(false)
-{
-}
-
 LLOfferInfo::LLOfferInfo(const LLSD& sd)
 {
 	mIM = (EInstantMessage)sd["im_type"].asInteger();
@@ -1299,7 +1085,6 @@ LLOfferInfo::LLOfferInfo(const LLSD& sd)
 	mFromName = sd["from_name"].asString();
 	mDesc = sd["description"].asString();
 	mHost = LLHost(sd["sender"].asString());
-	mPersist = sd["persist"].asBoolean();
 }
 
 LLOfferInfo::LLOfferInfo(const LLOfferInfo& info)
@@ -1315,7 +1100,6 @@ LLOfferInfo::LLOfferInfo(const LLOfferInfo& info)
 	mFromName = info.mFromName;
 	mDesc = info.mDesc;
 	mHost = info.mHost;
-	mPersist = info.mPersist;
 }
 
 LLSD LLOfferInfo::asLLSD()
@@ -1332,15 +1116,9 @@ LLSD LLOfferInfo::asLLSD()
 	sd["from_name"] = mFromName;
 	sd["description"] = mDesc;
 	sd["sender"] = mHost.getIPandPort();
-	sd["persist"] = mPersist;
 	return sd;
 }
 
-void LLOfferInfo::fromLLSD(const LLSD& params)
-{
-	*this = params;
-}
-
 void LLOfferInfo::send_auto_receive_response(void)
 {	
 	LLMessageSystem* msg = gMessageSystem;
@@ -1380,21 +1158,6 @@ void LLOfferInfo::send_auto_receive_response(void)
 	}
 }
 
-void LLOfferInfo::handleRespond(const LLSD& notification, const LLSD& response)
-{
-	initRespondFunctionMap();
-
-	const std::string name = notification["name"].asString();
-	if(mRespondFunctions.find(name) == mRespondFunctions.end())
-	{
-		llwarns << "Unexpected notification name : " << name << llendl;
-		llassert(!"Unexpected notification name");
-		return;
-	}
-
-	mRespondFunctions[name](notification, response);
-}
-
 bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& response)
 {
 	LLChat chat;
@@ -1417,13 +1180,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
 	// * we can't build two messages at once.
 	if (2 == button) // Block
 	{
-		LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
-
-		llassert(notification_ptr != NULL);
-		if (notification_ptr != NULL)
-		{
-			gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4, notification_ptr->getResponderPtr()));
-		}
+		gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4,this));
 	}
 
 	std::string from_string; // Used in the pop-up.
@@ -1447,9 +1204,11 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
 				// This is an offer from an agent. In this case, the back
 				// end has already copied the items into your inventory,
 				// so we can fetch it out of our inventory.
-				LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(mObjectID, from_string);
-				open_agent_offer->startFetch();
-				if(catp || (itemp && itemp->isFinished()))
+				uuid_vec_t items;
+				items.push_back(mObjectID);
+				LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string);
+				open_agent_offer->fetch(items);
+				if(catp || (itemp && itemp->isComplete()))
 				{
 					open_agent_offer->done();
 				}
@@ -1506,9 +1265,13 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
 			// Disabled logging to old chat floater to fix crash in group notices - EXT-4149
 			// LLFloaterChat::addChatHistory(chat);
 			
-			LLDiscardAgentOffer* discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID);
-			discard_agent_offer->startFetch();
-			if (catp || (itemp && itemp->isFinished()))
+			uuid_vec_t folders;
+			uuid_vec_t items;
+			items.push_back(mObjectID);
+			LLDiscardAgentOffer* discard_agent_offer;
+			discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID);
+			discard_agent_offer->fetch(folders, items);
+			if(catp || (itemp && itemp->isComplete()))
 			{
 				discard_agent_offer->done();
 			}
@@ -1537,10 +1300,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
 		gInventory.addObserver(opener);
 	}
 
-	if(!mPersist)
-	{
-		delete this;
-	}
+	delete this;
 	return false;
 }
 
@@ -1557,13 +1317,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const
 	// * we can't build two messages at once.
 	if (2 == button)
 	{
-		LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
-
-		llassert(notification_ptr != NULL);
-		if (notification_ptr != NULL)
-		{
-			gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4, notification_ptr->getResponderPtr()));
-		}
+		gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4,this));
 	}
 	
 	LLMessageSystem* msg = gMessageSystem;
@@ -1712,34 +1466,10 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const
 		gInventory.addObserver(opener);
 	}
 
-	if(!mPersist)
-	{
-		delete this;
-	}
+	delete this;
 	return false;
 }
 
-class LLPostponedOfferNotification: public LLPostponedNotification
-{
-protected:
-	/* virtual */
-	void modifyNotificationParams()
-	{
-		LLSD substitutions = mParams.substitutions;
-		substitutions["NAME"] = mName;
-		mParams.substitutions = substitutions;
-	}
-};
-
-void LLOfferInfo::initRespondFunctionMap()
-{
-	if(mRespondFunctions.empty())
-	{
-		mRespondFunctions["ObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
-		mRespondFunctions["UserGiveItem"] = boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2);
-	}
-}
-
 void inventory_offer_handler(LLOfferInfo* info)
 {
 	//Until throttling is implmented, busy mode should reject inventory instead of silently
@@ -1806,6 +1536,30 @@ void inventory_offer_handler(LLOfferInfo* info)
 		return;
 	}
 
+	// Name cache callbacks don't store userdata, so can't save
+	// off the LLOfferInfo.  Argh.
+	BOOL name_found = FALSE;
+	if (info->mFromGroup)
+	{
+		std::string group_name;
+		if (gCacheName->getGroupName(info->mFromID, group_name))
+		{
+			args["FIRST"] = group_name;
+			args["LAST"] = "";
+			name_found = TRUE;
+		}
+	}
+	else
+	{
+		std::string first_name, last_name;
+		if (gCacheName->getName(info->mFromID, first_name, last_name))
+		{
+			args["FIRST"] = first_name;
+			args["LAST"] = last_name;
+			name_found = TRUE;
+		}
+	}
+
 	// If mObjectID is null then generate the object_id based on msg to prevent
 	// multiple creation of chiclets for same object.
 	LLUUID object_id = info->mObjectID;
@@ -1820,9 +1574,9 @@ void inventory_offer_handler(LLOfferInfo* info)
 	payload["give_inventory_notification"] = FALSE;
 	args["OBJECTFROMNAME"] = info->mFromName;
 	args["NAME"] = info->mFromName;
-	args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "about").getSLURLString();
+	args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about");
 	std::string verb = "select?name=" + LLURI::escape(msg);
-	args["ITEM_SLURL"] = LLSLURL("inventory", info->mObjectID, verb.c_str()).getSLURLString();
+	args["ITEM_SLURL"] = LLSLURL::buildCommand("inventory", info->mObjectID, verb.c_str());
 
 	LLNotification::Params p("ObjectGiveItem");
 
@@ -1832,11 +1586,10 @@ void inventory_offer_handler(LLOfferInfo* info)
 		// Inventory Slurls don't currently work for non agent transfers, so only display the object name.
 		args["ITEM_SLURL"] = msg;
 		// Note: sets inventory_task_offer_callback as the callback
-		p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
-		info->mPersist = true;
-		p.name = "ObjectGiveItem";
+		p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_task_offer_callback, info, _1, _2));
+		p.name = name_found ? "ObjectGiveItem" : "ObjectGiveItemUnknownUser";
 		// Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory.
-	    LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == TRUE);
+		LLNotifications::instance().add(p);
 	}
 	else // Agent -> Agent Inventory Offer
 	{
@@ -1845,14 +1598,15 @@ void inventory_offer_handler(LLOfferInfo* info)
 		// *TODO fix memory leak
 		// inventory_offer_callback() is not invoked if user received notification and 
 		// closes viewer(without responding the notification)
-		p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
-		info->mPersist = true;
+		p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, info, _1, _2));
 		p.name = "UserGiveItem";
 		
 		// Prefetch the item into your local inventory.
-		LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID);
-		fetch_item->startFetch();
-		if(fetch_item->isFinished())
+		uuid_vec_t items;
+		items.push_back(info->mObjectID);
+		LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver();
+		fetch_item->fetch(items);
+		if(fetch_item->isEverythingComplete())
 		{
 			fetch_item->done();
 		}
@@ -1867,8 +1621,7 @@ void inventory_offer_handler(LLOfferInfo* info)
 		// Inform user that there is a script floater via toast system
 		{
 			payload["give_inventory_notification"] = TRUE;
-		    p.payload = payload;
-		    LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, false);
+			LLNotificationPtr notification = LLNotifications::instance().add(p.payload(payload)); 
 		}
 	}
 }
@@ -1945,76 +1698,6 @@ class LLPostponedServerObjectNotification: public LLPostponedNotification
 	}
 };
 
-static bool parse_lure_bucket(const std::string& bucket,
-							  U64& region_handle,
-							  LLVector3& pos,
-							  LLVector3& look_at,
-							  U8& region_access)
-{
-	// tokenize the bucket
-	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
-	boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
-	tokenizer tokens(bucket, sep);
-	tokenizer::iterator iter = tokens.begin();
-
-	S32 gx,gy,rx,ry,rz,lx,ly,lz;
-	try
-	{
-		gx = boost::lexical_cast<S32>((*(iter)).c_str());
-		gy = boost::lexical_cast<S32>((*(++iter)).c_str());
-		rx = boost::lexical_cast<S32>((*(++iter)).c_str());
-		ry = boost::lexical_cast<S32>((*(++iter)).c_str());
-		rz = boost::lexical_cast<S32>((*(++iter)).c_str());
-		lx = boost::lexical_cast<S32>((*(++iter)).c_str());
-		ly = boost::lexical_cast<S32>((*(++iter)).c_str());
-		lz = boost::lexical_cast<S32>((*(++iter)).c_str());
-	}
-	catch( boost::bad_lexical_cast& )
-	{
-		LL_WARNS("parse_lure_bucket")
-			<< "Couldn't parse lure bucket."
-			<< LL_ENDL;
-		return false;
-	}
-	// Grab region access
-	region_access = SIM_ACCESS_MIN;
-	if (++iter != tokens.end())
-	{
-		std::string access_str((*iter).c_str());
-		LLStringUtil::trim(access_str);
-		if ( access_str == "A" )
-		{
-			region_access = SIM_ACCESS_ADULT;
-		}
-		else if ( access_str == "M" )
-		{
-			region_access = SIM_ACCESS_MATURE;
-		}
-		else if ( access_str == "PG" )
-		{
-			region_access = SIM_ACCESS_PG;
-		}
-	}
-
-	pos.setVec((F32)rx, (F32)ry, (F32)rz);
-	look_at.setVec((F32)lx, (F32)ly, (F32)lz);
-
-	region_handle = to_region_handle(gx, gy);
-	return true;
-}
-
-class LLPostponedIMSystemTipNotification: public LLPostponedNotification
-{
-protected:
-	/* virtual */
-	void modifyNotificationParams()
-	{
-		LLSD payload = mParams.payload;
-		payload["SESSION_NAME"] = mName;
-		mParams.payload = payload;
-	}
-};
-
 void process_improved_im(LLMessageSystem *msg, void **user_data)
 {
 	if (gNoRender)
@@ -2085,19 +1768,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 
 	LLSD args;
 	LLSD payload;
-	LLNotification::Params params;
-
 	switch(dialog)
 	{
 	case IM_CONSOLE_AND_CHAT_HISTORY:
+	  	// *TODO: Translate
 		args["MESSAGE"] = message;
-		args["NAME"] = name;
+		payload["SESSION_NAME"] = name;
 		payload["from_id"] = from_id;
-
-		params.name = "IMSystemMessageTip";
-		params.substitutions = args;
-		params.payload = payload;
-	    LLPostponedNotification::add<LLPostponedIMSystemTipNotification>(params, from_id, false);
+		LLNotificationsUtil::add("IMSystemMessageTip",args, payload);
 		break;
 
 	case IM_NOTHING_SPECIAL: 
@@ -2119,7 +1797,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				// initiated by the other party) then...
 				std::string my_name;
 				LLAgentUI::buildFullname(my_name);
-				std::string response = gSavedPerAccountSettings.getString("BusyModeResponse");
+				std::string response = gSavedPerAccountSettings.getString("BusyModeResponse2");
 				pack_instant_message(
 					gMessageSystem,
 					gAgent.getID(),
@@ -2382,8 +2060,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 
 				LLSD args;
 				args["MESSAGE"] = message;
-				// we shouldn't pass callback functor since it is registered in LLFunctorRegistration
-				LLNotificationsUtil::add("JoinGroup", args, payload);
+				LLNotificationsUtil::add("JoinGroup", args, payload, join_group_response);
 			}
 		}
 		break;
@@ -2444,8 +2121,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			if (is_muted)
 			{
 				// Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331)
-				LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID);
-				fetch_item->startFetch();
+				uuid_vec_t items;
+				items.push_back(info->mObjectID);
+				LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver();
+				fetch_item->fetch(items);
 				delete fetch_item;
 
 				// Same as closing window
@@ -2551,13 +2230,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				chat.mFromID = from_id ^ gAgent.getSessionID();
 			}
 
-			chat.mSourceType = CHAT_SOURCE_OBJECT;
-
 			if(SYSTEM_FROM == name)
 			{
 				// System's UUID is NULL (fixes EXT-4766)
 				chat.mFromID = LLUUID::null;
-				chat.mSourceType = CHAT_SOURCE_SYSTEM;
 			}
 
 			LLSD query_string;
@@ -2569,16 +2245,20 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				query_string["groupowned"] = "true";
 			}	
 
-			chat.mURL = LLSLURL("objectim", session_id, "").getSLURLString();
+			std::ostringstream link;
+			link << "secondlife:///app/objectim/" << session_id << LLURI::mapToQueryString(query_string);
+
+			chat.mURL = link.str();
 			chat.mText = message;
+			chat.mSourceType = CHAT_SOURCE_OBJECT;
 
 			// Note: lie to Nearby Chat, pretending that this is NOT an IM, because
 			// IMs from obejcts don't open IM sessions.
 			LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
-			if(SYSTEM_FROM != name && nearby_chat)
+			if(nearby_chat)
 			{
-				chat.mOwnerID = from_id;
 				LLSD args;
+				args["owner_id"] = from_id;
 				args["slurl"] = location;
 				args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
 				LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
@@ -2608,7 +2288,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			params.substitutions = substitutions;
 			params.payload = payload;
 
-			LLPostponedNotification::add<LLPostponedServerObjectNotification>(params, from_id, from_group);
+			LLPostponedNotification::add<LLPostponedServerObjectNotification>(params, from_id, false);
 		}
 		break;
 	case IM_FROM_TASK_AS_ALERT:
@@ -2649,34 +2329,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			}
 			else
 			{
-				LLVector3 pos, look_at;
-				U64 region_handle;
-				U8 region_access = SIM_ACCESS_MIN;
-				std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size);
-				std::string region_access_str = LLStringUtil::null;
-				std::string region_access_icn = LLStringUtil::null;
-
-				if (parse_lure_bucket(region_info, region_handle, pos, look_at, region_access))
-				{
-					region_access_str = LLViewerRegion::accessToString(region_access);
-					region_access_icn = LLViewerRegion::getAccessIcon(region_access);
-				}
-
 				LLSD args;
 				// *TODO: Translate -> [FIRST] [LAST] (maybe)
-				args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
+				args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about");
 				args["MESSAGE"] = message;
-				args["MATURITY_STR"] = region_access_str;
-				args["MATURITY_ICON"] = region_access_icn;
 				LLSD payload;
 				payload["from_id"] = from_id;
 				payload["lure_id"] = session_id;
 				payload["godlike"] = FALSE;
-
-			    LLNotification::Params params("TeleportOffered");
-			    params.substitutions = args;
-			    params.payload = payload;
-			    LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
+				LLNotificationsUtil::add("TeleportOffered", args, payload);
 			}
 		}
 		break;
@@ -2736,7 +2397,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			}
 			else
 			{
-				args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
+				args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about");
 				if(message.empty())
 				{
 					//support for frienship offers from clients before July 2008
@@ -2745,10 +2406,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				else
 				{
 					args["[MESSAGE]"] = message;
-				    LLNotification::Params params("OfferFriendship");
-				    params.substitutions = args;
-				    params.payload = payload;
-				    LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
+				        LLNotificationsUtil::add("OfferFriendship", args, payload);
 				}
 			}
 		}
@@ -2792,7 +2450,7 @@ void busy_message (LLMessageSystem* msg, LLUUID from_id)
 	{
 		std::string my_name;
 		LLAgentUI::buildFullname(my_name);
-		std::string response = gSavedPerAccountSettings.getString("BusyModeResponse");
+		std::string response = gSavedPerAccountSettings.getString("BusyModeResponse2");
 		pack_instant_message(
 			gMessageSystem,
 			gAgent.getID(),
@@ -3108,7 +2766,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
 		// object inspect for an object that is chatting with you
 		LLSD args;
 		args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
-		chat.mOwnerID = owner_id;
+		args["owner_id"] = owner_id;
 
 		LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
 	}
@@ -3189,9 +2847,7 @@ void process_teleport_progress(LLMessageSystem* msg, void**)
 class LLFetchInWelcomeArea : public LLInventoryFetchDescendentsObserver
 {
 public:
-	LLFetchInWelcomeArea(const uuid_vec_t &ids) :
-		LLInventoryFetchDescendentsObserver(ids)
-	{}
+	LLFetchInWelcomeArea() {}
 	virtual void done()
 	{
 		LLIsType is_landmark(LLAssetType::AT_LANDMARK);
@@ -3273,9 +2929,9 @@ BOOL LLPostTeleportNotifiers::tick()
 			folders.push_back(folder_id);
 		if(!folders.empty())
 		{
-			LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea(folders);
-			fetcher->startFetch();
-			if(fetcher->isFinished())
+			LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea;
+			fetcher->fetch(folders);
+			if(fetcher->isEverythingComplete())
 			{
 				fetcher->done();
 			}
@@ -3500,9 +3156,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 		{
 			// Chat the "back" SLURL. (DEV-4907)
 
-			LLSLURL slurl;
-			gAgent.getTeleportSourceSLURL(slurl);
-			LLSD substitution = LLSD().with("[T_SLURL]", slurl.getSLURLString());
+			LLSD substitution = LLSD().with("[T_SLURL]", gAgent.getTeleportSourceSLURL());
 			std::string completed_from = LLAgent::sTeleportProgressMessages["completed_from"];
 			LLStringUtil::format(completed_from, substitution);
 
@@ -4530,9 +4184,6 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
 	}
 	
 	gAgentCamera.setForceMouselook(force_mouselook);
-	// Forcing turning off flying here to prevent flying after pressing "Stand"
-	// to stand up from an object. See EXT-1655.
-	gAgent.setFlying(FALSE);
 
 	LLViewerObject* object = gObjectList.findObject(sitObjectID);
 	if (object)
@@ -4901,12 +4552,11 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
 				if(boost::regex_match(desc, matches, expr))
 				{
 					// Name of full localizable notification string
-					// there are four types of this string- with name of receiver and reason of payment,
-					// without name and without reason (both may also be absent simultaneously).
+					// there are three types of this string- with name of receiver and reason of payment,
+					// without name and without reason (but not simultaneously)
 					// example of string without name - You paid L$100 to create a group.
 					// example of string without reason - You paid Smdby Linden L$100.
 					// example of string with reason and name - You paid Smbdy Linden L$100 for a land access pass.
-					// example of string with no info - You paid L$50.
 					std::string line = "you_paid_ldollars_no_name";
 
 					// arguments of string which will be in notification
@@ -4927,7 +4577,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
 					std::string reason = std::string(matches[3]);
 					if (reason.empty())
 					{
-						line = name.empty() ? "you_paid_ldollars_no_info" : "you_paid_ldollars_no_reason";
+						line = "you_paid_ldollars_no_reason";
 					}
 					else
 					{
@@ -4971,10 +4621,6 @@ bool handle_special_notification_callback(const LLSD& notification, const LLSD&
 		gSavedSettings.setU32("PreferredMaturity", preferredMaturity);
 		gAgent.sendMaturityPreferenceToServer(preferredMaturity);
 
-		// notify user that the maturity preference has been changed
-		LLSD args;
-		args["RATING"] = LLViewerRegion::accessToString(preferredMaturity);
-		LLNotificationsUtil::add("PreferredMaturityChanged", args);
 	}
 	
 	return false;
@@ -5116,7 +4762,7 @@ void process_alert_message(LLMessageSystem *msgsystem, void **user_data)
 
 void process_alert_core(const std::string& message, BOOL modal)
 {
-	// HACK -- handle callbacks for specific alerts. It also is localized in notifications.xml
+	// HACK -- handle callbacks for specific alerts
 	if ( message == "You died and have been teleported to your home location")
 	{
 		LLViewerStats::getInstance()->incStat(LLViewerStats::ST_KILLED_COUNT);
@@ -5903,9 +5549,7 @@ void send_group_notice(const LLUUID& group_id,
 bool handle_lure_callback(const LLSD& notification, const LLSD& response)
 {
 	std::string text = response["message"].asString();
-	LLSLURL slurl;
-	LLAgentUI::buildSLURL(slurl);
-	text.append("\r\n").append(slurl.getSLURLString());
+	text.append("\r\n").append(LLAgentUI::buildSLURL());
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 
 	if(0 == option)
@@ -6348,7 +5992,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
 	LLFloaterBuyLand::updateEstateName(estate_name);
 
 	std::string owner_name =
-		LLSLURL("agent", estate_owner_id, "inspect").getSLURLString();
+		LLSLURL::buildCommand("agent", estate_owner_id, "inspect");
 	LLPanelEstateCovenant::updateEstateOwnerName(owner_name);
 	LLPanelLandCovenant::updateEstateOwnerName(owner_name);
 	LLFloaterBuyLand::updateEstateOwnerName(owner_name);
@@ -6528,4 +6172,3 @@ void LLOfferInfo::forceResponse(InventoryOfferResponse response)
 	params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2));
 	LLNotifications::instance().forceResponse(params, response);
 }
-
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index 6ff893f543c21875a509b5a6e80926c50543b98b..4015cca77b664cb059b796ead7ad7036ff293f3c 100644
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -2,25 +2,31 @@
  * @file llviewermessage.h
  * @brief Message system callbacks for viewer.
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -34,7 +40,6 @@
 #include "lluuid.h"
 #include "message.h"
 #include "stdenums.h"
-#include "llnotifications.h"
 
 //
 // Forward declarations
@@ -201,14 +206,13 @@ void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name)
 // Returns true if item is not in certain "quiet" folder which don't need UI
 // notification (e.g. trash, cof, lost-and-found) and agent is not AFK, false otherwise.
 // Returns false if item is not found.
-bool highlight_offered_object(const LLUUID& obj_id);
+bool highlight_offered_item(const LLUUID& item_id);
 
-void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid);
-
-class LLOfferInfo : public LLNotificationResponderInterface
+struct LLOfferInfo
 {
-public:
-	LLOfferInfo();
+        LLOfferInfo()
+	:	mFromGroup(FALSE), mFromObject(FALSE),
+		mIM(IM_NOTHING_SPECIAL), mType(LLAssetType::AT_NONE) {};
 	LLOfferInfo(const LLSD& sd);
 
 	LLOfferInfo(const LLOfferInfo& info);
@@ -226,27 +230,12 @@ class LLOfferInfo : public LLNotificationResponderInterface
 	std::string mFromName;
 	std::string mDesc;
 	LLHost mHost;
-	bool mPersist;
-
-	// LLNotificationResponderInterface implementation
-	/*virtual*/ LLSD asLLSD();
-	/*virtual*/ void fromLLSD(const LLSD& params);
-	/*virtual*/ void handleRespond(const LLSD& notification, const LLSD& response);
 
+	LLSD asLLSD();
 	void send_auto_receive_response(void);
-
-	// TODO - replace all references with handleRespond()
 	bool inventory_offer_callback(const LLSD& notification, const LLSD& response);
 	bool inventory_task_offer_callback(const LLSD& notification, const LLSD& response);
 
-private:
-
-	void initRespondFunctionMap();
-
-	typedef boost::function<bool (const LLSD&, const LLSD&)> respond_function_t;
-	typedef std::map<std::string, respond_function_t> respond_function_map_t;
-
-	respond_function_map_t mRespondFunctions;
 };
 
 void process_feature_disabled_message(LLMessageSystem* msg, void**);
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index eade16a075289c8440912a6574267f48150f52e7..987d23630a9e49b0d1b054beccb9e31346329185 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -3,567 +3,334 @@
  * @author James Cook, Richard Nelson
  * @brief Networking constants and globals for viewer.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 
 #include "llviewernetwork.h"
-#include "llviewercontrol.h"
-#include "llsdserialize.h"
-#include "llsecapi.h"
-#include "llweb.h"
 
-                                                            
-const char* DEFAULT_LOGIN_PAGE = "http://secondlife.com/app/login/";
+#include "llevents.h"
+#include "net.h"
 
-const char* SYSTEM_GRID_SLURL_BASE = "secondlife://%s/secondlife/";
-const char* MAIN_GRID_SLURL_BASE = "http://maps.secondlife.com/secondlife/";
-const char* SYSTEM_GRID_APP_SLURL_BASE = "secondlife:///app";
-
-const char* DEFAULT_SLURL_BASE = "https://%s/region/";
-const char* DEFAULT_APP_SLURL_BASE = "x-grid-location-info://%s/app";
+#include "llviewercontrol.h"
+#include "lllogin.h"
 
-LLGridManager::LLGridManager()
+struct LLGridData
 {
-	// by default, we use the 'grids.xml' file in the user settings directory
-	// this file is an LLSD file containing multiple grid definitions.
-	// This file does not contain definitions for secondlife.com grids,
-	// as that would be a security issue when they are overwritten by
-	// an attacker.  Don't want someone snagging a password.
-	std::string grid_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-														   "grids.xml");
-	initialize(grid_file);
-	
-}
-
+	const char* mLabel;
+	const char* mName;
+	const char* mLoginURI;
+	const char* mHelperURI;
+};
 
-LLGridManager::LLGridManager(const std::string& grid_file)
+static LLGridData gGridInfo[GRID_INFO_COUNT] = 
 {
-	// initialize with an explicity grid file for testing.
-	initialize(grid_file);
-}
-
-//
-// LLGridManager - class for managing the list of known grids, and the current
-// selection
-//
-
-
-//
-// LLGridManager::initialze - initialize the list of known grids based
-// on the fixed list of linden grids (fixed for security reasons)
-// the grids.xml file
-// and the command line.
-void LLGridManager::initialize(const std::string& grid_file)
+	{ "None", "", "", ""},
+	{ "Aditi", 
+	  "util.aditi.lindenlab.com", 
+	  "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
+	  "http://aditi-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Agni", 
+	  "util.agni.lindenlab.com", 
+	  "https://login.agni.lindenlab.com/cgi-bin/login.cgi",
+	  "https://secondlife.com/helpers/" },
+	{ "Aruna",
+	  "util.aruna.lindenlab.com",
+	  "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",
+	  "http://aruna-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Bharati",
+	  "util.bharati.lindenlab.com",
+	  "https://login.bharati.lindenlab.com/cgi-bin/login.cgi",
+	  "http://bharati-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Chandra",
+	  "util.chandra.lindenlab.com",
+	  "https://login.chandra.lindenlab.com/cgi-bin/login.cgi",
+	  "http://chandra-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Damballah",
+	  "util.damballah.lindenlab.com",
+	  "https://login.damballah.lindenlab.com/cgi-bin/login.cgi",
+	  "http://damballah-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Danu",
+	  "util.danu.lindenlab.com",
+	  "https://login.danu.lindenlab.com/cgi-bin/login.cgi",
+	  "http://danu-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Durga",
+	  "util.durga.lindenlab.com",
+	  "https://login.durga.lindenlab.com/cgi-bin/login.cgi",
+	  "http://durga-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Ganga",
+	  "util.ganga.lindenlab.com",
+	  "https://login.ganga.lindenlab.com/cgi-bin/login.cgi",
+	  "http://ganga-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Mitra",
+	  "util.mitra.lindenlab.com",
+	  "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",
+	  "http://mitra-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Mohini",
+	  "util.mohini.lindenlab.com",
+	  "https://login.mohini.lindenlab.com/cgi-bin/login.cgi",
+	  "http://mohini-secondlife.webdev.lindenlab.com/helpers/" },
+  	{ "Nandi",
+	  "util.nandi.lindenlab.com",
+	  "https://login.nandi.lindenlab.com/cgi-bin/login.cgi",
+	  "http://nandi-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Parvati",
+	  "util.parvati.lindenlab.com",
+	  "https://login.parvati.lindenlab.com/cgi-bin/login.cgi",
+	  "http://parvati-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Radha",
+	  "util.radha.lindenlab.com",
+	  "https://login.radha.lindenlab.com/cgi-bin/login.cgi",
+	  "http://radha-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Ravi",
+	  "util.ravi.lindenlab.com",
+	  "https://login.ravi.lindenlab.com/cgi-bin/login.cgi",
+	  "http://ravi-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Siva", 
+	  "util.siva.lindenlab.com",
+	  "https://login.siva.lindenlab.com/cgi-bin/login.cgi",
+	  "http://siva-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Shakti",
+	  "util.shakti.lindenlab.com",
+	  "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",
+	  "http://shakti-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Skanda",
+	  "util.skanda.lindenlab.com",
+	  "https://login.skanda.lindenlab.com/cgi-bin/login.cgi",
+	  "http://skanda-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Soma",
+	  "util.soma.lindenlab.com",
+	  "https://login.soma.lindenlab.com/cgi-bin/login.cgi",
+	  "http://soma-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Uma",
+	  "util.uma.lindenlab.com",
+	  "https://login.uma.lindenlab.com/cgi-bin/login.cgi",
+	  "http://uma-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Vaak",
+	  "util.vaak.lindenlab.com",
+	  "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",
+	  "http://vaak-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Yami",
+	  "util.yami.lindenlab.com",
+	  "https://login.yami.lindenlab.com/cgi-bin/login.cgi",
+	  "http://yami-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Local", 
+	  "localhost", 
+	  "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
+	  "" },
+	{ "Other", 
+	  "", 
+	  "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
+	  "" }
+};
+
+const EGridInfo DEFAULT_GRID_CHOICE = GRID_INFO_AGNI;
+
+
+unsigned char gMACAddress[MAC_ADDRESS_BYTES];		/* Flawfinder: ignore */
+
+LLViewerLogin::LLViewerLogin() :
+	mGridChoice(DEFAULT_GRID_CHOICE)
 {
-	// default grid list.
-	// Don't move to a modifiable file for security reasons,
-	mGrid.clear() ;
-	// set to undefined
-	mGridList = LLSD();
-	mGridFile = grid_file;
-	// as we don't want an attacker to override our grid list
-	// to point the default grid to an invalid grid
-	addSystemGrid("None", "", "", "", DEFAULT_LOGIN_PAGE);
-	
-
+}
 
-  	addSystemGrid("Agni",                                                                                             
-				  MAINGRID,                                               
-				  "https://login.agni.lindenlab.com/cgi-bin/login.cgi",                    
-				  "https://secondlife.com/helpers/",     
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Aditi",                                                                                             
-				  "util.aditi.lindenlab.com",                                              
-				  "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://aditi-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Aruna",                                                                                            
-				  "util.aruna.lindenlab.com",                                              
-				  "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://aruna-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Bharati",                                                                                            
-				  "util.bharati.lindenlab.com",                                              
-				  "https://login.bharati.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://bharati-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Chandra",                                                                                            
-				  "util.chandra.lindenlab.com",                                              
-				  "https://login.chandra.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://chandra-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Damballah",                                                                                            
-				  "util.damballah.lindenlab.com",                                              
-				  "https://login.damballah.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://damballah-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Danu",                                                                                            
-				  "util.danu.lindenlab.com",                                              
-				  "https://login.danu.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://danu-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Durga",                                                                                            
-				  "util.durga.lindenlab.com",                                              
-				  "https://login.durga.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://durga-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Ganga",                                                                                            
-				  "util.ganga.lindenlab.com",                                              
-				  "https://login.ganga.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://ganga-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Mitra",                                                                                            
-				  "util.mitra.lindenlab.com",                                              
-				  "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://mitra-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Mohini",                                                                                           
-				  "util.mohini.lindenlab.com",                                             
-				  "https://login.mohini.lindenlab.com/cgi-bin/login.cgi",                  
-				  "http://mohini-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Nandi",                                                                                            
-				  "util.nandi.lindenlab.com",                                              
-				  "https://login.nandi.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://nandi-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Parvati",                                                                                            
-				  "util.parvati.lindenlab.com",                                              
-				  "https://login.parvati.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://parvati-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Radha",                                                                                            
-				  "util.radha.lindenlab.com",                                              
-				  "https://login.radha.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://radha-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Ravi",                                                                                             
-				  "util.ravi.lindenlab.com",                                               
-				  "https://login.ravi.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://ravi-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Siva",                                                                                             
-				  "util.siva.lindenlab.com",                                               
-				  "https://login.siva.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://siva-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Shakti",                                                                                           
-				  "util.shakti.lindenlab.com",                                             
-				  "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",                  
-				  "http://shakti-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Soma",                                                                                             
-				  "util.soma.lindenlab.com",                                               
-				  "https://login.soma.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://soma-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Uma",                                                                                              
-				  "util.uma.lindenlab.com",                                                
-				  "https://login.uma.lindenlab.com/cgi-bin/login.cgi",                     
-				  "http://uma-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Vaak",                                                                                             
-				  "util.vaak.lindenlab.com",                                               
-				  "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://vaak-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Yami",                                                                                             
-				  "util.yami.lindenlab.com",                                               
-				  "https://login.yami.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://yami-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Local (Linden)",                                                                                    
-				  "localhost",                                                             
-				  "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",                     
-				  "",
-				  DEFAULT_LOGIN_PAGE); 
+ LLViewerLogin::~LLViewerLogin() 
+ {
+ }
 
-	
-	LLSD other_grids;
-	llifstream llsd_xml;
-	if (!grid_file.empty())
+void LLViewerLogin::setGridChoice(EGridInfo grid)
+{	
+	if(grid < 0 || grid >= GRID_INFO_COUNT)
 	{
-		llsd_xml.open( grid_file.c_str(), std::ios::in | std::ios::binary );
-
-		// parse through the gridfile, inserting grids into the list unless
-		// they overwrite a linden grid.
-		if( llsd_xml.is_open()) 
-		{
-			LLSDSerialize::fromXMLDocument( other_grids, llsd_xml );
-			if(other_grids.isMap())
-			{
-				for(LLSD::map_iterator grid_itr = other_grids.beginMap(); 
-					grid_itr != other_grids.endMap();
-					++grid_itr)
-				{
-					LLSD::String key_name = grid_itr->first;
-					LLSD grid = grid_itr->second;
-					// TODO:  Make sure gridfile specified label is not 
-					// a system grid label
-					LL_DEBUGS("GridManager") << "reading: " << key_name << LL_ENDL;
-					if (mGridList.has(key_name) &&
-						mGridList[key_name].has(GRID_IS_SYSTEM_GRID_VALUE))
-					{
-						LL_DEBUGS("GridManager") << "Cannot override grid " << key_name << " as it's a system grid" << LL_ENDL;
-						// If the system grid does exist in the grids file, and it's marked as a favorite, set it as a favorite.
-						if(grid_itr->second.has(GRID_IS_FAVORITE_VALUE) && grid_itr->second[GRID_IS_FAVORITE_VALUE].asBoolean() )
-						{
-							mGridList[key_name][GRID_IS_FAVORITE_VALUE] = TRUE;
-						}
-					}
-					else
-					{
-						try
-						{
-							addGrid(grid);
-							LL_DEBUGS("GridManager") << "Added grid: " << key_name << LL_ENDL;
-						}
-						catch (...)
-						{
-						}
-					}
-				}
-				llsd_xml.close();
-			}	
-		}     
+		llerrs << "Invalid grid index specified." << llendl;
+		return;
 	}
-	
-	// load a grid from the command line.
-	// if the actual grid name is specified from the command line,
-	// set it as the 'selected' grid.
-	std::string cmd_line_grid = gSavedSettings.getString("CmdLineGridChoice");
-	if(!cmd_line_grid.empty())
+
+	if(mGridChoice != grid || gSavedSettings.getS32("ServerChoice") != grid)
 	{
-		// try to find the grid assuming the command line parameter is
-		// the case-insensitive 'label' of the grid.  ie 'Agni'
-		mGrid = getGridByLabel(cmd_line_grid);
-		if(mGrid.empty())
+		mGridChoice = grid;
+		if(GRID_INFO_LOCAL == mGridChoice)
 		{
-			// if we couldn't find it, assume the
-			// requested grid is the actual grid 'name' or index,
-			// which would be the dns name of the grid (for non
-			// linden hosted grids)
-			// If the grid isn't there, that's ok, as it will be
-			// automatically added later.
-			mGrid = cmd_line_grid;
+			mGridName = LOOPBACK_ADDRESS_STRING;
+		}
+		else if(GRID_INFO_OTHER == mGridChoice)
+		{
+			// *FIX:Mani - could this possibly be valid?
+			mGridName = "other"; 
+		}
+		else
+		{
+			mGridName = gGridInfo[mGridChoice].mLabel;
 		}
-		
-	}
-	else
-	{
-		// if a grid was not passed in via the command line, grab it from the CurrentGrid setting.
-		// if there's no current grid, that's ok as it'll be either set by the value passed
-		// in via the login uri if that's specified, or will default to maingrid
-		mGrid = gSavedSettings.getString("CurrentGrid");
-	}
-	
-	if(mGrid.empty())
-	{
-		// no grid was specified so default to maingrid
-		LL_DEBUGS("GridManager") << "Setting grid to MAINGRID as no grid has been specified " << LL_ENDL;
-		mGrid = MAINGRID;
-		
-	}
-	
-	// generate a 'grid list' entry for any command line parameter overrides
-	// or setting overides that we'll add to the grid list or override
-	// any grid list entries with.
-	LLSD grid = LLSD::emptyMap();	
-	
-	if(mGridList.has(mGrid))
-	{
-		grid = mGridList[mGrid];
-	}
-	else
-	{
-		grid[GRID_VALUE] = mGrid;
-		// add the grid with the additional values, or update the
-		// existing grid if it exists with the given values
-		addGrid(grid);		
-	}
 
-	LL_DEBUGS("GridManager") << "Selected grid is " << mGrid << LL_ENDL;		
-	setGridChoice(mGrid);
-	if(mGridList[mGrid][GRID_LOGIN_URI_VALUE].isArray())
-	{
-		llinfos << "is array" << llendl;
+		gSavedSettings.setS32("ServerChoice", mGridChoice);
+		gSavedSettings.setString("CustomServer", "");
 	}
 }
 
-LLGridManager::~LLGridManager()
+void LLViewerLogin::setGridChoice(const std::string& grid_name)
 {
-	saveFavorites();
+	// Set the grid choice based on a string.
+	// The string can be:
+	// - a grid label from the gGridInfo table 
+	// - an ip address
+    if(!grid_name.empty())
+    {
+        // find the grid choice from the user setting.
+        int grid_index = GRID_INFO_NONE; 
+        for(;grid_index < GRID_INFO_OTHER; ++grid_index)
+        {
+            if(0 == LLStringUtil::compareInsensitive(gGridInfo[grid_index].mLabel, grid_name))
+            {
+				// Founding a matching label in the list...
+				setGridChoice((EGridInfo)grid_index);
+				break;
+            }
+        }
+
+        if(GRID_INFO_OTHER == grid_index)
+        {
+            // *FIX:MEP Can and should we validate that this is an IP address?
+            mGridChoice = GRID_INFO_OTHER;
+            mGridName = grid_name;
+			gSavedSettings.setS32("ServerChoice", mGridChoice);
+			gSavedSettings.setString("CustomServer", mGridName);
+        }
+    }
 }
 
-void LLGridManager::getGridInfo(const std::string &grid, LLSD& grid_info)
+void LLViewerLogin::resetURIs()
 {
-	
-	grid_info = mGridList[grid]; 
-	
-	// override any grid data with the command line info.
-	
-	LLSD cmd_line_login_uri = gSavedSettings.getLLSD("CmdLineLoginURI");
-	if (cmd_line_login_uri.isString())
-	{	
-		grid_info[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
-		grid_info[GRID_LOGIN_URI_VALUE].append(cmd_line_login_uri);
-	}
-	
-	// override the helper uri if it was passed in
-	std::string cmd_line_helper_uri = gSavedSettings.getString("CmdLineHelperURI");
-	if(!cmd_line_helper_uri.empty())
-	{
-		grid_info[GRID_HELPER_URI_VALUE] = cmd_line_helper_uri;	
-	}
-	
-	// override the login page if it was passed in
-	std::string cmd_line_login_page = gSavedSettings.getString("LoginPage");
-	if(!cmd_line_login_page.empty())
-	{
-		grid_info[GRID_LOGIN_PAGE_VALUE] = cmd_line_login_page;
-	}	
+    // Clear URIs when picking a new server
+	gSavedSettings.setLLSD("CmdLineLoginURI", LLSD::emptyArray());
+	gSavedSettings.setString("CmdLineHelperURI", "");
 }
 
-
-//
-// LLGridManager::addGrid - add a grid to the grid list, populating the needed values
-// if they're not populated yet.
-//
-
-void LLGridManager::addGrid(LLSD& grid_data)
+EGridInfo LLViewerLogin::getGridChoice() const
 {
-	if (grid_data.isMap() && grid_data.has(GRID_VALUE))
-	{
-		std::string grid = utf8str_tolower(grid_data[GRID_VALUE]);
-
-		// grid should be in the form of a dns address
-		if (!grid.empty() &&
-			grid.find_first_not_of("abcdefghijklmnopqrstuvwxyz1234567890-_. ") != std::string::npos)
-		{
-			printf("grid name: %s", grid.c_str());
-			throw LLInvalidGridName(grid);
-		}
-		
-		// populate the other values if they don't exist
-		if (!grid_data.has(GRID_LABEL_VALUE)) 
-		{
-			grid_data[GRID_LABEL_VALUE] = grid;
-		}
-		if (!grid_data.has(GRID_ID_VALUE))
-		{
-			grid_data[GRID_ID_VALUE] = grid;
-		}
-		
-		// if the grid data doesn't include any of the URIs, then 
-		// generate them from the grid, which should be a dns address
-		if (!grid_data.has(GRID_LOGIN_URI_VALUE)) 
-		{
-			grid_data[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
-			grid_data[GRID_LOGIN_URI_VALUE].append(std::string("https://") + 
-													grid + "/cgi-bin/login.cgi");
-		}
-		// Populate to the default values
-		if (!grid_data.has(GRID_LOGIN_PAGE_VALUE)) 
-		{
-			grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/";
-		}		
-		if (!grid_data.has(GRID_HELPER_URI_VALUE)) 
-		{
-			grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/";
-		}
-		
-		if (!grid_data.has(GRID_LOGIN_IDENTIFIER_TYPES))
-		{
-			// non system grids and grids that haven't already been configured with values
-			// get both types of credentials.
-			grid_data[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
-			grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
-			grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_ACCOUNT);
-		}
-		
-		LL_DEBUGS("GridManager") << "ADDING: " << grid << LL_ENDL;
-		mGridList[grid] = grid_data;		
-	}
+	return mGridChoice;
 }
 
-//
-// LLGridManager::addSystemGrid - helper for adding a system grid.
-void LLGridManager::addSystemGrid(const std::string& label, 
-								  const std::string& name, 
-								  const std::string& login, 
-								  const std::string& helper,
-								  const std::string& login_page,
-								  const std::string& login_id)
+std::string LLViewerLogin::getGridLabel() const
 {
-	LLSD grid = LLSD::emptyMap();
-	grid[GRID_VALUE] = name;
-	grid[GRID_LABEL_VALUE] = label;
-	grid[GRID_HELPER_URI_VALUE] = helper;
-	grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
-	grid[GRID_LOGIN_URI_VALUE].append(login);
-	grid[GRID_LOGIN_PAGE_VALUE] = login_page;
-	grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
-	grid[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
-	grid[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
-	
-	grid[GRID_APP_SLURL_BASE] = SYSTEM_GRID_APP_SLURL_BASE;
-	if (login_id.empty())
-	{
-		grid[GRID_ID_VALUE] = name;
-	}
-	else
+	if(mGridChoice == GRID_INFO_NONE)
 	{
-		grid[GRID_ID_VALUE] = login_id;
+		return "None";
 	}
-	
-	// only add the system grids beyond agni to the visible list
-	// if we're building a debug version.
-	if (name == std::string(MAINGRID))
+	else if(mGridChoice < GRID_INFO_OTHER)
 	{
-		grid[GRID_SLURL_BASE] = MAIN_GRID_SLURL_BASE;		
-		grid[GRID_IS_FAVORITE_VALUE] = TRUE;		
-	}
-	else
-	{
-		grid[GRID_SLURL_BASE] = llformat(SYSTEM_GRID_SLURL_BASE, label.c_str());
-	}
-	addGrid(grid);
-}
-
-// return a list of grid name -> grid label mappings for UI purposes
-std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
-{
-	std::map<std::string, std::string> result;
-	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
-		grid_iter != mGridList.endMap();
-		grid_iter++) 
-	{
-		if(!favorite_only || grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
-		{
-			result[grid_iter->first] = grid_iter->second[GRID_LABEL_VALUE].asString();
-		}
+		return gGridInfo[mGridChoice].mLabel;
 	}
 
-	return result;
+	return mGridName;
 }
 
-
-void LLGridManager::setGridChoice(const std::string& grid)
+std::string LLViewerLogin::getKnownGridLabel(EGridInfo grid_index) const
 {
-	// Set the grid choice based on a string.
-	// The string can be:
-	// - a grid label from the gGridInfo table 
-	// - a hostname
-	// - an ip address
-
-	// loop through.  We could do just a hash lookup but we also want to match
-	// on label
-	std::string grid_name = grid;
-	if(!mGridList.has(grid_name))
-	{
-		// case insensitive
-		grid_name = getGridByLabel(grid);
-	}
-	
-	if(grid_name.empty())
+	if(grid_index > GRID_INFO_NONE && grid_index < GRID_INFO_OTHER)
 	{
-		// the grid was not in the list of grids.
-		LLSD grid_data = LLSD::emptyMap();
-		grid_data[GRID_VALUE] = grid;
-		addGrid(grid_data);		
+		return gGridInfo[grid_index].mLabel;
 	}
-	mGrid = grid;
-	gSavedSettings.setString("CurrentGrid", grid);
+	return gGridInfo[GRID_INFO_NONE].mLabel;
 }
 
-std::string LLGridManager::getGridByLabel( const std::string &grid_label, bool case_sensitive)
+void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const
 {
-	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
-		grid_iter != mGridList.endMap();
-		grid_iter++) 
+	// return the login uri set on the command line.
+	LLControlVariable* c = gSavedSettings.getControl("CmdLineLoginURI");
+	if(c)
 	{
-		if (grid_iter->second.has(GRID_LABEL_VALUE))
+		LLSD v = c->getValue();
+		if(v.isArray())
+		{
+			for(LLSD::array_const_iterator itr = v.beginArray();
+				itr != v.endArray(); ++itr)
+			{
+				std::string uri = itr->asString();
+				if(!uri.empty())
+				{
+					uris.push_back(uri);
+				}
+			}
+		}
+		else
 		{
-			if (0 == (case_sensitive?LLStringUtil::compareStrings(grid_label, grid_iter->second[GRID_LABEL_VALUE].asString()):
-				LLStringUtil::compareInsensitive(grid_label, grid_iter->second[GRID_LABEL_VALUE].asString())))
+			std::string uri = v.asString();
+			if(!uri.empty())
 			{
-				return grid_iter->first;
+				uris.push_back(uri);
 			}
 		}
 	}
-	return std::string();
-}
 
-void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
-{
-	uris.clear();
-	LLSD cmd_line_login_uri = gSavedSettings.getLLSD("CmdLineLoginURI");
-	if (cmd_line_login_uri.isString())
-	{	
-		uris.push_back(cmd_line_login_uri);
-		return;
-	}
-	for (LLSD::array_iterator llsd_uri = mGridList[mGrid][GRID_LOGIN_URI_VALUE].beginArray();
-		 llsd_uri != mGridList[mGrid][GRID_LOGIN_URI_VALUE].endArray();
-		 llsd_uri++)
+	// If there was no command line uri...
+	if(uris.empty())
 	{
-		uris.push_back(llsd_uri->asString());
+		// If its a known grid choice, get the uri from the table,
+		// else try the grid name.
+		if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
+		{
+			uris.push_back(gGridInfo[mGridChoice].mLoginURI);
+		}
+		else
+		{
+			uris.push_back(mGridName);
+		}
 	}
 }
 
-std::string LLGridManager::getHelperURI() 
+std::string LLViewerLogin::getHelperURI() const
 {
-	std::string cmd_line_helper_uri = gSavedSettings.getString("CmdLineHelperURI");
-	if(!cmd_line_helper_uri.empty())
+	std::string helper_uri = gSavedSettings.getString("CmdLineHelperURI");
+	if (helper_uri.empty())
 	{
-		return cmd_line_helper_uri;	
-	}
-	return mGridList[mGrid][GRID_HELPER_URI_VALUE];
-}
+		// grab URI from selected grid
+		if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
+		{
+			helper_uri = gGridInfo[mGridChoice].mHelperURI;
+		}
 
-std::string LLGridManager::getLoginPage() 
-{
-	// override the login page if it was passed in
-	std::string cmd_line_login_page = gSavedSettings.getString("LoginPage");
-	if(!cmd_line_login_page.empty())
-	{
-		return cmd_line_login_page;
-	}	
-	
-	return mGridList[mGrid][GRID_LOGIN_PAGE_VALUE];
+		if (helper_uri.empty())
+		{
+			// what do we do with unnamed/miscellaneous grids?
+			// for now, operations that rely on the helper URI (currency/land purchasing) will fail
+		}
+	}
+	return helper_uri;
 }
 
-bool LLGridManager::isInProductionGrid()
+bool LLViewerLogin::isInProductionGrid()
 {
 	// *NOTE:Mani This used to compare GRID_INFO_AGNI to gGridChoice,
 	// but it seems that loginURI trumps that.
 	std::vector<std::string> uris;
 	getLoginURIs(uris);
-	if (uris.size() < 1)
-	{
-		return 1;
-	}
 	LLStringUtil::toLower(uris[0]);
 	if((uris[0].find("agni") != std::string::npos))
 	{
@@ -572,51 +339,3 @@ bool LLGridManager::isInProductionGrid()
 
 	return false;
 }
-
-void LLGridManager::saveFavorites()
-{
-	// filter out just those marked as favorites
-	LLSD output_grid_list = LLSD::emptyMap();
-	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
-		grid_iter != mGridList.endMap();
-		grid_iter++)
-	{
-		if(grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
-		{
-			output_grid_list[grid_iter->first] = grid_iter->second;
-		}
-	}       
-	llofstream llsd_xml;
-	llsd_xml.open( mGridFile.c_str(), std::ios::out | std::ios::binary);	
-	LLSDSerialize::toPrettyXML(output_grid_list, llsd_xml);
-	llsd_xml.close();
-}
-
-
-// build a slurl for the given region within the selected grid
-std::string LLGridManager::getSLURLBase(const std::string& grid)
-{
-	std::string grid_base;
-	if(mGridList.has(grid) && mGridList[grid].has(GRID_SLURL_BASE))
-	{
-		return mGridList[grid][GRID_SLURL_BASE].asString();
-	}
-	else
-	{
-		return  llformat(DEFAULT_SLURL_BASE, grid.c_str());
-	}
-}
-
-// build a slurl for the given region within the selected grid
-std::string LLGridManager::getAppSLURLBase(const std::string& grid)
-{
-	std::string grid_base;
-	if(mGridList.has(grid) && mGridList[grid].has(GRID_APP_SLURL_BASE))
-	{
-	  return mGridList[grid][GRID_APP_SLURL_BASE].asString();
-	}
-	else
-	{
-	  return  llformat(DEFAULT_APP_SLURL_BASE, grid.c_str());
-	}
-}
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index 70b06b1dc20fc40d892b0dd7146709ccfb97af36..edae6dc47b56b87f1770269bf2fde8b61261de56 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -3,148 +3,113 @@
  * @author James Cook
  * @brief Networking constants and globals for viewer.
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #ifndef LL_LLVIEWERNETWORK_H
 #define LL_LLVIEWERNETWORK_H
-                                                                                                       
-extern const char* DEFAULT_LOGIN_PAGE;
-      
-#define GRID_VALUE "name"
-#define GRID_LABEL_VALUE "label"
-#define GRID_ID_VALUE "grid_login_id"
-#define GRID_LOGIN_URI_VALUE "login_uri"
-#define GRID_HELPER_URI_VALUE "helper_uri"
-#define GRID_LOGIN_PAGE_VALUE "login_page"
-#define GRID_IS_SYSTEM_GRID_VALUE "system_grid"
-#define GRID_IS_FAVORITE_VALUE "favorite"
-#define MAINGRID "util.agni.lindenlab.com"
-#define GRID_LOGIN_IDENTIFIER_TYPES "login_identifier_types"
-// defines slurl formats associated with various grids.
-// we need to continue to support existing forms, as slurls
-// are shared between viewers that may not understand newer
-// forms.
-#define GRID_SLURL_BASE "slurl_base"
-#define GRID_APP_SLURL_BASE "app_slurl_base"
 
-class LLInvalidGridName
+#include <boost/scoped_ptr.hpp>
+
+class LLHost;
+class LLLogin;
+
+enum EGridInfo
 {
-public:
-	LLInvalidGridName(std::string grid) : mGrid(grid)
-	{
-	}
-protected:
-	std::string mGrid;
+	GRID_INFO_NONE,
+	GRID_INFO_ADITI,
+	GRID_INFO_AGNI,
+	GRID_INFO_ARUNA,
+	GRID_INFO_BHARATI,
+	GRID_INFO_CHANDRA,
+	GRID_INFO_DAMBALLAH,
+	GRID_INFO_DANU,
+	GRID_INFO_DURGA,
+	GRID_INFO_GANGA,
+	GRID_INFO_MITRA,
+	GRID_INFO_MOHINI,
+	GRID_INFO_NANDI,
+	GRID_INFO_PARVATI,
+	GRID_INFO_RADHA,
+	GRID_INFO_RAVI,
+	GRID_INFO_SIVA,
+	GRID_INFO_SHAKTI,
+	GRID_INFO_SKANDA,
+	GRID_INFO_SOMA,
+	GRID_INFO_UMA,
+	GRID_INFO_VAAK,
+	GRID_INFO_YAMI,
+	GRID_INFO_LOCAL,
+	GRID_INFO_OTHER, // IP address set via command line option
+	GRID_INFO_COUNT
 };
 
-
 /**
- * @brief A class to manage the grids available to the viewer
- * including persistance.  This class also maintains the currently
- * selected grid.
+ * @brief A class to manage the viewer's login state.
  * 
  **/
-class LLGridManager : public LLSingleton<LLGridManager>
+class LLViewerLogin : public LLSingleton<LLViewerLogin>
 {
 public:
-	
-	// when the grid manager is instantiated, the default grids are automatically
-	// loaded, and the grids favorites list is loaded from the xml file.
-	LLGridManager(const std::string& grid_file);
-	LLGridManager();
-	~LLGridManager();
-	
-	void initialize(const std::string& grid_file);
-	// grid list management
-	
-	// add a grid to the list of grids
-	void addGrid(LLSD& grid_info);	
+	LLViewerLogin();
+	~LLViewerLogin();
 
-	// retrieve a map of grid-name <-> label
-	// by default only return the user visible grids
-	std::map<std::string, std::string> getKnownGrids(bool favorites_only=FALSE);
-	
-	void getGridInfo(const std::string& grid, LLSD &grid_info);
-	
-	// current grid management
+	void setGridChoice(EGridInfo grid);
+	void setGridChoice(const std::string& grid_name);
+	void resetURIs();
 
-	// select a given grid as the current grid.  If the grid
-	// is not a known grid, then it's assumed to be a dns name for the
-	// grid, and the various URIs will be automatically generated.
-	void setGridChoice(const std::string& grid);
-	
-	
-	std::string getGridLabel() { return mGridList[mGrid][GRID_LABEL_VALUE]; } 	
-	std::string getGrid() const { return mGrid; }
-	void getLoginURIs(std::vector<std::string>& uris);
-	std::string getHelperURI();
-	std::string getLoginPage();
-	std::string getGridLoginID() { return mGridList[mGrid][GRID_ID_VALUE]; }	
-	std::string getLoginPage(const std::string& grid) { return mGridList[grid][GRID_LOGIN_PAGE_VALUE]; }
-	void        getLoginIdentifierTypes(LLSD& idTypes) { idTypes = mGridList[mGrid][GRID_LOGIN_IDENTIFIER_TYPES]; }
-	
-	// build a slurl for the given region within the selected grid
-	std::string getSLURLBase(const std::string& grid);
-	std::string getSLURLBase() { return getSLURLBase(mGrid); }
-	
-	std::string getAppSLURLBase(const std::string& grid);
-	std::string getAppSLURLBase() { return getAppSLURLBase(mGrid); }	
-	
-	void getGridInfo(LLSD &grid_info) { getGridInfo(mGrid, grid_info); }
-	
-	std::string getGridByLabel( const std::string &grid_label, bool case_sensitive = false);
-	
-	bool isSystemGrid(const std::string& grid) 
-	{ 
-		return mGridList.has(grid) &&
-		      mGridList[grid].has(GRID_IS_SYSTEM_GRID_VALUE) && 
-	           mGridList[grid][GRID_IS_SYSTEM_GRID_VALUE].asBoolean(); 
-	}
-	bool isSystemGrid() { return isSystemGrid(mGrid); }
-	// Mark this grid as a favorite that should be persisited on 'save'
-	// this is currently used to persist a grid after a successful login
-	void setFavorite() { mGridList[mGrid][GRID_IS_FAVORITE_VALUE] = TRUE; }
-	
-	bool isInProductionGrid();
-	void saveFavorites();
-	void clearFavorites();
+	/**
+	* @brief Get the enumeration of the grid choice.
+	* Should only return values > 0 && < GRID_INFO_COUNT
+	**/
+	EGridInfo getGridChoice() const;
+
+	/**
+	* @brief Get a readable label for the grid choice.
+	* Returns the readable name for the grid choice. 
+	* If the grid is 'other', returns something
+	* the string used to specifiy the grid.
+	**/
+	std::string getGridLabel() const; 
 
-protected:
+	std::string getKnownGridLabel(EGridInfo grid_index) const; 
+
+	void getLoginURIs(std::vector<std::string>& uris) const;
+	std::string getHelperURI() const;
+
+	bool isInProductionGrid();
 
-	// helper function for adding the predefined grids
-	void addSystemGrid(const std::string& label, 
-					   const std::string& name, 
-					   const std::string& login, 
-					   const std::string& helper,
-					   const std::string& login_page,
-					   const std::string& login_id = "");	
-	
-	
-	std::string mGrid;
-	std::string mGridFile;
-	LLSD mGridList;
+private:
+	EGridInfo mGridChoice;
+	std::string mGridName;
 };
 
 const S32 MAC_ADDRESS_BYTES = 6;
+extern unsigned char gMACAddress[MAC_ADDRESS_BYTES];		/* Flawfinder: ignore */
 
 #endif
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 2a909f87819dd8e206d3cc6faa507f239ecf1b6b..bb7933c10e8d90eccc6e578b36fac8f2a5e71c5d 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2,25 +2,31 @@
  * @file llviewerobject.cpp
  * @brief Base class for viewer objects
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -73,7 +79,6 @@
 #include "llviewerparceloverlay.h"
 #include "llviewerpartsource.h"
 #include "llviewerregion.h"
-#include "llviewerstats.h"
 #include "llviewertextureanim.h"
 #include "llviewerwindow.h" // For getSpinAxis
 #include "llvoavatar.h"
@@ -757,24 +762,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 	// Coordinates of objects on simulators are region-local.
 	U64 region_handle;
 	mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
-	
-	{
-		LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
-		if(regionp != mRegionp && regionp && mRegionp)//region cross
-		{
-			//this is the redundant position and region update, but it is necessary in case the viewer misses the following 
-			//position and region update messages from sim.
-			//this redundant update should not cause any problems.
-			LLVector3 delta_pos =  mRegionp->getOriginAgent() - regionp->getOriginAgent();
-			setPositionParent(getPosition() + delta_pos); //update to the new region position immediately.
-			setRegion(regionp) ; //change the region.
-		}
-		else
-		{
-			mRegionp = regionp ;
-		}
-	}	
-	
+	mRegionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
 	if (!mRegionp)
 	{
 		U32 x, y;
@@ -1911,12 +1899,6 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 
 			avatar->clampAttachmentPositions();
 		}
-		
-		// If we're snapping the position by more than 0.5m, update LLViewerStats::mAgentPositionSnaps
-		if ( asAvatar() && asAvatar()->isSelf() && (mag_sqr > 0.25f) )
-		{
-			LLViewerStats::getInstance()->mAgentPositionSnaps.push( diff.length() );
-		}
 	}
 
 	if (new_rot != mLastRot
@@ -4745,7 +4727,7 @@ BOOL LLViewerObject::permYouOwner() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4782,7 +4764,7 @@ BOOL LLViewerObject::permOwnerModify() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 	{
 			return TRUE;
@@ -4806,7 +4788,7 @@ BOOL LLViewerObject::permModify() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 	{
 			return TRUE;
@@ -4830,7 +4812,7 @@ BOOL LLViewerObject::permCopy() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4854,7 +4836,7 @@ BOOL LLViewerObject::permMove() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4878,7 +4860,7 @@ BOOL LLViewerObject::permTransfer() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4946,11 +4928,6 @@ void LLViewerObject::setIncludeInSearch(bool include_in_search)
 
 void LLViewerObject::setRegion(LLViewerRegion *regionp)
 {
-	if (!regionp)
-	{
-		llwarns << "viewer object set region to NULL" << llendl;
-	}
-	
 	mLatestRecvPacketID = 0;
 	mRegionp = regionp;
 
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index c3c1b2d1067627f1699fb7d093b0beca1f90aa6a..be83fb7ef8a292fae89327b7238135388926543d 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -2,25 +2,31 @@
  * @file llviewerobject.h
  * @brief Description of LLViewerObject class, which is the base class for most objects in the viewer.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 05695193a572a62c25537fa311d59b79d25a6754..752aeaaab01a157c7d58c6e3f40751d1fa3ca96a 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -2,25 +2,31 @@
  * @file llviewerobjectlist.cpp
  * @brief Implementation of LLViewerObjectList class.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -888,10 +894,10 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep)
 
 BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
 {
-	// Don't ever kill gAgentAvatarp, just force it to the agent's region
+	// Don't ever kill gAgentAvatarp, just mark it as null region instead.
 	if (objectp == gAgentAvatarp)
 	{
-		objectp->setRegion(gAgent.getRegion());
+		objectp->setRegion(NULL);
 		return FALSE;
 	}
 
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 3e984b6fc37f67e157189728d67c9846890cee35..b7c265be59722502745d63ede413a6a1c5b5f5da 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -2,25 +2,31 @@
  * @file llviewerstats.cpp
  * @brief LLViewerStats class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -274,8 +280,6 @@ LLViewerStats::LLViewerStats() :
 	{
 		mStats[ST_HAS_BAD_TIMER] = 1.0;
 	}	
-	
-	mAgentPositionSnaps.reset();
 }
 
 LLViewerStats::~LLViewerStats()
@@ -295,8 +299,6 @@ void LLViewerStats::resetStats()
 	LLViewerStats::getInstance()->mPacketsOutStat.reset();
 	LLViewerStats::getInstance()->mFPSStat.reset();
 	LLViewerStats::getInstance()->mTexturePacketsStat.reset();
-	
-	LLViewerStats::getInstance()->mAgentPositionSnaps.reset();
 }
 
 
@@ -391,10 +393,6 @@ void LLViewerStats::addToMessage(LLSD &body) const
 					<< llendl;
 		}
 	}
-	
-	body["AgentPositionSnaps"] = mAgentPositionSnaps.getData();
-	llinfos << "STAT: AgentPositionSnaps: Mean = " << mAgentPositionSnaps.getMean() << "; StdDev = " << mAgentPositionSnaps.getStdDev() 
-			<< "; Count = " << mAgentPositionSnaps.getCount() << llendl;
 }
 
 // static
@@ -770,11 +768,9 @@ void send_stats()
 	system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB();
 	system["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
 	system["cpu"] = gSysCPU.getCPUString();
-	unsigned char MACAddress[MAC_ADDRESS_BYTES];
-	LLUUID::getNodeID(MACAddress);
 	std::string macAddressString = llformat("%02x-%02x-%02x-%02x-%02x-%02x",
-											MACAddress[0],MACAddress[1],MACAddress[2],
-											MACAddress[3],MACAddress[4],MACAddress[5]);
+											gMACAddress[0],gMACAddress[1],gMACAddress[2],
+											gMACAddress[3],gMACAddress[4],gMACAddress[5]);
 	system["mac_address"] = macAddressString;
 	system["serial_number"] = LLAppViewer::instance()->getSerialNumber();
 	std::string gpu_desc = llformat(
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index 0c369708787b667b97cd56f4e0e0dfb516ca6a6d..59efae4cb21aabc01bdfbb471239d659c5e9e0e5 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -2,25 +2,31 @@
  * @file llviewertexteditor.cpp
  * @brief Text editor widget to let users enter a multi-line document.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -84,7 +90,7 @@ class LLEmbeddedLandmarkCopied: public LLInventoryCallback
 	}
 	static void processForeignLandmark(LLLandmark* landmark,
 			const LLUUID& object_id, const LLUUID& notecard_inventory_id,
-			LLPointer<LLInventoryItem> item_ptr)
+			LLInventoryItem* item)
 	{
 		LLVector3d global_pos;
 		landmark->getGlobalPos(global_pos);
@@ -97,16 +103,8 @@ class LLEmbeddedLandmarkCopied: public LLInventoryCallback
 		}
 		else
 		{
-			if (item_ptr.isNull())
-			{
-				// check to prevent a crash. See EXT-8459.
-				llwarns << "Passed handle contains a dead inventory item. Most likely notecard has been closed and embedded item was destroyed." << llendl;
-			}
-			else
-			{
-				LLPointer<LLEmbeddedLandmarkCopied> cb = new LLEmbeddedLandmarkCopied();
-				copy_inventory_from_notecard(object_id, notecard_inventory_id, item_ptr.get(), gInventoryCallbacks.registerCB(cb));
-			}
+			LLPointer<LLEmbeddedLandmarkCopied> cb = new LLEmbeddedLandmarkCopied();
+			copy_inventory_from_notecard(object_id, notecard_inventory_id, item, gInventoryCallbacks.registerCB(cb));
 		}
 	}
 };
@@ -302,14 +300,14 @@ class LLEmbeddedItems
 
 	void	markSaved();
 	
-	static LLPointer<LLInventoryItem> getEmbeddedItemPtr(llwchar ext_char); // returns pointer to item from static list
+	static LLInventoryItem* getEmbeddedItem(llwchar ext_char); // returns item from static list
 	static BOOL getEmbeddedItemSaved(llwchar ext_char); // returns whether item from static list is saved
 
 private:
 
 	struct embedded_info_t
 	{
-		LLPointer<LLInventoryItem> mItemPtr;
+		LLPointer<LLInventoryItem> mItem;
 		BOOL mSaved;
 	};
 	typedef std::map<llwchar, embedded_info_t > item_map_t;
@@ -380,7 +378,7 @@ BOOL LLEmbeddedItems::insertEmbeddedItem( LLInventoryItem* item, llwchar* ext_ch
 		++wc_emb;
 	}
 
-	sEntries[wc_emb].mItemPtr = item;
+	sEntries[wc_emb].mItem = item;
 	sEntries[wc_emb].mSaved = is_new ? FALSE : TRUE;
 	*ext_char = wc_emb;
 	mEmbeddedUsedChars.insert(wc_emb);
@@ -402,14 +400,14 @@ BOOL LLEmbeddedItems::removeEmbeddedItem( llwchar ext_char )
 }
 	
 // static
-LLPointer<LLInventoryItem> LLEmbeddedItems::getEmbeddedItemPtr(llwchar ext_char)
+LLInventoryItem* LLEmbeddedItems::getEmbeddedItem(llwchar ext_char)
 {
 	if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR )
 	{
 		item_map_t::iterator iter = sEntries.find(ext_char);
 		if (iter != sEntries.end())
 		{
-			return iter->second.mItemPtr;
+			return iter->second.mItem;
 		}
 	}
 	return NULL;
@@ -507,7 +505,7 @@ BOOL LLEmbeddedItems::hasEmbeddedItem(llwchar ext_char)
 
 LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const
 {
-	LLInventoryItem* item = getEmbeddedItemPtr(ext_char);
+	LLInventoryItem* item = getEmbeddedItem(ext_char);
 	if (item)
 	{
 		const char* img_name = "";
@@ -569,7 +567,7 @@ void LLEmbeddedItems::getEmbeddedItemList( std::vector<LLPointer<LLInventoryItem
 	for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin(); iter != mEmbeddedUsedChars.end(); ++iter)
 	{
 		llwchar wc = *iter;
-		LLPointer<LLInventoryItem> item = getEmbeddedItemPtr(wc);
+		LLPointer<LLInventoryItem> item = getEmbeddedItem(wc);
 		if (item)
 		{
 			items.push_back(item);
@@ -700,7 +698,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
 			{
 				wc = getWText()[mCursorPos];
 			}
-			LLPointer<LLInventoryItem> item_at_pos = LLEmbeddedItems::getEmbeddedItemPtr(wc);
+			LLInventoryItem* item_at_pos = LLEmbeddedItems::getEmbeddedItem(wc);
 			if (item_at_pos)
 			{
 				mDragItem = item_at_pos;
@@ -1021,7 +1019,7 @@ llwchar LLViewerTextEditor::pasteEmbeddedItem(llwchar ext_char)
 	{
 		return ext_char; // already exists in my list
 	}
-	LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItemPtr(ext_char);
+	LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem(ext_char);
 	if (item)
 	{
 		// Add item to my list and return new llwchar associated with it
@@ -1055,7 +1053,7 @@ void LLViewerTextEditor::findEmbeddedItemSegments(S32 start, S32 end)
 			&& embedded_char <= LAST_EMBEDDED_CHAR 
 			&& mEmbeddedItemList->hasEmbeddedItem(embedded_char) )
 		{
-			LLInventoryItem* itemp = mEmbeddedItemList->getEmbeddedItemPtr(embedded_char);
+			LLInventoryItem* itemp = mEmbeddedItemList->getEmbeddedItem(embedded_char);
 			LLUIImagePtr image = mEmbeddedItemList->getItemImage(embedded_char);
 			insertSegment(new LLEmbeddedItemSegment(idx, image, itemp, *this));
 		}
@@ -1067,7 +1065,7 @@ BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos)
 	if( pos < getLength())
 	{
 		llwchar wc = getWText()[pos];
-		LLPointer<LLInventoryItem> item = LLEmbeddedItems::getEmbeddedItemPtr( wc );
+		LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem( wc );
 		if( item )
 		{
 			BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( wc );
@@ -1085,7 +1083,7 @@ BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos)
 }
 
 
-BOOL LLViewerTextEditor::openEmbeddedItem(LLPointer<LLInventoryItem> item, llwchar wc)
+BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item, llwchar wc)
 {
 
 	switch( item->getType() )
@@ -1153,17 +1151,17 @@ void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item, llwchar wc )
 }
 
 
-void LLViewerTextEditor::openEmbeddedLandmark( LLPointer<LLInventoryItem> item_ptr, llwchar wc )
+void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item, llwchar wc )
 {
-	if (item_ptr.isNull())
+	if (!item)
 		return;
 
-	LLLandmark* landmark = gLandmarkList.getAsset(item_ptr->getAssetUUID(),
-			boost::bind(&LLEmbeddedLandmarkCopied::processForeignLandmark, _1, mObjectID, mNotecardInventoryID, item_ptr));
+	LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID(),
+			boost::bind(&LLEmbeddedLandmarkCopied::processForeignLandmark, _1, mObjectID, mNotecardInventoryID, item));
 	if (landmark)
 	{
 		LLEmbeddedLandmarkCopied::processForeignLandmark(landmark, mObjectID,
-				mNotecardInventoryID, item_ptr);
+				mNotecardInventoryID, item);
 	}
 }
 
@@ -1222,7 +1220,7 @@ bool LLViewerTextEditor::onCopyToInvDialog(const LLSD& notification, const LLSD&
 	{
 		LLUUID item_id = notification["payload"]["item_id"].asUUID();
 		llwchar wc = llwchar(notification["payload"]["item_wc"].asInteger());
-		LLInventoryItem* itemp = LLEmbeddedItems::getEmbeddedItemPtr(wc);
+		LLInventoryItem* itemp = LLEmbeddedItems::getEmbeddedItem(wc);
 		if (itemp)
 			copyInventory(itemp);
 	}
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 2981dc8c829e56efd737f5f393c961936fb28c65..96d9f2713e0b547f32eda0c1eeb01bd06bb8ab2a 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2,25 +2,31 @@
  * @file llviewerwindow.cpp
  * @brief Implementation of the LLViewerWindow class.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -79,6 +85,7 @@
 #include "lltooltip.h"
 #include "llmediaentry.h"
 #include "llurldispatcher.h"
+#include "llurlsimstring.h"
 
 // newview includes
 #include "llagent.h"
@@ -100,6 +107,7 @@
 #include "llfloaterbuildoptions.h"
 #include "llfloaterbuyland.h"
 #include "llfloatercamera.h"
+#include "llfloatercustomize.h"
 #include "llfloaterland.h"
 #include "llfloaterinspect.h"
 #include "llfloatermap.h"
@@ -195,7 +203,6 @@
 
 #include "llnearbychat.h"
 #include "llviewerwindowlistener.h"
-#include "llpaneltopinfobar.h"
 
 #if LL_WINDOWS
 #include <tchar.h> // For Unicode conversion methods
@@ -615,112 +622,107 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window,  LLCoordGL pos, MASK
 	x = llround((F32)x / mDisplayScale.mV[VX]);
 	y = llround((F32)y / mDisplayScale.mV[VY]);
 
-	// only send mouse clicks to UI if UI is visible
-	if(gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
-	{	
-
-		if (down)
-		{
-			buttonstatestr = "down" ;
-		}
-		else
-		{
-			buttonstatestr = "up" ;
-		}
-		
-		switch (clicktype)
-		{
-		case LLMouseHandler::CLICK_LEFT:
-			mLeftMouseDown = down;
-			buttonname = "Left";
-			break;
-		case LLMouseHandler::CLICK_RIGHT:
-			mRightMouseDown = down;
-			buttonname = "Right";
-			break;
-		case LLMouseHandler::CLICK_MIDDLE:
-			mMiddleMouseDown = down;
-			buttonname = "Middle";
-			break;
-		case LLMouseHandler::CLICK_DOUBLELEFT:
-			mLeftMouseDown = down;
-			buttonname = "Left Double Click";
-			break;
-		}
-		
-		LLView::sMouseHandlerMessage.clear();
-
-		if (gMenuBarView)
-		{
-			// stop ALT-key access to menu
-			gMenuBarView->resetMenuTrigger();
-		}
-
-		if (gDebugClicks)
-		{	
-			llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl;
-		}
+	if (down)
+	{
+		buttonstatestr = "down" ;
+	}
+	else
+	{
+		buttonstatestr = "up" ;
+	}
+	
+	switch (clicktype)
+	{
+	case LLMouseHandler::CLICK_LEFT:
+		mLeftMouseDown = down;
+		buttonname = "Left";
+		break;
+	case LLMouseHandler::CLICK_RIGHT:
+		mRightMouseDown = down;
+		buttonname = "Right";
+		break;
+	case LLMouseHandler::CLICK_MIDDLE:
+		mMiddleMouseDown = down;
+		buttonname = "Middle";
+		break;
+	case LLMouseHandler::CLICK_DOUBLELEFT:
+		mLeftMouseDown = down;
+		buttonname = "Left Double Click";
+		break;
+	}
+	
+	LLView::sMouseHandlerMessage.clear();
 
-		// Make sure we get a corresponding mouseup event, even if the mouse leaves the window
-		if (down)
-			mWindow->captureMouse();
-		else
-			mWindow->releaseMouse();
+	if (gMenuBarView)
+	{
+		// stop ALT-key access to menu
+		gMenuBarView->resetMenuTrigger();
+	}
 
-		// Indicate mouse was active
-		LLUI::resetMouseIdleTimer();
+	if (gDebugClicks)
+	{	
+		llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl;
+	}
 
-		// Don't let the user move the mouse out of the window until mouse up.
-		if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
-		{
-			mWindow->setMouseClipping(down);
-		}
+	// Make sure we get a corresponding mouseup event, even if the mouse leaves the window
+	if (down)
+		mWindow->captureMouse();
+	else
+		mWindow->releaseMouse();
 
-		LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
-		if( mouse_captor )
-		{
-			S32 local_x;
-			S32 local_y;
-			mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
-			if (LLView::sDebugMouseHandling)
-			{
-				llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl;
-			}
-			return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down);
-		}
+	// Indicate mouse was active
+	LLUI::resetMouseIdleTimer();
 
-		// Topmost view gets a chance before the hierarchy
-		//LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
-		//if (top_ctrl)
-		//{
-		//	S32 local_x, local_y;
-		//	top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
-		//		if (top_ctrl->pointInView(local_x, local_y))
-		//		{
-		//			return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down)	;
-		//		}
-		//		else
-		//		{
-		//		if (down)
-		//		{
-		//			gFocusMgr.setTopCtrl(NULL);
-		//		}
-		//	}
-		//}
+	// Don't let the user move the mouse out of the window until mouse up.
+	if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
+	{
+		mWindow->setMouseClipping(down);
+	}
 
-		// Give the UI views a chance to process the click
-		if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) )
+	LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
+	if( mouse_captor )
+	{
+		S32 local_x;
+		S32 local_y;
+		mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
+		if (LLView::sDebugMouseHandling)
 		{
-			if (LLView::sDebugMouseHandling)
-			{
-				llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl;
-			}
-			return TRUE;
+			llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl;
 		}
-		else if (LLView::sDebugMouseHandling)
+		return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down);
+	}
+
+	// Topmost view gets a chance before the hierarchy
+	//LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
+	//if (top_ctrl)
+	//{
+	//	S32 local_x, local_y;
+	//	top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
+	//		if (top_ctrl->pointInView(local_x, local_y))
+	//		{
+	//			return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down)	;
+	//		}
+	//		else
+	//		{
+	//		if (down)
+	//		{
+	//			gFocusMgr.setTopCtrl(NULL);
+	//		}
+	//	}
+	//}
+
+	// Give the UI views a chance to process the click
+	if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) )
+	{
+		if (LLView::sDebugMouseHandling)
 		{
-			llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl;
+			llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl;
 		}
+		return TRUE;
+	}
+	else if (LLView::sDebugMouseHandling)
+	{
+		llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl;
 	}
 
 	// Do not allow tool manager to handle mouseclicks if we have disconnected	
@@ -797,7 +799,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window,  LLCoordGL pos, MASK m
 BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask)
 {
 	BOOL down = TRUE;
-	LLVoiceClient::getInstance()->middleMouseState(true);
+	gVoiceClient->middleMouseState(true);
  	handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
   
   	// Always handled as far as the OS is concerned.
@@ -824,16 +826,20 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 					
 				if (slurl_dnd_enabled)
 				{
-					LLSLURL dropped_slurl(data);
-					if(dropped_slurl.isSpatial())
+					
+					// special case SLURLs
+					// isValidSLURL() call was added here to make sure that dragged SLURL is valid (EXT-4964)
+					if ( LLSLURL::isSLURL( data ) && LLSLURL::isValidSLURL( data ) )
 					{
 						if (drop)
 						{
-							LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), NULL, true );
-							return LLWindowCallbacks::DND_MOVE;
+							LLURLDispatcher::dispatch( data, NULL, true );
+							LLURLSimString::setStringRaw( LLSLURL::stripProtocol( data ) );
+							LLPanelLogin::refreshLocation( true );
+							LLPanelLogin::updateLocationUI();
 						}
-						return LLWindowCallbacks::DND_COPY;
-					}
+						return LLWindowCallbacks::DND_MOVE;
+					};
 				}
 
 				if (prim_media_dnd_enabled)
@@ -851,11 +857,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 					if (obj && !obj->getRegion()->getCapability("ObjectMedia").empty())
 					{
 						LLTextureEntry *te = obj->getTE(object_face);
-
-						// can modify URL if we can modify the object or we have navigate permissions
-						bool allow_modify_url = obj->permModify() || obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT );
-
-						if (te && allow_modify_url )
+						if (te)
 						{
 							if (drop)
 							{
@@ -886,24 +888,29 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 									// URL passes the whitelist
 									if (te->getMediaData()->checkCandidateUrl( url ) )
 									{
-										// just navigate to the URL
-										if (obj->getMediaImpl(object_face))
-										{
-											obj->getMediaImpl(object_face)->navigateTo(url);
-										}
-										else 
+										// we are allowed to modify the object or we have navigate permissions
+										// NOTE: Design states you you can change the URL if you have media 
+										//       navigate permissions even if you do not have prim modify rights
+										if ( obj->permModify() || obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT ) )
 										{
-											// This is very strange.  Navigation should
-											// happen via the Impl, but we don't have one.
-											// This sends it to the server, which /should/
-											// trigger us getting it.  Hopefully.
-											LLSD media_data;
-											media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
-											obj->syncMediaData(object_face, media_data, true, true);
-											obj->sendMediaDataUpdate();
+											// just navigate to the URL
+											if (obj->getMediaImpl(object_face))
+											{
+												obj->getMediaImpl(object_face)->navigateTo(url);
+											}
+											else 
+											{
+												// This is very strange.  Navigation should
+												// happen via the Impl, but we don't have one.
+												// This sends it to the server, which /should/
+												// trigger us getting it.  Hopefully.
+												LLSD media_data;
+												media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
+												obj->syncMediaData(object_face, media_data, true, true);
+												obj->sendMediaDataUpdate();
+											}
+											result = LLWindowCallbacks::DND_LINK;
 										}
-										result = LLWindowCallbacks::DND_LINK;
-										
 									}
 								}
 								LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
@@ -923,7 +930,6 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 										LLSelectMgr::getInstance()->highlightObjectOnly(mDragHoveredObject);
 									}
 									result = (! te->hasMedia()) ? LLWindowCallbacks::DND_COPY : LLWindowCallbacks::DND_LINK;
-
 								}
 							}
 						}
@@ -951,7 +957,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window,  LLCoordGL pos, MASK mask)
 {
 	BOOL down = FALSE;
-	LLVoiceClient::getInstance()->middleMouseState(false);
+	gVoiceClient->middleMouseState(false);
  	handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
   
   	// Always handled as far as the OS is concerned.
@@ -1068,7 +1074,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
 BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key,  MASK mask, BOOL repeated)
 {
 	// Let the voice chat code check for its PTT key.  Note that this never affects event processing.
-	LLVoiceClient::getInstance()->keyDown(key, mask);
+	gVoiceClient->keyDown(key, mask);
 	
 	if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME)
 	{
@@ -1090,7 +1096,7 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key,  MASK mask, BOOL repeated)
 BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key,  MASK mask)
 {
 	// Let the voice chat code check for its PTT key.  Note that this never affects event processing.
-	LLVoiceClient::getInstance()->keyUp(key, mask);
+	gVoiceClient->keyUp(key, mask);
 
 	return FALSE;
 }
@@ -1112,7 +1118,28 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
 		mActive = TRUE;
 		send_agent_resume();
 		gAgent.clearAFK();
-		
+		if (mWindow->getFullscreen() && !mIgnoreActivate)
+		{
+			if (!LLApp::isExiting() )
+			{
+				if (LLStartUp::getStartupState() >= STATE_STARTED)
+				{
+					// if we're in world, show a progress bar to hide reloading of textures
+					llinfos << "Restoring GL during activate" << llendl;
+					restoreGL(LLTrans::getString("ProgressRestoring"));
+				}
+				else
+				{
+					// otherwise restore immediately
+					restoreGL();
+				}
+			}
+			else
+			{
+				llwarns << "Activating while quitting" << llendl;
+			}
+		}
+
 		// Unmute audio
 		audio_update_volume();
 	}
@@ -1132,7 +1159,12 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
 		}
 		
 		send_agent_pause();
-	
+		
+		if (mWindow->getFullscreen() && !mIgnoreActivate)
+		{
+			llinfos << "Stopping GL during deactivation" << llendl;
+			stopGL();
+		}
 		// Mute audio
 		audio_update_volume();
 	}
@@ -1299,10 +1331,12 @@ LLViewerWindow::LLViewerWindow(
 	const std::string& title, const std::string& name,
 	S32 x, S32 y,
 	S32 width, S32 height,
-	BOOL fullscreen, BOOL ignore_pixel_depth) // fullscreen is no longer used
+	BOOL fullscreen, BOOL ignore_pixel_depth)
 	:
 	mWindow(NULL),
 	mActive(TRUE),
+	mWantFullscreen(fullscreen),
+	mShowFullscreenProgress(FALSE),
 	mWindowRectRaw(0, height, width, 0),
 	mWindowRectScaled(0, height, width, 0),
 	mWorldViewRectRaw(0, height, width, 0),
@@ -1317,6 +1351,7 @@ LLViewerWindow::LLViewerWindow(
 	mIgnoreActivate( FALSE ),
 	mResDirty(false),
 	mStatesDirty(false),
+	mIsFullscreenChecked(false),
 	mCurrResolutionIndex(0),
     mViewerWindowListener(new LLViewerWindowListener(this)),
 	mProgressView(NULL)
@@ -1398,7 +1433,6 @@ LLViewerWindow::LLViewerWindow(
 
 	if (LLFeatureManager::getInstance()->isSafe()
 		|| (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion())
-		|| (gSavedSettings.getS32("LastGPUClass") != LLFeatureManager::getInstance()->getGPUClass())
 		|| (gSavedSettings.getBOOL("ProbeHardwareOnStartup")))
 	{
 		LLFeatureManager::getInstance()->applyRecommendedSettings();
@@ -1556,9 +1590,6 @@ void LLViewerWindow::initBase()
 	gDebugView->init();
 	gToolTipView = getRootView()->getChild<LLToolTipView>("tooltip view");
 
-	// Initialize busy response message when logged in
-	LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLFloaterPreference::initBusyResponse));
-
 	// Add the progress bar view (startup view), which overrides everything
 	mProgressView = getRootView()->getChild<LLProgressView>("progress_view");
 	setShowProgress(FALSE);
@@ -1638,18 +1669,24 @@ void LLViewerWindow::initWorldUI()
 		navbar->showFavoritesPanel(FALSE);
 	}
 
-	// Top Info bar
-	LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container");
-	LLPanelTopInfoBar* topinfo_bar = LLPanelTopInfoBar::getInstance();
+	if (!gSavedSettings.getBOOL("ShowCameraButton"))
+	{
+		LLBottomTray::getInstance()->showCameraButton(FALSE);
+	}
 
-	topinfo_bar->setShape(topinfo_bar_container->getLocalRect());
+	if (!gSavedSettings.getBOOL("ShowSnapshotButton"))
+	{
+		LLBottomTray::getInstance()->showSnapshotButton(FALSE);
+	}
 
-	topinfo_bar_container->addChild(topinfo_bar);
-	topinfo_bar_container->setVisible(TRUE);
+	if (!gSavedSettings.getBOOL("ShowMoveButton"))
+	{
+		LLBottomTray::getInstance()->showMoveButton(FALSE);
+	}
 
-	if (!gSavedSettings.getBOOL("ShowMiniLocationPanel"))
+	if (!gSavedSettings.getBOOL("ShowGestureButton"))
 	{
-		topinfo_bar->setVisible(FALSE);
+		LLBottomTray::getInstance()->showGestureButton(FALSE);
 	}
 
 	if ( gHUDView == NULL )
@@ -1876,17 +1913,24 @@ void LLViewerWindow::reshape(S32 width, S32 height)
 
 		sendShapeToSim();
 
-		// store new settings for the mode we are in, regardless
-		// Only save size if not maximized
-		BOOL maximized = mWindow->getMaximized();
-		gSavedSettings.setBOOL("WindowMaximized", maximized);
 
-		LLCoordScreen window_size;
-		if (!maximized
-			&& mWindow->getSize(&window_size))
+		// store the mode the user wants (even if not there yet)
+		gSavedSettings.setBOOL("WindowFullScreen", mWantFullscreen);
+
+		// store new settings for the mode we are in, regardless
+		if (!mWindow->getFullscreen())
 		{
-			gSavedSettings.setS32("WindowWidth", window_size.mX);
-			gSavedSettings.setS32("WindowHeight", window_size.mY);
+			// Only save size if not maximized
+			BOOL maximized = mWindow->getMaximized();
+			gSavedSettings.setBOOL("WindowMaximized", maximized);
+
+			LLCoordScreen window_size;
+			if (!maximized
+				&& mWindow->getSize(&window_size))
+			{
+				gSavedSettings.setS32("WindowWidth", window_size.mX);
+				gSavedSettings.setS32("WindowHeight", window_size.mY);
+			}
 		}
 
 		LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width);
@@ -1911,7 +1955,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible )
 
 		// ...and set the menu color appropriately.
 		setMenuBackgroundColor(gAgent.getGodLevel() > GOD_NOT, 
-			LLGridManager::getInstance()->isInProductionGrid());
+			LLViewerLogin::getInstance()->isInProductionGrid());
 	}
         
 	if ( gStatusBar )
@@ -1932,15 +1976,15 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
     LLSD args;
     LLColor4 new_bg_color;
 
-    if(god_mode && LLGridManager::getInstance()->isInProductionGrid())
+    if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid())
     {
         new_bg_color = LLUIColorTable::instance().getColor( "MenuBarGodBgColor" );
     }
-    else if(god_mode && !LLGridManager::getInstance()->isInProductionGrid())
+    else if(god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
     {
         new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionGodBgColor" );
     }
-    else if(!god_mode && !LLGridManager::getInstance()->isInProductionGrid())
+    else if(!god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
     {
         new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
     }
@@ -2156,6 +2200,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 		}
 		return TRUE;
 	}
+
 	// hidden edit menu for cut/copy/paste
 	if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask))
 	{
@@ -2323,9 +2368,7 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
 
 	// Zoom the camera in and out behavior
 
-	if(top_ctrl == 0 
-		&& getWorldViewRectScaled().pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY) 
-		&& gAgentCamera.isInitialized())
+	if(top_ctrl == 0 && getWorldViewRectScaled().pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY) )
 		gAgentCamera.handleScrollWheel(clicks);
 
 	return;
@@ -2421,9 +2464,7 @@ void LLViewerWindow::updateUI()
 	// animate layout stacks so we have up to date rect for world view
 	LLLayoutStack::updateClass();
 
-	// use full window for world view when not rendering UI
-	bool world_view_uses_full_window = gAgentCamera.cameraMouselook() || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
-	updateWorldViewRect(world_view_uses_full_window);
+	updateWorldViewRect();
 
 	LLView::sMouseHandlerMessage.clear();
 
@@ -2473,55 +2514,28 @@ void LLViewerWindow::updateUI()
 		root_view = mRootView;
 	}
 
-	// only update mouse hover set when UI is visible (since we shouldn't send hover events to invisible UI
-	if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+	// include all ancestors of captor_view as automatically having mouse
+	if (captor_view)
 	{
-		// include all ancestors of captor_view as automatically having mouse
-		if (captor_view)
+		LLView* captor_parent_view = captor_view->getParent();
+		while(captor_parent_view)
 		{
-			LLView* captor_parent_view = captor_view->getParent();
-			while(captor_parent_view)
-			{
-				mouse_hover_set.insert(captor_parent_view->getHandle());
-				captor_parent_view = captor_parent_view->getParent();
-			}
+			mouse_hover_set.insert(captor_parent_view->getHandle());
+			captor_parent_view = captor_parent_view->getParent();
 		}
+	}
 
-		// aggregate visible views that contain mouse cursor in display order
-		LLPopupView::popup_list_t popups = mPopupView->getCurrentPopups();
-
-		for(LLPopupView::popup_list_t::iterator popup_it = popups.begin(); popup_it != popups.end(); ++popup_it)
-		{
-			LLView* popup = popup_it->get();
-			if (popup && popup->calcScreenBoundingRect().pointInRect(x, y))
-			{
-				// iterator over contents of top_ctrl, and throw into mouse_hover_set
-				for (LLView::tree_iterator_t it = popup->beginTreeDFS();
-					it != popup->endTreeDFS();
-					++it)
-				{
-					LLView* viewp = *it;
-					if (viewp->getVisible()
-						&& viewp->calcScreenBoundingRect().pointInRect(x, y))
-					{
-						// we have a view that contains the mouse, add it to the set
-						mouse_hover_set.insert(viewp->getHandle());
-					}
-					else
-					{
-						// skip this view and all of its children
-						it.skipDescendants();
-					}
-				}
-			}
-		}
+	// aggregate visible views that contain mouse cursor in display order
+	LLPopupView::popup_list_t popups = mPopupView->getCurrentPopups();
 
-		// while the top_ctrl contains the mouse cursor, only it and its descendants will receive onMouseEnter events
-		if (top_ctrl && top_ctrl->calcScreenBoundingRect().pointInRect(x, y))
+	for(LLPopupView::popup_list_t::iterator popup_it = popups.begin(); popup_it != popups.end(); ++popup_it)
+	{
+		LLView* popup = popup_it->get();
+		if (popup && popup->calcScreenBoundingRect().pointInRect(x, y))
 		{
 			// iterator over contents of top_ctrl, and throw into mouse_hover_set
-			for (LLView::tree_iterator_t it = top_ctrl->beginTreeDFS();
-				it != top_ctrl->endTreeDFS();
+			for (LLView::tree_iterator_t it = popup->beginTreeDFS();
+				it != popup->endTreeDFS();
 				++it)
 			{
 				LLView* viewp = *it;
@@ -2538,34 +2552,57 @@ void LLViewerWindow::updateUI()
 				}
 			}
 		}
-		else
+	}
+
+	// while the top_ctrl contains the mouse cursor, only it and its descendants will receive onMouseEnter events
+	if (top_ctrl && top_ctrl->calcScreenBoundingRect().pointInRect(x, y))
+	{
+		// iterator over contents of top_ctrl, and throw into mouse_hover_set
+		for (LLView::tree_iterator_t it = top_ctrl->beginTreeDFS();
+			it != top_ctrl->endTreeDFS();
+			++it)
 		{
-			// walk UI tree in depth-first order
-			for (LLView::tree_iterator_t it = root_view->beginTreeDFS();
-				it != root_view->endTreeDFS();
-				++it)
+			LLView* viewp = *it;
+			if (viewp->getVisible()
+				&& viewp->calcScreenBoundingRect().pointInRect(x, y))
+			{
+				// we have a view that contains the mouse, add it to the set
+				mouse_hover_set.insert(viewp->getHandle());
+			}
+			else
+			{
+				// skip this view and all of its children
+				it.skipDescendants();
+			}
+		}
+	}
+	else
+	{
+		// walk UI tree in depth-first order
+		for (LLView::tree_iterator_t it = root_view->beginTreeDFS();
+			it != root_view->endTreeDFS();
+			++it)
+		{
+			LLView* viewp = *it;
+			// calculating the screen rect involves traversing the parent, so this is less than optimal
+			if (viewp->getVisible()
+				&& viewp->calcScreenBoundingRect().pointInRect(x, y))
 			{
-				LLView* viewp = *it;
-				// calculating the screen rect involves traversing the parent, so this is less than optimal
-				if (viewp->getVisible()
-					&& viewp->calcScreenBoundingRect().pointInRect(x, y))
-				{
 
-					// if this view is mouse opaque, nothing behind it should be in mouse_hover_set
-					if (viewp->getMouseOpaque())
-					{
-						// constrain further iteration to children of this widget
-						it = viewp->beginTreeDFS();
-					}
-		
-					// we have a view that contains the mouse, add it to the set
-					mouse_hover_set.insert(viewp->getHandle());
-				}
-				else
+				// if this view is mouse opaque, nothing behind it should be in mouse_hover_set
+				if (viewp->getMouseOpaque())
 				{
-					// skip this view and all of its children
-					it.skipDescendants();
+					// constrain further iteration to children of this widget
+					it = viewp->beginTreeDFS();
 				}
+	
+				// we have a view that contains the mouse, add it to the set
+				mouse_hover_set.insert(viewp->getHandle());
+			}
+			else
+			{
+				// skip this view and all of its children
+				it.skipDescendants();
 			}
 		}
 	}
@@ -2609,170 +2646,156 @@ void LLViewerWindow::updateUI()
 	// store resulting hover set for next frame
 	swap(mMouseHoverViews, mouse_hover_set);
 
-	// only handle hover events when UI is enabled
-	if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
-	{	
-
-		if( mouse_captor )
+	if( mouse_captor )
+	{
+		// Pass hover events to object capturing mouse events.
+		S32 local_x;
+		S32 local_y; 
+		mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
+		handled = mouse_captor->handleHover(local_x, local_y, mask);
+		if (LLView::sDebugMouseHandling)
 		{
-			// Pass hover events to object capturing mouse events.
-			S32 local_x;
-			S32 local_y; 
-			mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
-			handled = mouse_captor->handleHover(local_x, local_y, mask);
-			if (LLView::sDebugMouseHandling)
-			{
-				llinfos << "Hover handled by captor " << mouse_captor->getName() << llendl;
-			}
+			llinfos << "Hover handled by captor " << mouse_captor->getName() << llendl;
+		}
 
-			if( !handled )
-			{
-				lldebugst(LLERR_USER_INPUT) << "hover not handled by mouse captor" << llendl;
-			}
+		if( !handled )
+		{
+			lldebugst(LLERR_USER_INPUT) << "hover not handled by mouse captor" << llendl;
 		}
-		else
+	}
+	else
+	{
+		if (top_ctrl)
 		{
-			if (top_ctrl)
-			{
-				S32 local_x, local_y;
-				top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
-				handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask);
-				handled_by_top_ctrl = TRUE;
-			}
+			S32 local_x, local_y;
+			top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
+			handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask);
+			handled_by_top_ctrl = TRUE;
+		}
 
-			if ( !handled )
+		if ( !handled )
+		{
+			// x and y are from last time mouse was in window
+			// mMouseInWindow tracks *actual* mouse location
+			if (mMouseInWindow && mRootView->handleHover(x, y, mask) )
 			{
-				// x and y are from last time mouse was in window
-				// mMouseInWindow tracks *actual* mouse location
-				if (mMouseInWindow && mRootView->handleHover(x, y, mask) )
+				if (LLView::sDebugMouseHandling && LLView::sMouseHandlerMessage != last_handle_msg)
 				{
-					if (LLView::sDebugMouseHandling && LLView::sMouseHandlerMessage != last_handle_msg)
-					{
-						last_handle_msg = LLView::sMouseHandlerMessage;
-						llinfos << "Hover" << LLView::sMouseHandlerMessage << llendl;
-					}
-					handled = TRUE;
-				}
-				else if (LLView::sDebugMouseHandling)
-				{
-					if (last_handle_msg != LLStringUtil::null)
-					{
-						last_handle_msg.clear();
-						llinfos << "Hover not handled by view" << llendl;
-					}
+					last_handle_msg = LLView::sMouseHandlerMessage;
+					llinfos << "Hover" << LLView::sMouseHandlerMessage << llendl;
 				}
+				handled = TRUE;
 			}
-		
-			if (!handled)
+			else if (LLView::sDebugMouseHandling)
 			{
-				LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
-
-				if(mMouseInWindow && tool)
+				if (last_handle_msg != LLStringUtil::null)
 				{
-					handled = tool->handleHover(x, y, mask);
+					last_handle_msg.clear();
+					llinfos << "Hover not handled by view" << llendl;
 				}
 			}
 		}
 
-		// Show a new tool tip (or update one that is already shown)
-		BOOL tool_tip_handled = FALSE;
-		std::string tool_tip_msg;
-		if( handled 
-			&& !mWindow->isCursorHidden())
+		if (!handled)
 		{
-			LLRect screen_sticky_rect = mRootView->getLocalRect();
-			S32 local_x, local_y;
+			LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
 
-			if (gSavedSettings.getBOOL("DebugShowXUINames"))
+			if(mMouseInWindow && tool)
 			{
-				LLToolTip::Params params;
+				handled = tool->handleHover(x, y, mask);
+			}
+		}
+	}
+
+	// Show a new tool tip (or update one that is already shown)
+	BOOL tool_tip_handled = FALSE;
+	std::string tool_tip_msg;
+	if( handled 
+		&& !mWindow->isCursorHidden())
+	{
+		LLRect screen_sticky_rect = mRootView->getLocalRect();
+		S32 local_x, local_y;
 
-				LLView* tooltip_view = mRootView;
-				LLView::tree_iterator_t end_it = mRootView->endTreeDFS();
-				for (LLView::tree_iterator_t it = mRootView->beginTreeDFS(); it != end_it; ++it)
+		if (gSavedSettings.getBOOL("DebugShowXUINames"))
+		{
+			LLToolTip::Params params;
+
+			LLView* tooltip_view = mRootView;
+			LLView::tree_iterator_t end_it = mRootView->endTreeDFS();
+			for (LLView::tree_iterator_t it = mRootView->beginTreeDFS(); it != end_it; ++it)
+			{
+				LLView* viewp = *it;
+				LLRect screen_rect;
+				viewp->localRectToScreen(viewp->getLocalRect(), &screen_rect);
+				if (!(viewp->getVisible()
+					 && screen_rect.pointInRect(x, y)))
+				{
+					it.skipDescendants();
+				}
+				// only report xui names for LLUICtrls, 
+				// and blacklist the various containers we don't care about
+				else if (dynamic_cast<LLUICtrl*>(viewp) 
+						&& viewp != gMenuHolder
+						&& viewp != gFloaterView
+						&& viewp != gConsole) 
 				{
-					LLView* viewp = *it;
-					LLRect screen_rect;
-					viewp->localRectToScreen(viewp->getLocalRect(), &screen_rect);
-					if (!(viewp->getVisible()
-						 && screen_rect.pointInRect(x, y)))
+					if (dynamic_cast<LLFloater*>(viewp))
 					{
-						it.skipDescendants();
+						// constrain search to descendants of this (frontmost) floater
+						// by resetting iterator
+						it = viewp->beginTreeDFS();
 					}
-					// only report xui names for LLUICtrls, 
-					// and blacklist the various containers we don't care about
-					else if (dynamic_cast<LLUICtrl*>(viewp) 
-							&& viewp != gMenuHolder
-							&& viewp != gFloaterView
-							&& viewp != gConsole) 
-					{
-						if (dynamic_cast<LLFloater*>(viewp))
-						{
-							// constrain search to descendants of this (frontmost) floater
-							// by resetting iterator
-							it = viewp->beginTreeDFS();
-						}
 
-						// if we are in a new part of the tree (not a descendent of current tooltip_view)
-						// then push the results for tooltip_view and start with a new potential view
-						// NOTE: this emulates visiting only the leaf nodes that meet our criteria
-						if (!viewp->hasAncestor(tooltip_view))
-						{
-							append_xui_tooltip(tooltip_view, params);
-							screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
-						}
-						tooltip_view = viewp;
+					// if we are in a new part of the tree (not a descendent of current tooltip_view)
+					// then push the results for tooltip_view and start with a new potential view
+					// NOTE: this emulates visiting only the leaf nodes that meet our criteria
+					if (!viewp->hasAncestor(tooltip_view))
+					{
+						append_xui_tooltip(tooltip_view, params);
+						screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
 					}
+					tooltip_view = viewp;
 				}
+			}
 
-				append_xui_tooltip(tooltip_view, params);
-				screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
-				
-				params.sticky_rect = screen_sticky_rect;
-				params.max_width = 400;
+			append_xui_tooltip(tooltip_view, params);
+			screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
+			
+			params.sticky_rect = screen_sticky_rect;
+			params.max_width = 400;
 
-				LLToolTipMgr::instance().show(params);
-			}
-			// if there is a mouse captor, nothing else gets a tooltip
-			else if (mouse_captor)
+			LLToolTipMgr::instance().show(params);
+		}
+		// if there is a mouse captor, nothing else gets a tooltip
+		else if (mouse_captor)
+		{
+			mouse_captor->screenPointToLocal(x, y, &local_x, &local_y);
+			tool_tip_handled = mouse_captor->handleToolTip(local_x, local_y, mask);
+		}
+		else 
+		{
+			// next is top_ctrl
+			if (!tool_tip_handled && top_ctrl)
 			{
-				mouse_captor->screenPointToLocal(x, y, &local_x, &local_y);
-				tool_tip_handled = mouse_captor->handleToolTip(local_x, local_y, mask);
+				top_ctrl->screenPointToLocal(x, y, &local_x, &local_y);
+				tool_tip_handled = top_ctrl->handleToolTip(local_x, local_y, mask );
 			}
-			else 
+			
+			if (!tool_tip_handled)
 			{
-				// next is top_ctrl
-				if (!tool_tip_handled && top_ctrl)
-				{
-					top_ctrl->screenPointToLocal(x, y, &local_x, &local_y);
-					tool_tip_handled = top_ctrl->handleToolTip(local_x, local_y, mask );
-				}
-				
-				if (!tool_tip_handled)
-				{
-					local_x = x; local_y = y;
-					tool_tip_handled = mRootView->handleToolTip(local_x, local_y, mask );
-				}
-
-				LLTool* current_tool = LLToolMgr::getInstance()->getCurrentTool();
-				if (!tool_tip_handled && current_tool)
-				{
-					current_tool->screenPointToLocal(x, y, &local_x, &local_y);
-					tool_tip_handled = current_tool->handleToolTip(local_x, local_y, mask );
-				}
+				local_x = x; local_y = y;
+				tool_tip_handled = mRootView->handleToolTip(local_x, local_y, mask );
 			}
-		}		
-	}
-	else
-	{	// just have tools handle hover when UI is turned off
-		LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
 
-		if(mMouseInWindow && tool)
-		{
-			handled = tool->handleHover(x, y, mask);
+			LLTool* current_tool = LLToolMgr::getInstance()->getCurrentTool();
+			if (!tool_tip_handled && current_tool)
+			{
+				current_tool->screenPointToLocal(x, y, &local_x, &local_y);
+				tool_tip_handled = current_tool->handleToolTip(local_x, local_y, mask );
+			}
 		}
-	}
-
+	}		
+	
 	updateLayout();
 
 	mLastMousePoint = mCurrentMousePoint;
@@ -2888,11 +2911,6 @@ void LLViewerWindow::updateMouseDelta()
 
 void LLViewerWindow::updateKeyboardFocus()
 {
-	if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
-	{
-		gFocusMgr.setKeyboardFocus(NULL);
-	}
-
 	// clean up current focus
 	LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
 	if (cur_focus)
@@ -2995,12 +3013,6 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window)
 		new_world_rect.mTop = llround((F32)new_world_rect.mTop * mDisplayScale.mV[VY]);
 	}
 
-	if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE)
-	{
-		// use right edge of window, ignoring sidebar
-		new_world_rect.mRight = mWindowRectRaw.mRight;
-	}
-
 	if (mWorldViewRectRaw != new_world_rect)
 	{
 		mWorldViewRectRaw = new_world_rect;
@@ -3766,7 +3778,18 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
 		BORDERHEIGHT = size.mY- y;
 		LLCoordScreen new_size(new_width + BORDERWIDTH, 
 							   new_height + BORDERHEIGHT);
-		gViewerWindow->mWindow->setSize(new_size);
+		BOOL disable_sync = gSavedSettings.getBOOL("DisableVerticalSync");
+		if (gViewerWindow->mWindow->getFullscreen())
+		{
+			gViewerWindow->changeDisplaySettings(FALSE, 
+												new_size, 
+												disable_sync, 
+												TRUE);
+		}
+		else
+		{
+			gViewerWindow->mWindow->setSize(new_size);
+		}
 	}
 }
 
@@ -3812,140 +3835,6 @@ void LLViewerWindow::playSnapshotAnimAndSound()
 BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type)
 {
 	return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, do_rebuild, type);
-	
-	// *TODO below code was broken in deferred pipeline
-	/*
-	if ((!raw) || preview_width < 10 || preview_height < 10)
-	{
-		return FALSE;
-	}
-
-	if(gResizeScreenTexture) //the window is resizing
-	{
-		return FALSE ;
-	}
-
-	setCursor(UI_CURSOR_WAIT);
-
-	// Hide all the UI widgets first and draw a frame
-	BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
-
-	if ( prev_draw_ui != show_ui)
-	{
-		LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI);
-	}
-
-	BOOL hide_hud = !gSavedSettings.getBOOL("RenderHUDInSnapshot") && LLPipeline::sShowHUDAttachments;
-	if (hide_hud)
-	{
-		LLPipeline::sShowHUDAttachments = FALSE;
-	}
-
-	S32 render_name = gSavedSettings.getS32("RenderName");
-	gSavedSettings.setS32("RenderName", 0);
-	LLVOAvatar::updateFreezeCounter(1) ; //pause avatar updating for one frame
-	
-	S32 w = preview_width ;
-	S32 h = preview_height ;
-	LLVector2 display_scale = mDisplayScale ;
-	mDisplayScale.setVec((F32)w / mWindowRectRaw.getWidth(), (F32)h / mWindowRectRaw.getHeight()) ;
-	LLRect window_rect = mWindowRectRaw;
-	mWindowRectRaw.set(0, h, w, 0);
-	
-	gDisplaySwapBuffers = FALSE;
-	gDepthDirty = TRUE;
-	glClearColor(0.f, 0.f, 0.f, 0.f);
-	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
-	setup3DRender();
-
-	LLFontGL::setFontDisplay(FALSE) ;
-	LLHUDText::setDisplayText(FALSE) ;
-	if (type == SNAPSHOT_TYPE_OBJECT_ID)
-	{
-		gObjectList.renderPickList(gViewerWindow->getWindowRectScaled(), FALSE, FALSE);
-	}
-	else
-	{
-		display(do_rebuild, 1.0f, 0, TRUE);
-		render_ui();
-	}
-
-	S32 glformat, gltype, glpixel_length ;
-	if(SNAPSHOT_TYPE_DEPTH == type)
-	{
-		glpixel_length = 4 ;
-		glformat = GL_DEPTH_COMPONENT ; 
-		gltype = GL_FLOAT ;
-	}
-	else
-	{
-		glpixel_length = 3 ;
-		glformat = GL_RGB ;
-		gltype = GL_UNSIGNED_BYTE ;
-	}
-
-	raw->resize(w, h, glpixel_length);
-	glReadPixels(0, 0, w, h, glformat, gltype, raw->getData());
-
-	if(SNAPSHOT_TYPE_DEPTH == type)
-	{
-		LLViewerCamera* camerap = LLViewerCamera::getInstance();
-		F32 depth_conversion_factor_1 = (camerap->getFar() + camerap->getNear()) / (2.f * camerap->getFar() * camerap->getNear());
-		F32 depth_conversion_factor_2 = (camerap->getFar() - camerap->getNear()) / (2.f * camerap->getFar() * camerap->getNear());
-
-		//calculate the depth 
-		for (S32 y = 0 ; y < h ; y++)
-		{
-			for(S32 x = 0 ; x < w ; x++)
-			{
-				S32 i = (w * y + x) << 2 ;
-				
-				F32 depth_float_i = *(F32*)(raw->getData() + i);
-				
-				F32 linear_depth_float = 1.f / (depth_conversion_factor_1 - (depth_float_i * depth_conversion_factor_2));
-				U8 depth_byte = F32_to_U8(linear_depth_float, camerap->getNear(), camerap->getFar());
-				*(raw->getData() + i + 0) = depth_byte;
-				*(raw->getData() + i + 1) = depth_byte;
-				*(raw->getData() + i + 2) = depth_byte;
-				*(raw->getData() + i + 3) = 255;
-			}
-		}		
-	}
-
-	LLFontGL::setFontDisplay(TRUE) ;
-	LLHUDText::setDisplayText(TRUE) ;
-	mDisplayScale.setVec(display_scale) ;
-	mWindowRectRaw = window_rect;	
-	setup3DRender();
-	gDisplaySwapBuffers = FALSE;
-	gDepthDirty = TRUE;
-
-	// POST SNAPSHOT
-	if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
-	{
-		LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI);
-	}
-
-	if (hide_hud)
-	{
-		LLPipeline::sShowHUDAttachments = TRUE;
-	}
-
-	setCursor(UI_CURSOR_ARROW);
-
-	if (do_rebuild)
-	{
-		// If we had to do a rebuild, that means that the lists of drawables to be rendered
-		// was empty before we started.
-		// Need to reset these, otherwise we call state sort on it again when render gets called the next time
-		// and we stand a good chance of crashing on rebuild because the render drawable arrays have multiple copies of
-		// objects on them.
-		gPipeline.resetDrawOrders();
-	}
-	
-	gSavedSettings.setS32("RenderName", render_name);	
-	
-	return TRUE;*/
 }
 
 // Saves the image from the screen to the specified filename and path.
@@ -3960,6 +3849,9 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 	// PRE SNAPSHOT
 	gDisplaySwapBuffers = FALSE;
 	
+	// if not showing ui, use full window to render world view
+	updateWorldViewRect(!show_ui);
+
 	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
 	setCursor(UI_CURSOR_WAIT);
 
@@ -4032,9 +3924,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 		//else: keep the current scene scale, re-scale it if necessary after reading out.
 	}
 	
-	// if not showing ui, use full window to render world view
-	updateWorldViewRect(!show_ui);
-
 	S32 buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f);
 	S32 buffer_y_offset = llfloor(((window_height - snapshot_height) * scale_factor) / 2.f);
 
@@ -4518,7 +4407,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
 		
 		gResizeScreenTexture = TRUE;
 
-		if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures())
+		if (gFloaterCustomize && gFloaterCustomize->getVisible())
 		{
 			LLVisualParamHint::requestHintUpdates();
 		}
@@ -4552,12 +4441,51 @@ void LLViewerWindow::initFonts(F32 zoom_factor)
 	LLFontGL::loadDefaultFonts();
 }
 
+void LLViewerWindow::toggleFullscreen(BOOL show_progress)
+{
+	if (mWindow)
+	{
+		mWantFullscreen = mWindow->getFullscreen() ? FALSE : TRUE;
+		mIsFullscreenChecked =  mWindow->getFullscreen() ? FALSE : TRUE;
+		mShowFullscreenProgress = show_progress;
+	}
+}
+
+void LLViewerWindow::getTargetWindow(BOOL& fullscreen, S32& width, S32& height) const
+{
+	fullscreen = mWantFullscreen;
+	
+	if (mWindow
+	&&  mWindow->getFullscreen() == mWantFullscreen)
+	{
+		width = getWindowWidthRaw();
+		height = getWindowHeightRaw();
+	}
+	else if (mWantFullscreen)
+	{
+		width = gSavedSettings.getS32("FullScreenWidth");
+		height = gSavedSettings.getS32("FullScreenHeight");
+	}
+	else
+	{
+		width = gSavedSettings.getS32("WindowWidth");
+		height = gSavedSettings.getS32("WindowHeight");
+	}
+}
+
 void LLViewerWindow::requestResolutionUpdate()
 {
 	mResDirty = true;
 }
 
-void LLViewerWindow::checkSettings()
+void LLViewerWindow::requestResolutionUpdate(bool fullscreen_checked)
+{
+	mResDirty = true;
+	mWantFullscreen = fullscreen_checked;
+	mIsFullscreenChecked = fullscreen_checked;
+}
+
+BOOL LLViewerWindow::checkSettings()
 {
 	if (mStatesDirty)
 	{
@@ -4569,9 +4497,70 @@ void LLViewerWindow::checkSettings()
 	// We want to update the resolution AFTER the states getting refreshed not before.
 	if (mResDirty)
 	{
+		if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio"))
+		{
+			getWindow()->setNativeAspectRatio(0.f);
+		}
+		else
+		{
+			getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio"));
+		}
+		
 		reshape(getWindowWidthRaw(), getWindowHeightRaw());
+
+		// force aspect ratio
+		if (mIsFullscreenChecked)
+		{
+			LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
+		}
+
 		mResDirty = false;
-	}	
+	}
+		
+	BOOL is_fullscreen = mWindow->getFullscreen();
+	if(mWantFullscreen)
+	{
+		LLCoordScreen screen_size;
+		LLCoordScreen desired_screen_size(gSavedSettings.getS32("FullScreenWidth"),
+								   gSavedSettings.getS32("FullScreenHeight"));
+		getWindow()->getSize(&screen_size);
+		if(!is_fullscreen || 
+		    screen_size.mX != desired_screen_size.mX 
+			|| screen_size.mY != desired_screen_size.mY)
+		{
+			if (!LLStartUp::canGoFullscreen())
+			{
+				return FALSE;
+			}
+			
+			LLGLState::checkStates();
+			LLGLState::checkTextureChannels();
+			changeDisplaySettings(TRUE, 
+								  desired_screen_size,
+								  gSavedSettings.getBOOL("DisableVerticalSync"),
+								  mShowFullscreenProgress);
+
+			LLGLState::checkStates();
+			LLGLState::checkTextureChannels();
+			mStatesDirty = true;
+			return TRUE;
+		}
+	}
+	else
+	{
+		if(is_fullscreen)
+		{
+			// Changing to windowed mode.
+			changeDisplaySettings(FALSE, 
+								  LLCoordScreen(gSavedSettings.getS32("WindowWidth"),
+												gSavedSettings.getS32("WindowHeight")),
+								  TRUE,
+								  mShowFullscreenProgress);
+			mStatesDirty = true;
+			return TRUE;
+		}
+	}
+	return FALSE;
 }
 
 void LLViewerWindow::restartDisplay(BOOL show_progress_bar)
@@ -4588,23 +4577,38 @@ void LLViewerWindow::restartDisplay(BOOL show_progress_bar)
 	}
 }
 
-BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar)
+BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar)
 {
 	BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
+	mWantFullscreen = fullscreen;
+	mShowFullscreenProgress = show_progress_bar;
+	gSavedSettings.setBOOL("WindowFullScreen", mWantFullscreen);
 
 	//gResizeScreenTexture = TRUE;
 
-	U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
-	U32 old_fsaa = mWindow->getFSAASamples();
-	// if not maximized, use the request size
-	if (!mWindow->getMaximized())
+	BOOL old_fullscreen = mWindow->getFullscreen();
+	if (!old_fullscreen && fullscreen && !LLStartUp::canGoFullscreen())
 	{
-		mWindow->setSize(size);
+		// Not allowed to switch to fullscreen now, so exit early.
+		// *NOTE: This case should never be reached, but just-in-case.
+		return TRUE;
 	}
 
-	if (fsaa == old_fsaa)
+	U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
+	U32 old_fsaa = mWindow->getFSAASamples();
+	// going from windowed to windowed
+	if (!old_fullscreen && !fullscreen)
 	{
-		return TRUE;
+		// if not maximized, use the request size
+		if (!mWindow->getMaximized())
+		{
+			mWindow->setSize(size);
+		}
+
+		if (fsaa == old_fsaa)
+		{
+			return TRUE;
+		}
 	}
 
 	// Close floaters that don't handle settings change
@@ -4621,15 +4625,23 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL disable_vsyn
 	LLCoordScreen old_size;
 	LLCoordScreen old_pos;
 	mWindow->getSize(&old_size);
+	BOOL got_position = mWindow->getPosition(&old_pos);
 
+	if (!old_fullscreen && fullscreen && got_position)
+	{
+		// switching from windowed to fullscreen, so save window position
+		gSavedSettings.setS32("WindowX", old_pos.mX);
+		gSavedSettings.setS32("WindowY", old_pos.mY);
+	}
+	
 	mWindow->setFSAASamples(fsaa);
 
-	result_first_try = mWindow->switchContext(false, size, disable_vsync);
+	result_first_try = mWindow->switchContext(fullscreen, size, disable_vsync);
 	if (!result_first_try)
 	{
 		// try to switch back
 		mWindow->setFSAASamples(old_fsaa);
-		result_second_try = mWindow->switchContext(false, old_size, disable_vsync);
+		result_second_try = mWindow->switchContext(old_fullscreen, old_size, disable_vsync);
 
 		if (!result_second_try)
 		{
@@ -4661,8 +4673,19 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL disable_vsyn
 	}
 
 	BOOL success = result_first_try || result_second_try;
-
 	if (success)
+	{
+#if LL_WINDOWS
+		// Only trigger a reshape after switching to fullscreen; otherwise rely on the windows callback
+		// (otherwise size is wrong; this is the entire window size, reshape wants the visible window size)
+		if (fullscreen && result_first_try)
+#endif
+		{
+			reshape(size.mX, size.mY);
+		}
+	}
+
+	if (!mWindow->getFullscreen() && success)
 	{
 		// maximize window if was maximized, else reposition
 		if (was_maximized)
@@ -4680,14 +4703,45 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL disable_vsyn
 
 	mIgnoreActivate = FALSE;
 	gFocusMgr.setKeyboardFocus(keyboard_focus);
+	mWantFullscreen = mWindow->getFullscreen();
+	mShowFullscreenProgress = FALSE;
 	
 	return success;
 }
 
+
+F32 LLViewerWindow::getDisplayAspectRatio() const
+{
+	if (mWindow->getFullscreen())
+	{
+		if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio"))
+		{
+			return mWindow->getNativeAspectRatio();	
+		}
+		else
+		{
+			return gSavedSettings.getF32("FullScreenAspectRatio");
+		}
+	}
+	else
+	{
+		return mWindow->getNativeAspectRatio();
+	}
+}
+
+
 F32	LLViewerWindow::getWorldViewAspectRatio() const
 {
 	F32 world_aspect = (F32)mWorldViewRectRaw.getWidth() / (F32)mWorldViewRectRaw.getHeight();
-	return world_aspect;
+	//F32 window_aspect = (F32)mWindowRectRaw.getWidth() / (F32)mWindowRectRaw.getHeight();
+	if (mWindow->getFullscreen())
+	{
+		return world_aspect * mWindow->getPixelAspectRatio();
+	}
+	else
+	{
+		return world_aspect;
+	}
 }
 
 void LLViewerWindow::calcDisplayScale()
@@ -4695,13 +4749,27 @@ void LLViewerWindow::calcDisplayScale()
 	F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor");
 	LLVector2 display_scale;
 	display_scale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f));
-	display_scale *= ui_scale_factor;
+	F32 height_normalization = gSavedSettings.getBOOL("UIAutoScale") ? ((F32)mWindowRectRaw.getHeight() / display_scale.mV[VY]) / 768.f : 1.f;
+	if(mWindow->getFullscreen())
+	{
+		display_scale *= (ui_scale_factor * height_normalization);
+	}
+	else
+	{
+		display_scale *= ui_scale_factor;
+	}
 
 	// limit minimum display scale
 	if (display_scale.mV[VX] < MIN_DISPLAY_SCALE || display_scale.mV[VY] < MIN_DISPLAY_SCALE)
 	{
 		display_scale *= MIN_DISPLAY_SCALE / llmin(display_scale.mV[VX], display_scale.mV[VY]);
 	}
+
+	if (mWindow->getFullscreen())
+	{
+		display_scale.mV[0] = llround(display_scale.mV[0], 2.0f/(F32) mWindowRectRaw.getWidth());
+		display_scale.mV[1] = llround(display_scale.mV[1], 2.0f/(F32) mWindowRectRaw.getHeight());
+	}
 	
 	if (display_scale != mDisplayScale)
 	{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index b5faa984eb6454d32fa60643d7094cd7725bf615..af833db9c3afce894c36a682351a498b7230191f 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1,6 +1,6 @@
 /** 
  * @File llvoavatar.cpp
- * @brief Implementation of LLVOAvatar class which is a derivation of LLViewerObject
+ * @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject
  *
  * $LicenseInfo:firstyear=2001&license=viewergpl$
  * 
@@ -66,9 +66,7 @@
 #include "llkeyframewalkmotion.h"
 #include "llmutelist.h"
 #include "llmoveview.h"
-#include "llnotificationsutil.h"
 #include "llquantize.h"
-#include "llrand.h"
 #include "llregionhandle.h"
 #include "llresmgr.h"
 #include "llselectmgr.h"
@@ -96,12 +94,6 @@
 #include "llvoiceclient.h"
 #include "llvoicevisualizer.h" // Ventrella
 
-#include "lldebugmessagebox.h"
-extern F32 SPEED_ADJUST_MAX;
-extern F32 SPEED_ADJUST_MAX_SEC;
-extern F32 ANIM_SPEED_MAX;
-extern F32 ANIM_SPEED_MIN;
-
 #if LL_MSVC
 // disable boost::lexical_cast warning
 #pragma warning (disable:4702)
@@ -664,7 +656,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	mNameMute(FALSE),
 	mRenderGroupTitles(sRenderGroupTitles),
 	mNameAppearance(FALSE),
-	mNameCloud(FALSE),
 	mFirstTEMessageReceived( FALSE ),
 	mFirstAppearanceMessageReceived( FALSE ),
 	mCulled( FALSE ),
@@ -674,8 +665,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	mTexEyeColor( NULL ),
 	mNeedsSkin(FALSE),
 	mUpdatePeriod(1),
-	mFullyLoaded(FALSE),
-	mPreviousFullyLoaded(FALSE),
 	mFullyLoadedInitialized(FALSE),
 	mSupportsAlphaLayers(FALSE)
 {
@@ -755,11 +744,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	mOohMorph      = NULL;
 	mAahMorph      = NULL;
 
-	mCurrentGesticulationLevel = 0;
+	mCurrentGesticulationLevel = 0;		
 
-	mRuthTimer.reset();
-	mRuthDebugTimer.reset();
-	mDebugExistenceTimer.reset();
 }
 
 //------------------------------------------------------------------------
@@ -767,27 +753,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 //------------------------------------------------------------------------
 LLVOAvatar::~LLVOAvatar()
 {
-	if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
-	{
-		if (!mFullyLoaded)
-		{
-			llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' left after " << (U32)mRuthDebugTimer.getElapsedTimeF32() << " seconds as cloud." << llendl;
-			LLSD args;
-			args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
-			args["TIME"] = llformat("%d",(U32)mRuthDebugTimer.getElapsedTimeF32());
-			args["NAME"] = getFullname();
-			LLNotificationsUtil::add("AvatarRezLeftCloudNotification",args);
-		}
-		else
-		{
-			llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' left." << llendl;
-			LLSD args;
-			args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
-			args["NAME"] = getFullname();
-			LLNotificationsUtil::add("AvatarRezLeftNotification",args);
-		}
-
-	}
 	lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl;
 
 	mRoot.removeAllChildren();
@@ -859,7 +824,7 @@ BOOL LLVOAvatar::isFullyBaked()
 	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 	{
 		if (!isTextureDefined(mBakedTextureDatas[i].mTextureIndex)
-			&& ( (i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ) )
+			&& ( (i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ) )
 		{
 			return FALSE;
 		}
@@ -1145,17 +1110,6 @@ void LLVOAvatar::initClass()
 	{
 		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
 	}
-
-	gAnimLibrary.animStateSetString(ANIM_AGENT_BODY_NOISE,"body_noise");
-	gAnimLibrary.animStateSetString(ANIM_AGENT_BREATHE_ROT,"breathe_rot");
-	gAnimLibrary.animStateSetString(ANIM_AGENT_EDITING,"editing");
-	gAnimLibrary.animStateSetString(ANIM_AGENT_EYE,"eye");
-	gAnimLibrary.animStateSetString(ANIM_AGENT_FLY_ADJUST,"fly_adjust");
-	gAnimLibrary.animStateSetString(ANIM_AGENT_HAND_MOTION,"hand_motion");
-	gAnimLibrary.animStateSetString(ANIM_AGENT_HEAD_ROT,"head_rot");
-	gAnimLibrary.animStateSetString(ANIM_AGENT_PELVIS_FIX,"pelvis_fix");
-	gAnimLibrary.animStateSetString(ANIM_AGENT_TARGET,"target");
-	gAnimLibrary.animStateSetString(ANIM_AGENT_WALK_ADJUST,"walk_adjust");
 }
 
 
@@ -1267,11 +1221,7 @@ void LLVOAvatar::initInstance(void)
 		registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE,		LLEmote::create );
 		registerMotion( ANIM_AGENT_EXPRESS_WINK,			LLEmote::create );
 		registerMotion( ANIM_AGENT_EXPRESS_WORRY,			LLEmote::create );
-		registerMotion( ANIM_AGENT_FEMALE_RUN_NEW,			LLKeyframeWalkMotion::create );
-		registerMotion( ANIM_AGENT_FEMALE_WALK,				LLKeyframeWalkMotion::create );
-		registerMotion( ANIM_AGENT_FEMALE_WALK_NEW,			LLKeyframeWalkMotion::create );
 		registerMotion( ANIM_AGENT_RUN,						LLKeyframeWalkMotion::create );
-		registerMotion( ANIM_AGENT_RUN_NEW,					LLKeyframeWalkMotion::create );
 		registerMotion( ANIM_AGENT_STAND,					LLKeyframeStandMotion::create );
 		registerMotion( ANIM_AGENT_STAND_1,					LLKeyframeStandMotion::create );
 		registerMotion( ANIM_AGENT_STAND_2,					LLKeyframeStandMotion::create );
@@ -1281,7 +1231,6 @@ void LLVOAvatar::initInstance(void)
 		registerMotion( ANIM_AGENT_TURNLEFT,				LLKeyframeWalkMotion::create );
 		registerMotion( ANIM_AGENT_TURNRIGHT,				LLKeyframeWalkMotion::create );
 		registerMotion( ANIM_AGENT_WALK,					LLKeyframeWalkMotion::create );
-		registerMotion( ANIM_AGENT_WALK_NEW,				LLKeyframeWalkMotion::create );
 		
 		// motions without a start/stop bit
 		registerMotion( ANIM_AGENT_BODY_NOISE,				LLBodyNoiseMotion::create );
@@ -1317,8 +1266,7 @@ void LLVOAvatar::initInstance(void)
 	
 	//VTPause();  // VTune
 	
-	mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) );
-
+	mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) );
 }
 
 const LLVector3 LLVOAvatar::getRenderPosition() const
@@ -2126,24 +2074,9 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys,
 	LLMemType mt(LLMemType::MTYPE_AVATAR);
 	
 	LLVector3 old_vel = getVelocity();
-	const BOOL has_name = !getNVPair("FirstName");
-
 	// Do base class updates...
 	U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
 
-	// Print out arrival information once we have name of avatar.
-	if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
-	{
-		if (has_name && getNVPair("FirstName"))
-		{
-			mDebugExistenceTimer.reset();
-			LLSD args;
-			args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
-			args["NAME"] = getFullname();
-			LLNotificationsUtil::add("AvatarRezArrivedNotification",args);
-			llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' arrived." << llendl;
-		}
-	}
 	if(retval & LLViewerObject::INVALID_UPDATE)
 	{
 		if (isSelf())
@@ -2178,33 +2111,6 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid)
 static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Update Avatar");
 static LLFastTimer::DeclareTimer FTM_JOINT_UPDATE("Update Joints");
 
-//------------------------------------------------------------------------
-// LLVOAvatar::dumpAnimationState()
-//------------------------------------------------------------------------
-void LLVOAvatar::dumpAnimationState()
-{
-	llinfos << "==============================================" << llendl;
-	for (LLVOAvatar::AnimIterator it = mSignaledAnimations.begin(); it != mSignaledAnimations.end(); ++it)
-	{
-		LLUUID id = it->first;
-		std::string playtag = "";
-		if (mPlayingAnimations.find(id) != mPlayingAnimations.end())
-		{
-			playtag = "*";
-		}
-		llinfos << gAnimLibrary.animationName(id) << playtag << llendl;
-	}
-	for (LLVOAvatar::AnimIterator it = mPlayingAnimations.begin(); it != mPlayingAnimations.end(); ++it)
-	{
-		LLUUID id = it->first;
-		bool is_signaled = mSignaledAnimations.find(id) != mSignaledAnimations.end();
-		if (!is_signaled)
-		{
-			llinfos << gAnimLibrary.animationName(id) << "!S" << llendl;
-		}
-	}
-}
-
 //------------------------------------------------------------------------
 // idleUpdate()
 //------------------------------------------------------------------------
@@ -2291,8 +2197,8 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 	}
 
 	static LLUICachedControl<bool> visualizers_in_calls("ShowVoiceVisualizersInCalls", false);
-	bool voice_enabled = (visualizers_in_calls || LLVoiceClient::getInstance()->inProximalChannel()) &&
-						 LLVoiceClient::getInstance()->getVoiceEnabled(mID);
+	bool voice_enabled = (visualizers_in_calls || gVoiceClient->inProximalChannel()) &&
+						 gVoiceClient->getVoiceEnabled(mID);
 
 	idleUpdateVoiceVisualizer( voice_enabled );
 	idleUpdateMisc( detailed_update );
@@ -2308,7 +2214,6 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 	idleUpdateNameTag( root_pos_last );
 	idleUpdateRenderCost();
 	idleUpdateTractorBeam();
-
 	return TRUE;
 }
 
@@ -2356,7 +2261,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
 		// Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been
 		// "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking. 
 		//-----------------------------------------------------------------------------------------------------------------
-		if (LLVoiceClient::getInstance()->getIsSpeaking( mID ))
+		if (gVoiceClient->getIsSpeaking( mID ))
 		{		
 			if (!mVoiceVisualizer->getCurrentlySpeaking())
 			{
@@ -2365,7 +2270,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
 				//printf( "gAwayTimer.reset();\n" );
 			}
 			
-			mVoiceVisualizer->setSpeakingAmplitude( LLVoiceClient::getInstance()->getCurrentPower( mID ) );
+			mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) );
 			
 			if( isSelf() )
 			{
@@ -2594,7 +2499,7 @@ F32 LLVOAvatar::calcMorphAmount()
 void LLVOAvatar::idleUpdateLipSync(bool voice_enabled)
 {
 	// Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
-	if ( voice_enabled && (LLVoiceClient::getInstance()->lipSyncEnabled()) && LLVoiceClient::getInstance()->getIsSpeaking( mID ) )
+	if ( voice_enabled && (gVoiceClient->lipSyncEnabled()) && gVoiceClient->getIsSpeaking( mID ) )
 	{
 		F32 ooh_morph_amount = 0.0f;
 		F32 aah_morph_amount = 0.0f;
@@ -2859,33 +2764,17 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
 
 		if (mNameText.notNull() && firstname && lastname)
 		{
-			const BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY)  != mSignaledAnimations.end();
-			const BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end();
-			const BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end();
-			const BOOL is_muted = isSelf() ? FALSE : LLMuteList::getInstance()->isMuted(getID());
-			const BOOL is_cloud = getIsCloud();
-
-			if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
+			BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY)  != mSignaledAnimations.end();
+			BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end();
+			BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end();
+			BOOL is_muted;
+			if (isSelf())
 			{
-				if (is_appearance != mNameAppearance)
-				{
-					if (is_appearance)
-					{
-						LLSD args;
-						args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
-						args["NAME"] = getFullname();
-						LLNotificationsUtil::add("AvatarRezEnteredAppearanceNotification",args);
-						llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' entered appearance mode." << llendl;
-					}
-					else
-					{
-						LLSD args;
-						args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
-						args["NAME"] = getFullname();
-						LLNotificationsUtil::add("AvatarRezLeftAppearanceNotification",args);
-						llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' left appearance mode." << llendl;
-					}
-				}
+				is_muted = FALSE;
+			}
+			else
+			{
+				is_muted = LLMuteList::getInstance()->isMuted(getID());
 			}
 
 			if (mNameString.empty() ||
@@ -2893,9 +2782,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
 				(!title && !mTitle.empty()) ||
 				(title && mTitle != title->getString()) ||
 				(is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute)
-				|| is_appearance != mNameAppearance 
-				|| is_cloud != mNameCloud
-				)
+				|| is_appearance != mNameAppearance)
 			{
 				std::string line;
 				if (!sRenderGroupTitles)
@@ -2949,12 +2836,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
 					}
 					line += ")";
 				}
-				if (is_cloud)
-				{
-					line += "\n";
-					line += "(" + LLTrans::getString("LoadingData") + ")";
-				}
-				else if (is_appearance)
+				if (is_appearance)
 				{
 					line += "\n";
 					line += LLTrans::getString("AvatarEditingAppearance");
@@ -2963,7 +2845,6 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
 				mNameBusy = is_busy;
 				mNameMute = is_muted;
 				mNameAppearance = is_appearance;
-				mNameCloud = is_cloud;
 				mTitle = title ? title->getString() : "";
 				LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR);
 				mNameString = utf8str_to_wstring(line);
@@ -3784,7 +3665,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
 			mMeshLOD[MESH_ID_LOWER_BODY]->updateJointGeometry();
 			mMeshLOD[MESH_ID_UPPER_BODY]->updateJointGeometry();
 
-			if( isWearingWearableType( LLWearableType::WT_SKIRT ) )
+			if( isWearingWearableType( WT_SKIRT ) )
 			{
 				mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry();
 			}
@@ -3944,7 +3825,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
 U32 LLVOAvatar::renderTransparent(BOOL first_pass)
 {
 	U32 num_indices = 0;
-	if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) )
+	if( isWearingWearableType( WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) )
 	{
 		gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f);
 		num_indices += mMeshLOD[MESH_ID_SKIRT]->render(mAdjustedPixelArea, FALSE);
@@ -4147,7 +4028,7 @@ void LLVOAvatar::updateTextures()
 	mHasGrey = FALSE; // debug
 	for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++)
 	{
-		LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)texture_index);
+		EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)texture_index);
 		U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
 		const LLTextureEntry *te = getTE(texture_index);
 		const F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT);
@@ -4209,16 +4090,8 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel
 {
 	mMaxPixelArea = llmax(pixel_area, mMaxPixelArea);
 	mMinPixelArea = llmin(pixel_area, mMinPixelArea);
-
-	imagep->resetTextureStats();
-	imagep->setResetMaxVirtualSizeFlag(false) ;
-	imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures.
 	imagep->addTextureStats(pixel_area / texel_area_ratio);
 	imagep->setBoostLevel(boost_level);
-	if(boost_level == LLViewerTexture::BOOST_AVATAR_BAKED_SELF)
-	{
-		imagep->setAdditionalDecodePriority(1.0f) ;
-	}
 }
 
 //virtual	
@@ -4491,79 +4364,34 @@ void LLVOAvatar::resetAnimations()
 	flushAllMotions();
 }
 
-// Override selectively based on avatar sex and whether we're using new
-// animations.
-LLUUID LLVOAvatar::remapMotionID(const LLUUID& id)
+//-----------------------------------------------------------------------------
+// startMotion()
+// id is the asset if of the animation to start
+// time_offset is the offset into the animation at which to start playing
+//-----------------------------------------------------------------------------
+BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
 {
-	BOOL use_new_walk_run = gSavedSettings.getBOOL("UseNewWalkRun");
-	LLUUID result = id;
-
+	LLMemType mt(LLMemType::MTYPE_AVATAR);
+	
 	// start special case female walk for female avatars
 	if (getSex() == SEX_FEMALE)
 	{
 		if (id == ANIM_AGENT_WALK)
 		{
-			if (use_new_walk_run)
-				result = ANIM_AGENT_FEMALE_WALK_NEW;
-			else
-				result = ANIM_AGENT_FEMALE_WALK;
-		}
-		else if (id == ANIM_AGENT_RUN)
-		{
-			// There is no old female run animation, so only override
-			// in one case.
-			if (use_new_walk_run)
-				result = ANIM_AGENT_FEMALE_RUN_NEW;
+			return LLCharacter::startMotion(ANIM_AGENT_FEMALE_WALK, time_offset);
 		}
 		else if (id == ANIM_AGENT_SIT)
 		{
-			result = ANIM_AGENT_SIT_FEMALE;
-		}
-	}
-	else
-	{
-		// Male avatar.
-		if (id == ANIM_AGENT_WALK)
-		{
-			if (use_new_walk_run)
-				result = ANIM_AGENT_WALK_NEW;
-		}
-		else if (id == ANIM_AGENT_RUN)
-		{
-			if (use_new_walk_run)
-				result = ANIM_AGENT_RUN_NEW;
+			return LLCharacter::startMotion(ANIM_AGENT_SIT_FEMALE, time_offset);
 		}
-	
 	}
 
-	return result;
-
-}
-
-//-----------------------------------------------------------------------------
-// startMotion()
-// id is the asset if of the animation to start
-// time_offset is the offset into the animation at which to start playing
-//-----------------------------------------------------------------------------
-BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
-{
-	LLMemType mt(LLMemType::MTYPE_AVATAR);
-
-	lldebugs << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << llendl;
-
-	LLUUID remap_id = remapMotionID(id);
-
-	if (remap_id != id)
-	{
-		lldebugs << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << llendl;
-	}
-
-	if (isSelf() && remap_id == ANIM_AGENT_AWAY)
+	if (isSelf() && id == ANIM_AGENT_AWAY)
 	{
 		gAgent.setAFK();
 	}
 
-	return LLCharacter::startMotion(remap_id, time_offset);
+	return LLCharacter::startMotion(id, time_offset);
 }
 
 //-----------------------------------------------------------------------------
@@ -4571,21 +4399,21 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
 //-----------------------------------------------------------------------------
 BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
 {
-	lldebugs << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << llendl;
-
-	LLUUID remap_id = remapMotionID(id);
-	
-	if (remap_id != id)
+	if (isSelf())
 	{
-		lldebugs << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << llendl;
+		gAgent.onAnimStop(id);
 	}
 
-	if (isSelf())
+	if (id == ANIM_AGENT_WALK)
 	{
-		gAgent.onAnimStop(remap_id);
+		LLCharacter::stopMotion(ANIM_AGENT_FEMALE_WALK, stop_immediate);
+	}
+	else if (id == ANIM_AGENT_SIT)
+	{
+		LLCharacter::stopMotion(ANIM_AGENT_SIT_FEMALE, stop_immediate);
 	}
 
-	return LLCharacter::stopMotion(remap_id, stop_immediate);
+	return LLCharacter::stopMotion(id, stop_immediate);
 }
 
 //-----------------------------------------------------------------------------
@@ -4988,7 +4816,7 @@ BOOL LLVOAvatar::loadAvatar()
 	}
 
 	// Uncomment to enable avatar_lad.xml debugging. 
-	std::ofstream file;
+/*	std::ofstream file;
 	file.open("avatar_lad.log");
 	for( LLViewerVisualParam* param = (LLViewerVisualParam*) getFirstVisualParam(); 
 	param;
@@ -4998,7 +4826,7 @@ BOOL LLVOAvatar::loadAvatar()
 		file << std::endl;
 	}
 
-	file.close();
+	file.close();*/
 	
 	return TRUE;
 }
@@ -5640,14 +5468,6 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi
 {
 	S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState());
 
-	// This should never happen unless the server didn't process the attachment point
-	// correctly, but putting this check in here to be safe.
-	if (attachmentID & ATTACHMENT_ADD)
-	{
-		llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl;
-		attachmentID &= ~ATTACHMENT_ADD;
-	}
-	
 	LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
 
 	if (!attachment)
@@ -5787,6 +5607,8 @@ void LLVOAvatar::sitDown(BOOL bSitting)
 //-----------------------------------------------------------------------------
 void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
 {
+	sitDown(TRUE);
+
 	if (isSelf())
 	{
 		// Might be first sit
@@ -5819,9 +5641,6 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
 	mDrawable->mXform.setRotation(mDrawable->getWorldRotation() * inv_obj_rot);
 
 	gPipeline.markMoved(mDrawable, TRUE);
-	// Notice that removing sitDown() from here causes avatars sitting on
-	// objects to be not rendered for new arrivals. See EXT-6835 and EXT-1655.
-	sitDown(TRUE);
 	mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject
 	mRoot.setPosition(getPosition());
 	mRoot.updateWorldMatrixChildren();
@@ -5993,29 +5812,27 @@ BOOL LLVOAvatar::isVisible() const
 		&& (mDrawable->isVisible() || mIsDummy);
 }
 
-// Determine if we have enough avatar data to render
-BOOL LLVOAvatar::getIsCloud()
+// call periodically to keep isFullyLoaded up to date.
+// returns true if the value has changed.
+BOOL LLVOAvatar::updateIsFullyLoaded()
 {
-	// Do we have a shape?
+    // a "heuristic" to determine if we have enough avatar data to render
+    // (to avoid rendering a "Ruth" - DEV-3168)
+	BOOL loading = FALSE;
+
+	// do we have a shape?
 	if (visualParamWeightsAreDefault())
 	{
-		return TRUE;
+		loading = TRUE;
 	}
 
 	if (!isTextureDefined(TEX_LOWER_BAKED) || 
 		!isTextureDefined(TEX_UPPER_BAKED) || 
 		!isTextureDefined(TEX_HEAD_BAKED))
 	{
-		return TRUE;
+		loading = TRUE;
 	}
-	return FALSE;
-}
-
-// call periodically to keep isFullyLoaded up to date.
-// returns true if the value has changed.
-BOOL LLVOAvatar::updateIsFullyLoaded()
-{
-	const BOOL loading = getIsCloud();
+	
 	updateRuthTimer(loading);
 	return processFullyLoadedChange(loading);
 }
@@ -6030,28 +5847,19 @@ void LLVOAvatar::updateRuthTimer(bool loading)
 	if (mPreviousFullyLoaded)
 	{
 		mRuthTimer.reset();
-		if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
-		{
-			llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' became cloud." << llendl;
-			LLSD args;
-			args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
-			args["TIME"] = llformat("%d",(U32)mRuthDebugTimer.getElapsedTimeF32());
-			args["NAME"] = getFullname();
-			LLNotificationsUtil::add("AvatarRezCloudNotification",args);
-		}
-		mRuthDebugTimer.reset();
 	}
 	
-	const F32 LOADING_TIMEOUT__SECONDS = 120.f;
-	if (mRuthTimer.getElapsedTimeF32() > LOADING_TIMEOUT__SECONDS)
+	const F32 LOADING_TIMEOUT = 120.f;
+	if (mRuthTimer.getElapsedTimeF32() > LOADING_TIMEOUT)
 	{
+		/*
 		llinfos << "Ruth Timer timeout: Missing texture data for '" << getFullname() << "' "
 				<< "( Params loaded : " << !visualParamWeightsAreDefault() << " ) "
 				<< "( Lower : " << isTextureDefined(TEX_LOWER_BAKED) << " ) "
 				<< "( Upper : " << isTextureDefined(TEX_UPPER_BAKED) << " ) "
 				<< "( Head : " << isTextureDefined(TEX_HEAD_BAKED) << " )."
 				<< llendl;
-		
+		*/
 		LLAvatarPropertiesProcessor::getInstance()->sendAvatarTexturesRequest(getID());
 		mRuthTimer.reset();
 	}
@@ -6067,19 +5875,7 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading)
 	
 	mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > PAUSE);
 
-	if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
-	{
-		if (!mPreviousFullyLoaded && !loading && mFullyLoaded)
-		{
-			llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' resolved in " << (U32)mRuthDebugTimer.getElapsedTimeF32() << " seconds." << llendl;
-			LLSD args;
-			args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
-			args["TIME"] = llformat("%d",(U32)mRuthDebugTimer.getElapsedTimeF32());
-			args["NAME"] = getFullname();
-			LLNotificationsUtil::add("AvatarRezNotification",args);
-		}
-	}
-
+	
 	// did our loading state "change" from last call?
 	const S32 UPDATE_RATE = 30;
 	BOOL changed =
@@ -6383,7 +6179,7 @@ void LLVOAvatar::releaseComponentTextures()
 		const LLVOAvatarDictionary::BakedEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
 		// skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID
 		if (!isTextureDefined(bakedDicEntry->mTextureIndex)
-			&& ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ))
+			&& ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ))
 		{
 			continue;
 		}
@@ -6456,14 +6252,6 @@ BOOL LLVOAvatar::teToColorParams( ETextureIndex te, U32 *param_name )
 			param_name[2] = 923; //"skirt_blue";
 			break;
 
-		case TEX_HEAD_TATTOO:
-		case TEX_LOWER_TATTOO:
-		case TEX_UPPER_TATTOO:
-			param_name[0] = 1071; //"tattoo_red";
-			param_name[1] = 1072; //"tattoo_green";
-			param_name[2] = 1073; //"tattoo_blue";
-			break;	
-
 		default:
 			llassert(0);
 			return FALSE;
@@ -6504,13 +6292,16 @@ LLColor4 LLVOAvatar::getDummyColor()
 
 void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const
 {	
+	/* const char* te_name[] = {
+			"TEX_HEAD_BODYPAINT   ",
+			"TEX_UPPER_SHIRT      ", */
 	llinfos << (isSelf() ? "Self: " : "Other: ") << context << llendl;
 	for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
 		 iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
 		 ++iter)
 	{
 		const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
-		// TODO: MULTI-WEARABLE: handle multiple textures for self
+		// TODO: handle multiple textures for self
 		const LLViewerTexture* te_image = getImage(iter->first,0);
 		if( !te_image )
 		{
@@ -6536,23 +6327,23 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const
 }
 
 // Unlike most wearable functions, this works for both self and other.
-BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const
+BOOL LLVOAvatar::isWearingWearableType(EWearableType type) const
 {
 	if (mIsDummy) return TRUE;
 
 	switch(type)
 	{
-		case LLWearableType::WT_SHAPE:
-		case LLWearableType::WT_SKIN:
-		case LLWearableType::WT_HAIR:
-		case LLWearableType::WT_EYES:
+		case WT_SHAPE:
+		case WT_SKIN:
+		case WT_HAIR:
+		case WT_EYES:
 			return TRUE;  // everyone has all bodyparts
 		default:
 			break; // Do nothing
 	}
 
 	/* switch(type)
-		case LLWearableType::WT_SHIRT:
+		case WT_SHIRT:
 			indicator_te = TEX_UPPER_SHIRT; */
 	for (LLVOAvatarDictionary::Textures::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
 		 tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
@@ -6689,41 +6480,6 @@ void LLVOAvatar::onFirstTEMessageReceived()
 	}
 }
 
-//-----------------------------------------------------------------------------
-// bool visualParamWeightsAreDefault()
-//-----------------------------------------------------------------------------
-bool LLVOAvatar::visualParamWeightsAreDefault()
-{
-	bool rtn = true;
-
-	bool is_wearing_skirt = isWearingWearableType(LLWearableType::WT_SKIRT);
-	for (LLVisualParam *param = getFirstVisualParam(); 
-	     param;
-	     param = getNextVisualParam())
-	{
-		if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
-		{
-			LLViewerVisualParam* vparam = dynamic_cast<LLViewerVisualParam*>(param);
-			llassert(vparam);
-			bool is_skirt_param = vparam &&
-				LLWearableType::WT_SKIRT == vparam->getWearableType();
-			if (param->getWeight() != param->getDefaultWeight() &&
-			    // we have to not care whether skirt weights are default, if we're not actually wearing a skirt
-			    (is_wearing_skirt || !is_skirt_param))
-			{
-				//llinfos << "param '" << param->getName() << "'=" << param->getWeight() << " which differs from default=" << param->getDefaultWeight() << llendl;
-				rtn = false;
-				break;
-			}
-		}
-	}
-
-	//llinfos << "params are default ? " << int(rtn) << llendl;
-
-	return rtn;
-}
-
-
 //-----------------------------------------------------------------------------
 // processAvatarAppearance()
 //-----------------------------------------------------------------------------
@@ -6792,17 +6548,16 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 	{
 		releaseComponentTextures();
 	}
-		
+	
+	
 	// parse visual params
 	S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam);
-	bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing
-	if( num_blocks > 1 && !drop_visual_params_debug)
+	if( num_blocks > 1 )
 	{
 		BOOL params_changed = FALSE;
 		BOOL interp_params = FALSE;
 		
 		LLVisualParam* param = getFirstVisualParam();
-		llassert(param); // if this ever fires, we should do the same as when num_blocks<=1
 		if (!param)
 		{
 			llwarns << "No visual params!" << llendl;
@@ -6818,8 +6573,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 						
 				if( !param )
 				{
-					// more visual params supplied than expected - just process what we know about
-					break;
+					llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl;
+					return;
 				}
 
 				U8 value;
@@ -6844,10 +6599,14 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 			}
 		}
 
-		const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE);
-		if (num_blocks != expected_tweakable_count)
+		while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) )
+		{
+			param = getNextVisualParam();
+		}
+		if( param )
 		{
-			llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << ").  Processing what we can.  object: " << getID() << llendl;
+			llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl;
+			return;
 		}
 
 		if (params_changed)
@@ -6864,37 +6623,16 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 				updateSexDependentLayerSets( FALSE );
 			}	
 		}
-
-		llassert( getSex() == ((getVisualParamWeight( "male" ) > 0.5f) ? SEX_MALE : SEX_FEMALE) );
 	}
 	else
 	{
-		// AvatarAppearance message arrived without visual params
-		if (drop_visual_params_debug)
-		{
-			llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: "  << getID() << llendl;
-		}
-		else
-		{
-			llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl;
-		}
-
-		// this isn't really a problem if we already have a non-default shape
-		if (visualParamWeightsAreDefault())
-		{
-			// re-request appearance, hoping that it comes back with a shape next time
-			llinfos << "Re-requesting AvatarAppearance for object: "  << getID() << llendl;
-			LLAvatarPropertiesProcessor::getInstance()->sendAvatarTexturesRequest(getID());
-		}
-		else
-		{
-			llinfos << "That's okay, we already have a non-default shape for object: "  << getID() << llendl;
-			// we don't really care.
-		}
+		llwarns << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl;
 	}
 
 	setCompositeUpdatesEnabled( TRUE );
 
+	llassert( getSex() == ((getVisualParamWeight( "male" ) > 0.5f) ? SEX_MALE : SEX_FEMALE) );
+
 	// If all of the avatars are completely baked, release the global image caches to conserve memory.
 	LLVOAvatar::cullAvatarsByPixelArea();
 
@@ -7122,9 +6860,9 @@ void LLVOAvatar::dumpArchetypeXML( void* )
 	apr_file_printf( file, "\n\t<archetype name=\"???\">\n" );
 
 	// only body parts, not clothing.
-	for (S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_EYES; type++)
+	for (S32 type = WT_SHAPE; type <= WT_EYES; type++)
 	{
-		const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type);
+		const std::string& wearable_name = LLWearableDictionary::getTypeName((EWearableType)type);
 		apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
 
 		for (LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam())
@@ -7918,8 +7656,6 @@ void LLVOAvatar::idleUpdateRenderCost()
 	static const U32 ARC_BODY_PART_COST = 20;
 	static const U32 ARC_LIMIT = 2048;
 
-	static std::set<LLUUID> all_textures;
-
 	if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME))
 	{
 		return;
@@ -7932,7 +7668,7 @@ void LLVOAvatar::idleUpdateRenderCost()
 	{
 		const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
 		ETextureIndex tex_index = baked_dict->mTextureIndex;
-		if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT)))
+		if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(WT_SKIRT)))
 		{
 			if (isTextureVisible(tex_index))
 			{
@@ -7965,45 +7701,7 @@ void LLVOAvatar::idleUpdateRenderCost()
 			}
 		}
 	}
-	// Diagnostic output to identify all avatar-related textures.
-	// Does not affect rendering cost calculation.
-	// Could be wrapped in a debug option if output becomes problematic.
-	if (isSelf())
-	{
-		// print any attachment textures we didn't already know about.
-		for (std::set<LLUUID>::iterator it = textures.begin(); it != textures.end(); ++it)
-		{
-			LLUUID image_id = *it;
-			if( image_id.isNull() || image_id == IMG_DEFAULT || image_id == IMG_DEFAULT_AVATAR)
-				continue;
-			if (all_textures.find(image_id) == all_textures.end())
-			{
-				// attachment texture not previously seen.
-				llinfos << "attachment_texture: " << image_id.asString() << llendl;
-				all_textures.insert(image_id);
-			}
-		}
 
-		// print any avatar textures we didn't already know about
-		for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
-			 iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
-			 ++iter)
-		{
-			const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
-			// TODO: MULTI-WEARABLE: handle multiple textures for self
-			const LLViewerTexture* te_image = getImage(iter->first,0);
-			if (!te_image)
-				continue;
-			LLUUID image_id = te_image->getID();
-			if( image_id.isNull() || image_id == IMG_DEFAULT || image_id == IMG_DEFAULT_AVATAR)
-				continue;
-			if (all_textures.find(image_id) == all_textures.end())
-			{
-				llinfos << "local_texture: " << texture_dict->mName << ": " << image_id << llendl;
-				all_textures.insert(image_id);
-			}
-		}
-	}
 	cost += textures.size() * LLVOVolume::ARC_TEXTURE_COST;
 
 	setDebugText(llformat("%d", cost));
@@ -8078,26 +7776,3 @@ BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index
 			getImage(te, index)->getID() != IMG_DEFAULT);
 }
 
-//virtual
-BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const
-{
-	if (isIndexLocalTexture(type))
-	{
-		return isTextureDefined(type, index);
-	}
-	else
-	{
-		// baked textures can use TE images directly
-		return ((isTextureDefined(type) || isSelf())
-				&& (getTEImage(type)->getID() != IMG_INVISIBLE 
-				|| LLDrawPoolAlpha::sShowDebugAlpha));
-	}
-}
-
-//virtual
-BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const
-{
-	// non-self avatars don't have wearables
-	return FALSE;
-}
-
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 6e7df878bbda6bcda96fdcdfa34fefbd663877e4..c15dbeb8c60b333c3499acb65d134a3498180582 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -49,14 +49,12 @@
 #include "llhudeffecttrail.h"
 #include "llhudmanager.h"
 #include "llinventoryfunctions.h"
-#include "llnotificationsutil.h"
 #include "llselectmgr.h"
 #include "lltoolgrab.h"	// for needsRenderBeam
 #include "lltoolmgr.h" // for needsRenderBeam
 #include "lltoolmorph.h"
 #include "lltrans.h"
 #include "llviewercamera.h"
-#include "llviewercontrol.h"
 #include "llviewermenu.h"
 #include "llviewerobjectlist.h"
 #include "llviewerstats.h"
@@ -105,7 +103,15 @@ struct LocalTextureData
 //-----------------------------------------------------------------------------
 // Callback data
 //-----------------------------------------------------------------------------
-
+struct LLAvatarTexData
+{
+	LLAvatarTexData(const LLUUID& id, ETextureIndex index) : 
+		mAvatarID(id), 
+		mIndex(index) 
+	{}
+	LLUUID			mAvatarID;
+	ETextureIndex	mIndex;
+};
 
 /**
  **
@@ -137,9 +143,7 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id,
 	mRegionCrossingCount(0)
 {
 	gAgentWearables.setAvatarObject(this);
-
-	mMotionController.mIsSelf = TRUE;
-
+	
 	lldebugs << "Marking avatar as self " << id << llendl;
 }
 
@@ -152,23 +156,6 @@ void LLVOAvatarSelf::initInstance()
 	// adds attachment points to mScreen among other things
 	LLVOAvatar::initInstance();
 
-	llinfos << "Self avatar object created. Starting timer." << llendl;
-	mDebugSelfLoadTimer.reset();
-	// clear all times to -1 for debugging
-	for (U32 i =0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i)
-	{
-		for (U32 j = 0; j <= MAX_DISCARD_LEVEL; ++j)
-		{
-			mDebugTextureLoadTimes[i][j] = -1.0f;
-		}
-	}
-
-	for (U32 i =0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i)
-	{
-		mDebugBakedTextureTimes[i][0] = -1.0f;
-		mDebugBakedTextureTimes[i][1] = -1.0f;
-	}
-
 	status &= buildMenus();
 	if (!status)
 	{
@@ -196,7 +183,7 @@ void LLVOAvatarSelf::markDead()
 		 param;
 		 param = (LLViewerVisualParam*) getNextVisualParam())
 	{
-		if (param->getWearableType() != LLWearableType::WT_INVALID)
+		if (param->getWearableType() != WT_INVALID)
 		{
 			param->setIsDummy(TRUE);
 		}
@@ -692,7 +679,7 @@ BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL
 
 	if (param->getCrossWearable())
 	{
-		LLWearableType::EType type = (LLWearableType::EType)param->getWearableType();
+		EWearableType type = (EWearableType)param->getWearableType();
 		U32 size = gAgentWearables.getWearableCount(type);
 		for (U32 count = 0; count < size; ++count)
 		{
@@ -710,6 +697,15 @@ BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL
 /*virtual*/ 
 void LLVOAvatarSelf::updateVisualParams()
 {
+	for (U32 type = 0; type < WT_COUNT; type++)
+	{
+		LLWearable *wearable = gAgentWearables.getTopWearable((EWearableType)type);
+		if (wearable)
+		{
+			wearable->writeToAvatar();
+		}
+	}
+
 	LLVOAvatar::updateVisualParams();
 }
 
@@ -720,14 +716,7 @@ void LLVOAvatarSelf::idleUpdateAppearanceAnimation()
 	gAgentWearables.animateAllWearableParams(calcMorphAmount(), FALSE);
 
 	// apply wearable visual params to avatar
-	for (U32 type = 0; type < LLWearableType::WT_COUNT; type++)
-	{
-		LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type);
-		if (wearable)
-		{
-			wearable->writeToAvatar();
-		}
-	}
+	updateVisualParams();
 
 	//allow avatar to process updates
 	LLVOAvatar::idleUpdateAppearanceAnimation();
@@ -956,17 +945,17 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode)
 	}
 }
 
-/*virtual*/ BOOL LLVOAvatarSelf::isWearingWearableType(LLWearableType::EType type ) const
+/*virtual*/ BOOL LLVOAvatarSelf::isWearingWearableType(EWearableType type ) const
 {
 	return gAgentWearables.getWearableCount(type) > 0;
 }
 
 //-----------------------------------------------------------------------------
-// updatedWearable( LLWearableType::EType type )
+// updatedWearable( EWearableType type )
 // forces an update to any baked textures relevant to type.
 // will force an upload of the resulting bake if the second parameter is TRUE
 //-----------------------------------------------------------------------------
-void LLVOAvatarSelf::wearableUpdated( LLWearableType::EType type, BOOL upload_result )
+void LLVOAvatarSelf::wearableUpdated( EWearableType type, BOOL upload_result )
 {
 	for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
 		 baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
@@ -975,13 +964,19 @@ void LLVOAvatarSelf::wearableUpdated( LLWearableType::EType type, BOOL upload_re
 		const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
 		const LLVOAvatarDefines::EBakedTextureIndex index = baked_iter->first;
 
+		// if we're editing our appearance, ensure that we're not using baked textures
+		// The baked texture for alpha masks is set explicitly when you hit "save"
+		if (gAgentCamera.cameraCustomizeAvatar())
+		{
+			setNewBakedTexture(index,IMG_DEFAULT_AVATAR);
+		}
 		if (baked_dict)
 		{
 			for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin();
 				type_iter != baked_dict->mWearables.end();
 				 ++type_iter)
 			{
-				const LLWearableType::EType comp_type = *type_iter;
+				const EWearableType comp_type = *type_iter;
 				if (comp_type == type)
 				{
 					if (mBakedTextureDatas[index].mTexLayerSet)
@@ -1117,19 +1112,19 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
 
 U32 LLVOAvatarSelf::getNumWearables(LLVOAvatarDefines::ETextureIndex i) const
 {
-	LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
+	EWearableType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
 	return gAgentWearables.getWearableCount(type);
 }
 
 // virtual
 void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
 {	
+	//llinfos << "onLocalTextureLoaded: " << src_vi->getID() << llendl;
 
 	const LLUUID& src_id = src_vi->getID();
 	LLAvatarTexData *data = (LLAvatarTexData *)userdata;
 	ETextureIndex index = data->mIndex;
 	if (!isIndexLocalTexture(index)) return;
-
 	LLLocalTextureObject *local_tex_obj = getLocalTextureObject(index, 0);
 
 	// fix for EXT-268. Preventing using of NULL pointer
@@ -1245,7 +1240,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset)
 				 ++local_tex_iter)
 			{
 				const ETextureIndex tex_index = *local_tex_iter;
-				const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+				const EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
 				const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
 				for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
 				{
@@ -1267,9 +1262,6 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset)
 //-----------------------------------------------------------------------------
 BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) const
 {
-	//const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); 
-	const U32 desired_tex_discard_level = 0; // SERAPH hack to not bake textures on lower discard levels.
-
 	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 	{
 		if (layerset == mBakedTextureDatas[i].mTexLayerSet)
@@ -1280,11 +1272,11 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) cons
 				 ++local_tex_iter)
 			{
 				const ETextureIndex tex_index = *local_tex_iter;
-				const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+				const EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
 				const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
 				for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
 				{
-					if (getLocalDiscardLevel(*local_tex_iter, wearable_index) > (S32)(desired_tex_discard_level))
+					if (getLocalDiscardLevel(*local_tex_iter, wearable_index) != 0)
 					{
 						return FALSE;
 					}
@@ -1297,49 +1289,13 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) cons
 	return FALSE;
 }
 
-BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
-{
-	// const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); 
-	const U32 desired_tex_discard_level = 0; // SERAPH hack to not bake textures on lower discard levels
-
-	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
-	{
-		const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
-		for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
-			 local_tex_iter != baked_dict->mLocalTextures.end();
-			 ++local_tex_iter)
-		{
-			const ETextureIndex tex_index = *local_tex_iter;
-			const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
-			const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
-			for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
-			{
-				if (getLocalDiscardLevel(*local_tex_iter, wearable_index) > (S32)(desired_tex_discard_level))
-				{
-					return FALSE;
-				}
-			}
-		}
-	}
-	return TRUE;
-}
-
-BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const
-{
-	const LLTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet;
-	if (!layerset) return FALSE;
-	const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
-	if (!layerset_buffer) return FALSE;
-	return !layerset_buffer->uploadPending();
-}
-
 BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const
 {
 	LLUUID id;
 	BOOL isDefined = TRUE;
 	if (isIndexLocalTexture(type))
 	{
-		const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(type);
+		const EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType(type);
 		const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
 		if (index >= wearable_count)
 		{
@@ -1365,32 +1321,6 @@ BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32
 	return isDefined;
 }
 
-//virtual
-BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const
-{
-	if (isIndexBakedTexture(type))
-	{
-		return LLVOAvatar::isTextureVisible(type, (U32)0);
-	}
-
-	LLUUID tex_id = getLocalTextureID(type,index);
-	return (tex_id != IMG_INVISIBLE) 
-			|| (LLDrawPoolAlpha::sShowDebugAlpha);
-}
-
-//virtual
-BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const
-{
-	if (isIndexBakedTexture(type))
-	{
-		return LLVOAvatar::isTextureVisible(type);
-	}
-
-	U32 index = gAgentWearables.getWearableIndex(wearable);
-	return isTextureVisible(type,index);
-}
-
-
 //-----------------------------------------------------------------------------
 // requestLayerSetUploads()
 //-----------------------------------------------------------------------------
@@ -1405,7 +1335,7 @@ void LLVOAvatarSelf::requestLayerSetUploads()
 void LLVOAvatarSelf::requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i)
 {
 	ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex;
-	const BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index));
+	bool  layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index));
 	if (!layer_baked && mBakedTextureDatas[i].mTexLayerSet)
 	{
 		mBakedTextureDatas[i].mTexLayerSet->requestUpload();
@@ -1422,8 +1352,8 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const
 {
 	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 	{
-		LLTexLayerSet* layerset = mBakedTextureDatas[i].mTexLayerSet;
-		if (layerset && layerset->getComposite() && layerset->getComposite()->uploadPending())
+		BOOL upload_pending = (mBakedTextureDatas[i].mTexLayerSet && mBakedTextureDatas[i].mTexLayerSet->getComposite()->uploadPending());
+		if (upload_pending)
 		{
 			return true;
 		}
@@ -1437,7 +1367,7 @@ void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_r
 	{
 		return;
 	}
-	// llinfos << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegionName() << llendl;
+	// llinfos << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegion() << llendl;
 
 	layerset->requestUpdate();
 	layerset->invalidateMorphMasks();
@@ -1459,7 +1389,6 @@ void LLVOAvatarSelf::invalidateAll()
 	{
 		invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, TRUE);
 	}
-	mDebugSelfLoadTimer.reset();
 }
 
 //-----------------------------------------------------------------------------
@@ -1508,7 +1437,7 @@ void LLVOAvatarSelf::updateComposites()
 	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 	{
 		if (mBakedTextureDatas[i].mTexLayerSet 
-			&& ((i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT)))
+			&& ((i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT)))
 		{
 			mBakedTextureDatas[i].mTexLayerSet->updateComposite();
 		}
@@ -1587,7 +1516,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
 			llerrs << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << llendl;
 			return;
 		}
-		LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType(type);
+		EWearableType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType(type);
 		if (!gAgentWearables.getWearable(wearable_type,index))
 		{
 			// no wearable is loaded, cannot set the texture.
@@ -1770,20 +1699,22 @@ void LLVOAvatarSelf::dumpTotalLocalTextureByteCount()
 	llinfos << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << llendl;
 }
 
-BOOL LLVOAvatarSelf::getIsCloud()
+BOOL LLVOAvatarSelf::updateIsFullyLoaded()
 {
+	BOOL loading = FALSE;
+
 	// do we have our body parts?
-	if (gAgentWearables.getWearableCount(LLWearableType::WT_SHAPE) == 0 ||
-		gAgentWearables.getWearableCount(LLWearableType::WT_HAIR) == 0 ||
-		gAgentWearables.getWearableCount(LLWearableType::WT_EYES) == 0 ||
-		gAgentWearables.getWearableCount(LLWearableType::WT_SKIN) == 0)	
+	if (gAgentWearables.getWearableCount(WT_SHAPE) == 0 ||
+		gAgentWearables.getWearableCount(WT_HAIR) == 0 ||
+		gAgentWearables.getWearableCount(WT_EYES) == 0 ||
+		gAgentWearables.getWearableCount(WT_SKIN) == 0)	
 	{
-		return TRUE;
+		loading = TRUE;
 	}
 
 	if (!isTextureDefined(TEX_HAIR, 0))
 	{
-		return TRUE;
+		loading = TRUE;
 	}
 
 	if (!mPreviousFullyLoaded)
@@ -1791,170 +1722,52 @@ BOOL LLVOAvatarSelf::getIsCloud()
 		if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_LOWER].mTexLayerSet) &&
 			(!isTextureDefined(TEX_LOWER_BAKED, 0)))
 		{
-			return TRUE;
+			loading = TRUE;
 		}
 
 		if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_UPPER].mTexLayerSet) &&
 			(!isTextureDefined(TEX_UPPER_BAKED, 0)))
 		{
-			return TRUE;
+			loading = TRUE;
 		}
 
 		for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 		{
-			if (i == BAKED_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT))
+			if (i == BAKED_SKIRT && !isWearingWearableType(WT_SKIRT))
 				continue;
 
-			const BakedTextureData& texture_data = mBakedTextureDatas[i];
+			BakedTextureData& texture_data = mBakedTextureDatas[i];
 			if (!isTextureDefined(texture_data.mTextureIndex, 0))
 				continue;
 
 			// Check for the case that texture is defined but not sufficiently loaded to display anything.
-			const LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 );
+			LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 );
 			if (!baked_img || !baked_img->hasGLTexture())
 			{
-				return TRUE;
+				loading = TRUE;
 			}
-		}
-
-	}
-	return FALSE;
-}
-
-/*static*/
-void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
-{
-	gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
-}
-
-void LLVOAvatarSelf::debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
-{
-	LLAvatarTexData *data = (LLAvatarTexData *)userdata;
-	if (!data)
-	{
-		return;
-	}
-
-	ETextureIndex index = data->mIndex;
-	
-	if (index < 0 || index >= TEX_NUM_INDICES)
-	{
-		return;
-	}
 
-	if (discard_level >=0 && discard_level <= MAX_DISCARD_LEVEL) // ignore discard level -1, as it means we have no data.
-	{
-		mDebugTextureLoadTimes[(U32)index][(U32)discard_level] = mDebugSelfLoadTimer.getElapsedTimeF32();
-	}
-	if (final)
-	{
-		delete data;
-	}
-}
-
-void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, BOOL finished)
-{
-	U32 done = 0;
-	if (finished)
-	{
-		done = 1;
-	}
-	mDebugBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32();
-}
-
-const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLTexLayerSet* layerset) const
-{
-	std::string text="";
-
-	text = llformat("[Final:%d Avail:%d] ",isLocalTextureDataFinal(layerset), isLocalTextureDataAvailable(layerset));
-
-	/* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
-	   return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */
-	for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
-		 baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
-		 ++baked_iter)
-	{
-		const EBakedTextureIndex baked_index = baked_iter->first;
-		if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
-		{
-			const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
-			text += llformat("%d-%s ( ",baked_index, baked_dict->mName.c_str());
-			for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
-				 local_tex_iter != baked_dict->mLocalTextures.end();
-				 ++local_tex_iter)
-			{
-				const ETextureIndex tex_index = *local_tex_iter;
-				const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
-				const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
-				if (wearable_count > 0)
-				{
-					text += LLWearableType::getTypeName(wearable_type) + ":";
-					for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
-					{
-						const U32 discard_level = getLocalDiscardLevel(tex_index, wearable_index);
-						std::string discard_str = llformat("%d ",discard_level);
-						text += llformat("%d ",discard_level);
-					}
-				}
-			}
-			text += ")";
-			break;
 		}
-	}
-	return text;
-}
 
-const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const
-{
-	std::string text;
-	const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
-
-	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
-	{
-		const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
-		BOOL is_texture_final = TRUE;
-		for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
-			 local_tex_iter != baked_dict->mLocalTextures.end();
-			 ++local_tex_iter)
-		{
-			const ETextureIndex tex_index = *local_tex_iter;
-			const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
-			const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
-			for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
-			{
-				is_texture_final &= (getLocalDiscardLevel(*local_tex_iter, wearable_index) <= (S32)(override_tex_discard_level));
-			}
-		}
-		text += llformat("%s:%d ",baked_dict->mName.c_str(),is_texture_final);
 	}
-	return text;
+	return processFullyLoadedChange(loading);
 }
 
-const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) const
+const LLUUID& LLVOAvatarSelf::grabLocalTexture(ETextureIndex type, U32 index) const
 {
-	if (canGrabBakedTexture(baked_index))
+	if (canGrabLocalTexture(type, index))
 	{
-		ETextureIndex tex_index = LLVOAvatarDictionary::bakedToLocalTextureIndex(baked_index);
-		if (tex_index == TEX_NUM_INDICES)
-		{
-			return LLUUID::null;
-		}
-		return getTEImage( tex_index )->getID();
+		return getTEImage( type )->getID();
 	}
 	return LLUUID::null;
 }
 
-BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
+BOOL LLVOAvatarSelf::canGrabLocalTexture(ETextureIndex type, U32 index) const
 {
-	ETextureIndex tex_index = LLVOAvatarDictionary::bakedToLocalTextureIndex(baked_index);
-	if (tex_index == TEX_NUM_INDICES)
-	{
-		return FALSE;
-	}
 	// Check if the texture hasn't been baked yet.
-	if (!isTextureDefined(tex_index, 0))
+	if (!isTextureDefined(type, index))
 	{
-		lldebugs << "getTEImage( " << (U32) tex_index << " )->getID() == IMG_DEFAULT_AVATAR" << llendl;
+		lldebugs << "getTEImage( " << (U32) type << ", " << index << " )->getID() == IMG_DEFAULT_AVATAR" << llendl;
 		return FALSE;
 	}
 
@@ -1964,54 +1777,50 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
 	// Check permissions of textures that show up in the
 	// baked texture.  We don't want people copying people's
 	// work via baked textures.
+	/* switch(type)
+		case TEX_EYES_BAKED:
+			textures.push_back(TEX_EYES_IRIS); */
+	const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(type);
+	if (!texture_dict->mIsUsedByBakedTexture) return FALSE;
 
+	const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
 	const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
 	for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin();
 		 iter != baked_dict->mLocalTextures.end();
 		 ++iter)
 	{
 		const ETextureIndex t_index = (*iter);
-		LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(t_index);
-		U32 count = gAgentWearables.getWearableCount(wearable_type);
-		lldebugs << "Checking index " << (U32) t_index << " count: " << count << llendl;
-		
-		for (U32 wearable_index = 0; wearable_index < count; ++wearable_index)
-		{
-			LLWearable *wearable = gAgentWearables.getWearable(wearable_type, wearable_index);
-			if (wearable)
+		lldebugs << "Checking index " << (U32) t_index << llendl;
+		// MULTI-WEARABLE: old method. replace.
+		const LLUUID& texture_id = getTEImage( t_index )->getID();
+		if (texture_id != IMG_DEFAULT_AVATAR)
+		{
+			// Search inventory for this texture.
+			LLViewerInventoryCategory::cat_array_t cats;
+			LLViewerInventoryItem::item_array_t items;
+			LLAssetIDMatches asset_id_matches(texture_id);
+			gInventory.collectDescendentsIf(LLUUID::null,
+											cats,
+											items,
+											LLInventoryModel::INCLUDE_TRASH,
+											asset_id_matches);
+
+			BOOL can_grab = FALSE;
+			lldebugs << "item count for asset " << texture_id << ": " << items.count() << llendl;
+			if (items.count())
 			{
-				const LLLocalTextureObject *texture = wearable->getLocalTextureObject((S32)t_index);
-				const LLUUID& texture_id = texture->getID();
-				if (texture_id != IMG_DEFAULT_AVATAR)
+				// search for full permissions version
+				for (S32 i = 0; i < items.count(); i++)
 				{
-					// Search inventory for this texture.
-					LLViewerInventoryCategory::cat_array_t cats;
-					LLViewerInventoryItem::item_array_t items;
-					LLAssetIDMatches asset_id_matches(texture_id);
-					gInventory.collectDescendentsIf(LLUUID::null,
-													cats,
-													items,
-													LLInventoryModel::INCLUDE_TRASH,
-													asset_id_matches);
-
-					BOOL can_grab = FALSE;
-					lldebugs << "item count for asset " << texture_id << ": " << items.count() << llendl;
-					if (items.count())
+					LLViewerInventoryItem* itemp = items[i];
+                                        if (itemp->getIsFullPerm())
 					{
-						// search for full permissions version
-						for (S32 i = 0; i < items.count(); i++)
-						{
-							LLViewerInventoryItem* itemp = items[i];
-												if (itemp->getIsFullPerm())
-							{
-								can_grab = TRUE;
-								break;
-							}
-						}
+						can_grab = TRUE;
+						break;
 					}
-					if (!can_grab) return FALSE;
 				}
 			}
+			if (!can_grab) return FALSE;
 		}
 	}
 
@@ -2030,13 +1839,8 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
 			F32 desired_pixels;
 			desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
 			imagep->setBoostLevel(getAvatarBoostLevel());
-
-			imagep->resetTextureStats();
-			imagep->setResetMaxVirtualSizeFlag(false) ;
 			imagep->addTextureStats( desired_pixels / texel_area_ratio );
-			imagep->setAdditionalDecodePriority(1.0f) ;
 			imagep->forceUpdateBindStats() ;
-			
 			if (imagep->getDiscardLevel() < 0)
 			{
 				mHasGrey = TRUE; // for statistics gathering
@@ -2052,7 +1856,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
 
 LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::ETextureIndex i, U32 wearable_index) const
 {
-	LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
+	EWearableType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
 	LLWearable* wearable = gAgentWearables.getWearable(type, wearable_index);
 	if (wearable)
 	{
@@ -2107,7 +1911,6 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
 	const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(te);
 	if (texture_dict->mIsBakedTexture)
 	{
-		debugBakedTextureUpload(texture_dict->mBakedTextureIndex, TRUE); // FALSE for start of upload, TRUE for finish.
 		llinfos << "New baked texture: " << texture_dict->mName << " UUID: " << uuid <<llendl;
 	}
 	else
@@ -2120,76 +1923,6 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
 	if (!hasPendingBakedUploads())
 	{
 		gAgent.sendAgentSetAppearance();
-
-		if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
-		{
-			LLSD args;
-			args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
-			args["TIME"] = llformat("%d",(U32)mDebugSelfLoadTimer.getElapsedTimeF32());
-			if (isAllLocalTextureDataFinal())
-			{
-				LLNotificationsUtil::add("AvatarRezSelfBakedDoneNotification",args);
-			}
-			else
-			{
-				args["STATUS"] = debugDumpAllLocalTextureDataInfo();
-				LLNotificationsUtil::add("AvatarRezSelfBakedUpdateNotification",args);
-			}
-		}
-
-		outputRezDiagnostics();
-	}
-}
-
-void LLVOAvatarSelf::outputRezDiagnostics() const
-{
-	const F32 final_time = mDebugSelfLoadTimer.getElapsedTimeF32();
-	llinfos << "REZTIME: Myself rez stats:" << llendl;
-	llinfos << "\t Time from avatar creation to load wearables: " << (S32)mDebugTimeWearablesLoaded << llendl;
-	llinfos << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << llendl;
-	llinfos << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << llendl;
-	llinfos << "\t Load time for each texture: " << llendl;
-	for (U32 i = 0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i)
-	{
-		std::stringstream out;
-		out << "\t\t (" << i << ") ";
-		U32 j=0;
-		for (j=0; j <= MAX_DISCARD_LEVEL; j++)
-		{
-			out << "\t";
-			S32 load_time = (S32)mDebugTextureLoadTimes[i][j];
-			if (load_time == -1)
-			{
-				out << "*";
-				if (j == 0)
-					break;
-			}
-			else
-			{
-				out << load_time;
-			}
-		}
-
-		// Don't print out non-existent textures.
-		if (j != 0)
-			llinfos << out.str() << llendl;
-	}
-	llinfos << "\t Time points for each upload (start / finish)" << llendl;
-	for (U32 i = 0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i)
-	{
-		llinfos << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << llendl;
-	}
-
-	for (LLVOAvatarDefines::LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
-		 baked_iter != LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
-		 ++baked_iter)
-	{
-		const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first;
-		const LLTexLayerSet *layerset = debugGetLayerSet(baked_index);
-		if (!layerset) continue;
-		const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
-		if (!layerset_buffer) continue;
-		llinfos << layerset_buffer->dumpTextureInfo() << llendl;
 	}
 }
 
@@ -2289,6 +2022,7 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
 
 	// Don't know if this is needed
 	updateMeshTextures();
+
 }
 
 //-----------------------------------------------------------------------------
@@ -2508,6 +2242,7 @@ LLGLuint LLVOAvatarSelf::getScratchTexName( LLGLenum format, S32& components, U3
 	{
 		case GL_LUMINANCE:			components = 1; internal_format = GL_LUMINANCE8;		break;
 		case GL_ALPHA:				components = 1; internal_format = GL_ALPHA8;			break;
+		case GL_COLOR_INDEX:		components = 1; internal_format = GL_COLOR_INDEX8_EXT;	break;
 		case GL_LUMINANCE_ALPHA:	components = 2; internal_format = GL_LUMINANCE8_ALPHA8;	break;
 		case GL_RGB:				components = 3; internal_format = GL_RGB8;				break;
 		case GL_RGBA:				components = 4; internal_format = GL_RGBA8;				break;
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 02d0a28f46ffe68b8495d50d70655812ffaa6b46..4856e8227506c2ab6fe399653f15b98114a81216 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -3,25 +3,31 @@
  * @brief Declaration of LLVOAvatar class which is a derivation fo
  * LLViewerObject
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -33,10 +39,9 @@
 
 struct LocalTextureData;
 
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//------------------------------------------------------------------------
 // LLVOAvatarSelf
-//
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//------------------------------------------------------------------------
 class LLVOAvatarSelf :
 	public LLVOAvatar
 {
@@ -117,12 +122,12 @@ class LLVOAvatarSelf :
 	// Loading state
 	//--------------------------------------------------------------------
 public:
-	/*virtual*/ BOOL    getIsCloud();
+	/*virtual*/ BOOL    updateIsFullyLoaded();
+private:
 
 	//--------------------------------------------------------------------
 	// Region state
 	//--------------------------------------------------------------------
-private:
 	U64				mLastRegionHandle;
 	LLFrameTimer	mRegionCrossingTimer;
 	S32				mRegionCrossingCount;
@@ -171,12 +176,8 @@ class LLVOAvatarSelf :
 	bool				areTexturesCurrent() const;
 	BOOL				isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const;
 	BOOL				isLocalTextureDataFinal(const LLTexLayerSet* layerset) const;
-	BOOL				isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const;
 	// If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index
 	/*virtual*/ BOOL    isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
-	/*virtual*/ BOOL	isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;
-	/*virtual*/ BOOL	isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const;
-
 
 	//--------------------------------------------------------------------
 	// Local Textures
@@ -186,6 +187,8 @@ class LLVOAvatarSelf :
 	LLViewerFetchedTexture*	getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
 	const LLUUID&		getLocalTextureID(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
 	void				setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index);
+	const LLUUID&		grabLocalTexture(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
+	BOOL				canGrabLocalTexture(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
 	/*virtual*/ void	setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index);
 protected:
 	/*virtual*/ void	setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index);
@@ -211,7 +214,6 @@ class LLVOAvatarSelf :
 	void				setCachedBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid);
 	void				forceBakeAllTextures(bool slam_for_debug = false);
 	static void			processRebakeAvatarTextures(LLMessageSystem* msg, void**);
-	BOOL				isUsingBakedTextures() const; // e.g. false if in appearance edit mode
 protected:
 	/*virtual*/ void	removeMissingBakedTextures();
 
@@ -236,10 +238,6 @@ class LLVOAvatarSelf :
 	void				setupComposites();
 	void				updateComposites();
 
-	const LLUUID&		grabBakedTexture(LLVOAvatarDefines::EBakedTextureIndex baked_index) const;
-	BOOL				canGrabBakedTexture(LLVOAvatarDefines::EBakedTextureIndex baked_index) const;
-
-
 	//--------------------------------------------------------------------
 	// Scratch textures (used for compositing)
 	//--------------------------------------------------------------------
@@ -274,8 +272,8 @@ class LLVOAvatarSelf :
  **/
 
 public:
-	/*virtual*/ BOOL	isWearingWearableType(LLWearableType::EType type) const;
-	void				wearableUpdated(LLWearableType::EType type, BOOL upload_result);
+	/*virtual*/ BOOL	isWearingWearableType(EWearableType type) const;
+	void				wearableUpdated(EWearableType type, BOOL upload_result);
 protected:
 	U32 getNumWearables(LLVOAvatarDefines::ETextureIndex i) const;
 
@@ -324,46 +322,11 @@ class LLVOAvatarSelf :
  **                    DIAGNOSTICS
  **/
 
-	//--------------------------------------------------------------------
-	// General
-	//--------------------------------------------------------------------
 public:	
 	static void		dumpTotalLocalTextureByteCount();
 	void			dumpLocalTextures() const;
 	static void		dumpScratchTextureByteCount();
 
-	//--------------------------------------------------------------------
-	// Avatar Rez Metrics
-	//--------------------------------------------------------------------
-public:	
-	struct LLAvatarTexData
-	{
-		LLAvatarTexData(const LLUUID& id, LLVOAvatarDefines::ETextureIndex index) : 
-			mAvatarID(id), 
-			mIndex(index) 
-		{}
-		LLUUID			mAvatarID;
-		LLVOAvatarDefines::ETextureIndex	mIndex;
-	};
-	void 					debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); }
-	void 					debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); }
-	void 					outputRezDiagnostics() const;
-	void 					debugBakedTextureUpload(LLVOAvatarDefines::EBakedTextureIndex index, BOOL finished);
-	static void				debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
-
-	BOOL					isAllLocalTextureDataFinal() const;
-
-	const LLTexLayerSet*  	debugGetLayerSet(LLVOAvatarDefines::EBakedTextureIndex index) const { return mBakedTextureDatas[index].mTexLayerSet; }
-	const std::string		debugDumpLocalTextureDataInfo(const LLTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer
-	const std::string		debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD
-private:
-	LLFrameTimer    		mDebugSelfLoadTimer;
-	F32						mDebugTimeWearablesLoaded;
-	F32 					mDebugTimeAvatarVisible;
-	F32 					mDebugTextureLoadTimes[LLVOAvatarDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level
-	F32 					mDebugBakedTextureTimes[LLVOAvatarDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture
-	void					debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
-
 /**                    Diagnostics
  **                                                                            **
  *******************************************************************************/
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index 9e3d61ae441a3f6c33c01eda3e1694f62676fbff..fac7fa6a18564923ce11f2f4907f88ffed1e38a2 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -2,25 +2,31 @@
  * @file llvoicechannel.cpp
  * @brief Voice Channel related classes
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -66,9 +72,9 @@ class LLVoiceCallCapResponder : public LLHTTPClient::Responder
 
 void LLVoiceCallCapResponder::error(U32 status, const std::string& reason)
 {
-	LL_WARNS("Voice") << "LLVoiceCallCapResponder::error("
+	llwarns << "LLVoiceCallCapResponder::error("
 		<< status << ": " << reason << ")"
-		<< LL_ENDL;
+		<< llendl;
 	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
 	if ( channelp )
 	{
@@ -98,8 +104,8 @@ void LLVoiceCallCapResponder::result(const LLSD& content)
 		LLSD::map_const_iterator iter;
 		for(iter = content.beginMap(); iter != content.endMap(); ++iter)
 		{
-			LL_DEBUGS("Voice") << "LLVoiceCallCapResponder::result got " 
-				<< iter->first << LL_ENDL;
+			llinfos << "LLVoiceCallCapResponder::result got " 
+				<< iter->first << llendl;
 		}
 
 		channelp->setChannelInfo(
@@ -125,16 +131,21 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
 	{
 		// a voice channel already exists for this session id, so this instance will be orphaned
 		// the end result should simply be the failure to make voice calls
-		LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
+		llwarns << "Duplicate voice channels registered for session_id " << session_id << llendl;
 	}
+
+	LLVoiceClient::getInstance()->addObserver(this);
 }
 
 LLVoiceChannel::~LLVoiceChannel()
 {
-	// Must check instance exists here, the singleton MAY have already been destroyed.
+	// Don't use LLVoiceClient::getInstance() here -- this can get called during atexit() time and that singleton MAY have already been destroyed.
+	// Using call of instanceExists() instead of gVoiceClient in check to avoid crash in LLVoiceClient::removeObserver() 
+	// when quitting viewer by closing console window before login (though in case of such quit crash will occur 
+	// later in other destructors anyway). EXT-5524
 	if(LLVoiceClient::instanceExists())
 	{
-		LLVoiceClient::getInstance()->removeObserver(this);
+		gVoiceClient->removeObserver(this);
 	}
 	
 	sVoiceChannelMap.erase(mSessionID);
@@ -154,13 +165,13 @@ void LLVoiceChannel::setChannelInfo(
 		if (mURI.empty())
 		{
 			LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
-			LL_WARNS("Voice") << "Received empty URI for channel " << mSessionName << LL_ENDL;
+			llwarns << "Received empty URI for channel " << mSessionName << llendl;
 			deactivate();
 		}
 		else if (mCredentials.empty())
 		{
 			LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
-			LL_WARNS("Voice") << "Received empty credentials for channel " << mSessionName << LL_ENDL;
+			llwarns << "Received empty credentials for channel " << mSessionName << llendl;
 			deactivate();
 		}
 		else
@@ -275,14 +286,13 @@ void LLVoiceChannel::deactivate()
 		//Default mic is OFF when leaving voice calls
 		if (gSavedSettings.getBOOL("AutoDisengageMic") && 
 			sCurrentVoiceChannel == this &&
-			LLVoiceClient::getInstance()->getUserPTTState())
+			gVoiceClient->getUserPTTState())
 		{
 			gSavedSettings.setBOOL("PTTCurrentlyEnabled", true);
-			LLVoiceClient::getInstance()->inputUserControlState(true);
+			gVoiceClient->inputUserControlState(true);
 		}
 	}
-	LLVoiceClient::getInstance()->removeObserver(this);
-	
+
 	if (sCurrentVoiceChannel == this)
 	{
 		// default channel is proximal channel
@@ -322,9 +332,7 @@ void LLVoiceChannel::activate()
 	{
 		setState(STATE_CALL_STARTED);
 	}
-	
-	LLVoiceClient::getInstance()->addObserver(this);
-	
+
 	//do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
 	sCurrentVoiceChannelChangedSignal(this->mSessionID);
 }
@@ -366,11 +374,6 @@ LLVoiceChannel* LLVoiceChannel::getChannelByURI(std::string uri)
 	}
 }
 
-LLVoiceChannel* LLVoiceChannel::getCurrentVoiceChannel()
-{
-	return sCurrentVoiceChannel;
-}
-
 void LLVoiceChannel::updateSessionID(const LLUUID& new_session_id)
 {
 	sVoiceChannelMap.erase(sVoiceChannelMap.find(mSessionID));
@@ -422,6 +425,7 @@ void LLVoiceChannel::initClass()
 	sCurrentVoiceChannel = LLVoiceChannelProximal::getInstance();
 }
 
+
 //static 
 void LLVoiceChannel::suspend()
 {
@@ -437,7 +441,7 @@ void LLVoiceChannel::resume()
 {
 	if (sSuspended)
 	{
-		if (LLVoiceClient::getInstance()->voiceEnabled())
+		if (gVoiceClient->voiceEnabled())
 		{
 			if (sSuspendedVoiceChannel)
 			{
@@ -507,9 +511,9 @@ void LLVoiceChannelGroup::activate()
 #endif
 
 		//Mic default state is OFF on initiating/joining Ad-Hoc/Group calls
-		if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
+		if (gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
 		{
-			LLVoiceClient::getInstance()->inputUserControlState(true);
+			gVoiceClient->inputUserControlState(true);
 		}
 		
 	}
@@ -556,7 +560,7 @@ void LLVoiceChannelGroup::setChannelInfo(
 		else
 		{
 			//*TODO: notify user
-			LL_WARNS("Voice") << "Received invalid credentials for channel " << mSessionName << LL_ENDL;
+			llwarns << "Received invalid credentials for channel " << mSessionName << llendl;
 			deactivate();
 		}
 	}
@@ -655,6 +659,7 @@ void LLVoiceChannelGroup::setState(EState state)
 LLVoiceChannelProximal::LLVoiceChannelProximal() : 
 	LLVoiceChannel(LLUUID::null, LLStringUtil::null)
 {
+	activate();
 }
 
 BOOL LLVoiceChannelProximal::isActive()
@@ -666,13 +671,13 @@ void LLVoiceChannelProximal::activate()
 {
 	if (callStarted()) return;
 
-	if((LLVoiceChannel::sCurrentVoiceChannel != this) && (LLVoiceChannel::getState() == STATE_CONNECTED))
+	LLVoiceChannel::activate();
+
+	if (callStarted())
 	{
-		// we're connected to a non-spatial channel, so disconnect.
-		LLVoiceClient::getInstance()->leaveNonSpatialChannel();	
+		// this implicitly puts you back in the spatial channel
+		LLVoiceClient::getInstance()->leaveNonSpatialChannel();
 	}
-	LLVoiceChannel::activate();
-	
 }
 
 void LLVoiceChannelProximal::onChange(EStatusType type, const std::string &channelURI, bool proximal)
@@ -702,7 +707,7 @@ void LLVoiceChannelProximal::handleStatusChange(EStatusType status)
 		return;
 	case STATUS_VOICE_DISABLED:
 		//skip showing "Voice not available at your current location" when agent voice is disabled (EXT-4749)
-		if(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking())
+		if(LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking())
 		{
 			//TODO: remove or redirect this call status notification
 //			LLCallInfoDialog::show("unavailable", mNotifyArgs);
@@ -762,7 +767,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string
 
 void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
 {
-	LL_INFOS("Voice") << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << LL_ENDL;
+	llinfos << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << llendl;
 
 	// status updates
 	switch(type)
@@ -785,12 +790,6 @@ void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
 		}
 		mIgnoreNextSessionLeave = FALSE;
 		return;
-	case STATUS_JOINING:
-		// because we join session we expect to process session leave event in the future. EXT-7371
-		// may be this should be done in the LLVoiceChannel::handleStatusChange.
-		mIgnoreNextSessionLeave = FALSE;
-		break;
-
 	default:
 		break;
 	}
@@ -842,9 +841,9 @@ void LLVoiceChannelP2P::activate()
 		LLRecentPeople::instance().add(mOtherUserID);
 
 		//Default mic is ON on initiating/joining P2P calls
-		if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
+		if (!gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
 		{
-			LLVoiceClient::getInstance()->inputUserControlState(true);
+			gVoiceClient->inputUserControlState(true);
 		}
 	}
 }
@@ -891,9 +890,9 @@ void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::s
 	else
 	{
 		LL_WARNS("Voice") << "incoming SIP URL is not provided. Channel may not work properly." << LL_ENDL;
-		// In the case of an incoming AvaLine call, the generated URI will be different from the
-		// original one. This is because the P2P URI is based on avatar UUID but Avaline is not.
-		// See LLVoiceClient::sessionAddedEvent()
+		// In case of incoming AvaLine call generated URI will be differ from original one.
+		// This is because Avatar-2-Avatar URI is based on avatar UUID but Avaline is not.
+		// See LLVoiceClient::sessionAddedEvent() -> setUUIDFromStringHash()
 		setURI(LLVoiceClient::getInstance()->sipURIFromID(mOtherUserID));
 	}
 	
@@ -907,7 +906,7 @@ void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::s
 
 void LLVoiceChannelP2P::setState(EState state)
 {
-	LL_INFOS("Voice") << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << LL_ENDL;
+	llinfos << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << llendl;
 
 	if (mReceivedCall) // incoming call
 	{
diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h
index c8d338b0a38000d453d8acd1338f4ba8d4034b16..941cccacc3ab9771ba29ad1a1568068c7c879d9e 100644
--- a/indra/newview/llvoicechannel.h
+++ b/indra/newview/llvoicechannel.h
@@ -2,25 +2,31 @@
  * @file llvoicechannel.h
  * @brief Voice channel related classes
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -92,8 +98,7 @@ class LLVoiceChannel : public LLVoiceClientStatusObserver
 
 	static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
 	static LLVoiceChannel* getChannelByURI(std::string uri);
-	static LLVoiceChannel* getCurrentVoiceChannel();
-	
+	static LLVoiceChannel* getCurrentVoiceChannel() { return sCurrentVoiceChannel; }
 	static void initClass();
 	
 	static void suspend();
@@ -107,7 +112,7 @@ class LLVoiceChannel : public LLVoiceClientStatusObserver
 	void doSetState(const EState& state);
 	void setURI(std::string uri);
 
-	// there can be two directions INCOMING and OUTGOING
+	// there can be two directions ICOMING and OUTGOING
 	EDirection mCallDirection;
 
 	std::string	mURI;
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 6c44f639ec16fca90882fa784dc9f6367dbdfb2c..2238acd64376a1402c602640bf21a71f3ed11d1a 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -1,807 +1,7275 @@
  /** 
  * @file llvoiceclient.cpp
- * @brief Voice client delegation class implementation.
+ * @brief Implementation of LLVoiceClient class which is the interface to the voice client process.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 #include "llvoiceclient.h"
-#include "llviewercontrol.h"
-#include "llviewerwindow.h"
-#include "llvoicevivox.h"
-#include "llviewernetwork.h"
-#include "llcommandhandler.h"
-#include "llhttpnode.h"
+
+#include <boost/tokenizer.hpp>
+
+// library includes
 #include "llnotificationsutil.h"
 #include "llsdserialize.h"
-#include "llui.h"
+#include "llsdutil.h"
+
+
+// project includes
+#include "llvoavatar.h"
+#include "llbufferstream.h"
+#include "llfile.h"
+#ifdef LL_STANDALONE
+# include "expat.h"
+#else
+# include "expat/expat.h"
+#endif
+#include "llcallbacklist.h"
+#include "llcallingcard.h"   // for LLFriendObserver
+#include "llviewerregion.h"
+#include "llviewernetwork.h"		// for gGridChoice
+#include "llbase64.h"
+#include "llviewercontrol.h"
+#include "llkeyboard.h"
+#include "llappviewer.h"	// for gDisconnected, gDisableVoice
+#include "llmutelist.h"  // to check for muted avatars
+#include "llagent.h"
+#include "llvoavatarself.h"
+#include "llcachename.h"
+#include "llimview.h" // for LLIMMgr
+#include "llparcel.h"
+#include "llviewerparcelmgr.h"
+//#include "llfirstuse.h"
+#include "llspeakers.h"
+#include "lltrans.h"
+#include "llviewerwindow.h"
+#include "llviewercamera.h"
+#include "llvoavatarself.h"
+#include "llvoicechannel.h"
+
+// for base64 decoding
+#include "apr_base64.h"
+
+// for SHA1 hash
+#include "apr_sha1.h"
+
+// for MD5 hash
+#include "llmd5.h"
 
-const F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
+#define USE_SESSION_GROUPS 0
+
+static bool sConnectingToAgni = false;
+F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
 
 const F32 LLVoiceClient::VOLUME_MIN = 0.f;
 const F32 LLVoiceClient::VOLUME_DEFAULT = 0.5f;
 const F32 LLVoiceClient::VOLUME_MAX = 1.0f;
 
+const F32 VOLUME_SCALE_VIVOX = 0.01f;
 
-// Support for secondlife:///app/voice SLapps
-class LLVoiceHandler : public LLCommandHandler
-{
-public:
-	// requests will be throttled from a non-trusted browser
-	LLVoiceHandler() : LLCommandHandler("voice", UNTRUSTED_THROTTLE) {}
-
-	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
-	{
-		if (params[0].asString() == "effects")
-		{
-			LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
-			// If the voice client doesn't support voice effects, we can't handle effects SLapps
-			if (!effect_interface)
-			{
-				return false;
-			}
-
-			// Support secondlife:///app/voice/effects/refresh to update the voice effect list with new effects
-			if (params[1].asString() == "refresh")
-			{
-				effect_interface->refreshVoiceEffectLists(false);
-				return true;
-			}
-		}
-		return false;
-	}
-};
-LLVoiceHandler gVoiceHandler;
+const F32 SPEAKING_TIMEOUT = 1.f;
 
+const int VOICE_MAJOR_VERSION = 1;
+const int VOICE_MINOR_VERSION = 0;
 
+LLVoiceClient *gVoiceClient = NULL;
 
-std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus)
-{
-	std::string result = "UNKNOWN";
-	
-	// Prevent copy-paste errors when updating this list...
-#define CASE(x)  case x:  result = #x;  break
-	
-	switch(inStatus)
-	{
-			CASE(STATUS_LOGIN_RETRY);
-			CASE(STATUS_LOGGED_IN);
-			CASE(STATUS_JOINING);
-			CASE(STATUS_JOINED);
-			CASE(STATUS_LEFT_CHANNEL);
-			CASE(STATUS_VOICE_DISABLED);
-			CASE(BEGIN_ERROR_STATUS);
-			CASE(ERROR_CHANNEL_FULL);
-			CASE(ERROR_CHANNEL_LOCKED);
-			CASE(ERROR_NOT_AVAILABLE);
-			CASE(ERROR_UNKNOWN);
-		default:
-			break;
-	}
-	
-#undef CASE
-	
-	return result;
-}
+// Don't retry connecting to the daemon more frequently than this:
+const F32 CONNECT_THROTTLE_SECONDS = 1.0f;
 
+// Don't send positional updates more frequently than this:
+const F32 UPDATE_THROTTLE_SECONDS = 0.1f;
 
+const F32 LOGIN_RETRY_SECONDS = 10.0f;
+const int MAX_LOGIN_RETRIES = 12;
 
-///////////////////////////////////////////////////////////////////////////////////////////////
+// Defines the maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine()
+// which is treated as normal. If this number is exceeded we suspect there is a problem with connection
+// to voice server (EXT-4313). When voice works correctly, there is from 1 to 15 times. 50 was chosen 
+// to make sure we don't make mistake when slight connection problems happen- situation when connection to server is 
+// blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability.
+const int MAX_NORMAL_JOINING_SPATIAL_NUM = 50;
 
-LLVoiceClient::LLVoiceClient()
-	:
-	mVoiceModule(NULL),
-	m_servicePump(NULL),
-	mVoiceEffectEnabled(LLCachedControl<bool>(gSavedSettings, "VoiceMorphingEnabled")),
-	mVoiceEffectDefault(LLCachedControl<std::string>(gSavedPerAccountSettings, "VoiceEffectDefault"))
+static void setUUIDFromStringHash(LLUUID &uuid, const std::string &str)
 {
+	LLMD5 md5_uuid;
+	md5_uuid.update((const unsigned char*)str.data(), str.size());
+	md5_uuid.finalize();
+	md5_uuid.raw_digest(uuid.mData);
 }
 
-//---------------------------------------------------
-// Basic setup/shutdown
-
-LLVoiceClient::~LLVoiceClient()
+static int scale_mic_volume(float volume)
 {
+	// incoming volume has the range [0.0 ... 2.0], with 1.0 as the default.
+	// Map it to Vivox levels as follows: 0.0 -> 30, 1.0 -> 50, 2.0 -> 70
+	return 30 + (int)(volume * 20.0f);
 }
 
-void LLVoiceClient::init(LLPumpIO *pump)
+static int scale_speaker_volume(float volume)
 {
-	// Initialize all of the voice modules
-	m_servicePump = pump;
+	// incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
+	// Map it to Vivox levels as follows: 0.0 -> 30, 0.5 -> 50, 1.0 -> 70
+	return 30 + (int)(volume * 40.0f);
 }
 
-void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
+class LLViewerVoiceAccountProvisionResponder :
+	public LLHTTPClient::Responder
 {
-	// In the future, we should change this to allow voice module registration
-	// with a table lookup of sorts.
-	std::string voice_server = gSavedSettings.getString("VoiceServerType");
-	LL_DEBUGS("Voice") << "voice server type " << voice_server << LL_ENDL;
-	if(voice_server == "vivox")
-	{
-		mVoiceModule = (LLVoiceModuleInterface *)LLVivoxVoiceClient::getInstance();
-	}
-	else
+public:
+	LLViewerVoiceAccountProvisionResponder(int retries)
 	{
-		mVoiceModule = NULL;
-		return; 
+		mRetries = retries;
 	}
-	mVoiceModule->init(m_servicePump);	
-	mVoiceModule->userAuthorized(user_id, agentID);
-}
-
-
-void LLVoiceClient::terminate()
-{
-	if (mVoiceModule) mVoiceModule->terminate();
-	mVoiceModule = NULL;
-}
 
-const LLVoiceVersionInfo LLVoiceClient::getVersion()
-{
-	if (mVoiceModule) 
+	virtual void error(U32 status, const std::string& reason)
 	{
-		return mVoiceModule->getVersion();
+		if ( mRetries > 0 )
+		{
+			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, retrying.  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
+			if ( gVoiceClient ) gVoiceClient->requestVoiceAccountProvision(
+				mRetries - 1);
+		}
+		else
+		{
+			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, too many retries (giving up).  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
+			if ( gVoiceClient ) gVoiceClient->giveUp();
+		}
 	}
-	else
+
+	virtual void result(const LLSD& content)
 	{
-		LLVoiceVersionInfo result;
-		result.serverVersion = std::string();
-		result.serverType = std::string();
-		return result;
+		if ( gVoiceClient )
+		{
+			std::string voice_sip_uri_hostname;
+			std::string voice_account_server_uri;
+			
+			LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
+			
+			if(content.has("voice_sip_uri_hostname"))
+				voice_sip_uri_hostname = content["voice_sip_uri_hostname"].asString();
+			
+			// this key is actually misnamed -- it will be an entire URI, not just a hostname.
+			if(content.has("voice_account_server_name"))
+				voice_account_server_uri = content["voice_account_server_name"].asString();
+			
+			gVoiceClient->login(
+				content["username"].asString(),
+				content["password"].asString(),
+				voice_sip_uri_hostname,
+				voice_account_server_uri);
+		}
 	}
-}
 
-void LLVoiceClient::updateSettings()
+private:
+	int mRetries;
+};
+
+/** 
+ * @class LLVivoxProtocolParser
+ * @brief This class helps construct new LLIOPipe specializations
+ * @see LLIOPipe
+ *
+ * THOROUGH_DESCRIPTION
+ */
+class LLVivoxProtocolParser : public LLIOPipe
 {
-	if (mVoiceModule) mVoiceModule->updateSettings();
-}
+	LOG_CLASS(LLVivoxProtocolParser);
+public:
+	LLVivoxProtocolParser();
+	virtual ~LLVivoxProtocolParser();
+
+protected:
+	/* @name LLIOPipe virtual implementations
+	 */
+	//@{
+	/** 
+	 * @brief Process the data in buffer
+	 */
+	virtual EStatus process_impl(
+		const LLChannelDescriptors& channels,
+		buffer_ptr_t& buffer,
+		bool& eos,
+		LLSD& context,
+		LLPumpIO* pump);
+	//@}
+	
+	std::string 	mInput;
+	
+	// Expat control members
+	XML_Parser		parser;
+	int				responseDepth;
+	bool			ignoringTags;
+	bool			isEvent;
+	int				ignoreDepth;
+
+	// Members for processing responses. The values are transient and only valid within a call to processResponse().
+	bool			squelchDebugOutput;
+	int				returnCode;
+	int				statusCode;
+	std::string		statusString;
+	std::string		requestId;
+	std::string		actionString;
+	std::string		connectorHandle;
+	std::string		versionID;
+	std::string		accountHandle;
+	std::string		sessionHandle;
+	std::string		sessionGroupHandle;
+	std::string		alias;
+	std::string		applicationString;
+
+	// Members for processing events. The values are transient and only valid within a call to processResponse().
+	std::string		eventTypeString;
+	int				state;
+	std::string		uriString;
+	bool			isChannel;
+	bool			incoming;
+	bool			enabled;
+	std::string		nameString;
+	std::string		audioMediaString;
+	std::string		displayNameString;
+	std::string		deviceString;
+	int				participantType;
+	bool			isLocallyMuted;
+	bool			isModeratorMuted;
+	bool			isSpeaking;
+	int				volume;
+	F32				energy;
+	std::string		messageHeader;
+	std::string		messageBody;
+	std::string		notificationType;
+	bool			hasText;
+	bool			hasAudio;
+	bool			hasVideo;
+	bool			terminated;
+	std::string		blockMask;
+	std::string		presenceOnly;
+	std::string		autoAcceptMask;
+	std::string		autoAddAsBuddy;
+	int				numberOfAliases;
+	std::string		subscriptionHandle;
+	std::string		subscriptionType;
+		
 
-//--------------------------------------------------
-// tuning
+	// Members for processing text between tags
+	std::string		textBuffer;
+	bool			accumulateText;
+	
+	void			reset();
 
-void LLVoiceClient::tuningStart()
-{
-	if (mVoiceModule) mVoiceModule->tuningStart();
-}
+	void			processResponse(std::string tag);
 
-void LLVoiceClient::tuningStop()
-{
-	if (mVoiceModule) mVoiceModule->tuningStop();
-}
+static void XMLCALL ExpatStartTag(void *data, const char *el, const char **attr);
+static void XMLCALL ExpatEndTag(void *data, const char *el);
+static void XMLCALL ExpatCharHandler(void *data, const XML_Char *s, int len);
 
-bool LLVoiceClient::inTuningMode()
+	void			StartTag(const char *tag, const char **attr);
+	void			EndTag(const char *tag);
+	void			CharData(const char *buffer, int length);
+	
+};
+
+LLVivoxProtocolParser::LLVivoxProtocolParser()
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->inTuningMode();
-	}
-	else
-	{
-		return false;
-	}
+	parser = NULL;
+	parser = XML_ParserCreate(NULL);
+	
+	reset();
 }
 
-void LLVoiceClient::tuningSetMicVolume(float volume)
+void LLVivoxProtocolParser::reset()
 {
-	if (mVoiceModule) mVoiceModule->tuningSetMicVolume(volume);
+	responseDepth = 0;
+	ignoringTags = false;
+	accumulateText = false;
+	energy = 0.f;
+	hasText = false;
+	hasAudio = false;
+	hasVideo = false;
+	terminated = false;
+	ignoreDepth = 0;
+	isChannel = false;
+	incoming = false;
+	enabled = false;
+	isEvent = false;
+	isLocallyMuted = false;
+	isModeratorMuted = false;
+	isSpeaking = false;
+	participantType = 0;
+	squelchDebugOutput = false;
+	returnCode = -1;
+	state = 0;
+	statusCode = 0;
+	volume = 0;
+	textBuffer.clear();
+	alias.clear();
+	numberOfAliases = 0;
+	applicationString.clear();
 }
 
-void LLVoiceClient::tuningSetSpeakerVolume(float volume)
+//virtual 
+LLVivoxProtocolParser::~LLVivoxProtocolParser()
 {
-	if (mVoiceModule) mVoiceModule->tuningSetSpeakerVolume(volume);
+	if (parser)
+		XML_ParserFree(parser);
 }
 
-float LLVoiceClient::tuningGetEnergy(void)
+// virtual
+LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
+	const LLChannelDescriptors& channels,
+	buffer_ptr_t& buffer,
+	bool& eos,
+	LLSD& context,
+	LLPumpIO* pump)
 {
-	if (mVoiceModule) 
+	LLBufferStream istr(channels, buffer.get());
+	std::ostringstream ostr;
+	while (istr.good())
 	{
-		return mVoiceModule->tuningGetEnergy();
+		char buf[1024];
+		istr.read(buf, sizeof(buf));
+		mInput.append(buf, istr.gcount());
 	}
-	else
-	{
-		return 0.0;
+	
+	// Look for input delimiter(s) in the input buffer.  If one is found, send the message to the xml parser.
+	int start = 0;
+	int delim;
+	while((delim = mInput.find("\n\n\n", start)) != std::string::npos)
+	{	
+		
+		// Reset internal state of the LLVivoxProtocolParser (no effect on the expat parser)
+		reset();
+		
+		XML_ParserReset(parser, NULL);
+		XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag);
+		XML_SetCharacterDataHandler(parser, ExpatCharHandler);
+		XML_SetUserData(parser, this);	
+		XML_Parse(parser, mInput.data() + start, delim - start, false);
+		
+		// If this message isn't set to be squelched, output the raw XML received.
+		if(!squelchDebugOutput)
+		{
+			LL_DEBUGS("Voice") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL;
+		}
+		
+		start = delim + 3;
 	}
-}
-
-
-//------------------------------------------------
-// devices
+	
+	if(start != 0)
+		mInput = mInput.substr(start);
 
-bool LLVoiceClient::deviceSettingsAvailable()
-{
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->deviceSettingsAvailable();
-	}
-	else
+	LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
+	
+	if(!gVoiceClient->mConnected)
 	{
-		return false;
+		// If voice has been disabled, we just want to close the socket.  This does so.
+		LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
+		return STATUS_STOP;
 	}
-}
-
-void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
-{
-	if (mVoiceModule) mVoiceModule->refreshDeviceLists(clearCurrentList);
-}
-
-void LLVoiceClient::setCaptureDevice(const std::string& name)
-{
-	if (mVoiceModule) mVoiceModule->setCaptureDevice(name);
 	
+	return STATUS_OK;
 }
 
-void LLVoiceClient::setRenderDevice(const std::string& name)
-{
-	if (mVoiceModule) mVoiceModule->setRenderDevice(name);	
-}
-
-const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices()
+void XMLCALL LLVivoxProtocolParser::ExpatStartTag(void *data, const char *el, const char **attr)
 {
-	static LLVoiceDeviceList nullCaptureDevices;
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->getCaptureDevices();
-	}
-	else
+	if (data)
 	{
-		return nullCaptureDevices;
+		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
+		object->StartTag(el, attr);
 	}
 }
 
+// --------------------------------------------------------------------------------
 
-const LLVoiceDeviceList& LLVoiceClient::getRenderDevices()
+void XMLCALL LLVivoxProtocolParser::ExpatEndTag(void *data, const char *el)
 {
-	static LLVoiceDeviceList nullRenderDevices;	
-	if (mVoiceModule) 
+	if (data)
 	{
-		return mVoiceModule->getRenderDevices();
-	}
-	else
-	{
-		return nullRenderDevices;
+		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
+		object->EndTag(el);
 	}
 }
 
+// --------------------------------------------------------------------------------
 
-//--------------------------------------------------
-// participants
-
-void LLVoiceClient::getParticipantList(std::set<LLUUID> &participants)
+void XMLCALL LLVivoxProtocolParser::ExpatCharHandler(void *data, const XML_Char *s, int len)
 {
-	if (mVoiceModule) 
+	if (data)
 	{
-	  mVoiceModule->getParticipantList(participants);
+		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
+		object->CharData(s, len);
 	}
-	else
-	{
-	  participants = std::set<LLUUID>();
-	}
-}
-
-bool LLVoiceClient::isParticipant(const LLUUID &speaker_id)
-{
-  if(mVoiceModule)
-    {
-      return mVoiceModule->isParticipant(speaker_id);
-    }
-  return false;
 }
 
+// --------------------------------------------------------------------------------
 
-//--------------------------------------------------
-// text chat
 
-
-BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id)
+void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->isSessionTextIMPossible(id);
+	// Reset the text accumulator. We shouldn't have strings that are inturrupted by new tags
+	textBuffer.clear();
+	// only accumulate text if we're not ignoring tags.
+	accumulateText = !ignoringTags;
+	
+	if (responseDepth == 0)
+	{	
+		isEvent = !stricmp("Event", tag);
+		
+		if (!stricmp("Response", tag) || isEvent)
+		{
+			// Grab the attributes
+			while (*attr)
+			{
+				const char	*key = *attr++;
+				const char	*value = *attr++;
+				
+				if (!stricmp("requestId", key))
+				{
+					requestId = value;
+				}
+				else if (!stricmp("action", key))
+				{
+					actionString = value;
+				}
+				else if (!stricmp("type", key))
+				{
+					eventTypeString = value;
+				}
+			}
+		}
+		LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
 	}
 	else
 	{
-		return FALSE;
-	}	
-}
+		if (ignoringTags)
+		{
+			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+		}
+		else
+		{
+			LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
+	
+			// Ignore the InputXml stuff so we don't get confused
+			if (!stricmp("InputXml", tag))
+			{
+				ignoringTags = true;
+				ignoreDepth = responseDepth;
+				accumulateText = false;
 
-BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id)
-{
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->isSessionCallBackPossible(id);
+				LL_DEBUGS("VivoxProtocolParser") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
+			}
+			else if (!stricmp("CaptureDevices", tag))
+			{
+				gVoiceClient->clearCaptureDevices();
+			}
+			else if (!stricmp("RenderDevices", tag))
+			{
+				gVoiceClient->clearRenderDevices();
+			}
+			else if (!stricmp("CaptureDevice", tag))
+			{
+				deviceString.clear();
+			}
+			else if (!stricmp("RenderDevice", tag))
+			{
+				deviceString.clear();
+			}
+			else if (!stricmp("Buddies", tag))
+			{
+				gVoiceClient->deleteAllBuddies();
+			}
+			else if (!stricmp("BlockRules", tag))
+			{
+				gVoiceClient->deleteAllBlockRules();
+			}
+			else if (!stricmp("AutoAcceptRules", tag))
+			{
+				gVoiceClient->deleteAllAutoAcceptRules();
+			}
+			
+		}
 	}
-	else
-	{
-		return FALSE;
-	}	
+	responseDepth++;
 }
 
-BOOL LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
-{
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->sendTextMessage(participant_id, message);
-	}
-	else
-	{
-		return FALSE;
-	}	
-}
+// --------------------------------------------------------------------------------
 
-void LLVoiceClient::endUserIMSession(const LLUUID& participant_id)
+void LLVivoxProtocolParser::EndTag(const char *tag)
 {
-	if (mVoiceModule) 
-	{
-		mVoiceModule->endUserIMSession(participant_id);
-	}
-}
+	const std::string& string = textBuffer;
 
-//----------------------------------------------
-// channels
+	responseDepth--;
 
-bool LLVoiceClient::inProximalChannel()
-{
-	if (mVoiceModule) 
+	if (ignoringTags)
 	{
-		return mVoiceModule->inProximalChannel();
+		if (ignoreDepth == responseDepth)
+		{
+			LL_DEBUGS("VivoxProtocolParser") << "end of ignore" << LL_ENDL;
+			ignoringTags = false;
+		}
+		else
+		{
+			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+		}
 	}
-	else
+	
+	if (!ignoringTags)
 	{
-		return false;
+		LL_DEBUGS("VivoxProtocolParser") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+
+		// Closing a tag. Finalize the text we've accumulated and reset
+		if (!stricmp("ReturnCode", tag))
+			returnCode = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("SessionHandle", tag))
+			sessionHandle = string;
+		else if (!stricmp("SessionGroupHandle", tag))
+			sessionGroupHandle = string;
+		else if (!stricmp("StatusCode", tag))
+			statusCode = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("StatusString", tag))
+			statusString = string;
+		else if (!stricmp("ParticipantURI", tag))
+			uriString = string;
+		else if (!stricmp("Volume", tag))
+			volume = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("Energy", tag))
+			energy = (F32)strtod(string.c_str(), NULL);
+		else if (!stricmp("IsModeratorMuted", tag))
+			isModeratorMuted = !stricmp(string.c_str(), "true");
+		else if (!stricmp("IsSpeaking", tag))
+			isSpeaking = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Alias", tag))
+			alias = string;
+		else if (!stricmp("NumberOfAliases", tag))
+			numberOfAliases = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("Application", tag))
+			applicationString = string;
+		else if (!stricmp("ConnectorHandle", tag))
+			connectorHandle = string;
+		else if (!stricmp("VersionID", tag))
+			versionID = string;
+		else if (!stricmp("AccountHandle", tag))
+			accountHandle = string;
+		else if (!stricmp("State", tag))
+			state = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("URI", tag))
+			uriString = string;
+		else if (!stricmp("IsChannel", tag))
+			isChannel = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Incoming", tag))
+			incoming = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Enabled", tag))
+			enabled = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Name", tag))
+			nameString = string;
+		else if (!stricmp("AudioMedia", tag))
+			audioMediaString = string;
+		else if (!stricmp("ChannelName", tag))
+			nameString = string;
+		else if (!stricmp("DisplayName", tag))
+			displayNameString = string;
+		else if (!stricmp("Device", tag))
+			deviceString = string;
+		else if (!stricmp("AccountName", tag))
+			nameString = string;
+		else if (!stricmp("ParticipantType", tag))
+			participantType = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("IsLocallyMuted", tag))
+			isLocallyMuted = !stricmp(string.c_str(), "true");
+		else if (!stricmp("MicEnergy", tag))
+			energy = (F32)strtod(string.c_str(), NULL);
+		else if (!stricmp("ChannelName", tag))
+			nameString = string;
+		else if (!stricmp("ChannelURI", tag))
+			uriString = string;
+		else if (!stricmp("BuddyURI", tag))
+			uriString = string;
+		else if (!stricmp("Presence", tag))
+			statusString = string;
+		else if (!stricmp("CaptureDevice", tag))
+		{
+			gVoiceClient->addCaptureDevice(deviceString);
+		}
+		else if (!stricmp("RenderDevice", tag))
+		{
+			gVoiceClient->addRenderDevice(deviceString);
+		}
+		else if (!stricmp("Buddy", tag))
+		{
+			gVoiceClient->processBuddyListEntry(uriString, displayNameString);
+		}
+		else if (!stricmp("BlockRule", tag))
+		{
+			gVoiceClient->addBlockRule(blockMask, presenceOnly);
+		}
+		else if (!stricmp("BlockMask", tag))
+			blockMask = string;
+		else if (!stricmp("PresenceOnly", tag))
+			presenceOnly = string;
+		else if (!stricmp("AutoAcceptRule", tag))
+		{
+			gVoiceClient->addAutoAcceptRule(autoAcceptMask, autoAddAsBuddy);
+		}
+		else if (!stricmp("AutoAcceptMask", tag))
+			autoAcceptMask = string;
+		else if (!stricmp("AutoAddAsBuddy", tag))
+			autoAddAsBuddy = string;
+		else if (!stricmp("MessageHeader", tag))
+			messageHeader = string;
+		else if (!stricmp("MessageBody", tag))
+			messageBody = string;
+		else if (!stricmp("NotificationType", tag))
+			notificationType = string;
+		else if (!stricmp("HasText", tag))
+			hasText = !stricmp(string.c_str(), "true");
+		else if (!stricmp("HasAudio", tag))
+			hasAudio = !stricmp(string.c_str(), "true");
+		else if (!stricmp("HasVideo", tag))
+			hasVideo = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Terminated", tag))
+			terminated = !stricmp(string.c_str(), "true");
+		else if (!stricmp("SubscriptionHandle", tag))
+			subscriptionHandle = string;
+		else if (!stricmp("SubscriptionType", tag))
+			subscriptionType = string;
+		
+		textBuffer.clear();
+		accumulateText= false;
+		
+		if (responseDepth == 0)
+		{
+			// We finished all of the XML, process the data
+			processResponse(tag);
+		}
 	}
 }
 
-void LLVoiceClient::setNonSpatialChannel(
-	const std::string &uri,
-	const std::string &credentials)
-{
-	if (mVoiceModule) mVoiceModule->setNonSpatialChannel(uri, credentials);
-}
+// --------------------------------------------------------------------------------
 
-void LLVoiceClient::setSpatialChannel(
-	const std::string &uri,
-	const std::string &credentials)
+void LLVivoxProtocolParser::CharData(const char *buffer, int length)
 {
-	if (mVoiceModule) mVoiceModule->setSpatialChannel(uri, credentials);
+	/*
+		This method is called for anything that isn't a tag, which can be text you
+		want that lies between tags, and a lot of stuff you don't want like file formatting
+		(tabs, spaces, CR/LF, etc).
+		
+		Only copy text if we are in accumulate mode...
+	*/
+	if (accumulateText)
+		textBuffer.append(buffer, length);
 }
 
-void LLVoiceClient::leaveNonSpatialChannel()
-{
-	if (mVoiceModule) mVoiceModule->leaveNonSpatialChannel();
-}
+// --------------------------------------------------------------------------------
 
-void LLVoiceClient::leaveChannel(void)
+void LLVivoxProtocolParser::processResponse(std::string tag)
 {
-	if (mVoiceModule) mVoiceModule->leaveChannel();
-}
+	LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
 
-std::string LLVoiceClient::getCurrentChannel()
-{
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->getCurrentChannel();
-	}
-	else
+	// SLIM SDK: the SDK now returns a statusCode of "200" (OK) for success.  This is a change vs. previous SDKs.
+	// According to Mike S., "The actual API convention is that responses with return codes of 0 are successful, regardless of the status code returned",
+	// so I believe this will give correct behavior.
+	
+	if(returnCode == 0)
+		statusCode = 0;
+		
+	if (isEvent)
 	{
-		return std::string();
-	}
-}
-
-
-//---------------------------------------
-// invitations
-
-void LLVoiceClient::callUser(const LLUUID &uuid)
-{
-	if (mVoiceModule) mVoiceModule->callUser(uuid);
-}
-
-bool LLVoiceClient::isValidChannel(std::string &session_handle)
+		const char *eventTypeCstr = eventTypeString.c_str();
+		if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
+		{
+			gVoiceClient->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
+		{
+			/*
+			<Event type="SessionAddedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+				<Uri>sip:confctl-1408789@bhr.vivox.com</Uri>
+				<IsChannel>true</IsChannel>
+				<Incoming>false</Incoming>
+				<ChannelName />
+			</Event>
+			*/
+			gVoiceClient->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
+		{
+			gVoiceClient->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
+		{
+			gVoiceClient->sessionGroupAddedEvent(sessionGroupHandle);
+		}
+		else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
+		{
+			/*
+			<Event type="MediaStreamUpdatedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+				<StatusCode>200</StatusCode>
+				<StatusString>OK</StatusString>
+				<State>2</State>
+				<Incoming>false</Incoming>
+			</Event>
+			*/
+			gVoiceClient->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
+		}		
+		else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent"))
+		{
+			/*
+			<Event type="TextStreamUpdatedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg1</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==1</SessionHandle>
+				<Enabled>true</Enabled>
+				<State>1</State>
+				<Incoming>true</Incoming>
+			</Event>
+			*/
+			gVoiceClient->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming);
+		}
+		else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
+		{
+			/* 
+			<Event type="ParticipantAddedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+				<ParticipantUri>sip:xI5auBZ60SJWIk606-1JGRQ==@bhr.vivox.com</ParticipantUri>
+				<AccountName>xI5auBZ60SJWIk606-1JGRQ==</AccountName>
+				<DisplayName />
+				<ParticipantType>0</ParticipantType>
+			</Event>
+			*/
+			gVoiceClient->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
+		}
+		else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
+		{
+			/*
+			<Event type="ParticipantRemovedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+				<ParticipantUri>sip:xtx7YNV-3SGiG7rA1fo5Ndw==@bhr.vivox.com</ParticipantUri>
+				<AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
+			</Event>
+			*/
+			gVoiceClient->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
+		}
+		else if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
+		{
+			/*
+			<Event type="ParticipantUpdatedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+				<ParticipantUri>sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com</ParticipantUri>
+				<IsModeratorMuted>false</IsModeratorMuted>
+				<IsSpeaking>true</IsSpeaking>
+				<Volume>44</Volume>
+				<Energy>0.0879437</Energy>
+			</Event>
+			*/
+			
+			// These happen so often that logging them is pretty useless.
+			squelchDebugOutput = true;
+			
+			gVoiceClient->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
+		}
+		else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
+		{
+			gVoiceClient->auxAudioPropertiesEvent(energy);
+		}
+		else if (!stricmp(eventTypeCstr, "BuddyPresenceEvent"))
+		{
+			gVoiceClient->buddyPresenceEvent(uriString, alias, statusString, applicationString);
+		}
+		else if (!stricmp(eventTypeCstr, "BuddyAndGroupListChangedEvent"))
+		{
+			// The buddy list was updated during parsing.
+			// Need to recheck against the friends list.
+			gVoiceClient->buddyListChanged();
+		}
+		else if (!stricmp(eventTypeCstr, "BuddyChangedEvent"))
+		{
+			/*
+			<Event type="BuddyChangedEvent">
+				<AccountHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==</AccountHandle>
+				<BuddyURI>sip:x9fFHFZjOTN6OESF1DUPrZQ==@bhr.vivox.com</BuddyURI>
+				<DisplayName>Monroe Tester</DisplayName>
+				<BuddyData />
+				<GroupID>0</GroupID>
+				<ChangeType>Set</ChangeType>
+			</Event>
+			*/		
+			// TODO: Question: Do we need to process this at all?
+		}
+		else if (!stricmp(eventTypeCstr, "MessageEvent"))  
+		{
+			gVoiceClient->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))  
+		{
+			gVoiceClient->sessionNotificationEvent(sessionHandle, uriString, notificationType);
+		}
+		else if (!stricmp(eventTypeCstr, "SubscriptionEvent"))  
+		{
+			gVoiceClient->subscriptionEvent(uriString, subscriptionHandle, alias, displayNameString, applicationString, subscriptionType);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))  
+		{
+			/*
+			<Event type="SessionUpdatedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+				<Uri>sip:confctl-9@bhd.vivox.com</Uri>
+				<IsMuted>0</IsMuted>
+				<Volume>50</Volume>
+				<TransmitEnabled>1</TransmitEnabled>
+				<IsFocused>0</IsFocused>
+				<SpeakerPosition><Position><X>0</X><Y>0</Y><Z>0</Z></Position></SpeakerPosition>
+				<SessionFontID>0</SessionFontID>
+			</Event>
+			*/
+			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+		}
+		
+		else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent"))  
+		{
+			/*
+			<Event type="SessionGroupRemovedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+			</Event>
+			*/
+			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+		}
+		else
+		{
+			LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL;
+		}
+	}
+	else
+	{
+		const char *actionCstr = actionString.c_str();
+		if (!stricmp(actionCstr, "Connector.Create.1"))
+		{
+			gVoiceClient->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
+		}
+		else if (!stricmp(actionCstr, "Account.Login.1"))
+		{
+			gVoiceClient->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
+		}
+		else if (!stricmp(actionCstr, "Session.Create.1"))
+		{
+			gVoiceClient->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);			
+		}
+		else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
+		{
+			gVoiceClient->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);			
+		}
+		else if (!stricmp(actionCstr, "Session.Connect.1"))
+		{
+			gVoiceClient->sessionConnectResponse(requestId, statusCode, statusString);			
+		}
+		else if (!stricmp(actionCstr, "Account.Logout.1"))
+		{
+			gVoiceClient->logoutResponse(statusCode, statusString);			
+		}
+		else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
+		{
+			gVoiceClient->connectorShutdownResponse(statusCode, statusString);			
+		}
+		else if (!stricmp(actionCstr, "Account.ListBlockRules.1"))
+		{
+			gVoiceClient->accountListBlockRulesResponse(statusCode, statusString);						
+		}
+		else if (!stricmp(actionCstr, "Account.ListAutoAcceptRules.1"))
+		{
+			gVoiceClient->accountListAutoAcceptRulesResponse(statusCode, statusString);						
+		}
+		else if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
+		{
+			// We don't need to process these, but they're so spammy we don't want to log them.
+			squelchDebugOutput = true;
+		}
+/*
+		else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
+		{
+			gVoiceClient->channelGetListResponse(statusCode, statusString);
+		}
+		else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Connector.MuteLocalMic.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Connector.MuteLocalSpeaker.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Connector.SetLocalMicVolume.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Connector.SetLocalSpeakerVolume.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Session.ListenerSetPosition.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Session.SpeakerSetPosition.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Session.AudioSourceSetPosition.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Session.GetChannelParticipants.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelCreate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelUpdate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelDelete.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelCreateAndInvite.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelFolderCreate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelFolderUpdate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelFolderDelete.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelAddModerator.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelDeleteModerator.1"))
+		{
+			
+		}
+*/
+	}
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+class LLVoiceClientMuteListObserver : public LLMuteListObserver
+{
+	/* virtual */ void onChange()  { gVoiceClient->muteListChanged();}
+};
+
+class LLVoiceClientFriendsObserver : public LLFriendObserver
+{
+public:
+	/* virtual */ void changed(U32 mask) { gVoiceClient->updateFriends(mask);}
+};
+
+static LLVoiceClientMuteListObserver mutelist_listener;
+static bool sMuteListListener_listening = false;
+
+static LLVoiceClientFriendsObserver *friendslist_listener = NULL;
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+class LLVoiceClientCapResponder : public LLHTTPClient::Responder
+{
+public:
+	LLVoiceClientCapResponder(void){};
+
+	virtual void error(U32 status, const std::string& reason);	// called with bad status codes
+	virtual void result(const LLSD& content);
+
+private:
+};
+
+void LLVoiceClientCapResponder::error(U32 status, const std::string& reason)
+{
+	LL_WARNS("Voice") << "LLVoiceClientCapResponder::error("
+		<< status << ": " << reason << ")"
+		<< LL_ENDL;
+}
+
+void LLVoiceClientCapResponder::result(const LLSD& content)
+{
+	LLSD::map_const_iterator iter;
+	
+	LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
+
+	if ( content.has("voice_credentials") )
+	{
+		LLSD voice_credentials = content["voice_credentials"];
+		std::string uri;
+		std::string credentials;
+
+		if ( voice_credentials.has("channel_uri") )
+		{
+			uri = voice_credentials["channel_uri"].asString();
+		}
+		if ( voice_credentials.has("channel_credentials") )
+		{
+			credentials =
+				voice_credentials["channel_credentials"].asString();
+		}
+
+		gVoiceClient->setSpatialChannel(uri, credentials);
+	}
+}
+
+
+
+#if LL_WINDOWS
+static HANDLE sGatewayHandle = 0;
+
+static bool isGatewayRunning()
+{
+	bool result = false;
+	if(sGatewayHandle != 0)		
+	{
+		DWORD waitresult = WaitForSingleObject(sGatewayHandle, 0);
+		if(waitresult != WAIT_OBJECT_0)
+		{
+			result = true;
+		}			
+	}
+	return result;
+}
+static void killGateway()
+{
+	if(sGatewayHandle != 0)
+	{
+		TerminateProcess(sGatewayHandle,0);
+	}
+}
+
+#else // Mac and linux
+
+static pid_t sGatewayPID = 0;
+static bool isGatewayRunning()
+{
+	bool result = false;
+	if(sGatewayPID != 0)
+	{
+		// A kill with signal number 0 has no effect, just does error checking.  It should return an error if the process no longer exists.
+		if(kill(sGatewayPID, 0) == 0)
+		{
+			result = true;
+		}
+	}
+	return result;
+}
+
+static void killGateway()
+{
+	if(sGatewayPID != 0)
+	{
+		kill(sGatewayPID, SIGTERM);
+	}
+}
+
+#endif
+
+class LLSpeakerVolumeStorage : public LLSingleton<LLSpeakerVolumeStorage>
+{
+	LOG_CLASS(LLSpeakerVolumeStorage);
+public:
+
+	/**
+	 * Stores volume level for specified user.
+	 *
+	 * @param[in] speaker_id - LLUUID of user to store volume level for.
+	 * @param[in] volume - volume level to be stored for user.
+	 */
+	void storeSpeakerVolume(const LLUUID& speaker_id, F32 volume);
+
+	/**
+	 * Gets stored volume level for specified speaker
+	 *
+	 * @param[in] speaker_id - LLUUID of user to retrieve volume level for.
+	 * @param[out] volume - set to stored volume if found, otherwise unmodified.
+	 * @return - true if a stored volume is found.
+	 */
+	bool getSpeakerVolume(const LLUUID& speaker_id, F32& volume);
+
+	/**
+	 * Removes stored volume level for specified user.
+	 *
+	 * @param[in] speaker_id - LLUUID of user to remove.
+	 */
+	void removeSpeakerVolume(const LLUUID& speaker_id);
+
+private:
+	friend class LLSingleton<LLSpeakerVolumeStorage>;
+	LLSpeakerVolumeStorage();
+	~LLSpeakerVolumeStorage();
+
+	const static std::string SETTINGS_FILE_NAME;
+
+	void load();
+	void save();
+
+	static F32 transformFromLegacyVolume(F32 volume_in);
+	static F32 transformToLegacyVolume(F32 volume_in);
+
+	typedef std::map<LLUUID, F32> speaker_data_map_t;
+	speaker_data_map_t mSpeakersData;
+};
+
+const std::string LLSpeakerVolumeStorage::SETTINGS_FILE_NAME = "volume_settings.xml";
+
+LLSpeakerVolumeStorage::LLSpeakerVolumeStorage()
+{
+	load();
+}
+
+LLSpeakerVolumeStorage::~LLSpeakerVolumeStorage()
+{
+	save();
+}
+
+void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 volume)
+{
+	if ((volume >= LLVoiceClient::VOLUME_MIN) && (volume <= LLVoiceClient::VOLUME_MAX))
+	{
+		mSpeakersData[speaker_id] = volume;
+
+		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+		// LL_DEBUGS("Voice") << "Stored volume = " << volume <<  " for " << id << LL_ENDL;
+	}
+	else
+	{
+		LL_WARNS("Voice") << "Attempted to store out of range volume " << volume << " for " << speaker_id << LL_ENDL;
+		llassert(0);
+	}
+}
+
+bool LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id, F32& volume)
+{
+	speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id);
+	
+	if (it != mSpeakersData.end())
+	{
+		volume = it->second;
+
+		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+		// LL_DEBUGS("Voice") << "Retrieved stored volume = " << volume <<  " for " << id << LL_ENDL;
+
+		return true;
+	}
+
+	return false;
+}
+
+void LLSpeakerVolumeStorage::removeSpeakerVolume(const LLUUID& speaker_id)
+{
+	mSpeakersData.erase(speaker_id);
+
+	// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+	// LL_DEBUGS("Voice") << "Removing stored volume for  " << id << LL_ENDL;
+}
+
+/* static */ F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in)
+{
+	// Convert to linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+	// from legacy characteristic composed of two square-curves
+	// that intersect at volume_in = 0.5, volume_out = 0.56
+
+	F32 volume_out = 0.f;
+	volume_in = llclamp(volume_in, 0.f, 1.0f);
+
+	if (volume_in <= 0.5f)
+	{
+		volume_out = volume_in * volume_in * 4.f * 0.56f;
+	}
+	else
+	{
+		volume_out = (1.f - 0.56f) * (4.f * volume_in * volume_in - 1.f) / 3.f + 0.56f;
+	}
+
+	return volume_out;
+}
+
+/* static */ F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in)
+{
+	// Convert from linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+	// to legacy characteristic composed of two square-curves
+	// that intersect at volume_in = 0.56, volume_out = 0.5
+
+	F32 volume_out = 0.f;
+	volume_in = llclamp(volume_in, 0.f, 1.0f);
+
+	if (volume_in <= 0.56f)
+	{
+		volume_out = sqrt(volume_in / (4.f * 0.56f));
+	}
+	else
+	{
+		volume_out = sqrt((3.f * (volume_in - 0.56f) / (1.f - 0.56f) + 1.f) / 4.f);
+	}
+
+	return volume_out;
+}
+
+void LLSpeakerVolumeStorage::load()
+{
+	// load per-resident voice volume information
+	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
+
+	LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL;
+
+	LLSD settings_llsd;
+	llifstream file;
+	file.open(filename);
+	if (file.is_open())
+	{
+		LLSDSerialize::fromXML(settings_llsd, file);
+	}
+
+	for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
+		iter != settings_llsd.endMap(); ++iter)
+	{
+		// Maintain compatibility with 1.23 non-linear saved volume levels
+		F32 volume = transformFromLegacyVolume((F32)iter->second.asReal());
+
+		storeSpeakerVolume(LLUUID(iter->first), volume);
+	}
+}
+
+void LLSpeakerVolumeStorage::save()
+{
+	// If we quit from the login screen we will not have an SL account
+	// name.  Don't try to save, otherwise we'll dump a file in
+	// C:\Program Files\SecondLife\ or similar. JC
+	std::string user_dir = gDirUtilp->getLindenUserDir();
+	if (!user_dir.empty())
+	{
+		std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
+		LLSD settings_llsd;
+
+		LL_INFOS("Voice") << "Saving stored speaker volumes to: " << filename << LL_ENDL;
+
+		for(speaker_data_map_t::const_iterator iter = mSpeakersData.begin(); iter != mSpeakersData.end(); ++iter)
+		{
+			// Maintain compatibility with 1.23 non-linear saved volume levels
+			F32 volume = transformToLegacyVolume(iter->second);
+
+			settings_llsd[iter->first.asString()] = volume;
+		}
+
+		llofstream file;
+		file.open(filename);
+		LLSDSerialize::toPrettyXML(settings_llsd, file);
+	}
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+LLVoiceClient::LLVoiceClient() :
+	mState(stateDisabled),
+	mSessionTerminateRequested(false),
+	mRelogRequested(false),
+	mConnected(false),
+	mPump(NULL),
+	mSpatialJoiningNum(0),
+	
+	mTuningMode(false),
+	mTuningEnergy(0.0f),
+	mTuningMicVolume(0),
+	mTuningMicVolumeDirty(true),
+	mTuningSpeakerVolume(0),
+	mTuningSpeakerVolumeDirty(true),
+	mTuningExitState(stateDisabled),
+	
+	mAreaVoiceDisabled(false),
+	mAudioSession(NULL),
+	mAudioSessionChanged(false),
+	mNextAudioSession(NULL),
+	
+	mCurrentParcelLocalID(0),
+	mNumberOfAliases(0),
+	mCommandCookie(0),
+	mLoginRetryCount(0),
+	
+	mBuddyListMapPopulated(false),
+	mBlockRulesListReceived(false),
+	mAutoAcceptRulesListReceived(false),
+	mCaptureDeviceDirty(false),
+	mRenderDeviceDirty(false),
+	mSpatialCoordsDirty(false),
+
+	mPTTDirty(true),
+	mPTT(true),
+	mUsePTT(true),
+	mPTTIsMiddleMouse(false),
+	mPTTKey(0),
+	mPTTIsToggle(false),
+	mUserPTTState(false),
+	mMuteMic(false),
+	mFriendsListDirty(true),
+	
+	mEarLocation(0),
+	mSpeakerVolumeDirty(true),
+	mSpeakerMuteDirty(true),
+	mMicVolume(0),
+	mMicVolumeDirty(true),
+	
+	mVoiceEnabled(false),
+	mWriteInProgress(false),
+	
+	mLipSyncEnabled(false)
+{	
+	gVoiceClient = this;
+	
+	mAPIVersion = LLTrans::getString("NotConnected");
+
+	mSpeakerVolume = scale_speaker_volume(0);
+	
+#if LL_DARWIN || LL_LINUX || LL_SOLARIS
+		// HACK: THIS DOES NOT BELONG HERE
+		// When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
+		// This should cause us to ignore SIGPIPE and handle the error through proper channels.
+		// This should really be set up elsewhere.  Where should it go?
+		signal(SIGPIPE, SIG_IGN);
+		
+		// Since we're now launching the gateway with fork/exec instead of system(), we need to deal with zombie processes.
+		// Ignoring SIGCHLD should prevent zombies from being created.  Alternately, we could use wait(), but I'd rather not do that.
+		signal(SIGCHLD, SIG_IGN);
+#endif
+
+	// set up state machine
+	setState(stateDisabled);
+	
+	gIdleCallbacks.addFunction(idle, this);
+}
+
+//---------------------------------------------------
+
+LLVoiceClient::~LLVoiceClient()
+{
+}
+
+//----------------------------------------------
+
+void LLVoiceClient::init(LLPumpIO *pump)
+{
+	// constructor will set up gVoiceClient
+	LLVoiceClient::getInstance()->mPump = pump;
+	LLVoiceClient::getInstance()->updateSettings();
+}
+
+void LLVoiceClient::terminate()
+{
+	if(gVoiceClient)
+	{
+//		gVoiceClient->leaveAudioSession();
+		gVoiceClient->logout();
+		// As of SDK version 4885, this should no longer be necessary.  It will linger after the socket close if it needs to.
+		// ms_sleep(2000);
+		gVoiceClient->connectorShutdown();
+		gVoiceClient->closeSocket();		// Need to do this now -- bad things happen if the destructor does it later.
+		
+		// This will do unpleasant things on windows.
+//		killGateway();
+		
+		// Don't do this anymore -- LLSingleton will take care of deleting the object.		
+//		delete gVoiceClient;
+		
+		// Hint to other code not to access the voice client anymore.
+		gVoiceClient = NULL;
+	}
+}
+
+//---------------------------------------------------
+
+void LLVoiceClient::updateSettings()
+{
+	setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
+	setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
+	std::string keyString = gSavedSettings.getString("PushToTalkButton");
+	setPTTKey(keyString);
+	setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
+	setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
+
+	std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
+	setCaptureDevice(inputDevice);
+	std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
+	setRenderDevice(outputDevice);
+	F32 mic_level = gSavedSettings.getF32("AudioLevelMic");
+	setMicGain(mic_level);
+	setLipSyncEnabled(gSavedSettings.getBOOL("LipSyncEnabled"));
+}
+
+/////////////////////////////
+// utility functions
+
+bool LLVoiceClient::writeString(const std::string &str)
+{
+	bool result = false;
+	if(mConnected)
+	{
+		apr_status_t err;
+		apr_size_t size = (apr_size_t)str.size();
+		apr_size_t written = size;
+	
+		//MARK: Turn this on to log outgoing XML
+//		LL_DEBUGS("Voice") << "sending: " << str << LL_ENDL;
+
+		// check return code - sockets will fail (broken, etc.)
+		err = apr_socket_send(
+				mSocket->getSocket(),
+				(const char*)str.data(),
+				&written);
+		
+		if(err == 0)
+		{
+			// Success.
+			result = true;
+		}
+		// TODO: handle partial writes (written is number of bytes written)
+		// Need to set socket to non-blocking before this will work.
+//		else if(APR_STATUS_IS_EAGAIN(err))
+//		{
+//			// 
+//		}
+		else
+		{
+			// Assume any socket error means something bad.  For now, just close the socket.
+			char buf[MAX_STRING];
+			LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
+			daemonDied();
+		}
+	}
+		
+	return result;
+}
+
+
+/////////////////////////////
+// session control messages
+void LLVoiceClient::connectorCreate()
+{
+	std::ostringstream stream;
+	std::string logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
+	std::string loglevel = "0";
+	
+	// Transition to stateConnectorStarted when the connector handle comes back.
+	setState(stateConnectorStarting);
+
+	std::string savedLogLevel = gSavedSettings.getString("VivoxDebugLevel");
+		
+	if(savedLogLevel != "-1")
+	{
+		LL_DEBUGS("Voice") << "creating connector with logging enabled" << LL_ENDL;
+		loglevel = "10";
+	}
+	
+	stream 
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
+		<< "<ClientName>V2 SDK</ClientName>"
+		<< "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
+		<< "<Mode>Normal</Mode>"
+		<< "<Logging>"
+			<< "<Folder>" << logpath << "</Folder>"
+			<< "<FileNamePrefix>Connector</FileNamePrefix>"
+			<< "<FileNameSuffix>.log</FileNameSuffix>"
+			<< "<LogLevel>" << loglevel << "</LogLevel>"
+		<< "</Logging>"
+		<< "<Application>SecondLifeViewer.1</Application>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::connectorShutdown()
+{
+	setState(stateConnectorStopping);
+	
+	if(!mConnectorHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.InitiateShutdown.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+		
+		mConnectorHandle.clear();
+		
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::userAuthorized(const std::string& firstName, const std::string& lastName, const LLUUID &agentID)
+{
+	mAccountFirstName = firstName;
+	mAccountLastName = lastName;
+
+	mAccountDisplayName = firstName;
+	mAccountDisplayName += " ";
+	mAccountDisplayName += lastName;
+
+	LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
+
+	sConnectingToAgni = LLViewerLogin::getInstance()->isInProductionGrid();
+
+	mAccountName = nameFromID(agentID);
+}
+
+void LLVoiceClient::requestVoiceAccountProvision(S32 retries)
+{
+	if ( gAgent.getRegion() && mVoiceEnabled )
+	{
+		std::string url = 
+			gAgent.getRegion()->getCapability(
+				"ProvisionVoiceAccountRequest");
+
+		if ( url == "" ) return;
+
+		LLHTTPClient::post(
+			url,
+			LLSD(),
+			new LLViewerVoiceAccountProvisionResponder(retries));
+	}
+}
+
+void LLVoiceClient::login(
+	const std::string& account_name,
+	const std::string& password,
+	const std::string& voice_sip_uri_hostname,
+	const std::string& voice_account_server_uri)
+{
+	mVoiceSIPURIHostName = voice_sip_uri_hostname;
+	mVoiceAccountServerURI = voice_account_server_uri;
+
+	if(!mAccountHandle.empty())
+	{
+		// Already logged in.
+		LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
+		
+		// Don't process another login.
+		return;
+	}
+	else if ( account_name != mAccountName )
+	{
+		//TODO: error?
+		LL_WARNS("Voice") << "Wrong account name! " << account_name
+				<< " instead of " << mAccountName << LL_ENDL;
+	}
+	else
+	{
+		mAccountPassword = password;
+	}
+
+	std::string debugSIPURIHostName = gSavedSettings.getString("VivoxDebugSIPURIHostName");
+	
+	if( !debugSIPURIHostName.empty() )
+	{
+		mVoiceSIPURIHostName = debugSIPURIHostName;
+	}
+	
+	if( mVoiceSIPURIHostName.empty() )
+	{
+		// we have an empty account server name
+		// so we fall back to hardcoded defaults
+
+		if(sConnectingToAgni)
+		{
+			// Use the release account server
+			mVoiceSIPURIHostName = "bhr.vivox.com";
+		}
+		else
+		{
+			// Use the development account server
+			mVoiceSIPURIHostName = "bhd.vivox.com";
+		}
+	}
+	
+	std::string debugAccountServerURI = gSavedSettings.getString("VivoxDebugVoiceAccountServerURI");
+
+	if( !debugAccountServerURI.empty() )
+	{
+		mVoiceAccountServerURI = debugAccountServerURI;
+	}
+	
+	if( mVoiceAccountServerURI.empty() )
+	{
+		// If the account server URI isn't specified, construct it from the SIP URI hostname
+		mVoiceAccountServerURI = "https://www." + mVoiceSIPURIHostName + "/api2/";		
+	}
+}
+
+void LLVoiceClient::idle(void* user_data)
+{
+	LLVoiceClient* self = (LLVoiceClient*)user_data;
+	self->stateMachine();
+}
+
+std::string LLVoiceClient::state2string(LLVoiceClient::state inState)
+{
+	std::string result = "UNKNOWN";
+	
+		// Prevent copy-paste errors when updating this list...
+#define CASE(x)  case x:  result = #x;  break
+
+	switch(inState)
+	{
+		CASE(stateDisableCleanup);
+		CASE(stateDisabled);
+		CASE(stateStart);
+		CASE(stateDaemonLaunched);
+		CASE(stateConnecting);
+		CASE(stateConnected);
+		CASE(stateIdle);
+		CASE(stateMicTuningStart);
+		CASE(stateMicTuningRunning);
+		CASE(stateMicTuningStop);
+		CASE(stateConnectorStart);
+		CASE(stateConnectorStarting);
+		CASE(stateConnectorStarted);
+		CASE(stateLoginRetry);
+		CASE(stateLoginRetryWait);
+		CASE(stateNeedsLogin);
+		CASE(stateLoggingIn);
+		CASE(stateLoggedIn);
+		CASE(stateCreatingSessionGroup);
+		CASE(stateNoChannel);
+		CASE(stateJoiningSession);
+		CASE(stateSessionJoined);
+		CASE(stateRunning);
+		CASE(stateLeavingSession);
+		CASE(stateSessionTerminated);
+		CASE(stateLoggingOut);
+		CASE(stateLoggedOut);
+		CASE(stateConnectorStopping);
+		CASE(stateConnectorStopped);
+		CASE(stateConnectorFailed);
+		CASE(stateConnectorFailedWaiting);
+		CASE(stateLoginFailed);
+		CASE(stateLoginFailedWaiting);
+		CASE(stateJoinSessionFailed);
+		CASE(stateJoinSessionFailedWaiting);
+		CASE(stateJail);
+	}
+
+#undef CASE
+	
+	return result;
+}
+
+std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus)
+{
+	std::string result = "UNKNOWN";
+	
+		// Prevent copy-paste errors when updating this list...
+#define CASE(x)  case x:  result = #x;  break
+
+	switch(inStatus)
+	{
+		CASE(STATUS_LOGIN_RETRY);
+		CASE(STATUS_LOGGED_IN);
+		CASE(STATUS_JOINING);
+		CASE(STATUS_JOINED);
+		CASE(STATUS_LEFT_CHANNEL);
+		CASE(STATUS_VOICE_DISABLED);
+		CASE(STATUS_VOICE_ENABLED);
+		CASE(BEGIN_ERROR_STATUS);
+		CASE(ERROR_CHANNEL_FULL);
+		CASE(ERROR_CHANNEL_LOCKED);
+		CASE(ERROR_NOT_AVAILABLE);
+		CASE(ERROR_UNKNOWN);
+	default:
+		break;
+	}
+
+#undef CASE
+	
+	return result;
+}
+
+void LLVoiceClient::setState(state inState)
+{
+	LL_DEBUGS("Voice") << "entering state " << state2string(inState) << LL_ENDL;
+	
+	mState = inState;
+}
+
+void LLVoiceClient::stateMachine()
+{
+	if(gDisconnected)
+	{
+		// The viewer has been disconnected from the sim.  Disable voice.
+		setVoiceEnabled(false);
+	}
+	
+	if(mVoiceEnabled)
+	{
+		updatePosition();
+	}
+	else if(mTuningMode)
+	{
+		// Tuning mode is special -- it needs to launch SLVoice even if voice is disabled.
+	}
+	else
+	{
+		if((getState() != stateDisabled) && (getState() != stateDisableCleanup))
+		{
+			// User turned off voice support.  Send the cleanup messages, close the socket, and reset.
+			if(!mConnected)
+			{
+				// if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill.
+				LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL;
+				killGateway();
+			}
+			
+			logout();
+			connectorShutdown();
+			
+			setState(stateDisableCleanup);
+		}
+	}
+	
+	// Check for parcel boundary crossing
+	{
+		LLViewerRegion *region = gAgent.getRegion();
+		LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+		
+		if(region && parcel)
+		{
+			S32 parcelLocalID = parcel->getLocalID();
+			std::string regionName = region->getName();
+			std::string capURI = region->getCapability("ParcelVoiceInfoRequest");
+		
+//			LL_DEBUGS("Voice") << "Region name = \"" << regionName << "\", parcel local ID = " << parcelLocalID << ", cap URI = \"" << capURI << "\"" << LL_ENDL;
+
+			// The region name starts out empty and gets filled in later.  
+			// Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
+			// If either is empty, wait for the next time around.
+			if(!regionName.empty())
+			{
+				if(!capURI.empty())
+				{
+					if((parcelLocalID != mCurrentParcelLocalID) || (regionName != mCurrentRegionName))
+					{
+						// We have changed parcels.  Initiate a parcel channel lookup.
+						mCurrentParcelLocalID = parcelLocalID;
+						mCurrentRegionName = regionName;
+						
+						parcelChanged();
+					}
+				}
+				else
+				{
+					LL_WARNS_ONCE("Voice") << "region doesn't have ParcelVoiceInfoRequest capability.  This is normal for a short time after teleporting, but bad if it persists for very long." << LL_ENDL;
+				}
+			}
+		}
+	}
+
+	switch(getState())
+	{
+		//MARK: stateDisableCleanup
+		case stateDisableCleanup:
+			// Clean up and reset everything. 
+			closeSocket();
+			deleteAllSessions();
+			deleteAllBuddies();		
+			
+			mConnectorHandle.clear();
+			mAccountHandle.clear();
+			mAccountPassword.clear();
+			mVoiceAccountServerURI.clear();
+			
+			setState(stateDisabled);	
+		break;
+		
+		//MARK: stateDisabled
+		case stateDisabled:
+			if(mTuningMode || (mVoiceEnabled && !mAccountName.empty()))
+			{
+				setState(stateStart);
+			}
+		break;
+		
+		//MARK: stateStart
+		case stateStart:
+			if(gSavedSettings.getBOOL("CmdLineDisableVoice"))
+			{
+				// Voice is locked out, we must not launch the vivox daemon.
+				setState(stateJail);
+			}
+			else if(!isGatewayRunning())
+			{
+				if(true)
+				{
+					// Launch the voice daemon
+					
+					// *FIX:Mani - Using the executable dir instead 
+					// of mAppRODataDir, the working directory from which the app
+					// is launched.
+					//std::string exe_path = gDirUtilp->getAppRODataDir();
+					std::string exe_path = gDirUtilp->getExecutableDir();
+					exe_path += gDirUtilp->getDirDelimiter();
+#if LL_WINDOWS
+					exe_path += "SLVoice.exe";
+#elif LL_DARWIN
+					exe_path += "../Resources/SLVoice";
+#else
+					exe_path += "SLVoice";
+#endif
+					// See if the vivox executable exists
+					llstat s;
+					if(!LLFile::stat(exe_path, &s))
+					{
+						// vivox executable exists.  Build the command line and launch the daemon.
+						// SLIM SDK: these arguments are no longer necessary.
+//						std::string args = " -p tcp -h -c";
+						std::string args;
+						std::string loglevel = gSavedSettings.getString("VivoxDebugLevel");
+						
+						if(loglevel.empty())
+						{
+							loglevel = "-1";	// turn logging off completely
+						}
+						
+						args += " -ll ";
+						args += loglevel;
+						
+						LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL;
+
+#if LL_WINDOWS
+						PROCESS_INFORMATION pinfo;
+						STARTUPINFOW sinfo;
+						memset(&sinfo, 0, sizeof(sinfo));
+
+						std::string exe_dir = gDirUtilp->getExecutableDir();
+
+						llutf16string exe_path16 = utf8str_to_utf16str(exe_path);
+						llutf16string exe_dir16 = utf8str_to_utf16str(exe_dir);
+						llutf16string args16 = utf8str_to_utf16str(args);
+						// Create a writeable copy to keep Windows happy.
+						U16 *argscpy_16 = new U16[args16.size() + 1];
+						wcscpy_s(argscpy_16,args16.size()+1,args16.c_str());
+						if(!CreateProcessW(exe_path16.c_str(), argscpy_16, NULL, NULL, FALSE, 0, NULL, exe_dir16.c_str(), &sinfo, &pinfo))
+						{
+//							DWORD dwErr = GetLastError();
+						}
+						else
+						{
+							// foo = pinfo.dwProcessId; // get your pid here if you want to use it later on
+							// CloseHandle(pinfo.hProcess); // stops leaks - nothing else
+							sGatewayHandle = pinfo.hProcess;
+							CloseHandle(pinfo.hThread); // stops leaks - nothing else
+						}		
+						
+						delete[] argscpy_16;
+#else	// LL_WINDOWS
+						// This should be the same for mac and linux
+						{
+							std::vector<std::string> arglist;
+							arglist.push_back(exe_path);
+							
+							// Split the argument string into separate strings for each argument
+							typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+							boost::char_separator<char> sep(" ");
+							tokenizer tokens(args, sep);
+							tokenizer::iterator token_iter;
+
+							for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
+							{
+								arglist.push_back(*token_iter);
+							}
+							
+							// create an argv vector for the child process
+							char **fakeargv = new char*[arglist.size() + 1];
+							int i;
+							for(i=0; i < arglist.size(); i++)
+								fakeargv[i] = const_cast<char*>(arglist[i].c_str());
+
+							fakeargv[i] = NULL;
+							
+							fflush(NULL); // flush all buffers before the child inherits them
+							pid_t id = vfork();
+							if(id == 0)
+							{
+								// child
+								execv(exe_path.c_str(), fakeargv);
+								
+								// If we reach this point, the exec failed.
+								// Use _exit() instead of exit() per the vfork man page.
+								_exit(0);
+							}
+
+							// parent
+							delete[] fakeargv;
+							sGatewayPID = id;
+						}
+#endif	// LL_WINDOWS
+						mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost").c_str(), gSavedSettings.getU32("VoicePort"));
+					}	
+					else
+					{
+						LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL;
+					}	
+				}
+				else
+				{		
+					// SLIM SDK: port changed from 44124 to 44125.
+					// We can connect to a client gateway running on another host.  This is useful for testing.
+					// To do this, launch the gateway on a nearby host like this:
+					//  vivox-gw.exe -p tcp -i 0.0.0.0:44125
+					// and put that host's IP address here.
+					mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost"), gSavedSettings.getU32("VoicePort"));
+				}
+
+				mUpdateTimer.start();
+				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
+
+				setState(stateDaemonLaunched);
+				
+				// Dirty the states we'll need to sync with the daemon when it comes up.
+				mPTTDirty = true;
+				mMicVolumeDirty = true;
+				mSpeakerVolumeDirty = true;
+				mSpeakerMuteDirty = true;
+				// These only need to be set if they're not default (i.e. empty string).
+				mCaptureDeviceDirty = !mCaptureDevice.empty();
+				mRenderDeviceDirty = !mRenderDevice.empty();
+				
+				mMainSessionGroupHandle.clear();
+			}
+		break;
+
+		//MARK: stateDaemonLaunched
+		case stateDaemonLaunched:
+			if(mUpdateTimer.hasExpired())
+			{
+				LL_DEBUGS("Voice") << "Connecting to vivox daemon" << LL_ENDL;
+
+				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
+
+				if(!mSocket)
+				{
+					mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);	
+				}
+				
+				mConnected = mSocket->blockingConnect(mDaemonHost);
+				if(mConnected)
+				{
+					setState(stateConnecting);
+				}
+				else
+				{
+					// If the connect failed, the socket may have been put into a bad state.  Delete it.
+					closeSocket();
+				}
+			}
+		break;
+
+		//MARK: stateConnecting
+		case stateConnecting:
+		// Can't do this until we have the pump available.
+		if(mPump)
+		{
+			// MBW -- Note to self: pumps and pipes examples in
+			//  indra/test/io.cpp
+			//  indra/test/llpipeutil.{cpp|h}
+
+			// Attach the pumps and pipes
+				
+			LLPumpIO::chain_t readChain;
+
+			readChain.push_back(LLIOPipe::ptr_t(new LLIOSocketReader(mSocket)));
+			readChain.push_back(LLIOPipe::ptr_t(new LLVivoxProtocolParser()));
+
+			mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS);
+
+			setState(stateConnected);
+		}
+
+		break;
+		
+		//MARK: stateConnected
+		case stateConnected:
+			// Initial devices query
+			getCaptureDevicesSendMessage();
+			getRenderDevicesSendMessage();
+
+			mLoginRetryCount = 0;
+
+			setState(stateIdle);
+		break;
+
+		//MARK: stateIdle
+		case stateIdle:
+			// This is the idle state where we're connected to the daemon but haven't set up a connector yet.
+			if(mTuningMode)
+			{
+				mTuningExitState = stateIdle;
+				setState(stateMicTuningStart);
+			}
+			else if(!mVoiceEnabled)
+			{
+				// We never started up the connector.  This will shut down the daemon.
+				setState(stateConnectorStopped);
+			}
+			else if(!mAccountName.empty())
+			{
+				LLViewerRegion *region = gAgent.getRegion();
+				
+				if(region)
+				{
+					if ( region->getCapability("ProvisionVoiceAccountRequest") != "" )
+					{
+						if ( mAccountPassword.empty() )
+						{
+							requestVoiceAccountProvision();
+						}
+						setState(stateConnectorStart);
+					}
+					else
+					{
+						LL_WARNS_ONCE("Voice") << "region doesn't have ProvisionVoiceAccountRequest capability!" << LL_ENDL;
+					}
+				}
+			}
+		break;
+
+		//MARK: stateMicTuningStart
+		case stateMicTuningStart:
+			if(mUpdateTimer.hasExpired())
+			{
+				if(mCaptureDeviceDirty || mRenderDeviceDirty)
+				{
+					// These can't be changed while in tuning mode.  Set them before starting.
+					std::ostringstream stream;
+					
+					buildSetCaptureDevice(stream);
+					buildSetRenderDevice(stream);
+
+					if(!stream.str().empty())
+					{
+						writeString(stream.str());
+					}				
+
+					// This will come around again in the same state and start the capture, after the timer expires.
+					mUpdateTimer.start();
+					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+				}
+				else
+				{
+					// duration parameter is currently unused, per Mike S.
+					tuningCaptureStartSendMessage(10000);
+
+					setState(stateMicTuningRunning);
+				}
+			}
+			
+		break;
+		
+		//MARK: stateMicTuningRunning
+		case stateMicTuningRunning:
+			if(!mTuningMode || mCaptureDeviceDirty || mRenderDeviceDirty)
+			{
+				// All of these conditions make us leave tuning mode.
+				setState(stateMicTuningStop);
+			}
+			else
+			{
+				// process mic/speaker volume changes
+				if(mTuningMicVolumeDirty || mTuningSpeakerVolumeDirty)
+				{
+					std::ostringstream stream;
+					
+					if(mTuningMicVolumeDirty)
+					{
+						LL_INFOS("Voice") << "setting tuning mic level to " << mTuningMicVolume << LL_ENDL;
+						stream
+						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetMicLevel.1\">"
+						<< "<Level>" << mTuningMicVolume << "</Level>"
+						<< "</Request>\n\n\n";
+					}
+					
+					if(mTuningSpeakerVolumeDirty)
+					{
+						stream
+						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">"
+						<< "<Level>" << mTuningSpeakerVolume << "</Level>"
+						<< "</Request>\n\n\n";
+					}
+					
+					mTuningMicVolumeDirty = false;
+					mTuningSpeakerVolumeDirty = false;
+
+					if(!stream.str().empty())
+					{
+						writeString(stream.str());
+					}
+				}
+			}
+		break;
+		
+		//MARK: stateMicTuningStop
+		case stateMicTuningStop:
+		{
+			// transition out of mic tuning
+			tuningCaptureStopSendMessage();
+			
+			setState(mTuningExitState);
+			
+			// if we exited just to change devices, this will keep us from re-entering too fast.
+			mUpdateTimer.start();
+			mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+			
+		}
+		break;
+												
+		//MARK: stateConnectorStart
+		case stateConnectorStart:
+			if(!mVoiceEnabled)
+			{
+				// We were never logged in.  This will shut down the connector.
+				setState(stateLoggedOut);
+			}
+			else if(!mVoiceAccountServerURI.empty())
+			{
+				connectorCreate();
+			}
+		break;
+		
+		//MARK: stateConnectorStarting
+		case stateConnectorStarting:	// waiting for connector handle
+			// connectorCreateResponse() will transition from here to stateConnectorStarted.
+		break;
+		
+		//MARK: stateConnectorStarted
+		case stateConnectorStarted:		// connector handle received
+			if(!mVoiceEnabled)
+			{
+				// We were never logged in.  This will shut down the connector.
+				setState(stateLoggedOut);
+			}
+			else
+			{
+				// The connector is started.  Send a login message.
+				setState(stateNeedsLogin);
+			}
+		break;
+				
+		//MARK: stateLoginRetry
+		case stateLoginRetry:
+			if(mLoginRetryCount == 0)
+			{
+				// First retry -- display a message to the user
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGIN_RETRY);
+			}
+			
+			mLoginRetryCount++;
+			
+			if(mLoginRetryCount > MAX_LOGIN_RETRIES)
+			{
+				LL_WARNS("Voice") << "too many login retries, giving up." << LL_ENDL;
+				setState(stateLoginFailed);
+			}
+			else
+			{
+				LL_INFOS("Voice") << "will retry login in " << LOGIN_RETRY_SECONDS << " seconds." << LL_ENDL;
+				mUpdateTimer.start();
+				mUpdateTimer.setTimerExpirySec(LOGIN_RETRY_SECONDS);
+				setState(stateLoginRetryWait);
+			}
+		break;
+		
+		//MARK: stateLoginRetryWait
+		case stateLoginRetryWait:
+			if(mUpdateTimer.hasExpired())
+			{
+				setState(stateNeedsLogin);
+			}
+		break;
+		
+		//MARK: stateNeedsLogin
+		case stateNeedsLogin:
+			if(!mAccountPassword.empty())
+			{
+				setState(stateLoggingIn);
+				loginSendMessage();
+			}		
+		break;
+		
+		//MARK: stateLoggingIn
+		case stateLoggingIn:			// waiting for account handle
+			// loginResponse() will transition from here to stateLoggedIn.
+		break;
+		
+		//MARK: stateLoggedIn
+		case stateLoggedIn:				// account handle received
+
+			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN);
+
+			// request the current set of block rules (we'll need them when updating the friends list)
+			accountListBlockRulesSendMessage();
+			
+			// request the current set of auto-accept rules
+			accountListAutoAcceptRulesSendMessage();
+			
+			// Set up the mute list observer if it hasn't been set up already.
+			if((!sMuteListListener_listening))
+			{
+				LLMuteList::getInstance()->addObserver(&mutelist_listener);
+				sMuteListListener_listening = true;
+			}
+
+			// Set up the friends list observer if it hasn't been set up already.
+			if(friendslist_listener == NULL)
+			{
+				friendslist_listener = new LLVoiceClientFriendsObserver;
+				LLAvatarTracker::instance().addObserver(friendslist_listener);
+			}
+			
+			// Set the initial state of mic mute, local speaker volume, etc.
+			{
+				std::ostringstream stream;
+				
+				buildLocalAudioUpdates(stream);
+				
+				if(!stream.str().empty())
+				{
+					writeString(stream.str());
+				}
+			}
+			
+#if USE_SESSION_GROUPS			
+			// create the main session group
+			sessionGroupCreateSendMessage();
+			
+			setState(stateCreatingSessionGroup);
+#else
+			// Not using session groups -- skip the stateCreatingSessionGroup state.
+			setState(stateNoChannel);
+
+			// Initial kick-off of channel lookup logic
+			parcelChanged();		
+#endif
+		break;
+		
+		//MARK: stateCreatingSessionGroup
+		case stateCreatingSessionGroup:
+			if(mSessionTerminateRequested || !mVoiceEnabled)
+			{
+				// TODO: Question: is this the right way out of this state
+				setState(stateSessionTerminated);
+			}
+			else if(!mMainSessionGroupHandle.empty())
+			{
+				setState(stateNoChannel);
+				
+				// Start looped recording (needed for "panic button" anti-griefing tool)
+				recordingLoopStart();
+
+				// Initial kick-off of channel lookup logic
+				parcelChanged();		
+			}
+		break;
+					
+		//MARK: stateNoChannel
+		case stateNoChannel:
+			
+			mSpatialJoiningNum = 0;
+			// Do this here as well as inside sendPositionalUpdate().  
+			// Otherwise, if you log in but don't join a proximal channel (such as when your login location has voice disabled), your friends list won't sync.
+			sendFriendsListUpdates();
+			
+			if(mSessionTerminateRequested || !mVoiceEnabled)
+			{
+				// TODO: Question: Is this the right way out of this state?
+				setState(stateSessionTerminated);
+			}
+			else if(mTuningMode)
+			{
+				mTuningExitState = stateNoChannel;
+				setState(stateMicTuningStart);
+			}
+			else if(sessionNeedsRelog(mNextAudioSession))
+			{
+				requestRelog();
+				setState(stateSessionTerminated);
+			}
+			else if(mNextAudioSession)
+			{				
+				sessionState *oldSession = mAudioSession;
+
+				mAudioSession = mNextAudioSession;
+				if(!mAudioSession->mReconnect)	
+				{
+					mNextAudioSession = NULL;
+				}
+				
+				// The old session may now need to be deleted.
+				reapSession(oldSession);
+				
+				if(!mAudioSession->mHandle.empty())
+				{
+					// Connect to a session by session handle
+
+					sessionMediaConnectSendMessage(mAudioSession);
+				}
+				else
+				{
+					// Connect to a session by URI
+					sessionCreateSendMessage(mAudioSession, true, false);
+				}
+
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINING);
+				setState(stateJoiningSession);
+			}
+			else if(!mSpatialSessionURI.empty())
+			{
+				// If we're not headed elsewhere and have a spatial URI, return to spatial.
+				switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
+			}
+		break;
+
+		//MARK: stateJoiningSession
+		case stateJoiningSession:		// waiting for session handle
+
+			// If this is true we have problem with connection to voice server (EXT-4313).
+			// See descriptions of mSpatialJoiningNum and MAX_NORMAL_JOINING_SPATIAL_NUM.
+			if(mSpatialJoiningNum == MAX_NORMAL_JOINING_SPATIAL_NUM) 
+			{
+				// Notify observers to let them know there is problem with voice
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
+				llwarns << "There seems to be problem with connection to voice server. Disabling voice chat abilities." << llendl;
+			}
+
+			// Increase mSpatialJoiningNum only for spatial sessions- it's normal to reach this case for
+			// example for p2p many times while waiting for response, so it can't be used to detect errors
+			if(mAudioSession && mAudioSession->mIsSpatial)
+			{
+				mSpatialJoiningNum++;
+			}
+			
+			// joinedAudioSession() will transition from here to stateSessionJoined.
+			if(!mVoiceEnabled)
+			{
+				// User bailed out during connect -- jump straight to teardown.
+				setState(stateSessionTerminated);
+			}
+			else if(mSessionTerminateRequested)
+			{
+				if(mAudioSession && !mAudioSession->mHandle.empty())
+				{
+					// Only allow direct exits from this state in p2p calls (for cancelling an invite).
+					// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
+					if(mAudioSession->mIsP2P)
+					{
+						sessionMediaDisconnectSendMessage(mAudioSession);
+						setState(stateSessionTerminated);
+					}
+				}
+			}
+		break;
+		
+		//MARK: stateSessionJoined
+		case stateSessionJoined:		// session handle received
+			
+			mSpatialJoiningNum = 0;
+			// It appears that I need to wait for BOTH the SessionGroup.AddSession response and the SessionStateChangeEvent with state 4
+			// before continuing from this state.  They can happen in either order, and if I don't wait for both, things can get stuck.
+			// For now, the SessionGroup.AddSession response handler sets mSessionHandle and the SessionStateChangeEvent handler transitions to stateSessionJoined.
+			// This is a cheap way to make sure both have happened before proceeding.
+			if(mAudioSession && mAudioSession->mVoiceEnabled)
+			{
+				// Dirty state that may need to be sync'ed with the daemon.
+				mPTTDirty = true;
+				mSpeakerVolumeDirty = true;
+				mSpatialCoordsDirty = true;
+				
+				setState(stateRunning);
+				
+				// Start the throttle timer
+				mUpdateTimer.start();
+				mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+
+				// Events that need to happen when a session is joined could go here.
+				// Maybe send initial spatial data?
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
+
+			}
+			else if(!mVoiceEnabled)
+			{
+				// User bailed out during connect -- jump straight to teardown.
+				setState(stateSessionTerminated);
+			}
+			else if(mSessionTerminateRequested)
+			{
+				// Only allow direct exits from this state in p2p calls (for cancelling an invite).
+				// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
+				if(mAudioSession && mAudioSession->mIsP2P)
+				{
+					sessionMediaDisconnectSendMessage(mAudioSession);
+					setState(stateSessionTerminated);
+				}
+			}
+		break;
+		
+		//MARK: stateRunning
+		case stateRunning:				// steady state
+			// Disabling voice or disconnect requested.
+			if(!mVoiceEnabled || mSessionTerminateRequested)
+			{
+				leaveAudioSession();
+			}
+			else
+			{
+				
+				// Figure out whether the PTT state needs to change
+				{
+					bool newPTT;
+					if(mUsePTT)
+					{
+						// If configured to use PTT, track the user state.
+						newPTT = mUserPTTState;
+					}
+					else
+					{
+						// If not configured to use PTT, it should always be true (otherwise the user will be unable to speak).
+						newPTT = true;
+					}
+					
+					if(mMuteMic)
+					{
+						// This always overrides any other PTT setting.
+						newPTT = false;
+					}
+					
+					// Dirty if state changed.
+					if(newPTT != mPTT)
+					{
+						mPTT = newPTT;
+						mPTTDirty = true;
+					}
+				}
+				
+				if(!inSpatialChannel())
+				{
+					// When in a non-spatial channel, never send positional updates.
+					mSpatialCoordsDirty = false;
+				}
+				else
+				{
+					// Do the calculation that enforces the listener<->speaker tether (and also updates the real camera position)
+					enforceTether();
+				}
+				
+				// Send an update only if the ptt or mute state has changed (which shouldn't be able to happen that often
+				// -- the user can only click so fast) or every 10hz, whichever is sooner.
+				// Sending for every volume update causes an excessive flood of messages whenever a volume slider is dragged.
+				if((mAudioSession && mAudioSession->mMuteDirty) || mPTTDirty || mUpdateTimer.hasExpired())
+				{
+					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+					sendPositionalUpdate();
+				}
+			}
+		break;
+		
+		//MARK: stateLeavingSession
+		case stateLeavingSession:		// waiting for terminate session response
+			// The handler for the Session.Terminate response will transition from here to stateSessionTerminated.
+		break;
+
+		//MARK: stateSessionTerminated
+		case stateSessionTerminated:
+			
+			// Must do this first, since it uses mAudioSession.
+			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
+			
+			if(mAudioSession)
+			{
+				sessionState *oldSession = mAudioSession;
+
+				mAudioSession = NULL;
+				// We just notified status observers about this change.  Don't do it again.
+				mAudioSessionChanged = false;
+
+				// The old session may now need to be deleted.
+				reapSession(oldSession);
+			}
+			else
+			{
+				LL_WARNS("Voice") << "stateSessionTerminated with NULL mAudioSession" << LL_ENDL;
+			}
+	
+			// Always reset the terminate request flag when we get here.
+			mSessionTerminateRequested = false;
+
+			if(mVoiceEnabled && !mRelogRequested)
+			{				
+				// Just leaving a channel, go back to stateNoChannel (the "logged in but have no channel" state).
+				setState(stateNoChannel);
+			}
+			else
+			{
+				// Shutting down voice, continue with disconnecting.
+				logout();
+				
+				// The state machine will take it from here
+				mRelogRequested = false;
+			}
+			
+		break;
+		
+		//MARK: stateLoggingOut
+		case stateLoggingOut:			// waiting for logout response
+			// The handler for the AccountLoginStateChangeEvent will transition from here to stateLoggedOut.
+		break;
+		
+		//MARK: stateLoggedOut
+		case stateLoggedOut:			// logout response received
+			
+			// Once we're logged out, all these things are invalid.
+			mAccountHandle.clear();
+			deleteAllSessions();
+			deleteAllBuddies();
+
+			if(mVoiceEnabled && !mRelogRequested)
+			{
+				// User was logged out, but wants to be logged in.  Send a new login request.
+				setState(stateNeedsLogin);
+			}
+			else
+			{
+				// shut down the connector
+				connectorShutdown();
+			}
+		break;
+		
+		//MARK: stateConnectorStopping
+		case stateConnectorStopping:	// waiting for connector stop
+			// The handler for the Connector.InitiateShutdown response will transition from here to stateConnectorStopped.
+		break;
+
+		//MARK: stateConnectorStopped
+		case stateConnectorStopped:		// connector stop received
+			setState(stateDisableCleanup);
+		break;
+
+		//MARK: stateConnectorFailed
+		case stateConnectorFailed:
+			setState(stateConnectorFailedWaiting);
+		break;
+		//MARK: stateConnectorFailedWaiting
+		case stateConnectorFailedWaiting:
+			if(!mVoiceEnabled)
+			{
+				setState(stateDisableCleanup);
+			}
+		break;
+
+		//MARK: stateLoginFailed
+		case stateLoginFailed:
+			setState(stateLoginFailedWaiting);
+		break;
+		//MARK: stateLoginFailedWaiting
+		case stateLoginFailedWaiting:
+			if(!mVoiceEnabled)
+			{
+				setState(stateDisableCleanup);
+			}
+		break;
+
+		//MARK: stateJoinSessionFailed
+		case stateJoinSessionFailed:
+			// Transition to error state.  Send out any notifications here.
+			if(mAudioSession)
+			{
+				LL_WARNS("Voice") << "stateJoinSessionFailed: (" << mAudioSession->mErrorStatusCode << "): " << mAudioSession->mErrorStatusString << LL_ENDL;
+			}
+			else
+			{
+				LL_WARNS("Voice") << "stateJoinSessionFailed with no current session" << LL_ENDL;
+			}
+			
+			notifyStatusObservers(LLVoiceClientStatusObserver::ERROR_UNKNOWN);
+			setState(stateJoinSessionFailedWaiting);
+		break;
+		
+		//MARK: stateJoinSessionFailedWaiting
+		case stateJoinSessionFailedWaiting:
+			// Joining a channel failed, either due to a failed channel name -> sip url lookup or an error from the join message.
+			// Region crossings may leave this state and try the join again.
+			if(mSessionTerminateRequested)
+			{
+				setState(stateSessionTerminated);
+			}
+		break;
+		
+		//MARK: stateJail
+		case stateJail:
+			// We have given up.  Do nothing.
+		break;
+
+	}
+	
+	if(mAudioSession && mAudioSession->mParticipantsChanged)
+	{
+		mAudioSession->mParticipantsChanged = false;
+		mAudioSessionChanged = true;
+	}
+	
+	if(mAudioSessionChanged)
+	{
+		mAudioSessionChanged = false;
+		notifyParticipantObservers();
+	}
+}
+
+void LLVoiceClient::closeSocket(void)
+{
+	mSocket.reset();
+	mConnected = false;	
+}
+
+void LLVoiceClient::loginSendMessage()
+{
+	std::ostringstream stream;
+
+	bool autoPostCrashDumps = gSavedSettings.getBOOL("VivoxAutoPostCrashDumps");
+
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Login.1\">"
+		<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+		<< "<AccountName>" << mAccountName << "</AccountName>"
+		<< "<AccountPassword>" << mAccountPassword << "</AccountPassword>"
+		<< "<AudioSessionAnswerMode>VerifyAnswer</AudioSessionAnswerMode>"
+		<< "<EnableBuddiesAndPresence>true</EnableBuddiesAndPresence>"
+		<< "<BuddyManagementMode>Application</BuddyManagementMode>"
+		<< "<ParticipantPropertyFrequency>5</ParticipantPropertyFrequency>"
+		<< (autoPostCrashDumps?"<AutopostCrashDumps>true</AutopostCrashDumps>":"")
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::logout()
+{
+	// Ensure that we'll re-request provisioning before logging in again
+	mAccountPassword.clear();
+	mVoiceAccountServerURI.clear();
+	
+	setState(stateLoggingOut);
+	logoutSendMessage();
+}
+
+void LLVoiceClient::logoutSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Logout.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		mAccountHandle.clear();
+
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::accountListBlockRulesSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{		
+		std::ostringstream stream;
+
+		LL_DEBUGS("Voice") << "requesting block rules" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListBlockRules.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::accountListAutoAcceptRulesSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{		
+		std::ostringstream stream;
+
+		LL_DEBUGS("Voice") << "requesting auto-accept rules" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListAutoAcceptRules.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::sessionGroupCreateSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{		
+		std::ostringstream stream;
+
+		LL_DEBUGS("Voice") << "creating session group" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Create.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+			<< "<Type>Normal</Type>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::sessionCreateSendMessage(sessionState *session, bool startAudio, bool startText)
+{
+	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
+	
+	session->mCreateInProgress = true;
+	if(startAudio)
+	{
+		session->mMediaConnectInProgress = true;
+	}
+
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"Session.Create.1\">"
+		<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "<URI>" << session->mSIPURI << "</URI>";
+
+	static const std::string allowed_chars =
+				"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+				"0123456789"
+				"-._~";
+
+	if(!session->mHash.empty())
+	{
+		stream
+			<< "<Password>" << LLURI::escape(session->mHash, allowed_chars) << "</Password>"
+			<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>";
+	}
+	
+	stream
+		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+		<< "<Name>" << mChannelName << "</Name>"
+	<< "</Request>\n\n\n";
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio, bool startText)
+{
+	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
+	
+	session->mCreateInProgress = true;
+	if(startAudio)
+	{
+		session->mMediaConnectInProgress = true;
+	}
+	
+	std::string password;
+	if(!session->mHash.empty())
+	{
+		static const std::string allowed_chars =
+					"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+					"0123456789"
+					"-._~"
+					;
+		password = LLURI::escape(session->mHash, allowed_chars);
+	}
+
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"SessionGroup.AddSession.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<URI>" << session->mSIPURI << "</URI>"
+		<< "<Name>" << mChannelName << "</Name>"
+		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+		<< "<Password>" << password << "</Password>"
+		<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>"
+	<< "</Request>\n\n\n"
+	;
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionMediaConnectSendMessage(sessionState *session)
+{
+	LL_DEBUGS("Voice") << "connecting audio to session handle: " << session->mHandle << LL_ENDL;
+
+	session->mMediaConnectInProgress = true;
+	
+	std::ostringstream stream;
+
+	stream
+	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.MediaConnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+		<< "<Media>Audio</Media>"
+	<< "</Request>\n\n\n";
+
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionTextConnectSendMessage(sessionState *session)
+{
+	LL_DEBUGS("Voice") << "connecting text to session handle: " << session->mHandle << LL_ENDL;
+	
+	std::ostringstream stream;
+
+	stream
+	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.TextConnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+	<< "</Request>\n\n\n";
+
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionTerminate()
+{
+	mSessionTerminateRequested = true;
+}
+
+void LLVoiceClient::requestRelog()
+{
+	mSessionTerminateRequested = true;
+	mRelogRequested = true;
+}
+
+
+void LLVoiceClient::leaveAudioSession()
+{
+	if(mAudioSession)
+	{
+		LL_DEBUGS("Voice") << "leaving session: " << mAudioSession->mSIPURI << LL_ENDL;
+
+		switch(getState())
+		{
+			case stateNoChannel:
+				// In this case, we want to pretend the join failed so our state machine doesn't get stuck.
+				// Skip the join failed transition state so we don't send out error notifications.
+				setState(stateJoinSessionFailedWaiting);
+			break;
+			case stateJoiningSession:
+			case stateSessionJoined:
+			case stateRunning:
+				if(!mAudioSession->mHandle.empty())
+				{
+
+#if RECORD_EVERYTHING
+					// HACK: for testing only
+					// Save looped recording
+					std::string savepath("/tmp/vivoxrecording");
+					{
+						time_t now = time(NULL);
+						const size_t BUF_SIZE = 64;
+						char time_str[BUF_SIZE];	/* Flawfinder: ignore */
+						
+						strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
+						savepath += time_str;
+					}
+					recordingLoopSave(savepath);
+#endif
+
+					sessionMediaDisconnectSendMessage(mAudioSession);
+					setState(stateLeavingSession);
+				}
+				else
+				{
+					LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;	
+					setState(stateSessionTerminated);
+				}
+			break;
+			case stateJoinSessionFailed:
+			case stateJoinSessionFailedWaiting:
+				setState(stateSessionTerminated);
+			break;
+			
+			default:
+				LL_WARNS("Voice") << "called from unknown state" << LL_ENDL;
+			break;
+		}
+	}
+	else
+	{
+		LL_WARNS("Voice") << "called with no active session" << LL_ENDL;
+		setState(stateSessionTerminated);
+	}
+}
+
+void LLVoiceClient::sessionTerminateSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Terminate.1\">"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionGroupTerminateSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending SessionGroup.Terminate with handle " << session->mGroupHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Terminate.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.MediaDisconnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+		<< "<Media>Audio</Media>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+	
+}
+
+void LLVoiceClient::sessionTextDisconnectSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending Session.TextDisconnect with handle " << session->mHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.TextDisconnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::getCaptureDevicesSendMessage()
+{
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetCaptureDevices.1\">"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::getRenderDevicesSendMessage()
+{
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetRenderDevices.1\">"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::clearCaptureDevices()
+{
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+	mCaptureDevices.clear();
+}
+
+void LLVoiceClient::addCaptureDevice(const std::string& name)
+{
+	LL_DEBUGS("Voice") << name << LL_ENDL;
+
+	mCaptureDevices.push_back(name);
+}
+
+LLVoiceClient::deviceList *LLVoiceClient::getCaptureDevices()
+{
+	return &mCaptureDevices;
+}
+
+void LLVoiceClient::setCaptureDevice(const std::string& name)
+{
+	if(name == "Default")
+	{
+		if(!mCaptureDevice.empty())
+		{
+			mCaptureDevice.clear();
+			mCaptureDeviceDirty = true;	
+		}
+	}
+	else
+	{
+		if(mCaptureDevice != name)
+		{
+			mCaptureDevice = name;
+			mCaptureDeviceDirty = true;	
+		}
+	}
+}
+
+void LLVoiceClient::clearRenderDevices()
+{	
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+	mRenderDevices.clear();
+}
+
+void LLVoiceClient::addRenderDevice(const std::string& name)
+{
+	LL_DEBUGS("Voice") << name << LL_ENDL;
+	mRenderDevices.push_back(name);
+}
+
+LLVoiceClient::deviceList *LLVoiceClient::getRenderDevices()
+{
+	return &mRenderDevices;
+}
+
+void LLVoiceClient::setRenderDevice(const std::string& name)
+{
+	if(name == "Default")
+	{
+		if(!mRenderDevice.empty())
+		{
+			mRenderDevice.clear();
+			mRenderDeviceDirty = true;	
+		}
+	}
+	else
+	{
+		if(mRenderDevice != name)
+		{
+			mRenderDevice = name;
+			mRenderDeviceDirty = true;	
+		}
+	}
+	
+}
+
+void LLVoiceClient::tuningStart()
+{
+	mTuningMode = true;
+	if(getState() >= stateNoChannel)
+	{
+		sessionTerminate();
+	}
+}
+
+void LLVoiceClient::tuningStop()
+{
+	mTuningMode = false;
+}
+
+bool LLVoiceClient::inTuningMode()
+{
+	bool result = false;
+	switch(getState())
+	{
+	case stateMicTuningRunning:
+		result = true;
+		break;
+	default:
+		break;
+	}
+	return result;
+}
+
+void LLVoiceClient::tuningRenderStartSendMessage(const std::string& name, bool loop)
+{		
+	mTuningAudioFile = name;
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStart.1\">"
+    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
+    << "<Loop>" << (loop?"1":"0") << "</Loop>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::tuningRenderStopSendMessage()
+{
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
+    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::tuningCaptureStartSendMessage(int duration)
+{
+	LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
+	
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStart.1\">"
+    << "<Duration>" << duration << "</Duration>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::tuningCaptureStopSendMessage()
+{
+	LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
+	
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+
+	mTuningEnergy = 0.0f;
+}
+
+void LLVoiceClient::tuningSetMicVolume(float volume)
+{
+	int scaled_volume = scale_mic_volume(volume);
+
+	if(scaled_volume != mTuningMicVolume)
+	{
+		mTuningMicVolume = scaled_volume;
+		mTuningMicVolumeDirty = true;
+	}
+}
+
+void LLVoiceClient::tuningSetSpeakerVolume(float volume)
+{
+	int scaled_volume = scale_speaker_volume(volume);	
+
+	if(scaled_volume != mTuningSpeakerVolume)
+	{
+		mTuningSpeakerVolume = scaled_volume;
+		mTuningSpeakerVolumeDirty = true;
+	}
+}
+				
+float LLVoiceClient::tuningGetEnergy(void)
+{
+	return mTuningEnergy;
+}
+
+bool LLVoiceClient::deviceSettingsAvailable()
+{
+	bool result = true;
+	
+	if(!mConnected)
+		result = false;
+	
+	if(mRenderDevices.empty())
+		result = false;
+	
+	return result;
+}
+
+void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
+{
+	if(clearCurrentList)
+	{
+		clearCaptureDevices();
+		clearRenderDevices();
+	}
+	getCaptureDevicesSendMessage();
+	getRenderDevicesSendMessage();
+}
+
+void LLVoiceClient::daemonDied()
+{
+	// The daemon died, so the connection is gone.  Reset everything and start over.
+	LL_WARNS("Voice") << "Connection to vivox daemon lost.  Resetting state."<< LL_ENDL;
+
+	// Try to relaunch the daemon
+	setState(stateDisableCleanup);
+}
+
+void LLVoiceClient::giveUp()
+{
+	// All has failed.  Clean up and stop trying.
+	closeSocket();
+	deleteAllSessions();
+	deleteAllBuddies();
+	
+	setState(stateJail);
+}
+
+static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVector3d &pos, LLVector3 &vel)
+{
+	F32 nat[3], nup[3], nl[3], nvel[3]; // the new at, up, left vectors and the  new position and velocity
+	F64 npos[3];
+	
+	// The original XML command was sent like this:
+	/*
+			<< "<Position>"
+				<< "<X>" << pos[VX] << "</X>"
+				<< "<Y>" << pos[VZ] << "</Y>"
+				<< "<Z>" << pos[VY] << "</Z>"
+			<< "</Position>"
+			<< "<Velocity>"
+				<< "<X>" << mAvatarVelocity[VX] << "</X>"
+				<< "<Y>" << mAvatarVelocity[VZ] << "</Y>"
+				<< "<Z>" << mAvatarVelocity[VY] << "</Z>"
+			<< "</Velocity>"
+			<< "<AtOrientation>"
+				<< "<X>" << l.mV[VX] << "</X>"
+				<< "<Y>" << u.mV[VX] << "</Y>"
+				<< "<Z>" << a.mV[VX] << "</Z>"
+			<< "</AtOrientation>"
+			<< "<UpOrientation>"
+				<< "<X>" << l.mV[VZ] << "</X>"
+				<< "<Y>" << u.mV[VY] << "</Y>"
+				<< "<Z>" << a.mV[VZ] << "</Z>"
+			<< "</UpOrientation>"
+			<< "<LeftOrientation>"
+				<< "<X>" << l.mV [VY] << "</X>"
+				<< "<Y>" << u.mV [VZ] << "</Y>"
+				<< "<Z>" << a.mV [VY] << "</Z>"
+			<< "</LeftOrientation>";
+	*/
+
+#if 1
+	// This was the original transform done when building the XML command
+	nat[0] = left.mV[VX];
+	nat[1] = up.mV[VX];
+	nat[2] = at.mV[VX];
+
+	nup[0] = left.mV[VZ];
+	nup[1] = up.mV[VY];
+	nup[2] = at.mV[VZ];
+
+	nl[0] = left.mV[VY];
+	nl[1] = up.mV[VZ];
+	nl[2] = at.mV[VY];
+
+	npos[0] = pos.mdV[VX];
+	npos[1] = pos.mdV[VZ];
+	npos[2] = pos.mdV[VY];
+
+	nvel[0] = vel.mV[VX];
+	nvel[1] = vel.mV[VZ];
+	nvel[2] = vel.mV[VY];
+
+	for(int i=0;i<3;++i) {
+		at.mV[i] = nat[i];
+		up.mV[i] = nup[i];
+		left.mV[i] = nl[i];
+		pos.mdV[i] = npos[i];
+	}
+	
+	// This was the original transform done in the SDK
+	nat[0] = at.mV[2];
+	nat[1] = 0; // y component of at vector is always 0, this was up[2]
+	nat[2] = -1 * left.mV[2];
+
+	// We override whatever the application gives us
+	nup[0] = 0; // x component of up vector is always 0
+	nup[1] = 1; // y component of up vector is always 1
+	nup[2] = 0; // z component of up vector is always 0
+
+	nl[0] = at.mV[0];
+	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
+	nl[2] = -1 * left.mV[0];
+
+	npos[2] = pos.mdV[2] * -1.0;
+	npos[1] = pos.mdV[1];
+	npos[0] = pos.mdV[0];
+
+	for(int i=0;i<3;++i) {
+		at.mV[i] = nat[i];
+		up.mV[i] = nup[i];
+		left.mV[i] = nl[i];
+		pos.mdV[i] = npos[i];
+	}
+#else
+	// This is the compose of the two transforms (at least, that's what I'm trying for)
+	nat[0] = at.mV[VX];
+	nat[1] = 0; // y component of at vector is always 0, this was up[2]
+	nat[2] = -1 * up.mV[VZ];
+
+	// We override whatever the application gives us
+	nup[0] = 0; // x component of up vector is always 0
+	nup[1] = 1; // y component of up vector is always 1
+	nup[2] = 0; // z component of up vector is always 0
+
+	nl[0] = left.mV[VX];
+	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
+	nl[2] = -1 * left.mV[VY];
+
+	npos[0] = pos.mdV[VX];
+	npos[1] = pos.mdV[VZ];
+	npos[2] = pos.mdV[VY] * -1.0;
+
+	nvel[0] = vel.mV[VX];
+	nvel[1] = vel.mV[VZ];
+	nvel[2] = vel.mV[VY];
+
+	for(int i=0;i<3;++i) {
+		at.mV[i] = nat[i];
+		up.mV[i] = nup[i];
+		left.mV[i] = nl[i];
+		pos.mdV[i] = npos[i];
+	}
+	
+#endif
+}
+
+void LLVoiceClient::sendPositionalUpdate(void)
+{	
+	std::ostringstream stream;
+	
+	if(mSpatialCoordsDirty)
+	{
+		LLVector3 l, u, a, vel;
+		LLVector3d pos;
+
+		mSpatialCoordsDirty = false;
+		
+		// Always send both speaker and listener positions together.
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Set3DPosition.1\">"		
+			<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>";
+		
+		stream << "<SpeakerPosition>";
+
+//		LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
+		l = mAvatarRot.getLeftRow();
+		u = mAvatarRot.getUpRow();
+		a = mAvatarRot.getFwdRow();
+		pos = mAvatarPosition;
+		vel = mAvatarVelocity;
+
+		// SLIM SDK: the old SDK was doing a transform on the passed coordinates that the new one doesn't do anymore.
+		// The old transform is replicated by this function.
+		oldSDKTransform(l, u, a, pos, vel);
+		
+		stream 
+			<< "<Position>"
+				<< "<X>" << pos.mdV[VX] << "</X>"
+				<< "<Y>" << pos.mdV[VY] << "</Y>"
+				<< "<Z>" << pos.mdV[VZ] << "</Z>"
+			<< "</Position>"
+			<< "<Velocity>"
+				<< "<X>" << vel.mV[VX] << "</X>"
+				<< "<Y>" << vel.mV[VY] << "</Y>"
+				<< "<Z>" << vel.mV[VZ] << "</Z>"
+			<< "</Velocity>"
+			<< "<AtOrientation>"
+				<< "<X>" << a.mV[VX] << "</X>"
+				<< "<Y>" << a.mV[VY] << "</Y>"
+				<< "<Z>" << a.mV[VZ] << "</Z>"
+			<< "</AtOrientation>"
+			<< "<UpOrientation>"
+				<< "<X>" << u.mV[VX] << "</X>"
+				<< "<Y>" << u.mV[VY] << "</Y>"
+				<< "<Z>" << u.mV[VZ] << "</Z>"
+			<< "</UpOrientation>"
+			<< "<LeftOrientation>"
+				<< "<X>" << l.mV [VX] << "</X>"
+				<< "<Y>" << l.mV [VY] << "</Y>"
+				<< "<Z>" << l.mV [VZ] << "</Z>"
+			<< "</LeftOrientation>";
+
+		stream << "</SpeakerPosition>";
+
+		stream << "<ListenerPosition>";
+
+		LLVector3d	earPosition;
+		LLVector3	earVelocity;
+		LLMatrix3	earRot;
+		
+		switch(mEarLocation)
+		{
+			case earLocCamera:
+			default:
+				earPosition = mCameraPosition;
+				earVelocity = mCameraVelocity;
+				earRot = mCameraRot;
+			break;
+			
+			case earLocAvatar:
+				earPosition = mAvatarPosition;
+				earVelocity = mAvatarVelocity;
+				earRot = mAvatarRot;
+			break;
+			
+			case earLocMixed:
+				earPosition = mAvatarPosition;
+				earVelocity = mAvatarVelocity;
+				earRot = mCameraRot;
+			break;
+		}
+
+		l = earRot.getLeftRow();
+		u = earRot.getUpRow();
+		a = earRot.getFwdRow();
+		pos = earPosition;
+		vel = earVelocity;
+
+//		LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL;
+		
+		oldSDKTransform(l, u, a, pos, vel);
+		
+		stream 
+			<< "<Position>"
+				<< "<X>" << pos.mdV[VX] << "</X>"
+				<< "<Y>" << pos.mdV[VY] << "</Y>"
+				<< "<Z>" << pos.mdV[VZ] << "</Z>"
+			<< "</Position>"
+			<< "<Velocity>"
+				<< "<X>" << vel.mV[VX] << "</X>"
+				<< "<Y>" << vel.mV[VY] << "</Y>"
+				<< "<Z>" << vel.mV[VZ] << "</Z>"
+			<< "</Velocity>"
+			<< "<AtOrientation>"
+				<< "<X>" << a.mV[VX] << "</X>"
+				<< "<Y>" << a.mV[VY] << "</Y>"
+				<< "<Z>" << a.mV[VZ] << "</Z>"
+			<< "</AtOrientation>"
+			<< "<UpOrientation>"
+				<< "<X>" << u.mV[VX] << "</X>"
+				<< "<Y>" << u.mV[VY] << "</Y>"
+				<< "<Z>" << u.mV[VZ] << "</Z>"
+			<< "</UpOrientation>"
+			<< "<LeftOrientation>"
+				<< "<X>" << l.mV [VX] << "</X>"
+				<< "<Y>" << l.mV [VY] << "</Y>"
+				<< "<Z>" << l.mV [VZ] << "</Z>"
+			<< "</LeftOrientation>";
+
+
+		stream << "</ListenerPosition>";
+
+		stream << "</Request>\n\n\n";
+	}	
+	
+	if(mAudioSession && (mAudioSession->mVolumeDirty || mAudioSession->mMuteDirty))
+	{
+		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+
+		mAudioSession->mVolumeDirty = false;
+		mAudioSession->mMuteDirty = false;
+		
+		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+		{
+			participantState *p = iter->second;
+
+			if(p->mVolumeDirty)
+			{
+				// Can't set volume/mute for yourself
+				if(!p->mIsSelf)
+				{
+					// scale from the range 0.0-1.0 to vivox volume in the range 0-100
+					S32 volume = llround(p->mVolume / VOLUME_SCALE_VIVOX);
+
+					bool mute = p->mOnMuteList;
+
+					if(mute)
+					{
+						// SetParticipantMuteForMe doesn't work in p2p sessions.
+						// If we want the user to be muted, set their volume to 0 as well.
+						// This isn't perfect, but it will at least reduce their volume to a minimum.
+						volume = 0;
+
+						// Mark the current volume level as set to prevent incoming events
+						// changing it to 0, so that we can return to it when unmuting.
+						p->mVolumeSet = true;
+					}
+
+					if(volume == 0)
+					{
+						mute = true;
+					}
+
+					LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
+					
+					// SLIM SDK: Send both volume and mute commands.
+					
+					// Send a "volume for me" command for the user.
+					stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
+						<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+						<< "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+						<< "<Volume>" << volume << "</Volume>"
+						<< "</Request>\n\n\n";
+
+					if(!mAudioSession->mIsP2P)
+					{
+						// Send a "mute for me" command for the user
+						// Doesn't work in P2P sessions
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantMuteForMe.1\">"
+							<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+							<< "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+							<< "<Mute>" << (mute?"1":"0") << "</Mute>"
+							<< "<Scope>Audio</Scope>"
+							<< "</Request>\n\n\n";
+					}
+				}
+				
+				p->mVolumeDirty = false;
+			}
+		}
+	}
+			
+	buildLocalAudioUpdates(stream);
+	
+	if(!stream.str().empty())
+	{
+		writeString(stream.str());
+	}
+	
+	// Friends list updates can be huge, especially on the first voice login of an account with lots of friends.
+	// Batching them all together can choke SLVoice, so send them in separate writes.
+	sendFriendsListUpdates();
+}
+
+void LLVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
+{
+	if(mCaptureDeviceDirty)
+	{
+		LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
+	
+		stream 
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
+			<< "<CaptureDeviceSpecifier>" << mCaptureDevice << "</CaptureDeviceSpecifier>"
+		<< "</Request>"
+		<< "\n\n\n";
+		
+		mCaptureDeviceDirty = false;
+	}
+}
+
+void LLVoiceClient::buildSetRenderDevice(std::ostringstream &stream)
+{
+	if(mRenderDeviceDirty)
+	{
+		LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
+			<< "<RenderDeviceSpecifier>" << mRenderDevice << "</RenderDeviceSpecifier>"
+		<< "</Request>"
+		<< "\n\n\n";
+		mRenderDeviceDirty = false;
+	}
+}
+
+void LLVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream)
+{
+	buildSetCaptureDevice(stream);
+
+	buildSetRenderDevice(stream);
+
+	if(mPTTDirty)
+	{
+		mPTTDirty = false;
+
+		// Send a local mute command.
+		// NOTE that the state of "PTT" is the inverse of "local mute".
+		//   (i.e. when PTT is true, we send a mute command with "false", and vice versa)
+		
+		LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mPTT?"false":"true") << LL_ENDL;
+
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << (mPTT?"false":"true") << "</Value>"
+			<< "</Request>\n\n\n";
+		
+	}
+
+	if(mSpeakerMuteDirty)
+	{
+		const char *muteval = ((mSpeakerVolume <= scale_speaker_volume(0))?"true":"false");
+
+		mSpeakerMuteDirty = false;
+
+		LL_INFOS("Voice") << "Setting speaker mute to " << muteval  << LL_ENDL;
+		
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << muteval << "</Value>"
+			<< "</Request>\n\n\n";	
+		
+	}
+	
+	if(mSpeakerVolumeDirty)
+	{
+		mSpeakerVolumeDirty = false;
+
+		LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume  << LL_ENDL;
+
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << mSpeakerVolume << "</Value>"
+			<< "</Request>\n\n\n";
+			
+	}
+	
+	if(mMicVolumeDirty)
+	{
+		mMicVolumeDirty = false;
+
+		LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume  << LL_ENDL;
+
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << mMicVolume << "</Value>"
+			<< "</Request>\n\n\n";				
+	}
+
+	
+}
+
+void LLVoiceClient::checkFriend(const LLUUID& id)
+{
+	std::string name;
+	buddyListEntry *buddy = findBuddy(id);
+
+	// Make sure we don't add a name before it's been looked up.
+	if(gCacheName->getFullName(id, name))
+	{
+
+		const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id);
+		bool canSeeMeOnline = false;
+		if(relationInfo && relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS))
+			canSeeMeOnline = true;
+		
+		// When we get here, mNeedsSend is true and mInSLFriends is false.  Change them as necessary.
+		
+		if(buddy)
+		{
+			// This buddy is already in both lists.
+
+			if(name != buddy->mDisplayName)
+			{
+				// The buddy is in the list with the wrong name.  Update it with the correct name.
+				LL_WARNS("Voice") << "Buddy " << id << " has wrong name (\"" << buddy->mDisplayName << "\" should be \"" << name << "\"), updating."<< LL_ENDL;
+				buddy->mDisplayName = name;
+				buddy->mNeedsNameUpdate = true;		// This will cause the buddy to be resent.
+			}
+		}
+		else
+		{
+			// This buddy was not in the vivox list, needs to be added.
+			buddy = addBuddy(sipURIFromID(id), name);
+			buddy->mUUID = id;
+		}
+		
+		// In all the above cases, the buddy is in the SL friends list (which is how we got here).
+		buddy->mInSLFriends = true;
+		buddy->mCanSeeMeOnline = canSeeMeOnline;
+		buddy->mNameResolved = true;
+		
+	}
+	else
+	{
+		// This name hasn't been looked up yet.  Don't do anything with this buddy list entry until it has.
+		if(buddy)
+		{
+			buddy->mNameResolved = false;
+		}
+		
+		// Initiate a lookup.
+		// The "lookup completed" callback will ensure that the friends list is rechecked after it completes.
+		lookupName(id);
+	}
+}
+
+void LLVoiceClient::clearAllLists()
+{
+	// FOR TESTING ONLY
+	
+	// This will send the necessary commands to delete ALL buddies, autoaccept rules, and block rules SLVoice tells us about.
+	buddyListMap::iterator buddy_it;
+	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
+	{
+		buddyListEntry *buddy = buddy_it->second;
+		buddy_it++;
+		
+		std::ostringstream stream;
+
+		if(buddy->mInVivoxBuddies)
+		{
+			// delete this entry from the vivox buddy list
+			buddy->mInVivoxBuddies = false;
+			LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+				<< "</Request>\n\n\n";		
+		}
+
+		if(buddy->mHasBlockListEntry)
+		{
+			// Delete the associated block list entry (so the block list doesn't fill up with junk)
+			buddy->mHasBlockListEntry = false;
+			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+				<< "</Request>\n\n\n";								
+		}
+		if(buddy->mHasAutoAcceptListEntry)
+		{
+			// Delete the associated auto-accept list entry (so the auto-accept list doesn't fill up with junk)
+			buddy->mHasAutoAcceptListEntry = false;
+			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+				<< "</Request>\n\n\n";
+		}
+
+		writeString(stream.str());
+
+	}
+}
+
+void LLVoiceClient::sendFriendsListUpdates()
+{
+	if(mBuddyListMapPopulated && mBlockRulesListReceived && mAutoAcceptRulesListReceived && mFriendsListDirty)
+	{
+		mFriendsListDirty = false;
+		
+		if(0)
+		{
+			// FOR TESTING ONLY -- clear all buddy list, block list, and auto-accept list entries.
+			clearAllLists();
+			return;
+		}
+		
+		LL_INFOS("Voice") << "Checking vivox buddy list against friends list..." << LL_ENDL;
+		
+		buddyListMap::iterator buddy_it;
+		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+		{
+			// reset the temp flags in the local buddy list
+			buddy_it->second->mInSLFriends = false;
+		}
+		
+		// correlate with the friends list
+		{
+			LLCollectAllBuddies collect;
+			LLAvatarTracker::instance().applyFunctor(collect);
+			LLCollectAllBuddies::buddy_map_t::const_iterator it = collect.mOnline.begin();
+			LLCollectAllBuddies::buddy_map_t::const_iterator end = collect.mOnline.end();
+			
+			for ( ; it != end; ++it)
+			{
+				checkFriend(it->second);
+			}
+			it = collect.mOffline.begin();
+			end = collect.mOffline.end();
+			for ( ; it != end; ++it)
+			{
+				checkFriend(it->second);
+			}
+		}
+				
+		LL_INFOS("Voice") << "Sending friend list updates..." << LL_ENDL;
+
+		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
+		{
+			buddyListEntry *buddy = buddy_it->second;
+			buddy_it++;
+			
+			// Ignore entries that aren't resolved yet.
+			if(buddy->mNameResolved)
+			{
+				std::ostringstream stream;
+
+				if(buddy->mInSLFriends && (!buddy->mInVivoxBuddies || buddy->mNeedsNameUpdate))
+				{					
+					if(mNumberOfAliases > 0)
+					{
+						// Add (or update) this entry in the vivox buddy list
+						buddy->mInVivoxBuddies = true;
+						buddy->mNeedsNameUpdate = false;
+						LL_DEBUGS("Voice") << "add/update " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+						stream 
+							<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddySet.1\">"
+								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+								<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+								<< "<DisplayName>" << buddy->mDisplayName << "</DisplayName>"
+								<< "<BuddyData></BuddyData>"	// Without this, SLVoice doesn't seem to parse the command.
+								<< "<GroupID>0</GroupID>"
+							<< "</Request>\n\n\n";	
+					}
+				}
+				else if(!buddy->mInSLFriends)
+				{
+					// This entry no longer exists in your SL friends list.  Remove all traces of it from the Vivox buddy list.
+ 					if(buddy->mInVivoxBuddies)
+					{
+						// delete this entry from the vivox buddy list
+						buddy->mInVivoxBuddies = false;
+						LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
+							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+							<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+							<< "</Request>\n\n\n";		
+					}
+
+					if(buddy->mHasBlockListEntry)
+					{
+						// Delete the associated block list entry, if any
+						buddy->mHasBlockListEntry = false;
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+							<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+							<< "</Request>\n\n\n";								
+					}
+					if(buddy->mHasAutoAcceptListEntry)
+					{
+						// Delete the associated auto-accept list entry, if any
+						buddy->mHasAutoAcceptListEntry = false;
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+							<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+							<< "</Request>\n\n\n";
+					}
+				}
+				
+				if(buddy->mInSLFriends)
+				{
+
+					if(buddy->mCanSeeMeOnline)
+					{
+						// Buddy should not be blocked.
+
+						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
+						
+						// If the buddy has a block list entry, delete it.
+						if(buddy->mHasBlockListEntry)
+						{
+							buddy->mHasBlockListEntry = false;
+							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+								<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+								<< "</Request>\n\n\n";		
+							
+							
+							// If we just deleted a block list entry, add an auto-accept entry.
+							if(!buddy->mHasAutoAcceptListEntry)
+							{
+								buddy->mHasAutoAcceptListEntry = true;								
+								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateAutoAcceptRule.1\">"
+									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+									<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+									<< "<AutoAddAsBuddy>0</AutoAddAsBuddy>"
+									<< "</Request>\n\n\n";
+							}
+						}
+					}
+					else
+					{
+						// Buddy should be blocked.
+						
+						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
+
+						// If this buddy has an autoaccept entry, delete it
+						if(buddy->mHasAutoAcceptListEntry)
+						{
+							buddy->mHasAutoAcceptListEntry = false;
+							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+								<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+								<< "</Request>\n\n\n";
+						
+							// If we just deleted an auto-accept entry, add a block list entry.
+							if(!buddy->mHasBlockListEntry)
+							{
+								buddy->mHasBlockListEntry = true;
+								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateBlockRule.1\">"
+									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+									<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+									<< "<PresenceOnly>1</PresenceOnly>"
+									<< "</Request>\n\n\n";								
+							}
+						}
+					}
+
+					if(!buddy->mInSLFriends && !buddy->mInVivoxBuddies)
+					{
+						// Delete this entry from the local buddy list.  This should NOT invalidate the iterator,
+						// since it has already been incremented to the next entry.
+						deleteBuddy(buddy->mURI);
+					}
+
+				}
+				writeString(stream.str());
+			}
+		}
+	}
+}
+
+/////////////////////////////
+// Response/Event handlers
+
+void LLVoiceClient::connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID)
+{	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Connector.Create response failure: " << statusString << LL_ENDL;
+		setState(stateConnectorFailed);
+	}
+	else
+	{
+		// Connector created, move forward.
+		LL_INFOS("Voice") << "Connector.Create succeeded, Vivox SDK version is " << versionID << LL_ENDL;
+		mAPIVersion = versionID;
+		mConnectorHandle = connectorHandle;
+		if(getState() == stateConnectorStarting)
+		{
+			setState(stateConnectorStarted);
+		}
+	}
+}
+
+void LLVoiceClient::loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases)
+{ 
+	LL_DEBUGS("Voice") << "Account.Login response (" << statusCode << "): " << statusString << LL_ENDL;
+	
+	// Status code of 20200 means "bad password".  We may want to special-case that at some point.
+	
+	if ( statusCode == 401 )
+	{
+		// Login failure which is probably caused by the delay after a user's password being updated.
+		LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		setState(stateLoginRetry);
+	}
+	else if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		setState(stateLoginFailed);
+	}
+	else
+	{
+		// Login succeeded, move forward.
+		mAccountHandle = accountHandle;
+		mNumberOfAliases = numberOfAliases;
+		// This needs to wait until the AccountLoginStateChangeEvent is received.
+//		if(getState() == stateLoggingIn)
+//		{
+//			setState(stateLoggedIn);
+//		}
+	}
+}
+
+void LLVoiceClient::sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
+{	
+	sessionState *session = findSessionBeingCreatedByURI(requestId);
+	
+	if(session)
+	{
+		session->mCreateInProgress = false;
+	}
+	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		if(session)
+		{
+			session->mErrorStatusCode = statusCode;		
+			session->mErrorStatusString = statusString;
+			if(session == mAudioSession)
+			{
+				setState(stateJoinSessionFailed);
+			}
+			else
+			{
+				reapSession(session);
+			}
+		}
+	}
+	else
+	{
+		LL_INFOS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
+		if(session)
+		{
+			setSessionHandle(session, sessionHandle);
+		}
+	}
+}
+
+void LLVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
+{	
+	sessionState *session = findSessionBeingCreatedByURI(requestId);
+	
+	if(session)
+	{
+		session->mCreateInProgress = false;
+	}
+	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "SessionGroup.AddSession response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		if(session)
+		{
+			session->mErrorStatusCode = statusCode;		
+			session->mErrorStatusString = statusString;
+			if(session == mAudioSession)
+			{
+				setState(stateJoinSessionFailed);
+			}
+			else
+			{
+				reapSession(session);
+			}
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "SessionGroup.AddSession response received (success), session handle is " << sessionHandle << LL_ENDL;
+		if(session)
+		{
+			setSessionHandle(session, sessionHandle);
+		}
+	}
+}
+
+void LLVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString)
+{
+	sessionState *session = findSession(requestId);
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		if(session)
+		{
+			session->mMediaConnectInProgress = false;
+			session->mErrorStatusCode = statusCode;		
+			session->mErrorStatusString = statusString;
+			if(session == mAudioSession)
+				setState(stateJoinSessionFailed);
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::logoutResponse(int statusCode, std::string &statusString)
+{	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
+		// Should this ever fail?  do we care if it does?
+	}
+}
+
+void LLVoiceClient::connectorShutdownResponse(int statusCode, std::string &statusString)
+{
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
+		// Should this ever fail?  do we care if it does?
+	}
+	
+	mConnected = false;
+	
+	if(getState() == stateConnectorStopping)
+	{
+		setState(stateConnectorStopped);
+	}
+}
+
+void LLVoiceClient::sessionAddedEvent(
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		bool isChannel, 
+		bool incoming,
+		std::string &nameString,
+		std::string &applicationString)
+{
+	sessionState *session = NULL;
+
+	LL_INFOS("Voice") << "session " << uriString << ", alias " << alias << ", name " << nameString << " handle " << sessionHandle << LL_ENDL;
+	
+	session = addSession(uriString, sessionHandle);
+	if(session)
+	{
+		session->mGroupHandle = sessionGroupHandle;
+		session->mIsChannel = isChannel;
+		session->mIncoming = incoming;
+		session->mAlias = alias;
+			
+		// Generate a caller UUID -- don't need to do this for channels
+		if(!session->mIsChannel)
+		{
+			if(IDFromName(session->mSIPURI, session->mCallerID))
+			{
+				// Normal URI(base64-encoded UUID) 
+			}
+			else if(!session->mAlias.empty() && IDFromName(session->mAlias, session->mCallerID))
+			{
+				// Wrong URI, but an alias is available.  Stash the incoming URI as an alternate
+				session->mAlternateSIPURI = session->mSIPURI;
+				
+				// and generate a proper URI from the ID.
+				setSessionURI(session, sipURIFromID(session->mCallerID));
+			}
+			else
+			{
+				LL_INFOS("Voice") << "Could not generate caller id from uri, using hash of uri " << session->mSIPURI << LL_ENDL;
+				setUUIDFromStringHash(session->mCallerID, session->mSIPURI);
+				session->mSynthesizedCallerID = true;
+				
+				// Can't look up the name in this case -- we have to extract it from the URI.
+				std::string namePortion = nameFromsipURI(session->mSIPURI);
+				if(namePortion.empty())
+				{
+					// Didn't seem to be a SIP URI, just use the whole provided name.
+					namePortion = nameString;
+				}
+				
+				// Some incoming names may be separated with an underscore instead of a space.  Fix this.
+				LLStringUtil::replaceChar(namePortion, '_', ' ');
+				
+				// Act like we just finished resolving the name (this stores it in all the right places)
+				avatarNameResolved(session->mCallerID, namePortion);
+			}
+		
+			LL_INFOS("Voice") << "caller ID: " << session->mCallerID << LL_ENDL;
+
+			if(!session->mSynthesizedCallerID)
+			{
+				// If we got here, we don't have a proper name.  Initiate a lookup.
+				lookupName(session->mCallerID);
+			}
+		}
+	}
+}
+
+void LLVoiceClient::sessionGroupAddedEvent(std::string &sessionGroupHandle)
+{
+	LL_DEBUGS("Voice") << "handle " << sessionGroupHandle << LL_ENDL;
+	
+#if USE_SESSION_GROUPS
+	if(mMainSessionGroupHandle.empty())
+	{
+		// This is the first (i.e. "main") session group.  Save its handle.
+		mMainSessionGroupHandle = sessionGroupHandle;
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Already had a session group handle " << mMainSessionGroupHandle << LL_ENDL;
+	}
+#endif
+}
+
+void LLVoiceClient::joinedAudioSession(sessionState *session)
+{
+	if(mAudioSession != session)
+	{
+		sessionState *oldSession = mAudioSession;
+
+		mAudioSession = session;
+		mAudioSessionChanged = true;
+
+		// The old session may now need to be deleted.
+		reapSession(oldSession);
+	}
+	
+	// This is the session we're joining.
+	if(getState() == stateJoiningSession)
+	{
+		setState(stateSessionJoined);
+		
+		// SLIM SDK: we don't always receive a participant state change for ourselves when joining a channel now.
+		// Add the current user as a participant here.
+		participantState *participant = session->addParticipant(sipURIFromName(mAccountName));
+		if(participant)
+		{
+			participant->mIsSelf = true;
+			lookupName(participant->mAvatarID);
+
+			LL_INFOS("Voice") << "added self as participant \"" << participant->mAccountName 
+					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+		}
+		
+		if(!session->mIsChannel)
+		{
+			// this is a p2p session.  Make sure the other end is added as a participant.
+			participantState *participant = session->addParticipant(session->mSIPURI);
+			if(participant)
+			{
+				if(participant->mAvatarIDValid)
+				{
+					lookupName(participant->mAvatarID);
+				}
+				else if(!session->mName.empty())
+				{
+					participant->mDisplayName = session->mName;
+					avatarNameResolved(participant->mAvatarID, session->mName);
+				}
+				
+				// TODO: Question: Do we need to set up mAvatarID/mAvatarIDValid here?
+				LL_INFOS("Voice") << "added caller as participant \"" << participant->mAccountName 
+						<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+			}
+		}
+	}
+}
+
+void LLVoiceClient::sessionRemovedEvent(
+	std::string &sessionHandle, 
+	std::string &sessionGroupHandle)
+{
+	LL_INFOS("Voice") << "handle " << sessionHandle << LL_ENDL;
+	
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		leftAudioSession(session);
+
+		// This message invalidates the session's handle.  Set it to empty.
+		setSessionHandle(session);
+		
+		// This also means that the session's session group is now empty.
+		// Terminate the session group so it doesn't leak.
+		sessionGroupTerminateSendMessage(session);
+		
+		// Reset the media state (we now have no info)
+		session->mMediaStreamState = streamStateUnknown;
+		session->mTextStreamState = streamStateUnknown;
+		
+		// Conditionally delete the session
+		reapSession(session);
+	}
+	else
+	{
+		LL_WARNS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::reapSession(sessionState *session)
+{
+	if(session)
+	{
+		if(!session->mHandle.empty())
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL;
+		}
+		else if(session->mCreateInProgress)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL;
+		}
+		else if(session->mMediaConnectInProgress)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (connect in progress)" << LL_ENDL;
+		}
+		else if(session == mAudioSession)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the current session)" << LL_ENDL;
+		}
+		else if(session == mNextAudioSession)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the next session)" << LL_ENDL;
+		}
+		else
+		{
+			// TODO: Question: Should we check for queued text messages here?
+			// We don't have a reason to keep tracking this session, so just delete it.
+			LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL;
+			deleteSession(session);
+			session = NULL;
+		}	
+	}
+	else
+	{
+//		LL_DEBUGS("Voice") << "session is NULL" << LL_ENDL;
+	}
+}
+
+// Returns true if the session seems to indicate we've moved to a region on a different voice server
+bool LLVoiceClient::sessionNeedsRelog(sessionState *session)
+{
+	bool result = false;
+	
+	if(session != NULL)
+	{
+		// Only make this check for spatial channels (so it won't happen for group or p2p calls)
+		if(session->mIsSpatial)
+		{
+			std::string::size_type atsign;
+			
+			atsign = session->mSIPURI.find("@");
+			
+			if(atsign != std::string::npos)
+			{
+				std::string urihost = session->mSIPURI.substr(atsign + 1);
+				if(stricmp(urihost.c_str(), mVoiceSIPURIHostName.c_str()))
+				{
+					// The hostname in this URI is different from what we expect.  This probably means we need to relog.
+					
+					// We could make a ProvisionVoiceAccountRequest and compare the result with the current values of
+					// mVoiceSIPURIHostName and mVoiceAccountServerURI to be really sure, but this is a pretty good indicator.
+					
+					result = true;
+				}
+			}
+		}
+	}
+	
+	return result;
+}
+
+void LLVoiceClient::leftAudioSession(
+	sessionState *session)
+{
+	if(mAudioSession == session)
+	{
+		switch(getState())
+		{
+			case stateJoiningSession:
+			case stateSessionJoined:
+			case stateRunning:
+			case stateLeavingSession:
+			case stateJoinSessionFailed:
+			case stateJoinSessionFailedWaiting:
+				// normal transition
+				LL_DEBUGS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
+				setState(stateSessionTerminated);
+			break;
+			
+			case stateSessionTerminated:
+				// this will happen sometimes -- there are cases where we send the terminate and then go straight to this state.
+				LL_WARNS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
+			break;
+			
+			default:
+				LL_WARNS("Voice") << "unexpected SessionStateChangeEvent (left session) in state " << state2string(getState()) << LL_ENDL;
+				setState(stateSessionTerminated);
+			break;
+		}
+	}
+}
+
+void LLVoiceClient::accountLoginStateChangeEvent(
+		std::string &accountHandle, 
+		int statusCode, 
+		std::string &statusString, 
+		int state)
+{
+	LL_DEBUGS("Voice") << "state is " << state << LL_ENDL;
+	/*
+		According to Mike S., status codes for this event are:
+		login_state_logged_out=0,
+        login_state_logged_in = 1,
+        login_state_logging_in = 2,
+        login_state_logging_out = 3,
+        login_state_resetting = 4,
+        login_state_error=100	
+	*/
+	
+	switch(state)
+	{
+		case 1:
+		if(getState() == stateLoggingIn)
+		{
+			setState(stateLoggedIn);
+		}
+		break;
+
+		case 3:
+			// The user is in the process of logging out.
+			setState(stateLoggingOut);
+		break;
+
+		case 0:
+			// The user has been logged out.  
+			setState(stateLoggedOut);
+		break;
+		
+		default:
+			//Used to be a commented out warning
+			LL_DEBUGS("Voice") << "unknown state: " << state << LL_ENDL;
+		break;
+	}
+}
+
+void LLVoiceClient::mediaStreamUpdatedEvent(
+	std::string &sessionHandle, 
+	std::string &sessionGroupHandle, 
+	int statusCode, 
+	std::string &statusString, 
+	int state, 
+	bool incoming)
+{
+	sessionState *session = findSession(sessionHandle);
+	
+	LL_DEBUGS("Voice") << "session " << sessionHandle << ", status code " << statusCode << ", string \"" << statusString << "\"" << LL_ENDL;
+	
+	if(session)
+	{
+		// We know about this session
+		
+		// Save the state for later use
+		session->mMediaStreamState = state;
+		
+		switch(statusCode)
+		{
+			case 0:
+			case 200:
+				// generic success
+				// Don't change the saved error code (it may have been set elsewhere)
+			break;
+			default:
+				// save the status code for later
+				session->mErrorStatusCode = statusCode;
+			break;
+		}
+		
+		switch(state)
+		{
+			case streamStateIdle:
+				// Standard "left audio session"
+				session->mVoiceEnabled = false;
+				session->mMediaConnectInProgress = false;
+				leftAudioSession(session);
+			break;
+
+			case streamStateConnected:
+				session->mVoiceEnabled = true;
+				session->mMediaConnectInProgress = false;
+				joinedAudioSession(session);
+			break;
+			
+			case streamStateRinging:
+				if(incoming)
+				{
+					// Send the voice chat invite to the GUI layer
+					// *TODO: Question: Should we correlate with the mute list here?
+					session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
+					session->mVoiceInvitePending = true;
+					if(session->mName.empty())
+					{
+						lookupName(session->mCallerID);
+					}
+					else
+					{
+						// Act like we just finished resolving the name
+						avatarNameResolved(session->mCallerID, session->mName);
+					}
+				}
+			break;
+			
+			default:
+				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
+			break;
+			
+		}
+		
+	}
+	else
+	{
+		LL_WARNS("Voice") << "session " << sessionHandle << "not found"<< LL_ENDL;
+	}
+}
+
+void LLVoiceClient::textStreamUpdatedEvent(
+	std::string &sessionHandle, 
+	std::string &sessionGroupHandle, 
+	bool enabled,
+	int state, 
+	bool incoming)
+{
+	sessionState *session = findSession(sessionHandle);
+	
+	if(session)
+	{
+		// Save the state for later use
+		session->mTextStreamState = state;
+		
+		// We know about this session
+		switch(state)
+		{
+			case 0:	// We see this when the text stream closes
+				LL_DEBUGS("Voice") << "stream closed" << LL_ENDL;
+			break;
+			
+			case 1:	// We see this on an incoming call from the Connector
+				// Try to send any text messages queued for this session.
+				sendQueuedTextMessages(session);
+
+				// Send the text chat invite to the GUI layer
+				// TODO: Question: Should we correlate with the mute list here?
+				session->mTextInvitePending = true;
+				if(session->mName.empty())
+				{
+					lookupName(session->mCallerID);
+				}
+				else
+				{
+					// Act like we just finished resolving the name
+					avatarNameResolved(session->mCallerID, session->mName);
+				}
+			break;
+
+			default:
+				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
+			break;
+			
+		}
+	}
+}
+
+void LLVoiceClient::participantAddedEvent(
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &nameString, 
+		std::string &displayNameString, 
+		int participantType)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		participantState *participant = session->addParticipant(uriString);
+		if(participant)
+		{
+			participant->mAccountName = nameString;
+
+			LL_DEBUGS("Voice") << "added participant \"" << participant->mAccountName 
+					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+
+			if(participant->mAvatarIDValid)
+			{
+				// Initiate a lookup
+				lookupName(participant->mAvatarID);
+			}
+			else
+			{
+				// If we don't have a valid avatar UUID, we need to fill in the display name to make the active speakers floater work.
+				std::string namePortion = nameFromsipURI(uriString);
+				if(namePortion.empty())
+				{
+					// Problem with the SIP URI, fall back to the display name
+					namePortion = displayNameString;
+				}
+				if(namePortion.empty())
+				{
+					// Problems with both of the above, fall back to the account name
+					namePortion = nameString;
+				}
+				
+				// Set the display name (which is a hint to the active speakers window not to do its own lookup)
+				participant->mDisplayName = namePortion;
+				avatarNameResolved(participant->mAvatarID, namePortion);
+			}
+		}
+	}
+}
+
+void LLVoiceClient::participantRemovedEvent(
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &nameString)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		participantState *participant = session->findParticipant(uriString);
+		if(participant)
+		{
+			session->removeParticipant(participant);
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "unknown participant " << uriString << LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+	}
+}
+
+
+void LLVoiceClient::participantUpdatedEvent(
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		bool isModeratorMuted, 
+		bool isSpeaking, 
+		int volume, 
+		F32 energy)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		participantState *participant = session->findParticipant(uriString);
+		
+		if(participant)
+		{
+			participant->mIsSpeaking = isSpeaking;
+			participant->mIsModeratorMuted = isModeratorMuted;
+
+			// SLIM SDK: convert range: ensure that energy is set to zero if is_speaking is false
+			if (isSpeaking)
+			{
+				participant->mSpeakingTimeout.reset();
+				participant->mPower = energy;
+			}
+			else
+			{
+				participant->mPower = 0.0f;
+			}
+
+			// Ignore incoming volume level if it has been explicitly set, or there
+			//  is a volume or mute change pending.
+			if ( !participant->mVolumeSet && !participant->mVolumeDirty)
+			{
+				participant->mVolume = (F32)volume * VOLUME_SCALE_VIVOX;
+			}
+
+			// *HACK: mantipov: added while working on EXT-3544
+			/*
+			Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE 
+			LLViewerChatterBoxSessionAgentListUpdates::post() sometimes AFTER.
+			
+			participantUpdatedEvent updates voice participant state in particular participantState::mIsModeratorMuted
+			Originally we wanted to update session Speaker Manager to fire LLSpeakerVoiceModerationEvent to fix the EXT-3544 bug.
+			Calling of the LLSpeakerMgr::update() method was added into LLIMMgr::processAgentListUpdates.
+			
+			But in case participantUpdatedEvent() is called after LLViewerChatterBoxSessionAgentListUpdates::post()
+			voice participant mIsModeratorMuted is changed after speakers are updated in Speaker Manager
+			and event is not fired.
+
+			So, we have to call LLSpeakerMgr::update() here. In any case it is better than call it
+			in LLCallFloater::draw()
+			*/
+			LLVoiceChannel* voice_cnl = LLVoiceChannel::getCurrentVoiceChannel();
+
+			// ignore session ID of local chat
+			if (voice_cnl && voice_cnl->getSessionID().notNull())
+			{
+				LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(voice_cnl->getSessionID());
+				if (speaker_manager)
+				{
+					speaker_manager->update(true);
+				}
+			}
+		}
+		else
+		{
+			LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_INFOS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::buddyPresenceEvent(
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &statusString,
+		std::string &applicationString)
+{
+	buddyListEntry *buddy = findBuddy(uriString);
+	
+	if(buddy)
+	{
+		LL_DEBUGS("Voice") << "Presence event for " << buddy->mDisplayName << " status \"" << statusString << "\", application \"" << applicationString << "\""<< LL_ENDL;
+		LL_DEBUGS("Voice") << "before: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
+
+		if(applicationString.empty())
+		{
+			// This presence event is from a client that doesn't set up the Application string.  Do things the old-skool way.
+			// NOTE: this will be needed to support people who aren't on the 3010-class SDK yet.
+
+			if ( stricmp("Unknown", statusString.c_str())== 0) 
+			{
+				// User went offline with a non-SLim-enabled viewer.
+				buddy->mOnlineSL = false;
+			}
+			else if ( stricmp("Online", statusString.c_str())== 0) 
+			{
+				// User came online with a non-SLim-enabled viewer.
+				buddy->mOnlineSL = true;
+			}
+			else
+			{
+				// If the user is online through SLim, their status will be "Online-slc", "Away", or something else.
+				// NOTE: we should never see this unless someone is running an OLD version of SLim -- the versions that should be in use now all set the application string.
+				buddy->mOnlineSLim = true;
+			} 
+		}
+		else if(applicationString.find("SecondLifeViewer") != std::string::npos)
+		{
+			// This presence event is from a viewer that sets the application string
+			if ( stricmp("Unknown", statusString.c_str())== 0) 
+			{
+				// Viewer says they're offline
+				buddy->mOnlineSL = false;
+			}
+			else
+			{
+				// Viewer says they're online
+				buddy->mOnlineSL = true;
+			}
+		}
+		else
+		{
+			// This presence event is from something which is NOT the SL viewer (assume it's SLim).
+			if ( stricmp("Unknown", statusString.c_str())== 0) 
+			{
+				// SLim says they're offline
+				buddy->mOnlineSLim = false;
+			}
+			else
+			{
+				// SLim says they're online
+				buddy->mOnlineSLim = true;
+			}
+		} 
+
+		LL_DEBUGS("Voice") << "after: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
+		
+		// HACK -- increment the internal change serial number in the LLRelationship (without changing the actual status), so the UI notices the change.
+		LLAvatarTracker::instance().setBuddyOnline(buddy->mUUID,LLAvatarTracker::instance().isBuddyOnline(buddy->mUUID));
+
+		notifyFriendObservers();
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Presence for unknown buddy " << uriString << LL_ENDL;
+	}	
+}
+
+void LLVoiceClient::messageEvent(
+		std::string &sessionHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &messageHeader, 
+		std::string &messageBody,
+		std::string &applicationString)
+{
+	LL_DEBUGS("Voice") << "Message event, session " << sessionHandle << " from " << uriString << LL_ENDL;
+//	LL_DEBUGS("Voice") << "    header " << messageHeader << ", body: \n" << messageBody << LL_ENDL;
+	
+	if(messageHeader.find("text/html") != std::string::npos)
+	{
+		std::string message;
+
+		{
+			const std::string startMarker = "<body";
+			const std::string startMarker2 = ">";
+			const std::string endMarker = "</body>";
+			const std::string startSpan = "<span";
+			const std::string endSpan = "</span>";
+			std::string::size_type start;
+			std::string::size_type end;
+			
+			// Default to displaying the raw string, so the message gets through.
+			message = messageBody;
+
+			// Find the actual message text within the XML fragment
+			start = messageBody.find(startMarker);
+			start = messageBody.find(startMarker2, start);
+			end = messageBody.find(endMarker);
+
+			if(start != std::string::npos)
+			{
+				start += startMarker2.size();
+				
+				if(end != std::string::npos)
+					end -= start;
+					
+				message.assign(messageBody, start, end);
+			}
+			else 
+			{
+				// Didn't find a <body>, try looking for a <span> instead.
+				start = messageBody.find(startSpan);
+				start = messageBody.find(startMarker2, start);
+				end = messageBody.find(endSpan);
+				
+				if(start != std::string::npos)
+				{
+					start += startMarker2.size();
+					
+					if(end != std::string::npos)
+						end -= start;
+					
+					message.assign(messageBody, start, end);
+				}			
+			}
+		}	
+		
+//		LL_DEBUGS("Voice") << "    raw message = \n" << message << LL_ENDL;
+
+		// strip formatting tags
+		{
+			std::string::size_type start;
+			std::string::size_type end;
+			
+			while((start = message.find('<')) != std::string::npos)
+			{
+				if((end = message.find('>', start + 1)) != std::string::npos)
+				{
+					// Strip out the tag
+					message.erase(start, (end + 1) - start);
+				}
+				else
+				{
+					// Avoid an infinite loop
+					break;
+				}
+			}
+		}
+		
+		// Decode ampersand-escaped chars
+		{
+			std::string::size_type mark = 0;
+
+			// The text may contain text encoded with &lt;, &gt;, and &amp;
+			mark = 0;
+			while((mark = message.find("&lt;", mark)) != std::string::npos)
+			{
+				message.replace(mark, 4, "<");
+				mark += 1;
+			}
+			
+			mark = 0;
+			while((mark = message.find("&gt;", mark)) != std::string::npos)
+			{
+				message.replace(mark, 4, ">");
+				mark += 1;
+			}
+			
+			mark = 0;
+			while((mark = message.find("&amp;", mark)) != std::string::npos)
+			{
+				message.replace(mark, 5, "&");
+				mark += 1;
+			}
+		}
+		
+		// strip leading/trailing whitespace (since we always seem to get a couple newlines)
+		LLStringUtil::trim(message);
+		
+//		LL_DEBUGS("Voice") << "    stripped message = \n" << message << LL_ENDL;
+		
+		sessionState *session = findSession(sessionHandle);
+		if(session)
+		{
+			bool is_busy = gAgent.getBusy();
+			bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat);
+			bool is_linden = LLMuteList::getInstance()->isLinden(session->mName);
+			bool quiet_chat = false;
+			LLChat chat;
+
+			chat.mMuted = is_muted && !is_linden;
+			
+			if(!chat.mMuted)
+			{
+				chat.mFromID = session->mCallerID;
+				chat.mFromName = session->mName;
+				chat.mSourceType = CHAT_SOURCE_AGENT;
+
+				if(is_busy && !is_linden)
+				{
+					quiet_chat = true;
+					// TODO: Question: Return busy mode response here?  Or maybe when session is started instead?
+				}
+								
+				LL_DEBUGS("Voice") << "adding message, name " << session->mName << " session " << session->mIMSessionID << ", target " << session->mCallerID << LL_ENDL;
+				gIMMgr->addMessage(session->mIMSessionID,
+						session->mCallerID,
+						session->mName.c_str(),
+						message.c_str(),
+						LLStringUtil::null,		// default arg
+						IM_NOTHING_SPECIAL,		// default arg
+						0,						// default arg
+						LLUUID::null,			// default arg
+						LLVector3::zero,		// default arg
+						true);					// prepend name and make it a link to the user's profile
+			}
+		}		
+	}
+}
+
+void LLVoiceClient::sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType)
+{
+	sessionState *session = findSession(sessionHandle);
+	
+	if(session)
+	{
+		participantState *participant = session->findParticipant(uriString);
+		if(participant)
+		{
+			if (!stricmp(notificationType.c_str(), "Typing"))
+			{
+				// Other end started typing
+				// TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart().
+				// It requires an LLIMInfo for the message, which we don't have here.
+			}
+			else if (!stricmp(notificationType.c_str(), "NotTyping"))
+			{
+				// Other end stopped typing
+				// TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop().
+				// It requires an LLIMInfo for the message, which we don't have here.
+			}
+			else
+			{
+				LL_DEBUGS("Voice") << "Unknown notification type " << notificationType << "for participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+			}
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "Unknown participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Unknown session handle " << sessionHandle << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType)
+{
+	buddyListEntry *buddy = findBuddy(buddyURI);
+	
+	if(!buddy)
+	{
+		// Couldn't find buddy by URI, try converting the alias...
+		if(!alias.empty())
+		{
+			LLUUID id;
+			if(IDFromName(alias, id))
+			{
+				buddy = findBuddy(id);
+			}
+		}
+	}
+	
+	if(buddy)
+	{
+		std::ostringstream stream;
+		
+		if(buddy->mCanSeeMeOnline)
+		{
+			// Sending the response will create an auto-accept rule
+			buddy->mHasAutoAcceptListEntry = true;
+		}
+		else
+		{
+			// Sending the response will create a block rule
+			buddy->mHasBlockListEntry = true;
+		}
+		
+		if(buddy->mInSLFriends)
+		{
+			buddy->mInVivoxBuddies = true;
+		}
+		
+		stream
+			<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.SendSubscriptionReply.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+				<< "<RuleType>" << (buddy->mCanSeeMeOnline?"Allow":"Hide") << "</RuleType>"
+				<< "<AutoAccept>"<< (buddy->mInSLFriends?"1":"0")<< "</AutoAccept>"
+				<< "<SubscriptionHandle>" << subscriptionHandle << "</SubscriptionHandle>"
+			<< "</Request>"
+			<< "\n\n\n";
+			
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::auxAudioPropertiesEvent(F32 energy)
+{
+	LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
+	mTuningEnergy = energy;
+}
+
+void LLVoiceClient::buddyListChanged()
+{
+	// This is called after we receive a BuddyAndGroupListChangedEvent.
+	mBuddyListMapPopulated = true;
+	mFriendsListDirty = true;
+}
+
+void LLVoiceClient::muteListChanged()
+{
+	// The user's mute list has been updated.  Go through the current participant list and sync it with the mute list.
+	if(mAudioSession)
+	{
+		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+		
+		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+		{
+			participantState *p = iter->second;
+			
+			// Check to see if this participant is on the mute list already
+			if(p->updateMuteState())
+				mAudioSession->mMuteDirty = true;
+		}
+	}
+}
+
+void LLVoiceClient::updateFriends(U32 mask)
+{
+	if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::POWERS))
+	{
+		// Just resend the whole friend list to the daemon
+		mFriendsListDirty = true;
+	}
+}
+
+/////////////////////////////
+// Managing list of participants
+LLVoiceClient::participantState::participantState(const std::string &uri) : 
+	 mURI(uri), 
+	 mPTT(false), 
+	 mIsSpeaking(false), 
+	 mIsModeratorMuted(false), 
+	 mLastSpokeTimestamp(0.f), 
+	 mPower(0.f), 
+	 mVolume(VOLUME_DEFAULT),
+	 mOnMuteList(false),
+	 mVolumeSet(false),
+	 mVolumeDirty(false),
+	 mAvatarIDValid(false),
+	 mIsSelf(false)
+{
+}
+
+LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(const std::string &uri)
+{
+	participantState *result = NULL;
+	bool useAlternateURI = false;
+	
+	// Note: this is mostly the body of LLVoiceClient::sessionState::findParticipant(), but since we need to know if it
+	// matched the alternate SIP URI (so we can add it properly), we need to reproduce it here.
+	{
+		participantMap::iterator iter = mParticipantsByURI.find(&uri);
+
+		if(iter == mParticipantsByURI.end())
+		{
+			if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+			{
+				// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+				// Use mSIPURI instead, since it will be properly encoded.
+				iter = mParticipantsByURI.find(&(mSIPURI));
+				useAlternateURI = true;
+			}
+		}
+
+		if(iter != mParticipantsByURI.end())
+		{
+			result = iter->second;
+		}
+	}
+		
+	if(!result)
+	{
+		// participant isn't already in one list or the other.
+		result = new participantState(useAlternateURI?mSIPURI:uri);
+		mParticipantsByURI.insert(participantMap::value_type(&(result->mURI), result));
+		mParticipantsChanged = true;
+		
+		// Try to do a reverse transform on the URI to get the GUID back.
+		{
+			LLUUID id;
+			if(IDFromName(result->mURI, id))
+			{
+				result->mAvatarIDValid = true;
+				result->mAvatarID = id;
+
+				if(result->updateMuteState())
+					mMuteDirty = true;
+			}
+			else
+			{
+				// Create a UUID by hashing the URI, but do NOT set mAvatarIDValid.
+				// This tells both code in LLVoiceClient and code in llfloateractivespeakers.cpp that the ID will not be in the name cache.
+				setUUIDFromStringHash(result->mAvatarID, uri);
+			}
+		}
+		
+		mParticipantsByUUID.insert(participantUUIDMap::value_type(&(result->mAvatarID), result));
+
+		if (LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID, result->mVolume))
+		{
+			result->mVolumeDirty = true;
+			mVolumeDirty = true;
+		}
+
+		LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
+	}
+	
+	return result;
+}
+
+bool LLVoiceClient::participantState::updateMuteState()
+{
+	bool result = false;
+	
+	if(mAvatarIDValid)
+	{
+		bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat);
+		if(mOnMuteList != isMuted)
+		{
+			mOnMuteList = isMuted;
+			mVolumeDirty = true;
+			result = true;
+		}
+	}
+	return result;
+}
+
+bool LLVoiceClient::participantState::isAvatar()
+{
+	return mAvatarIDValid;
+}
+
+void LLVoiceClient::sessionState::removeParticipant(LLVoiceClient::participantState *participant)
+{
+	if(participant)
+	{
+		participantMap::iterator iter = mParticipantsByURI.find(&(participant->mURI));
+		participantUUIDMap::iterator iter2 = mParticipantsByUUID.find(&(participant->mAvatarID));
+		
+		LL_DEBUGS("Voice") << "participant \"" << participant->mURI <<  "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
+		
+		if(iter == mParticipantsByURI.end())
+		{
+			LL_ERRS("Voice") << "Internal error: participant " << participant->mURI << " not in URI map" << LL_ENDL;
+		}
+		else if(iter2 == mParticipantsByUUID.end())
+		{
+			LL_ERRS("Voice") << "Internal error: participant ID " << participant->mAvatarID << " not in UUID map" << LL_ENDL;
+		}
+		else if(iter->second != iter2->second)
+		{
+			LL_ERRS("Voice") << "Internal error: participant mismatch!" << LL_ENDL;
+		}
+		else
+		{
+			mParticipantsByURI.erase(iter);
+			mParticipantsByUUID.erase(iter2);
+			
+			delete participant;
+			mParticipantsChanged = true;
+		}
+	}
+}
+
+void LLVoiceClient::sessionState::removeAllParticipants()
+{
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+
+	while(!mParticipantsByURI.empty())
+	{
+		removeParticipant(mParticipantsByURI.begin()->second);
+	}
+	
+	if(!mParticipantsByUUID.empty())
+	{
+		LL_ERRS("Voice") << "Internal error: empty URI map, non-empty UUID map" << LL_ENDL;
+	}
+}
+
+LLVoiceClient::participantMap *LLVoiceClient::getParticipantList(void)
+{
+	participantMap *result = NULL;
+	if(mAudioSession)
+	{
+		result = &(mAudioSession->mParticipantsByURI);
+	}
+	return result;
+}
+
+void LLVoiceClient::getParticipantsUUIDSet(std::set<LLUUID>& participant_uuids)
+{
+	if (NULL == mAudioSession) return;
+
+	participantUUIDMap::const_iterator it = mAudioSession->mParticipantsByUUID.begin(),
+		it_end = mAudioSession->mParticipantsByUUID.end();
+	for (; it != it_end; ++it)
+	{
+		participant_uuids.insert((*(*it).first));
+	}
+}
+
+LLVoiceClient::participantState *LLVoiceClient::sessionState::findParticipant(const std::string &uri)
+{
+	participantState *result = NULL;
+	
+	participantMap::iterator iter = mParticipantsByURI.find(&uri);
+
+	if(iter == mParticipantsByURI.end())
+	{
+		if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+		{
+			// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+			// Look up the other URI
+			iter = mParticipantsByURI.find(&(mSIPURI));
+		}
+	}
+
+	if(iter != mParticipantsByURI.end())
+	{
+		result = iter->second;
+	}
+		
+	return result;
+}
+
+LLVoiceClient::participantState* LLVoiceClient::sessionState::findParticipantByID(const LLUUID& id)
+{
+	participantState * result = NULL;
+	participantUUIDMap::iterator iter = mParticipantsByUUID.find(&id);
+
+	if(iter != mParticipantsByUUID.end())
+	{
+		result = iter->second;
+	}
+
+	return result;
+}
+
+LLVoiceClient::participantState* LLVoiceClient::findParticipantByID(const LLUUID& id)
+{
+	participantState * result = NULL;
+	
+	if(mAudioSession)
+	{
+		result = mAudioSession->findParticipantByID(id);
+	}
+	
+	return result;
+}
+
+
+void LLVoiceClient::parcelChanged()
+{
+	if(getState() >= stateNoChannel)
+	{
+		// If the user is logged in, start a channel lookup.
+		LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL;
+
+		std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest");
+		LLSD data;
+		LLHTTPClient::post(
+			url,
+			data,
+			new LLVoiceClientCapResponder);
+	}
+	else
+	{
+		// The transition to stateNoChannel needs to kick this off again.
+		LL_INFOS("Voice") << "not logged in yet, deferring" << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::switchChannel(
+	std::string uri,
+	bool spatial,
+	bool no_reconnect,
+	bool is_p2p,
+	std::string hash)
+{
+	bool needsSwitch = false;
+	
+	LL_DEBUGS("Voice") 
+		<< "called in state " << state2string(getState()) 
+		<< " with uri \"" << uri << "\"" 
+		<< (spatial?", spatial is true":", spatial is false")
+		<< LL_ENDL;
+	
+	switch(getState())
+	{
+		case stateJoinSessionFailed:
+		case stateJoinSessionFailedWaiting:
+		case stateNoChannel:
+			// Always switch to the new URI from these states.
+			needsSwitch = true;
+		break;
+
+		default:
+			if(mSessionTerminateRequested)
+			{
+				// If a terminate has been requested, we need to compare against where the URI we're already headed to.
+				if(mNextAudioSession)
+				{
+					if(mNextAudioSession->mSIPURI != uri)
+						needsSwitch = true;
+				}
+				else
+				{
+					// mNextAudioSession is null -- this probably means we're on our way back to spatial.
+					if(!uri.empty())
+					{
+						// We do want to process a switch in this case.
+						needsSwitch = true;
+					}
+				}
+			}
+			else
+			{
+				// Otherwise, compare against the URI we're in now.
+				if(mAudioSession)
+				{
+					if(mAudioSession->mSIPURI != uri)
+					{
+						needsSwitch = true;
+					}
+				}
+				else
+				{
+					if(!uri.empty())
+					{
+						// mAudioSession is null -- it's not clear what case would cause this.
+						// For now, log it as a warning and see if it ever crops up.
+						LL_WARNS("Voice") << "No current audio session." << LL_ENDL;
+					}
+				}
+			}
+		break;
+	}
+	
+	if(needsSwitch)
+	{
+		if(uri.empty())
+		{
+			// Leave any channel we may be in
+			LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
+
+			sessionState *oldSession = mNextAudioSession;
+			mNextAudioSession = NULL;
+
+			// The old session may now need to be deleted.
+			reapSession(oldSession);
+
+			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
+
+			mNextAudioSession = addSession(uri);
+			mNextAudioSession->mHash = hash;
+			mNextAudioSession->mIsSpatial = spatial;
+			mNextAudioSession->mReconnect = !no_reconnect;
+			mNextAudioSession->mIsP2P = is_p2p;
+		}
+		
+		if(getState() <= stateNoChannel)
+		{
+			// We're already set up to join a channel, just needed to fill in the session URI
+		}
+		else
+		{
+			// State machine will come around and rejoin if uri/handle is not empty.
+			sessionTerminate();
+		}
+	}
+}
+
+void LLVoiceClient::joinSession(sessionState *session)
+{
+	mNextAudioSession = session;
+	
+	if(getState() <= stateNoChannel)
+	{
+		// We're already set up to join a channel, just needed to fill in the session handle
+	}
+	else
+	{
+		// State machine will come around and rejoin if uri/handle is not empty.
+		sessionTerminate();
+	}
+}
+
+void LLVoiceClient::setNonSpatialChannel(
+	const std::string &uri,
+	const std::string &credentials)
+{
+	switchChannel(uri, false, false, false, credentials);
+}
+
+void LLVoiceClient::setSpatialChannel(
+	const std::string &uri,
+	const std::string &credentials)
+{
+	mSpatialSessionURI = uri;
+	mSpatialSessionCredentials = credentials;
+	mAreaVoiceDisabled = mSpatialSessionURI.empty();
+
+	LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
+	
+	if((mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
+	{
+		// User is in a non-spatial chat or joining a non-spatial chat.  Don't switch channels.
+		LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
+	}
+	else
+	{
+		switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
+	}
+}
+
+void LLVoiceClient::callUser(const LLUUID &uuid)
+{
+	std::string userURI = sipURIFromID(uuid);
+
+	switchChannel(userURI, false, true, true);
+}
+
+LLVoiceClient::sessionState* LLVoiceClient::startUserIMSession(const LLUUID &uuid)
+{
+	// Figure out if a session with the user already exists
+	sessionState *session = findSession(uuid);
+	if(!session)
+	{
+		// No session with user, need to start one.
+		std::string uri = sipURIFromID(uuid);
+		session = addSession(uri);
+
+		llassert(session);
+		if (!session) return NULL;
+
+		session->mIsSpatial = false;
+		session->mReconnect = false;	
+		session->mIsP2P = true;
+		session->mCallerID = uuid;
+	}
+	
+	if(session->mHandle.empty())
+	{
+		// Session isn't active -- start it up.
+		sessionCreateSendMessage(session, false, true);
+	}
+	else
+	{	
+		// Session is already active -- start up text.
+		sessionTextConnectSendMessage(session);
+	}
+	
+	return session;
+}
+
+bool LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
+{
+	bool result = false;
+
+	// Attempt to locate the indicated session
+	sessionState *session = startUserIMSession(participant_id);
+	if(session)
+	{
+		// found the session, attempt to send the message
+		session->mTextMsgQueue.push(message);
+		
+		// Try to send queued messages (will do nothing if the session is not open yet)
+		sendQueuedTextMessages(session);
+
+		// The message is queued, so we succeed.
+		result = true;
+	}	
+	else
+	{
+		LL_DEBUGS("Voice") << "Session not found for participant ID " << participant_id << LL_ENDL;
+	}
+	
+	return result;
+}
+
+void LLVoiceClient::sendQueuedTextMessages(sessionState *session)
+{
+	if(session->mTextStreamState == 1)
+	{
+		if(!session->mTextMsgQueue.empty())
+		{
+			std::ostringstream stream;
+			
+			while(!session->mTextMsgQueue.empty())
+			{
+				std::string message = session->mTextMsgQueue.front();
+				session->mTextMsgQueue.pop();
+				stream
+				<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SendMessage.1\">"
+					<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+					<< "<MessageHeader>text/HTML</MessageHeader>"
+					<< "<MessageBody>" << message << "</MessageBody>"
+				<< "</Request>"
+				<< "\n\n\n";
+			}		
+			writeString(stream.str());
+		}
+	}
+	else
+	{
+		// Session isn't connected yet, defer until later.
+	}
+}
+
+void LLVoiceClient::endUserIMSession(const LLUUID &uuid)
+{
+	// Figure out if a session with the user exists
+	sessionState *session = findSession(uuid);
+	if(session)
+	{
+		// found the session
+		if(!session->mHandle.empty())
+		{
+			sessionTextDisconnectSendMessage(session);
+		}
+	}	
+	else
+	{
+		LL_DEBUGS("Voice") << "Session not found for participant ID " << uuid << LL_ENDL;
+	}
+}
+
+bool LLVoiceClient::answerInvite(std::string &sessionHandle)
+{
+	// this is only ever used to answer incoming p2p call invites.
+	
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		session->mIsSpatial = false;
+		session->mReconnect = false;	
+		session->mIsP2P = true;
+
+		joinSession(session);
+		return true;
+	}
+	
+	return false;
+}
+
+bool LLVoiceClient::isOnlineSIP(const LLUUID &id)
+{
+	bool result = false;
+	buddyListEntry *buddy = findBuddy(id);
+	if(buddy)
+	{
+		result = buddy->mOnlineSLim;
+		LL_DEBUGS("Voice") << "Buddy " << buddy->mDisplayName << " is SIP " << (result?"online":"offline") << LL_ENDL;
+	}
+
+	if(!result)
+	{
+		// This user isn't on the buddy list or doesn't show online status through the buddy list, but could be a participant in an existing session if they initiated a text IM.
+		sessionState *session = findSession(id);
+		if(session && !session->mHandle.empty())
+		{
+			if((session->mTextStreamState != streamStateUnknown) || (session->mMediaStreamState > streamStateIdle))
+			{
+				LL_DEBUGS("Voice") << "Open session with " << id << " found, returning SIP online state" << LL_ENDL;
+				// we have a p2p text session open with this user, so by definition they're online.
+				result = true;
+			}
+		}
+	}
+	
+	return result;
+}
+
+// Returns true if the indicated participant in the current audio session is really an SL avatar.
+// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
+bool LLVoiceClient::isParticipantAvatar(const LLUUID &id)
+{
+	bool result = true; 
+	sessionState *session = findSession(id);
+	
+	if(session != NULL)
+	{
+		// this is a p2p session with the indicated caller, or the session with the specified UUID.
+		if(session->mSynthesizedCallerID)
+			result = false;
+	}
+	else
+	{
+		// Didn't find a matching session -- check the current audio session for a matching participant
+		if(mAudioSession != NULL)
+		{
+			participantState *participant = findParticipantByID(id);
+			if(participant != NULL)
+			{
+				result = participant->isAvatar();
+			}
+		}
+	}
+	
+	return result;
+}
+
+// Returns true if calling back the session URI after the session has closed is possible.
+// Currently this will be false only for PSTN P2P calls.		
+bool LLVoiceClient::isSessionCallBackPossible(const LLUUID &session_id)
+{
+	bool result = true; 
+	sessionState *session = findSession(session_id);
+	
+	if(session != NULL)
+	{
+		result = session->isCallBackPossible();
+	}
+	
+	return result;
+}
+
+// Returns true if the session can accepte text IM's.
+// Currently this will be false only for PSTN P2P calls.
+bool LLVoiceClient::isSessionTextIMPossible(const LLUUID &session_id)
+{
+	bool result = true; 
+	sessionState *session = findSession(session_id);
+	
+	if(session != NULL)
+	{
+		result = session->isTextIMPossible();
+	}
+	
+	return result;
+}
+		
+
+void LLVoiceClient::declineInvite(std::string &sessionHandle)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		sessionMediaDisconnectSendMessage(session);
+	}
+}
+
+void LLVoiceClient::leaveNonSpatialChannel()
+{
+	LL_DEBUGS("Voice") 
+		<< "called in state " << state2string(getState()) 
+		<< LL_ENDL;
+	
+	// Make sure we don't rejoin the current session.	
+	sessionState *oldNextSession = mNextAudioSession;
+	mNextAudioSession = NULL;
+	
+	// Most likely this will still be the current session at this point, but check it anyway.
+	reapSession(oldNextSession);
+	
+	verifySessionState();
+	
+	sessionTerminate();
+}
+
+std::string LLVoiceClient::getCurrentChannel()
+{
+	std::string result;
+	
+	if((getState() == stateRunning) && !mSessionTerminateRequested)
+	{
+		result = getAudioSessionURI();
+	}
+	
+	return result;
+}
+
+bool LLVoiceClient::inProximalChannel()
+{
+	bool result = false;
+	
+	if((getState() == stateRunning) && !mSessionTerminateRequested)
+	{
+		result = inSpatialChannel();
+	}
+	
+	return result;
+}
+
+std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
+{
+	std::string result;
+	result = "sip:";
+	result += nameFromID(id);
+	result += "@";
+	result += mVoiceSIPURIHostName;
+	
+	return result;
+}
+
+std::string LLVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
+{
+	std::string result;
+	if(avatar)
+	{
+		result = "sip:";
+		result += nameFromID(avatar->getID());
+		result += "@";
+		result += mVoiceSIPURIHostName;
+	}
+	
+	return result;
+}
+
+std::string LLVoiceClient::nameFromAvatar(LLVOAvatar *avatar)
+{
+	std::string result;
+	if(avatar)
+	{
+		result = nameFromID(avatar->getID());
+	}	
+	return result;
+}
+
+std::string LLVoiceClient::nameFromID(const LLUUID &uuid)
+{
+	std::string result;
+	
+	if (uuid.isNull()) {
+		//VIVOX, the uuid emtpy look for the mURIString and return that instead.
+		//result.assign(uuid.mURIStringName);
+		LLStringUtil::replaceChar(result, '_', ' ');
+		return result;
+	}
+	// Prepending this apparently prevents conflicts with reserved names inside the vivox and diamondware code.
+	result = "x";
+	
+	// Base64 encode and replace the pieces of base64 that are less compatible 
+	// with e-mail local-parts.
+	// See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
+	result += LLBase64::encode(uuid.mData, UUID_BYTES);
+	LLStringUtil::replaceChar(result, '+', '-');
+	LLStringUtil::replaceChar(result, '/', '_');
+	
+	// If you need to transform a GUID to this form on the Mac OS X command line, this will do so:
+	// echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-')
+	
+	// The reverse transform can be done with:
+	// echo 'x5mkTKmxDTuGnjWyC__WfMg==' |cut -b 2- -|tr '_-' '/+' |openssl base64 -d|xxd -p
+	
+	return result;
+}
+
+bool LLVoiceClient::IDFromName(const std::string inName, LLUUID &uuid)
+{
+	bool result = false;
+	
+	// SLIM SDK: The "name" may actually be a SIP URI such as: "sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com"
+	// If it is, convert to a bare name before doing the transform.
+	std::string name = nameFromsipURI(inName);
+	
+	// Doesn't look like a SIP URI, assume it's an actual name.
+	if(name.empty())
+		name = inName;
+
+	// This will only work if the name is of the proper form.
+	// As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
+	// "xFnPP04IpREWNkuw1cOXlhw=="
+	
+	if((name.size() == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
+	{
+		// The name appears to have the right form.
+
+		// Reverse the transforms done by nameFromID
+		std::string temp = name;
+		LLStringUtil::replaceChar(temp, '-', '+');
+		LLStringUtil::replaceChar(temp, '_', '/');
+
+		U8 rawuuid[UUID_BYTES + 1]; 
+		int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1);
+		if(len == UUID_BYTES)
+		{
+			// The decode succeeded.  Stuff the bits into the result's UUID
+			memcpy(uuid.mData, rawuuid, UUID_BYTES);
+			result = true;
+		}
+	} 
+	
+	if(!result)
+	{
+		// VIVOX:  not a standard account name, just copy the URI name mURIString field
+		// and hope for the best.  bpj
+		uuid.setNull();  // VIVOX, set the uuid field to nulls
+	}
+	
+	return result;
+}
+
+std::string LLVoiceClient::displayNameFromAvatar(LLVOAvatar *avatar)
+{
+	return avatar->getFullname();
+}
+
+std::string LLVoiceClient::sipURIFromName(std::string &name)
+{
+	std::string result;
+	result = "sip:";
+	result += name;
+	result += "@";
+	result += mVoiceSIPURIHostName;
+
+//	LLStringUtil::toLower(result);
+
+	return result;
+}
+
+std::string LLVoiceClient::nameFromsipURI(const std::string &uri)
+{
+	std::string result;
+
+	std::string::size_type sipOffset, atOffset;
+	sipOffset = uri.find("sip:");
+	atOffset = uri.find("@");
+	if((sipOffset != std::string::npos) && (atOffset != std::string::npos))
+	{
+		result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4));
+	}
+	
+	return result;
+}
+
+bool LLVoiceClient::inSpatialChannel(void)
+{
+	bool result = false;
+	
+	if(mAudioSession)
+		result = mAudioSession->mIsSpatial;
+		
+	return result;
+}
+
+std::string LLVoiceClient::getAudioSessionURI()
+{
+	std::string result;
+	
+	if(mAudioSession)
+		result = mAudioSession->mSIPURI;
+		
+	return result;
+}
+
+std::string LLVoiceClient::getAudioSessionHandle()
+{
+	std::string result;
+	
+	if(mAudioSession)
+		result = mAudioSession->mHandle;
+		
+	return result;
+}
+
+
+/////////////////////////////
+// Sending updates of current state
+
+void LLVoiceClient::enforceTether(void)
+{
+	LLVector3d tethered	= mCameraRequestedPosition;
+
+	// constrain 'tethered' to within 50m of mAvatarPosition.
+	{
+		F32 max_dist = 50.0f;
+		LLVector3d camera_offset = mCameraRequestedPosition - mAvatarPosition;
+		F32 camera_distance = (F32)camera_offset.magVec();
+		if(camera_distance > max_dist)
+		{
+			tethered = mAvatarPosition + 
+				(max_dist / camera_distance) * camera_offset;
+		}
+	}
+	
+	if(dist_vec(mCameraPosition, tethered) > 0.1)
+	{
+		mCameraPosition = tethered;
+		mSpatialCoordsDirty = true;
+	}
+}
+
+void LLVoiceClient::updatePosition(void)
+{
+	if(gVoiceClient)
+	{
+		LLViewerRegion *region = gAgent.getRegion();
+		if(region && isAgentAvatarValid())
+		{
+			LLMatrix3 rot;
+			LLVector3d pos;
+
+			// TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
+			// They're currently always set to zero.
+
+			// Send the current camera position to the voice code
+			rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (),  LLViewerCamera::getInstance()->getUpAxis());		
+			pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
+			
+			gVoiceClient->setCameraPosition(
+					pos,				// position
+					LLVector3::zero, 	// velocity
+					rot);				// rotation matrix
+					
+			// Send the current avatar position to the voice code
+			rot = gAgentAvatarp->getRootJoint()->getWorldRotation().getMatrix3();
+	
+			pos = gAgentAvatarp->getPositionGlobal();
+			// TODO: Can we get the head offset from outside the LLVOAvatar?
+//			pos += LLVector3d(mHeadOffset);
+			pos += LLVector3d(0.f, 0.f, 1.f);
+		
+			gVoiceClient->setAvatarPosition(
+					pos,				// position
+					LLVector3::zero, 	// velocity
+					rot);				// rotation matrix
+		}
+	}
+}
+
+void LLVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+{
+	mCameraRequestedPosition = position;
+	
+	if(mCameraVelocity != velocity)
+	{
+		mCameraVelocity = velocity;
+		mSpatialCoordsDirty = true;
+	}
+	
+	if(mCameraRot != rot)
+	{
+		mCameraRot = rot;
+		mSpatialCoordsDirty = true;
+	}
+}
+
+void LLVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+{
+	if(dist_vec(mAvatarPosition, position) > 0.1)
+	{
+		mAvatarPosition = position;
+		mSpatialCoordsDirty = true;
+	}
+	
+	if(mAvatarVelocity != velocity)
+	{
+		mAvatarVelocity = velocity;
+		mSpatialCoordsDirty = true;
+	}
+	
+	if(mAvatarRot != rot)
+	{
+		mAvatarRot = rot;
+		mSpatialCoordsDirty = true;
+	}
+}
+
+bool LLVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
+{
+	bool result = false;
+	
+	if(region)
+	{
+		name = region->getName();
+	}
+	
+	if(!name.empty())
+		result = true;
+	
+	return result;
+}
+
+void LLVoiceClient::leaveChannel(void)
+{
+	if(getState() == stateRunning)
+	{
+		LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
+		mChannelName.clear();
+		sessionTerminate();
+	}
+}
+
+void LLVoiceClient::setMuteMic(bool muted)
+{
+	mMuteMic = muted;
+}
+
+bool LLVoiceClient::getMuteMic() const
+{
+	return mMuteMic;
+}
+
+void LLVoiceClient::setUserPTTState(bool ptt)
+{
+	mUserPTTState = ptt;
+}
+
+bool LLVoiceClient::getUserPTTState()
+{
+	return mUserPTTState;
+}
+
+void LLVoiceClient::toggleUserPTTState(void)
+{
+	mUserPTTState = !mUserPTTState;
+}
+
+void LLVoiceClient::setVoiceEnabled(bool enabled)
+{
+	if (enabled != mVoiceEnabled)
+	{
+		mVoiceEnabled = enabled;
+		LLVoiceClientStatusObserver::EStatusType status;
+
+		if (enabled)
+		{
+			LLVoiceChannel::getCurrentVoiceChannel()->activate();
+			status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
+		}
+		else
+		{
+			// Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
+			LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
+			status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
+		}
+
+		notifyStatusObservers(status);
+	}
+}
+
+bool LLVoiceClient::voiceEnabled()
+{
+	return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
+}
+
+//AD *TODO: investigate possible merge of voiceWorking() and voiceEnabled() into one non-static method
+bool LLVoiceClient::voiceWorking()
+{
+	//Added stateSessionTerminated state to avoid problems with call in parcels with disabled voice (EXT-4758)
+	// Condition with joining spatial num was added to take into account possible problems with connection to voice
+	// server(EXT-4313). See bug descriptions and comments for MAX_NORMAL_JOINING_SPATIAL_NUM for more info.
+	return (mSpatialJoiningNum < MAX_NORMAL_JOINING_SPATIAL_NUM) && (stateLoggedIn <= mState) && (mState <= stateSessionTerminated);
+}
+
+void LLVoiceClient::setLipSyncEnabled(BOOL enabled)
+{
+	mLipSyncEnabled = enabled;
+}
+
+BOOL LLVoiceClient::lipSyncEnabled()
+{
+	   
+	if ( mVoiceEnabled && stateDisabled != getState() )
+	{
+		return mLipSyncEnabled;
+	}
+	else
+	{
+		return FALSE;
+	}
+}
+
+void LLVoiceClient::setUsePTT(bool usePTT)
+{
+	if(usePTT && !mUsePTT)
+	{
+		// When the user turns on PTT, reset the current state.
+		mUserPTTState = false;
+	}
+	mUsePTT = usePTT;
+}
+
+void LLVoiceClient::setPTTIsToggle(bool PTTIsToggle)
+{
+	if(!PTTIsToggle && mPTTIsToggle)
+	{
+		// When the user turns off toggle, reset the current state.
+		mUserPTTState = false;
+	}
+	
+	mPTTIsToggle = PTTIsToggle;
+}
+
+bool LLVoiceClient::getPTTIsToggle()
+{
+	return mPTTIsToggle;
+}
+
+void LLVoiceClient::setPTTKey(std::string &key)
 {
-	if (mVoiceModule) 
+	if(key == "MiddleMouse")
 	{
-		return mVoiceModule->isValidChannel(session_handle);
+		mPTTIsMiddleMouse = true;
 	}
 	else
 	{
-		return false;
+		mPTTIsMiddleMouse = false;
+		if(!LLKeyboard::keyFromString(key, &mPTTKey))
+		{
+			// If the call failed, don't match any key.
+			key = KEY_NONE;
+		}
+	}
+}
+
+void LLVoiceClient::setEarLocation(S32 loc)
+{
+	if(mEarLocation != loc)
+	{
+		LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
+		
+		mEarLocation = loc;
+		mSpatialCoordsDirty = true;
+	}
+}
+
+void LLVoiceClient::setVoiceVolume(F32 volume)
+{
+	int scaled_volume = scale_speaker_volume(volume);	
+
+	if(scaled_volume != mSpeakerVolume)
+	{
+		int min_volume = scale_speaker_volume(0);
+		if((scaled_volume == min_volume) || (mSpeakerVolume == min_volume))
+		{
+			mSpeakerMuteDirty = true;
+		}
+
+		mSpeakerVolume = scaled_volume;
+		mSpeakerVolumeDirty = true;
+	}
+}
+
+void LLVoiceClient::setMicGain(F32 volume)
+{
+	int scaled_volume = scale_mic_volume(volume);
+	
+	if(scaled_volume != mMicVolume)
+	{
+		mMicVolume = scaled_volume;
+		mMicVolumeDirty = true;
+	}
+}
+
+void LLVoiceClient::keyDown(KEY key, MASK mask)
+{	
+	if (gKeyboard->getKeyRepeated(key))
+	{
+		// ignore auto-repeat keys
+		return;
+	}
+
+	if(!mPTTIsMiddleMouse)
+	{
+		bool down = (mPTTKey != KEY_NONE)
+			&& gKeyboard->getKeyDown(mPTTKey);
+		inputUserControlState(down);
+	}
+}
+void LLVoiceClient::keyUp(KEY key, MASK mask)
+{
+	if(!mPTTIsMiddleMouse)
+	{
+		bool down = (mPTTKey != KEY_NONE)
+			&& gKeyboard->getKeyDown(mPTTKey);
+		inputUserControlState(down);
+	}
+}
+void LLVoiceClient::inputUserControlState(bool down)
+{
+	if(mPTTIsToggle)
+	{
+		if(down) // toggle open-mic state on 'down'
+		{
+			toggleUserPTTState();
+		}
+	}
+	else // set open-mic state as an absolute
+	{
+		setUserPTTState(down);
+	}
+}
+void LLVoiceClient::middleMouseState(bool down)
+{
+	if(mPTTIsMiddleMouse)
+	{
+		inputUserControlState(down);
+	}
+}
+
+/////////////////////////////
+// Accessors for data related to nearby speakers
+BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id)
+{
+	BOOL result = FALSE;
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		// I'm not sure what the semantics of this should be.
+		// For now, if we have any data about the user that came through the chat channel, assume they're voice-enabled.
+		result = TRUE;
+	}
+	
+	return result;
+}
+
+BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id)
+{
+	BOOL result = FALSE;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT)
+		{
+			participant->mIsSpeaking = FALSE;
+		}
+		result = participant->mIsSpeaking;
+	}
+	
+	return result;
+}
+
+BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
+{
+	BOOL result = FALSE;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mIsModeratorMuted;
+	}
+	
+	return result;
+}
+
+F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
+{		
+	F32 result = 0;
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mPower;
+	}
+	
+	return result;
+}
+
+
+std::string LLVoiceClient::getDisplayName(const LLUUID& id)
+{
+	std::string result;
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mDisplayName;
+	}
+	
+	return result;
+}
+
+
+BOOL LLVoiceClient::getUsingPTT(const LLUUID& id)
+{
+	BOOL result = FALSE;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		// I'm not sure what the semantics of this should be.
+		// Does "using PTT" mean they're configured with a push-to-talk button?
+		// For now, we know there's no PTT mechanism in place, so nobody is using it.
 	}
+	
+	return result;
 }
 
-bool LLVoiceClient::answerInvite(std::string &channelHandle)
+BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
 {
-	if (mVoiceModule) 
+	BOOL result = FALSE;
+	
+	participantState *participant = findParticipantByID(id);
+	if(participant)
 	{
-		return mVoiceModule->answerInvite(channelHandle);
+		result = participant->mOnMuteList;
 	}
-	else
+
+	return result;
+}
+
+// External accessors.
+F32 LLVoiceClient::getUserVolume(const LLUUID& id)
+{
+	// Minimum volume will be returned for users with voice disabled
+	F32 result = VOLUME_MIN;
+	
+	participantState *participant = findParticipantByID(id);
+	if(participant)
 	{
-		return false;
+		result = participant->mVolume;
+
+		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+		// LL_DEBUGS("Voice") << "mVolume = " << result <<  " for " << id << LL_ENDL;
 	}
+
+	return result;
 }
 
-void LLVoiceClient::declineInvite(std::string &channelHandle)
+void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
 {
-	if (mVoiceModule) mVoiceModule->declineInvite(channelHandle);
+	if(mAudioSession)
+	{
+		participantState *participant = findParticipantByID(id);
+		if (participant && !participant->mIsSelf)
+		{
+			if (!is_approx_equal(volume, VOLUME_DEFAULT))
+			{
+				// Store this volume setting for future sessions if it has been
+				// changed from the default
+				LLSpeakerVolumeStorage::getInstance()->storeSpeakerVolume(id, volume);
+			}
+			else
+			{
+				// Remove stored volume setting if it is returned to the default
+				LLSpeakerVolumeStorage::getInstance()->removeSpeakerVolume(id);
+			}
+
+			participant->mVolume = llclamp(volume, VOLUME_MIN, VOLUME_MAX);
+			participant->mVolumeDirty = true;
+			mAudioSession->mVolumeDirty = true;
+		}
+	}
 }
 
+std::string LLVoiceClient::getGroupID(const LLUUID& id)
+{
+	std::string result;
 
-//------------------------------------------
-// Volume/gain
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mGroupID;
+	}
+	
+	return result;
+}
 
+BOOL LLVoiceClient::getAreaVoiceDisabled()
+{
+	return mAreaVoiceDisabled;
+}
 
-void LLVoiceClient::setVoiceVolume(F32 volume)
+void LLVoiceClient::recordingLoopStart(int seconds, int deltaFramesPerControlFrame)
 {
-	if (mVoiceModule) mVoiceModule->setVoiceVolume(volume);
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
+	
+	if(!mMainSessionGroupHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Start</RecordingControlType>" 
+		<< "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
+		<< "<Filename>" << "" << "</Filename>"
+		<< "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
+		<< "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
+		<< "</Request>\n\n\n";
+
+
+		writeString(stream.str());
+	}
 }
 
-void LLVoiceClient::setMicGain(F32 volume)
+void LLVoiceClient::recordingLoopSave(const std::string& filename)
 {
-	if (mVoiceModule) mVoiceModule->setMicGain(volume);
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Flush</RecordingControlType>" 
+		<< "<Filename>" << filename << "</Filename>"
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
+	}
 }
 
+void LLVoiceClient::recordingStop()
+{
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Stop)" << LL_ENDL;
 
-//------------------------------------------
-// enable/disable voice features
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Stop</RecordingControlType>" 
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
+	}
+}
 
-bool LLVoiceClient::voiceEnabled()
+void LLVoiceClient::filePlaybackStart(const std::string& filename)
 {
-	if (mVoiceModule) 
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Start)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
 	{
-		return mVoiceModule->voiceEnabled();
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Start</RecordingControlType>" 
+		<< "<Filename>" << filename << "</Filename>"
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
 	}
-	else
+}
+
+void LLVoiceClient::filePlaybackStop()
+{
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Stop)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
 	{
-		return false;
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Stop</RecordingControlType>" 
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
 	}
 }
 
-void LLVoiceClient::setVoiceEnabled(bool enabled)
+void LLVoiceClient::filePlaybackSetPaused(bool paused)
 {
-	if (mVoiceModule) mVoiceModule->setVoiceEnabled(enabled);
+	// TODO: Implement once Vivox gives me a sample
 }
 
-void LLVoiceClient::setLipSyncEnabled(BOOL enabled)
+void LLVoiceClient::filePlaybackSetMode(bool vox, float speed)
 {
-	if (mVoiceModule) mVoiceModule->setLipSyncEnabled(enabled);
+	// TODO: Implement once Vivox gives me a sample
 }
 
-BOOL LLVoiceClient::lipSyncEnabled()
+LLVoiceClient::sessionState::sessionState() :
+	mErrorStatusCode(0),
+	mMediaStreamState(streamStateUnknown),
+	mTextStreamState(streamStateUnknown),
+	mCreateInProgress(false),
+	mMediaConnectInProgress(false),
+	mVoiceInvitePending(false),
+	mTextInvitePending(false),
+	mSynthesizedCallerID(false),
+	mIsChannel(false),
+	mIsSpatial(false),
+	mIsP2P(false),
+	mIncoming(false),
+	mVoiceEnabled(false),
+	mReconnect(false),
+	mVolumeDirty(false),
+	mMuteDirty(false),
+	mParticipantsChanged(false)
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->lipSyncEnabled();
-	}
-	else
-	{
-		return false;
-	}
 }
 
-void LLVoiceClient::setMuteMic(bool muted)
+LLVoiceClient::sessionState::~sessionState()
+{
+	removeAllParticipants();
+}
+
+bool LLVoiceClient::sessionState::isCallBackPossible()
 {
-	if (mVoiceModule) mVoiceModule->setMuteMic(muted);
+	// This may change to be explicitly specified by vivox in the future...
+	// Currently, only PSTN P2P calls cannot be returned.
+	// Conveniently, this is also the only case where we synthesize a caller UUID.
+	return !mSynthesizedCallerID;
 }
 
+bool LLVoiceClient::sessionState::isTextIMPossible()
+{
+	// This may change to be explicitly specified by vivox in the future...
+	return !mSynthesizedCallerID;
+}
 
-// ----------------------------------------------
-// PTT
 
-void LLVoiceClient::setUserPTTState(bool ptt)
+LLVoiceClient::sessionIterator LLVoiceClient::sessionsBegin(void)
 {
-	if (mVoiceModule) mVoiceModule->setUserPTTState(ptt);
+	return mSessions.begin();
 }
 
-bool LLVoiceClient::getUserPTTState()
+LLVoiceClient::sessionIterator LLVoiceClient::sessionsEnd(void)
+{
+	return mSessions.end();
+}
+
+
+LLVoiceClient::sessionState *LLVoiceClient::findSession(const std::string &handle)
 {
-	if (mVoiceModule) 
+	sessionState *result = NULL;
+	sessionMap::iterator iter = mSessionsByHandle.find(&handle);
+	if(iter != mSessionsByHandle.end())
 	{
-		return mVoiceModule->getUserPTTState();
+		result = iter->second;
 	}
-	else
+	
+	return result;
+}
+
+LLVoiceClient::sessionState *LLVoiceClient::findSessionBeingCreatedByURI(const std::string &uri)
+{	
+	sessionState *result = NULL;
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
 	{
-		return false;
+		sessionState *session = *iter;
+		if(session->mCreateInProgress && (session->mSIPURI == uri))
+		{
+			result = session;
+			break;
+		}
 	}
+	
+	return result;
 }
 
-void LLVoiceClient::setUsePTT(bool usePTT)
+LLVoiceClient::sessionState *LLVoiceClient::findSession(const LLUUID &participant_id)
 {
-	if (mVoiceModule) mVoiceModule->setUsePTT(usePTT);
+	sessionState *result = NULL;
+	
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	{
+		sessionState *session = *iter;
+		if((session->mCallerID == participant_id) || (session->mIMSessionID == participant_id))
+		{
+			result = session;
+			break;
+		}
+	}
+	
+	return result;
 }
 
-void LLVoiceClient::setPTTIsToggle(bool PTTIsToggle)
+LLVoiceClient::sessionState *LLVoiceClient::addSession(const std::string &uri, const std::string &handle)
 {
-	if (mVoiceModule) mVoiceModule->setPTTIsToggle(PTTIsToggle);
-}
+	sessionState *result = NULL;
+	
+	if(handle.empty())
+	{
+		// No handle supplied.
+		// Check whether there's already a session with this URI
+		for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+		{
+			sessionState *s = *iter;
+			if((s->mSIPURI == uri) || (s->mAlternateSIPURI == uri))
+			{
+				// TODO: I need to think about this logic... it's possible that this case should raise an internal error.
+				result = s;
+				break;
+			}
+		}
+	}
+	else // (!handle.empty())
+	{
+		// Check for an existing session with this handle
+		sessionMap::iterator iter = mSessionsByHandle.find(&handle);
+		
+		if(iter != mSessionsByHandle.end())
+		{
+			result = iter->second;
+		}
+	}
 
-bool LLVoiceClient::getPTTIsToggle()
-{
-	if (mVoiceModule) 
+	if(!result)
 	{
-		return mVoiceModule->getPTTIsToggle();
+		// No existing session found.
+		
+		LL_DEBUGS("Voice") << "adding new session: handle " << handle << " URI " << uri << LL_ENDL;
+		result = new sessionState();
+		result->mSIPURI = uri;
+		result->mHandle = handle;
+		
+		mSessions.insert(result);
+
+		if(!result->mHandle.empty())
+		{
+			mSessionsByHandle.insert(sessionMap::value_type(&(result->mHandle), result));
+		}
 	}
-	else {
-		return false;
+	else
+	{
+		// Found an existing session
+		
+		if(uri != result->mSIPURI)
+		{
+			// TODO: Should this be an internal error?
+			LL_DEBUGS("Voice") << "changing uri from " << result->mSIPURI << " to " << uri << LL_ENDL;
+			setSessionURI(result, uri);
+		}
+
+		if(handle != result->mHandle)
+		{
+			if(handle.empty())
+			{
+				// There's at least one race condition where where addSession was clearing an existing session handle, which caused things to break.
+				LL_DEBUGS("Voice") << "NOT clearing handle " << result->mHandle << LL_ENDL;
+			}
+			else
+			{
+				// TODO: Should this be an internal error?
+				LL_DEBUGS("Voice") << "changing handle from " << result->mHandle << " to " << handle << LL_ENDL;
+				setSessionHandle(result, handle);
+			}
+		}
+		
+		LL_DEBUGS("Voice") << "returning existing session: handle " << handle << " URI " << uri << LL_ENDL;
 	}
 
+	verifySessionState();
+		
+	return result;
 }
 
-void LLVoiceClient::inputUserControlState(bool down)
+void LLVoiceClient::setSessionHandle(sessionState *session, const std::string &handle)
 {
-	if (mVoiceModule) mVoiceModule->inputUserControlState(down);	
-}
+	// Have to remove the session from the handle-indexed map before changing the handle, or things will break badly.
+	
+	if(!session->mHandle.empty())
+	{
+		// Remove session from the map if it should have been there.
+		sessionMap::iterator iter = mSessionsByHandle.find(&(session->mHandle));
+		if(iter != mSessionsByHandle.end())
+		{
+			if(iter->second != session)
+			{
+				LL_ERRS("Voice") << "Internal error: session mismatch!" << LL_ENDL;
+			}
 
-void LLVoiceClient::toggleUserPTTState(void)
-{
-	if (mVoiceModule) mVoiceModule->toggleUserPTTState();
-}
+			mSessionsByHandle.erase(iter);
+		}
+		else
+		{
+			LL_ERRS("Voice") << "Internal error: session handle not found in map!" << LL_ENDL;
+		}
+	}
+			
+	session->mHandle = handle;
 
-void LLVoiceClient::keyDown(KEY key, MASK mask)
-{	
-	if (mVoiceModule) mVoiceModule->keyDown(key, mask);
+	if(!handle.empty())
+	{
+		mSessionsByHandle.insert(sessionMap::value_type(&(session->mHandle), session));
+	}
+
+	verifySessionState();
 }
-void LLVoiceClient::keyUp(KEY key, MASK mask)
+
+void LLVoiceClient::setSessionURI(sessionState *session, const std::string &uri)
 {
-	if (mVoiceModule) mVoiceModule->keyUp(key, mask);
+	// There used to be a map of session URIs to sessions, which made this complex....
+	session->mSIPURI = uri;
+
+	verifySessionState();
 }
-void LLVoiceClient::middleMouseState(bool down)
+
+void LLVoiceClient::deleteSession(sessionState *session)
 {
-	if (mVoiceModule) mVoiceModule->middleMouseState(down);
-}
+	// Remove the session from the handle map
+	if(!session->mHandle.empty())
+	{
+		sessionMap::iterator iter = mSessionsByHandle.find(&(session->mHandle));
+		if(iter != mSessionsByHandle.end())
+		{
+			if(iter->second != session)
+			{
+				LL_ERRS("Voice") << "Internal error: session mismatch" << LL_ENDL;
+			}
+			mSessionsByHandle.erase(iter);
+		}
+	}
 
+	// Remove the session from the URI map
+	mSessions.erase(session);
+	
+	// At this point, the session should be unhooked from all lists and all state should be consistent.
+	verifySessionState();
 
-//-------------------------------------------
-// nearby speaker accessors
+	// If this is the current audio session, clean up the pointer which will soon be dangling.
+	if(mAudioSession == session)
+	{
+		mAudioSession = NULL;
+		mAudioSessionChanged = true;
+	}
 
-BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id)
+	// ditto for the next audio session
+	if(mNextAudioSession == session)
+	{
+		mNextAudioSession = NULL;
+	}
+
+	// delete the session
+	delete session;
+}
+
+void LLVoiceClient::deleteAllSessions()
 {
-	if (mVoiceModule) 
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+
+	while(!mSessions.empty())
 	{
-		return mVoiceModule->getVoiceEnabled(id);
-	} 
-	else
+		deleteSession(*(sessionsBegin()));
+	}
+	
+	if(!mSessionsByHandle.empty())
 	{
-		return FALSE;
+		LL_ERRS("Voice") << "Internal error: empty session map, non-empty handle map" << LL_ENDL;
 	}
 }
 
-std::string LLVoiceClient::getDisplayName(const LLUUID& id)
+void LLVoiceClient::verifySessionState(void)
 {
-	if (mVoiceModule) 
+	// This is mostly intended for debugging problems with session state management.
+	LL_DEBUGS("Voice") << "Total session count: " << mSessions.size() << " , session handle map size: " << mSessionsByHandle.size() << LL_ENDL;
+
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
 	{
-		return mVoiceModule->getDisplayName(id);
+		sessionState *session = *iter;
+
+		LL_DEBUGS("Voice") << "session " << session << ": handle " << session->mHandle << ", URI " << session->mSIPURI << LL_ENDL;
+		
+		if(!session->mHandle.empty())
+		{
+			// every session with a non-empty handle needs to be in the handle map
+			sessionMap::iterator i2 = mSessionsByHandle.find(&(session->mHandle));
+			if(i2 == mSessionsByHandle.end())
+			{
+				LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " not found in session map)" << LL_ENDL;
+			}
+			else
+			{
+				if(i2->second != session)
+				{
+					LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " in session map points to another session)" << LL_ENDL;
+				}
+			}
+		}
 	}
-	else
+		
+	// check that every entry in the handle map points to a valid session in the session set
+	for(sessionMap::iterator iter = mSessionsByHandle.begin(); iter != mSessionsByHandle.end(); iter++)
 	{
-	  return std::string();
+		sessionState *session = iter->second;
+		sessionIterator i2 = mSessions.find(session);
+		if(i2 == mSessions.end())
+		{
+			LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " not found in session map)" << LL_ENDL;
+		}
+		else
+		{
+			if(session->mHandle != (*i2)->mHandle)
+			{
+				LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " points to session with different handle " << (*i2)->mHandle << ")" << LL_ENDL;
+			}
+		}
 	}
 }
 
-bool LLVoiceClient::isVoiceWorking() const
+LLVoiceClient::buddyListEntry::buddyListEntry(const std::string &uri) :
+	mURI(uri)
+{
+	mOnlineSL = false;
+	mOnlineSLim = false;
+	mCanSeeMeOnline = true;
+	mHasBlockListEntry = false;
+	mHasAutoAcceptListEntry = false;
+	mNameResolved = false;
+	mInVivoxBuddies = false;
+	mInSLFriends = false;
+	mNeedsNameUpdate = false;
+}
+
+void LLVoiceClient::processBuddyListEntry(const std::string &uri, const std::string &displayName)
 {
-	if (mVoiceModule) 
+	buddyListEntry *buddy = addBuddy(uri, displayName);
+	buddy->mInVivoxBuddies = true;	
+}
+
+LLVoiceClient::buddyListEntry *LLVoiceClient::addBuddy(const std::string &uri)
+{
+	std::string empty;
+	buddyListEntry *buddy = addBuddy(uri, empty);
+	if(buddy->mDisplayName.empty())
 	{
-		return mVoiceModule->isVoiceWorking();
+		buddy->mNameResolved = false;
 	}
-	return false;
+	return buddy;
 }
 
-BOOL LLVoiceClient::isParticipantAvatar(const LLUUID& id)
+LLVoiceClient::buddyListEntry *LLVoiceClient::addBuddy(const std::string &uri, const std::string &displayName)
 {
-	if (mVoiceModule) 
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter = mBuddyListMap.find(&uri);
+	
+	if(iter != mBuddyListMap.end())
 	{
-		return mVoiceModule->isParticipantAvatar(id);
+		// Found a matching buddy already in the map.
+		LL_DEBUGS("Voice") << "adding existing buddy " << uri << LL_ENDL;
+		result = iter->second;
 	}
-	else
+
+	if(!result)
 	{
-		return FALSE;
+		// participant isn't already in one list or the other.
+		LL_DEBUGS("Voice") << "adding new buddy " << uri << LL_ENDL;
+		result = new buddyListEntry(uri);
+		result->mDisplayName = displayName;
+
+		if(IDFromName(uri, result->mUUID)) 
+		{
+			// Extracted UUID from name successfully.
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "Couldn't find ID for buddy " << uri << " (\"" << displayName << "\")" << LL_ENDL;
+		}
+
+		mBuddyListMap.insert(buddyListMap::value_type(&(result->mURI), result));
 	}
+	
+	return result;
 }
 
-BOOL LLVoiceClient::isOnlineSIP(const LLUUID& id)
+LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddy(const std::string &uri)
 {
-	if (mVoiceModule) 
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter = mBuddyListMap.find(&uri);
+	if(iter != mBuddyListMap.end())
 	{
-		return mVoiceModule->isOnlineSIP(id);
-	}
-	else
-	{
-		return FALSE;
+		result = iter->second;
 	}
+	
+	return result;
 }
 
-BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id)
+LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddy(const LLUUID &id)
 {
-	if (mVoiceModule) 
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter;
+
+	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
 	{
-		return mVoiceModule->getIsSpeaking(id);
+		if(iter->second->mUUID == id)
+		{
+			result = iter->second;
+			break;
+		}
 	}
-	else
+	
+	return result;
+}
+
+LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddyByDisplayName(const std::string &name)
+{
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter;
+
+	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
 	{
-		return FALSE;
+		if(iter->second->mDisplayName == name)
+		{
+			result = iter->second;
+			break;
+		}
 	}
+	
+	return result;
 }
 
-BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
+void LLVoiceClient::deleteBuddy(const std::string &uri)
 {
-	if (mVoiceModule) 
+	buddyListMap::iterator iter = mBuddyListMap.find(&uri);
+	if(iter != mBuddyListMap.end())
 	{
-		return mVoiceModule->getIsModeratorMuted(id);
+		LL_DEBUGS("Voice") << "deleting buddy " << uri << LL_ENDL;
+		buddyListEntry *buddy = iter->second;
+		mBuddyListMap.erase(iter);
+		delete buddy;
 	}
 	else
 	{
-		return FALSE;
+		LL_DEBUGS("Voice") << "attempt to delete nonexistent buddy " << uri << LL_ENDL;
 	}
+	
 }
 
-F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
-{		
-	if (mVoiceModule) 
+void LLVoiceClient::deleteAllBuddies(void)
+{
+	while(!mBuddyListMap.empty())
 	{
-		return mVoiceModule->getCurrentPower(id);
+		deleteBuddy(*(mBuddyListMap.begin()->first));
 	}
-	else
+	
+	// Don't want to correlate with friends list when we've emptied the buddy list.
+	mBuddyListMapPopulated = false;
+	
+	// Don't want to correlate with friends list when we've reset the block rules.
+	mBlockRulesListReceived = false;
+	mAutoAcceptRulesListReceived = false;
+}
+
+void LLVoiceClient::deleteAllBlockRules(void)
+{
+	// Clear the block list entry flags from all local buddy list entries
+	buddyListMap::iterator buddy_it;
+	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+	{
+		buddy_it->second->mHasBlockListEntry = false;
+	}
+}
+
+void LLVoiceClient::deleteAllAutoAcceptRules(void)
+{
+	// Clear the auto-accept list entry flags from all local buddy list entries
+	buddyListMap::iterator buddy_it;
+	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
 	{
-		return 0.0;
+		buddy_it->second->mHasAutoAcceptListEntry = false;
 	}
 }
 
-BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
+void LLVoiceClient::addBlockRule(const std::string &blockMask, const std::string &presenceOnly)
 {
-	if (mVoiceModule) 
+	buddyListEntry *buddy = NULL;
+
+	// blockMask is the SIP URI of a friends list entry
+	buddyListMap::iterator iter = mBuddyListMap.find(&blockMask);
+	if(iter != mBuddyListMap.end())
 	{
-		return mVoiceModule->getOnMuteList(id);
+		LL_DEBUGS("Voice") << "block list entry for " << blockMask << LL_ENDL;
+		buddy = iter->second;
 	}
-	else
+
+	if(buddy == NULL)
 	{
-		return FALSE;
+		LL_DEBUGS("Voice") << "block list entry for unknown buddy " << blockMask << LL_ENDL;
+		buddy = addBuddy(blockMask);
+	}
+	
+	if(buddy != NULL)
+	{
+		buddy->mHasBlockListEntry = true;
 	}
 }
 
-F32 LLVoiceClient::getUserVolume(const LLUUID& id)
+void LLVoiceClient::addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy)
 {
-	if (mVoiceModule) 
+	buddyListEntry *buddy = NULL;
+
+	// blockMask is the SIP URI of a friends list entry
+	buddyListMap::iterator iter = mBuddyListMap.find(&autoAcceptMask);
+	if(iter != mBuddyListMap.end())
 	{
-		return mVoiceModule->getUserVolume(id);
+		LL_DEBUGS("Voice") << "auto-accept list entry for " << autoAcceptMask << LL_ENDL;
+		buddy = iter->second;
 	}
-	else
+
+	if(buddy == NULL)
+	{
+		LL_DEBUGS("Voice") << "auto-accept list entry for unknown buddy " << autoAcceptMask << LL_ENDL;
+		buddy = addBuddy(autoAcceptMask);
+	}
+
+	if(buddy != NULL)
 	{
-		return 0.0;
+		buddy->mHasAutoAcceptListEntry = true;
 	}
 }
 
-void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
+void LLVoiceClient::accountListBlockRulesResponse(int statusCode, const std::string &statusString)
 {
-	if (mVoiceModule) mVoiceModule->setUserVolume(id, volume);
+	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
+	mBlockRulesListReceived = true;
 }
 
-//--------------------------------------------------
-// status observers
-
-void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
+void LLVoiceClient::accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString)
 {
-	if (mVoiceModule) mVoiceModule->addObserver(observer);
+	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
+	mAutoAcceptRulesListReceived = true;
 }
 
-void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
+void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
 {
-	if (mVoiceModule) mVoiceModule->removeObserver(observer);
+	mParticipantObservers.insert(observer);
 }
 
-void LLVoiceClient::addObserver(LLFriendObserver* observer)
+void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
 {
-	if (mVoiceModule) mVoiceModule->addObserver(observer);
+	mParticipantObservers.erase(observer);
 }
 
-void LLVoiceClient::removeObserver(LLFriendObserver* observer)
+void LLVoiceClient::notifyParticipantObservers()
 {
-	if (mVoiceModule) mVoiceModule->removeObserver(observer);
+	for (observer_set_t::iterator it = mParticipantObservers.begin();
+		it != mParticipantObservers.end();
+		)
+	{
+		LLVoiceClientParticipantObserver* observer = *it;
+		observer->onChange();
+		// In case onChange() deleted an entry.
+		it = mParticipantObservers.upper_bound(observer);
+	}
 }
 
-void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
+void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
 {
-	if (mVoiceModule) mVoiceModule->addObserver(observer);
+	mStatusObservers.insert(observer);
 }
 
-void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
+void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
 {
-	if (mVoiceModule) mVoiceModule->removeObserver(observer);
+	mStatusObservers.erase(observer);
 }
 
-std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
+void LLVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
 {
-	if (mVoiceModule) 
+	if(mAudioSession)
 	{
-		return mVoiceModule->sipURIFromID(id);
+		if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
+		{
+			switch(mAudioSession->mErrorStatusCode)
+			{
+				case 20713:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL; 		break;
+				case 20714:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED; 	break;
+				case 20715:
+					//invalid channel, we may be using a set of poorly cached
+					//info
+					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+					break;
+				case 1009:
+					//invalid username and password
+					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+					break;
+			}
+
+			// Reset the error code to make sure it won't be reused later by accident.
+			mAudioSession->mErrorStatusCode = 0;
+		}
+		else if(status == LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL)
+		{
+			switch(mAudioSession->mErrorStatusCode)
+			{
+				case 404:	// NOT_FOUND
+				case 480:	// TEMPORARILY_UNAVAILABLE
+				case 408:	// REQUEST_TIMEOUT
+					// call failed because other user was not available
+					// treat this as an error case
+					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+
+					// Reset the error code to make sure it won't be reused later by accident.
+					mAudioSession->mErrorStatusCode = 0;
+				break;
+			}
+		}
 	}
-	else
+		
+	LL_DEBUGS("Voice") 
+		<< " " << LLVoiceClientStatusObserver::status2string(status)  
+		<< ", session URI " << getAudioSessionURI() 
+		<< (inSpatialChannel()?", proximal is true":", proximal is false")
+	<< LL_ENDL;
+
+	for (status_observer_set_t::iterator it = mStatusObservers.begin();
+		it != mStatusObservers.end();
+		)
 	{
-		return std::string();
+		LLVoiceClientStatusObserver* observer = *it;
+		observer->onChange(status, getAudioSessionURI(), inSpatialChannel());
+		// In case onError() deleted an entry.
+		it = mStatusObservers.upper_bound(observer);
 	}
+
 }
 
-LLVoiceEffectInterface* LLVoiceClient::getVoiceEffectInterface() const
+void LLVoiceClient::addObserver(LLFriendObserver* observer)
 {
-	return getVoiceEffectEnabled() ? dynamic_cast<LLVoiceEffectInterface*>(mVoiceModule) : NULL;
+	mFriendObservers.insert(observer);
 }
 
-///////////////////
-// version checking
+void LLVoiceClient::removeObserver(LLFriendObserver* observer)
+{
+	mFriendObservers.erase(observer);
+}
 
-class LLViewerRequiredVoiceVersion : public LLHTTPNode
+void LLVoiceClient::notifyFriendObservers()
 {
-	static BOOL sAlertedUser;
-	virtual void post(
-					  LLHTTPNode::ResponsePtr response,
-					  const LLSD& context,
-					  const LLSD& input) const
+	for (friend_observer_set_t::iterator it = mFriendObservers.begin();
+		it != mFriendObservers.end();
+		)
 	{
-		//You received this messsage (most likely on region cross or
-		//teleport)
-		if ( input.has("body") && input["body"].has("major_version") )
+		LLFriendObserver* observer = *it;
+		it++;
+		// The only friend-related thing we notify on is online/offline transitions.
+		observer->changed(LLFriendObserver::ONLINE);
+	}
+}
+
+void LLVoiceClient::lookupName(const LLUUID &id)
+{
+	BOOL is_group = FALSE;
+	gCacheName->get(id, is_group, &LLVoiceClient::onAvatarNameLookup);
+}
+
+//static
+void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group)
+{
+	if(gVoiceClient)
+	{
+		std::string name = llformat("%s %s", first.c_str(), last.c_str());
+		gVoiceClient->avatarNameResolved(id, name);
+	}
+}
+
+void LLVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name)
+{
+	// If the avatar whose name just resolved is on our friends list, resync the friends list.
+	if(LLAvatarTracker::instance().getBuddyInfo(id) != NULL)
+	{
+		mFriendsListDirty = true;
+	}
+	
+	// Iterate over all sessions.
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	{
+		sessionState *session = *iter;
+
+		// Check for this user as a participant in this session
+		participantState *participant = session->findParticipantByID(id);
+		if(participant)
 		{
-			int major_voice_version =
-			input["body"]["major_version"].asInteger();
-			// 			int minor_voice_version =
-			// 				input["body"]["minor_version"].asInteger();
-			LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion();
-			
-			if (major_voice_version > 1)
+			// Found -- fill in the name
+			participant->mAccountName = name;
+			// and post a "participants updated" message to listeners later.
+			session->mParticipantsChanged = true;
+		}
+		
+		// Check whether this is a p2p session whose caller name just resolved
+		if(session->mCallerID == id)
+		{
+			// this session's "caller ID" just resolved.  Fill in the name.
+			session->mName = name;
+			if(session->mTextInvitePending)
 			{
-				if (!sAlertedUser)
-				{
-					//sAlertedUser = TRUE;
-					LLNotificationsUtil::add("VoiceVersionMismatch");
-					gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
-				}
+				session->mTextInvitePending = false;
+
+				// We don't need to call gIMMgr->addP2PSession() here.  The first incoming message will create the panel.				
+			}
+			if(session->mVoiceInvitePending)
+			{
+				session->mVoiceInvitePending = false;
+
+				gIMMgr->inviteToSession(
+					session->mIMSessionID,
+					session->mName,
+					session->mCallerID, 
+					session->mName, 
+					IM_SESSION_P2P_INVITE, 
+					LLIMMgr::INVITATION_TYPE_VOICE,
+					session->mHandle,
+					session->mSIPURI);
 			}
+			
 		}
 	}
-};
+}
 
 class LLViewerParcelVoiceInfo : public LLHTTPNode
 {
 	virtual void post(
-					  LLHTTPNode::ResponsePtr response,
-					  const LLSD& context,
-					  const LLSD& input) const
+		LLHTTPNode::ResponsePtr response,
+		const LLSD& context,
+		const LLSD& input) const
 	{
 		//the parcel you are in has changed something about its
 		//voice information
-		
+
 		//this is a misnomer, as it can also be when you are not in
 		//a parcel at all.  Should really be something like
 		//LLViewerVoiceInfoChanged.....
 		if ( input.has("body") )
 		{
 			LLSD body = input["body"];
-			
+
 			//body has "region_name" (str), "parcel_local_id"(int),
 			//"voice_credentials" (map).
-			
+
 			//body["voice_credentials"] has "channel_uri" (str),
 			//body["voice_credentials"] has "channel_credentials" (str)
-			
+
 			//if we really wanted to be extra careful,
 			//we'd check the supplied
 			//local parcel id to make sure it's for the same parcel
@@ -811,7 +7279,7 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode
 				LLSD voice_credentials = body["voice_credentials"];
 				std::string uri;
 				std::string credentials;
-				
+
 				if ( voice_credentials.has("channel_uri") )
 				{
 					uri = voice_credentials["channel_uri"].asString();
@@ -819,168 +7287,51 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode
 				if ( voice_credentials.has("channel_credentials") )
 				{
 					credentials =
-					voice_credentials["channel_credentials"].asString();
+						voice_credentials["channel_credentials"].asString();
 				}
-				
-				LLVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
+
+				gVoiceClient->setSpatialChannel(uri, credentials);
 			}
 		}
 	}
 };
 
-const std::string LLSpeakerVolumeStorage::SETTINGS_FILE_NAME = "volume_settings.xml";
-
-LLSpeakerVolumeStorage::LLSpeakerVolumeStorage()
-{
-	load();
-}
-
-LLSpeakerVolumeStorage::~LLSpeakerVolumeStorage()
-{
-	save();
-}
-
-void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 volume)
-{
-	if ((volume >= LLVoiceClient::VOLUME_MIN) && (volume <= LLVoiceClient::VOLUME_MAX))
-	{
-		mSpeakersData[speaker_id] = volume;
-
-		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-		// LL_DEBUGS("Voice") << "Stored volume = " << volume <<  " for " << id << LL_ENDL;
-	}
-	else
-	{
-		LL_WARNS("Voice") << "Attempted to store out of range volume " << volume << " for " << speaker_id << LL_ENDL;
-		llassert(0);
-	}
-}
-
-bool LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id, F32& volume)
-{
-	speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id);
-	
-	if (it != mSpeakersData.end())
-	{
-		volume = it->second;
-
-		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-		// LL_DEBUGS("Voice") << "Retrieved stored volume = " << volume <<  " for " << id << LL_ENDL;
-
-		return true;
-	}
-
-	return false;
-}
-
-void LLSpeakerVolumeStorage::removeSpeakerVolume(const LLUUID& speaker_id)
-{
-	mSpeakersData.erase(speaker_id);
-
-	// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-	// LL_DEBUGS("Voice") << "Removing stored volume for  " << id << LL_ENDL;
-}
-
-/* static */ F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in)
-{
-	// Convert to linear-logarithmic [0.0..1.0] with 0.5 = 0dB
-	// from legacy characteristic composed of two square-curves
-	// that intersect at volume_in = 0.5, volume_out = 0.56
-
-	F32 volume_out = 0.f;
-	volume_in = llclamp(volume_in, 0.f, 1.0f);
-
-	if (volume_in <= 0.5f)
-	{
-		volume_out = volume_in * volume_in * 4.f * 0.56f;
-	}
-	else
-	{
-		volume_out = (1.f - 0.56f) * (4.f * volume_in * volume_in - 1.f) / 3.f + 0.56f;
-	}
-
-	return volume_out;
-}
-
-/* static */ F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in)
-{
-	// Convert from linear-logarithmic [0.0..1.0] with 0.5 = 0dB
-	// to legacy characteristic composed of two square-curves
-	// that intersect at volume_in = 0.56, volume_out = 0.5
-
-	F32 volume_out = 0.f;
-	volume_in = llclamp(volume_in, 0.f, 1.0f);
-
-	if (volume_in <= 0.56f)
-	{
-		volume_out = sqrt(volume_in / (4.f * 0.56f));
-	}
-	else
-	{
-		volume_out = sqrt((3.f * (volume_in - 0.56f) / (1.f - 0.56f) + 1.f) / 4.f);
-	}
-
-	return volume_out;
-}
-
-void LLSpeakerVolumeStorage::load()
-{
-	// load per-resident voice volume information
-	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
-
-	LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL;
-
-	LLSD settings_llsd;
-	llifstream file;
-	file.open(filename);
-	if (file.is_open())
-	{
-		LLSDSerialize::fromXML(settings_llsd, file);
-	}
-
-	for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
-		iter != settings_llsd.endMap(); ++iter)
-	{
-		// Maintain compatibility with 1.23 non-linear saved volume levels
-		F32 volume = transformFromLegacyVolume((F32)iter->second.asReal());
-
-		storeSpeakerVolume(LLUUID(iter->first), volume);
-	}
-}
-
-void LLSpeakerVolumeStorage::save()
+class LLViewerRequiredVoiceVersion : public LLHTTPNode
 {
-	// If we quit from the login screen we will not have an SL account
-	// name.  Don't try to save, otherwise we'll dump a file in
-	// C:\Program Files\SecondLife\ or similar. JC
-	std::string user_dir = gDirUtilp->getLindenUserDir();
-	if (!user_dir.empty())
+	static BOOL sAlertedUser;
+	virtual void post(
+		LLHTTPNode::ResponsePtr response,
+		const LLSD& context,
+		const LLSD& input) const
 	{
-		std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
-		LLSD settings_llsd;
-
-		LL_INFOS("Voice") << "Saving stored speaker volumes to: " << filename << LL_ENDL;
-
-		for(speaker_data_map_t::const_iterator iter = mSpeakersData.begin(); iter != mSpeakersData.end(); ++iter)
+		//You received this messsage (most likely on region cross or
+		//teleport)
+		if ( input.has("body") && input["body"].has("major_version") )
 		{
-			// Maintain compatibility with 1.23 non-linear saved volume levels
-			F32 volume = transformToLegacyVolume(iter->second);
+			int major_voice_version =
+				input["body"]["major_version"].asInteger();
+// 			int minor_voice_version =
+// 				input["body"]["minor_version"].asInteger();
 
-			settings_llsd[iter->first.asString()] = volume;
+			if (gVoiceClient &&
+				(major_voice_version > VOICE_MAJOR_VERSION) )
+			{
+				if (!sAlertedUser)
+				{
+					//sAlertedUser = TRUE;
+					LLNotificationsUtil::add("VoiceVersionMismatch");
+					gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
+				}
+			}
 		}
-
-		llofstream file;
-		file.open(filename);
-		LLSDSerialize::toPrettyXML(settings_llsd, file);
 	}
-}
-
+};
 BOOL LLViewerRequiredVoiceVersion::sAlertedUser = FALSE;
 
 LLHTTPRegistration<LLViewerParcelVoiceInfo>
-gHTTPRegistrationMessageParcelVoiceInfo(
-										"/message/ParcelVoiceInfo");
+    gHTTPRegistrationMessageParcelVoiceInfo(
+		"/message/ParcelVoiceInfo");
 
 LLHTTPRegistration<LLViewerRequiredVoiceVersion>
-gHTTPRegistrationMessageRequiredVoiceVersion(
-											 "/message/RequiredVoiceVersion");
+    gHTTPRegistrationMessageRequiredVoiceVersion(
+		"/message/RequiredVoiceVersion");
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index 24d7d7163ede71a79208f7f2b3498bc910b9c538..a29c386182db988b5d96d56ced8b4b1a57a8f2c8 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -2,31 +2,38 @@
  * @file llvoiceclient.h
  * @brief Declaration of LLVoiceClient class which is the interface to the voice client process.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 #ifndef LL_VOICE_CLIENT_H
 #define LL_VOICE_CLIENT_H
 
 class LLVOAvatar;
+class LLVivoxProtocolParser;
 
 #include "lliopipe.h"
 #include "llpumpio.h"
@@ -35,25 +42,16 @@ class LLVOAvatar;
 #include "v3math.h"
 #include "llframetimer.h"
 #include "llviewerregion.h"
-#include "llcallingcard.h"   // for LLFriendObserver
-#include "llsecapi.h"
-#include "llcontrol.h"
-
-// devices
-
-typedef std::vector<std::string> LLVoiceDeviceList;	
-
+#include "m3math.h"			// LLMatrix3
 
+class LLFriendObserver;
 class LLVoiceClientParticipantObserver
 {
 public:
 	virtual ~LLVoiceClientParticipantObserver() { }
-	virtual void onParticipantsChanged() = 0;
+	virtual void onChange() = 0;
 };
 
-
-///////////////////////////////////
-/// @class LLVoiceClientStatusObserver
 class LLVoiceClientStatusObserver
 {
 public:
@@ -67,7 +65,11 @@ class LLVoiceClientStatusObserver
 		STATUS_JOINED,
 		STATUS_LEFT_CHANNEL,
 		STATUS_VOICE_DISABLED,
+
+		// Adding STATUS_VOICE_ENABLED as pair status for STATUS_VOICE_DISABLED
+		// See LLVoiceClient::setVoiceEnabled()
 		STATUS_VOICE_ENABLED,
+
 		BEGIN_ERROR_STATUS,
 		ERROR_CHANNEL_FULL,
 		ERROR_CHANNEL_LOCKED,
@@ -81,447 +83,699 @@ class LLVoiceClientStatusObserver
 	static std::string status2string(EStatusType inStatus);
 };
 
-struct LLVoiceVersionInfo
+class LLVoiceClient: public LLSingleton<LLVoiceClient>
 {
-	std::string serverType;
-	std::string serverVersion;
-};
-
-//////////////////////////////////
-/// @class LLVoiceModuleInterface
-/// @brief Voice module interface
-///
-/// Voice modules should provide an implementation for this interface.
-/////////////////////////////////
+	LOG_CLASS(LLVoiceClient);
+	public:
+		LLVoiceClient();	
+		~LLVoiceClient();
+		
+	public:
+		static void init(LLPumpIO *pump);	// Call this once at application startup (creates connector)
+		static void terminate();	// Call this to clean up during shutdown
+						
+	protected:
+		bool writeString(const std::string &str);
+
+	public:
+		
+		static F32 OVERDRIVEN_POWER_LEVEL;
 
-class LLVoiceModuleInterface
-{
-public:
-	LLVoiceModuleInterface() {}
-	virtual ~LLVoiceModuleInterface() {}
-	
-	virtual void init(LLPumpIO *pump)=0;	// Call this once at application startup (creates connector)
-	virtual void terminate()=0;	// Call this to clean up during shutdown
-	
-	virtual void updateSettings()=0; // call after loading settings and whenever they change
-	
-	virtual bool isVoiceWorking() const = 0; // connected to a voice server and voice channel
+		static const F32 VOLUME_MIN;
+		static const F32 VOLUME_DEFAULT;
+		static const F32 VOLUME_MAX;
 
-	virtual const LLVoiceVersionInfo& getVersion()=0;
-	
-	/////////////////////
-	/// @name Tuning
-	//@{
-	virtual void tuningStart()=0;
-	virtual void tuningStop()=0;
-	virtual bool inTuningMode()=0;
-	
-	virtual void tuningSetMicVolume(float volume)=0;
-	virtual void tuningSetSpeakerVolume(float volume)=0;
-	virtual float tuningGetEnergy(void)=0;
-	//@}
-	
-	/////////////////////
-	/// @name Devices
-	//@{
-	// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
-	// i.e. when the daemon is running and connected, and the device lists are populated.
-	virtual bool deviceSettingsAvailable()=0;
-	
-	// Requery the vivox daemon for the current list of input/output devices.
-	// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
-	// (use this if you want to know when it's done).
-	// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
-	virtual void refreshDeviceLists(bool clearCurrentList = true)=0;
-	
-	virtual void setCaptureDevice(const std::string& name)=0;
-	virtual void setRenderDevice(const std::string& name)=0;
-	
-	virtual LLVoiceDeviceList& getCaptureDevices()=0;
-	virtual LLVoiceDeviceList& getRenderDevices()=0;
-	
-	virtual void getParticipantList(std::set<LLUUID> &participants)=0;
-	virtual bool isParticipant(const LLUUID& speaker_id)=0;
-	//@}
-	
-	////////////////////////////
-	/// @ name Channel stuff
-	//@{
-	// returns true iff the user is currently in a proximal (local spatial) channel.
-	// Note that gestures should only fire if this returns true.
-	virtual bool inProximalChannel()=0;
-	
-	virtual void setNonSpatialChannel(const std::string &uri,
-									  const std::string &credentials)=0;
-	
-	virtual void setSpatialChannel(const std::string &uri,
-								   const std::string &credentials)=0;
-	
-	virtual void leaveNonSpatialChannel()=0;
-	
-	virtual void leaveChannel(void)=0;	
-	
-	// Returns the URI of the current channel, or an empty string if not currently in a channel.
-	// NOTE that it will return an empty string if it's in the process of joining a channel.
-	virtual std::string getCurrentChannel()=0;
-	//@}
-	
-	
-	//////////////////////////
-	/// @name invitations
-	//@{
-	// start a voice channel with the specified user
-	virtual void callUser(const LLUUID &uuid)=0;
-	virtual bool isValidChannel(std::string& channelHandle)=0;
-	virtual bool answerInvite(std::string &channelHandle)=0;
-	virtual void declineInvite(std::string &channelHandle)=0;
-	//@}
-	
-	/////////////////////////
-	/// @name Volume/gain
-	//@{
-	virtual void setVoiceVolume(F32 volume)=0;
-	virtual void setMicGain(F32 volume)=0;
-	//@}
-	
-	/////////////////////////
-	/// @name enable disable voice and features
-	//@{
-	virtual bool voiceEnabled()=0;
-	virtual void setVoiceEnabled(bool enabled)=0;
-	virtual void setLipSyncEnabled(BOOL enabled)=0;
-	virtual BOOL lipSyncEnabled()=0;	
-	virtual void setMuteMic(bool muted)=0;		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
-	//@}
-	
-	////////////////////////
-	/// @name PTT
-	//@{
-	virtual void setUserPTTState(bool ptt)=0;
-	virtual bool getUserPTTState()=0;
-	virtual void setUsePTT(bool usePTT)=0;
-	virtual void setPTTIsToggle(bool PTTIsToggle)=0;
-	virtual bool getPTTIsToggle()=0;	
-	virtual void toggleUserPTTState(void)=0;
-	virtual void inputUserControlState(bool down)=0;  // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
+		void updateSettings(); // call after loading settings and whenever they change
 	
-	virtual void keyDown(KEY key, MASK mask)=0;
-	virtual void keyUp(KEY key, MASK mask)=0;
-	virtual void middleMouseState(bool down)=0;
-	//@}
-	
-	//////////////////////////
-	/// @name nearby speaker accessors
-	//@{
-	virtual BOOL getVoiceEnabled(const LLUUID& id)=0;		// true if we've received data for this avatar
-	virtual std::string getDisplayName(const LLUUID& id)=0;
-	virtual BOOL isOnlineSIP(const LLUUID &id)=0;	
-	virtual BOOL isParticipantAvatar(const LLUUID &id)=0;
-	virtual BOOL getIsSpeaking(const LLUUID& id)=0;
-	virtual BOOL getIsModeratorMuted(const LLUUID& id)=0;
-	virtual F32 getCurrentPower(const LLUUID& id)=0;		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
-	virtual BOOL getOnMuteList(const LLUUID& id)=0;
-	virtual F32 getUserVolume(const LLUUID& id)=0;
-	virtual void setUserVolume(const LLUUID& id, F32 volume)=0; // set's volume for specified agent, from 0-1 (where .5 is nominal)	
-	//@}
-	
-	//////////////////////////
-	/// @name text chat
-	//@{
-	virtual BOOL isSessionTextIMPossible(const LLUUID& id)=0;
-	virtual BOOL isSessionCallBackPossible(const LLUUID& id)=0;
-	virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message)=0;
-	virtual void endUserIMSession(const LLUUID &uuid)=0;	
-	//@}
-	
-	// authorize the user
-	virtual void userAuthorized(const std::string& user_id,
-								const LLUUID &agentID)=0;
-	
-	//////////////////////////////
-	/// @name Status notification
-	//@{
-	virtual void addObserver(LLVoiceClientStatusObserver* observer)=0;
-	virtual void removeObserver(LLVoiceClientStatusObserver* observer)=0;
-	virtual void addObserver(LLFriendObserver* observer)=0;
-	virtual void removeObserver(LLFriendObserver* observer)=0;	
-	virtual void addObserver(LLVoiceClientParticipantObserver* observer)=0;
-	virtual void removeObserver(LLVoiceClientParticipantObserver* observer)=0;	
-	//@}
-	
-	virtual std::string sipURIFromID(const LLUUID &id)=0;
-	//@}
-	
-};
+		void getCaptureDevicesSendMessage();
+		void getRenderDevicesSendMessage();
+		
+		void clearCaptureDevices();
+		void addCaptureDevice(const std::string& name);
+		void setCaptureDevice(const std::string& name);
+		
+		void clearRenderDevices();
+		void addRenderDevice(const std::string& name);
+		void setRenderDevice(const std::string& name);
+
+		void tuningStart();
+		void tuningStop();
+		bool inTuningMode();
+		bool inTuningStates();
+		
+		void tuningRenderStartSendMessage(const std::string& name, bool loop);
+		void tuningRenderStopSendMessage();
 
+		void tuningCaptureStartSendMessage(int duration);
+		void tuningCaptureStopSendMessage();
+		
+		void tuningSetMicVolume(float volume);
+		void tuningSetSpeakerVolume(float volume);
+		float tuningGetEnergy(void);
+				
+		// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+		// i.e. when the daemon is running and connected, and the device lists are populated.
+		bool deviceSettingsAvailable();
+		
+		// Requery the vivox daemon for the current list of input/output devices.
+		// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+		// (use this if you want to know when it's done).
+		// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+		void refreshDeviceLists(bool clearCurrentList = true);
+		
+		// Call this if the connection to the daemon terminates unexpectedly.  It will attempt to reset everything and relaunch.
+		void daemonDied();
 
-//////////////////////////////////
-/// @class LLVoiceEffectObserver
-class LLVoiceEffectObserver
-{
-public:
-	virtual ~LLVoiceEffectObserver() { }
-	virtual void onVoiceEffectChanged(bool effect_list_updated) = 0;
-};
+		// Call this if we're just giving up on voice (can't provision an account, etc.).  It will clean up and go away.
+		void giveUp();
+		
+		/////////////////////////////
+		// Response/Event handlers
+		void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID);
+		void loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases);
+		void sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+		void sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+		void sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString);
+		void logoutResponse(int statusCode, std::string &statusString);
+		void connectorShutdownResponse(int statusCode, std::string &statusString);
+
+		void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state);
+		void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming);
+		void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming);
+		void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString);
+		void sessionGroupAddedEvent(std::string &sessionGroupHandle);
+		void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle);
+		void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
+		void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
+		void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
+		void auxAudioPropertiesEvent(F32 energy);
+		void buddyPresenceEvent(std::string &uriString, std::string &alias, std::string &statusString, std::string &applicationString);
+		void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
+		void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
+		void subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType);
+		
+		void buddyListChanged();
+		void muteListChanged();
+		void updateFriends(U32 mask);
+		
+		/////////////////////////////
+		// Sending updates of current state
+static	void updatePosition(void);
+		void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+		void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+		bool channelFromRegion(LLViewerRegion *region, std::string &name);
+		void leaveChannel(void);		// call this on logout or teleport begin
 
-typedef std::multimap<const std::string, const LLUUID, LLDictionaryLess> voice_effect_list_t;
+		
+		void setMuteMic(bool muted);		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
+		bool getMuteMic() const;
+		void setUserPTTState(bool ptt);
+		bool getUserPTTState();
+		void toggleUserPTTState(void);
+		void inputUserControlState(bool down); // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
+		void setVoiceEnabled(bool enabled);
+		static bool voiceEnabled();
+		// Checks is voice working judging from mState
+		// Returns true if vivox has successfully logged in and is not in error state
+		bool voiceWorking();
+		void setUsePTT(bool usePTT);
+		void setPTTIsToggle(bool PTTIsToggle);
+		bool getPTTIsToggle();
+		void setPTTKey(std::string &key);
+		void setEarLocation(S32 loc);
+		void setVoiceVolume(F32 volume);
+		void setMicGain(F32 volume);
+		void setUserVolume(const LLUUID& id, F32 volume); // sets volume for specified agent, from 0-1 (where .5 is nominal)
+		void setLipSyncEnabled(BOOL enabled);
+		BOOL lipSyncEnabled();
+
+		// PTT key triggering
+		void keyDown(KEY key, MASK mask);
+		void keyUp(KEY key, MASK mask);
+		void middleMouseState(bool down);
+
+		// Return the version of the Vivox library
+		std::string getAPIVersion() const { return mAPIVersion; }
+		
+		/////////////////////////////
+		// Accessors for data related to nearby speakers
+		BOOL getVoiceEnabled(const LLUUID& id);		// true if we've received data for this avatar
+		BOOL getIsSpeaking(const LLUUID& id);
+		BOOL getIsModeratorMuted(const LLUUID& id);
+		F32 getCurrentPower(const LLUUID& id);		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
+		BOOL getOnMuteList(const LLUUID& id);
+		F32 getUserVolume(const LLUUID& id);
+		std::string getDisplayName(const LLUUID& id);
+		
+		// MBW -- XXX -- Not sure how to get this data out of the TVC
+		BOOL getUsingPTT(const LLUUID& id);
+		std::string getGroupID(const LLUUID& id);		// group ID if the user is in group chat (empty string if not applicable)
 
-//////////////////////////////////
-/// @class LLVoiceEffectInterface
-/// @brief Voice effect module interface
-///
-/// Voice effect modules should provide an implementation for this interface.
-/////////////////////////////////
+		/////////////////////////////
+		BOOL getAreaVoiceDisabled();		// returns true if the area the avatar is in is speech-disabled.
+											// Use this to determine whether to show a "no speech" icon in the menu bar.
+		
+		/////////////////////////////
+		// Recording controls
+		void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
+		void recordingLoopSave(const std::string& filename);
+		void recordingStop();
+		
+		// Playback controls
+		void filePlaybackStart(const std::string& filename);
+		void filePlaybackStop();
+		void filePlaybackSetPaused(bool paused);
+		void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
+		
+		
+		// This is used by the string-keyed maps below, to avoid storing the string twice.
+		// The 'const std::string *' in the key points to a string actually stored in the object referenced by the map.
+		// The add and delete operations for each map allocate and delete in the right order to avoid dangling references.
+		// The default compare operation would just compare pointers, which is incorrect, so they must use this comparitor instead.
+		struct stringMapComparitor
+		{
+			bool operator()(const std::string* a, const std::string * b) const
+			{
+				return a->compare(*b) < 0;
+			}
+		};
+
+		struct uuidMapComparitor
+		{
+			bool operator()(const LLUUID* a, const LLUUID * b) const
+			{
+				return *a < *b;
+			}
+		};
+		
+		struct participantState
+		{
+		public:
+			participantState(const std::string &uri);
+
+			bool updateMuteState();	// true if mute state has changed
+			bool isAvatar();
+
+			std::string mURI;
+			LLUUID mAvatarID;
+			std::string mAccountName;
+			std::string mDisplayName;
+			LLFrameTimer mSpeakingTimeout;
+			F32	mLastSpokeTimestamp;
+			F32 mPower;
+			F32 mVolume;
+			std::string mGroupID;
+			bool mPTT;
+			bool mIsSpeaking;
+			bool mIsModeratorMuted;
+			bool mOnMuteList;		// true if this avatar is on the user's mute list (and should be muted)
+			bool mVolumeSet;		// true if incoming volume messages should not change the volume
+			bool mVolumeDirty;		// true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
+			bool mAvatarIDValid;
+			bool mIsSelf;
+		};
+		typedef std::map<const std::string *, participantState*, stringMapComparitor> participantMap;
+
+		typedef std::map<const LLUUID *, participantState*, uuidMapComparitor> participantUUIDMap;
+	
+		enum streamState
+		{
+			streamStateUnknown = 0,
+			streamStateIdle = 1,
+			streamStateConnected = 2,
+			streamStateRinging = 3,
+		};
+		
+		struct sessionState
+		{
+		public:
+			sessionState();
+			~sessionState();
+
+			participantState *addParticipant(const std::string &uri);
+			// Note: after removeParticipant returns, the participant* that was passed to it will have been deleted.
+			// Take care not to use the pointer again after that.
+			void removeParticipant(participantState *participant);
+			void removeAllParticipants();
+
+			participantState *findParticipant(const std::string &uri);
+			participantState *findParticipantByID(const LLUUID& id);
+
+			bool isCallBackPossible();
+			bool isTextIMPossible();
+
+			std::string mHandle;
+			std::string mGroupHandle;
+			std::string mSIPURI;
+			std::string mAlias;
+			std::string mName;
+			std::string mAlternateSIPURI;
+			std::string mHash;			// Channel password
+			std::string mErrorStatusString;
+			std::queue<std::string> mTextMsgQueue;
+			
+			LLUUID		mIMSessionID;
+			LLUUID		mCallerID;
+			int			mErrorStatusCode;
+			int			mMediaStreamState;
+			int			mTextStreamState;
+			bool		mCreateInProgress;	// True if a Session.Create has been sent for this session and no response has been received yet.
+			bool		mMediaConnectInProgress;	// True if a Session.MediaConnect has been sent for this session and no response has been received yet.
+			bool		mVoiceInvitePending;	// True if a voice invite is pending for this session (usually waiting on a name lookup)
+			bool		mTextInvitePending;		// True if a text invite is pending for this session (usually waiting on a name lookup)
+			bool		mSynthesizedCallerID;	// True if the caller ID is a hash of the SIP URI -- this means we shouldn't do a name lookup.
+			bool		mIsChannel;	// True for both group and spatial channels (false for p2p, PSTN)
+			bool		mIsSpatial;	// True for spatial channels
+			bool		mIsP2P;
+			bool		mIncoming;
+			bool		mVoiceEnabled;
+			bool		mReconnect;	// Whether we should try to reconnect to this session if it's dropped
+			// Set to true when the mute state of someone in the participant list changes.
+			// The code will have to walk the list to find the changed participant(s).
+			bool		mVolumeDirty;
+			bool		mMuteDirty;
+
+			bool		mParticipantsChanged;
+			participantMap mParticipantsByURI;
+			participantUUIDMap mParticipantsByUUID;
+		};
+
+		participantState *findParticipantByID(const LLUUID& id);
+		participantMap *getParticipantList(void);
+		void getParticipantsUUIDSet(std::set<LLUUID>& participant_uuids);
+		
+		typedef std::map<const std::string*, sessionState*, stringMapComparitor> sessionMap;
+		typedef std::set<sessionState*> sessionSet;
+				
+		typedef sessionSet::iterator sessionIterator;
+		sessionIterator sessionsBegin(void);
+		sessionIterator sessionsEnd(void);
+
+		sessionState *findSession(const std::string &handle);
+		sessionState *findSessionBeingCreatedByURI(const std::string &uri);
+		sessionState *findSession(const LLUUID &participant_id);
+		sessionState *findSessionByCreateID(const std::string &create_id);
+		
+		sessionState *addSession(const std::string &uri, const std::string &handle = LLStringUtil::null);
+		void setSessionHandle(sessionState *session, const std::string &handle = LLStringUtil::null);
+		void setSessionURI(sessionState *session, const std::string &uri);
+		void deleteSession(sessionState *session);
+		void deleteAllSessions(void);
 
-class LLVoiceEffectInterface
-{
-public:
-	LLVoiceEffectInterface() {}
-	virtual ~LLVoiceEffectInterface() {}
-
-	//////////////////////////
-	/// @name Accessors
-	//@{
-	virtual bool setVoiceEffect(const LLUUID& id) = 0;
-	virtual const LLUUID getVoiceEffect() = 0;
-	virtual LLSD getVoiceEffectProperties(const LLUUID& id) = 0;
-
-	virtual void refreshVoiceEffectLists(bool clear_lists) = 0;
-	virtual const voice_effect_list_t &getVoiceEffectList() const = 0;
-	virtual const voice_effect_list_t &getVoiceEffectTemplateList() const = 0;
-	//@}
-
-	//////////////////////////////
-	/// @name Status notification
-	//@{
-	virtual void addObserver(LLVoiceEffectObserver* observer) = 0;
-	virtual void removeObserver(LLVoiceEffectObserver* observer) = 0;
-	//@}
-
-	//////////////////////////////
-	/// @name Preview buffer
-	//@{
-	virtual void enablePreviewBuffer(bool enable) = 0;
-	virtual void recordPreviewBuffer() = 0;
-	virtual void playPreviewBuffer(const LLUUID& effect_id = LLUUID::null) = 0;
-	virtual void stopPreviewBuffer() = 0;
-
-	virtual bool isPreviewRecording() = 0;
-	virtual bool isPreviewPlaying() = 0;
-	//@}
-};
+		void verifySessionState(void);
 
+		void joinedAudioSession(sessionState *session);
+		void leftAudioSession(sessionState *session);
 
-class LLVoiceClient: public LLSingleton<LLVoiceClient>
-{
-	LOG_CLASS(LLVoiceClient);
-public:
-	LLVoiceClient();	
-	~LLVoiceClient();
+		// This is called in several places where the session _may_ need to be deleted.
+		// It contains logic for whether to delete the session or keep it around.
+		void reapSession(sessionState *session);
+		
+		// Returns true if the session seems to indicate we've moved to a region on a different voice server
+		bool sessionNeedsRelog(sessionState *session);
+		
+		struct buddyListEntry
+		{
+			buddyListEntry(const std::string &uri);
+			std::string mURI;
+			std::string mDisplayName;
+			LLUUID	mUUID;
+			bool mOnlineSL;
+			bool mOnlineSLim;
+			bool mCanSeeMeOnline;
+			bool mHasBlockListEntry;
+			bool mHasAutoAcceptListEntry;
+			bool mNameResolved;
+			bool mInSLFriends;
+			bool mInVivoxBuddies;
+			bool mNeedsNameUpdate;
+		};
+
+		typedef std::map<const std::string*, buddyListEntry*, stringMapComparitor> buddyListMap;
+		
+		// This should be called when parsing a buddy list entry sent by SLVoice.		
+		void processBuddyListEntry(const std::string &uri, const std::string &displayName);
+
+		buddyListEntry *addBuddy(const std::string &uri);
+		buddyListEntry *addBuddy(const std::string &uri, const std::string &displayName);
+		buddyListEntry *findBuddy(const std::string &uri);
+		buddyListEntry *findBuddy(const LLUUID &id);
+		buddyListEntry *findBuddyByDisplayName(const std::string &name);
+		void deleteBuddy(const std::string &uri);
+		void deleteAllBuddies(void);
+
+		void deleteAllBlockRules(void);
+		void addBlockRule(const std::string &blockMask, const std::string &presenceOnly);
+		void deleteAllAutoAcceptRules(void);
+		void addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy);
+		void accountListBlockRulesResponse(int statusCode, const std::string &statusString);						
+		void accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString);						
+		
+		/////////////////////////////
+		// session control messages
+		void connectorCreate();
+		void connectorShutdown();
+
+		void requestVoiceAccountProvision(S32 retries = 3);
+		void userAuthorized(
+			const std::string& firstName,
+			const std::string& lastName,
+			const LLUUID &agentID);
+		void login(
+			const std::string& account_name,
+			const std::string& password,
+			const std::string& voice_sip_uri_hostname,
+			const std::string& voice_account_server_uri);
+		void loginSendMessage();
+		void logout();
+		void logoutSendMessage();
+
+		void accountListBlockRulesSendMessage();
+		void accountListAutoAcceptRulesSendMessage();
+		
+		void sessionGroupCreateSendMessage();
+		void sessionCreateSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
+		void sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
+		void sessionMediaConnectSendMessage(sessionState *session);		// just joins the audio session
+		void sessionTextConnectSendMessage(sessionState *session);		// just joins the text session
+		void sessionTerminateSendMessage(sessionState *session);
+		void sessionGroupTerminateSendMessage(sessionState *session);
+		void sessionMediaDisconnectSendMessage(sessionState *session);
+		void sessionTextDisconnectSendMessage(sessionState *session);
+
+		// Pokes the state machine to leave the audio session next time around.
+		void sessionTerminate();	
+		
+		// Pokes the state machine to shut down the connector and restart it.
+		void requestRelog();
+		
+		// Does the actual work to get out of the audio session
+		void leaveAudioSession();
+		
+		void addObserver(LLVoiceClientParticipantObserver* observer);
+		void removeObserver(LLVoiceClientParticipantObserver* observer);
 
-	void init(LLPumpIO *pump);	// Call this once at application startup (creates connector)
-	void terminate();	// Call this to clean up during shutdown
-	
-	const LLVoiceVersionInfo getVersion();
-	
-	static const F32 OVERDRIVEN_POWER_LEVEL;
+		void addObserver(LLVoiceClientStatusObserver* observer);
+		void removeObserver(LLVoiceClientStatusObserver* observer);
 
-	static const F32 VOLUME_MIN;
-	static const F32 VOLUME_DEFAULT;
-	static const F32 VOLUME_MAX;
+		void addObserver(LLFriendObserver* observer);
+		void removeObserver(LLFriendObserver* observer);
+		
+		void lookupName(const LLUUID &id);
+		static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group);
+		void avatarNameResolved(const LLUUID &id, const std::string &name);
+		
+		typedef std::vector<std::string> deviceList;
 
-	void updateSettings(); // call after loading settings and whenever they change
+		deviceList *getCaptureDevices();
+		deviceList *getRenderDevices();
+		
+		void setNonSpatialChannel(
+			const std::string &uri,
+			const std::string &credentials);
+		void setSpatialChannel(
+			const std::string &uri,
+			const std::string &credentials);
+		// start a voice session with the specified user
+		void callUser(const LLUUID &uuid);
+		
+		// Send a text message to the specified user, initiating the session if necessary.
+		bool sendTextMessage(const LLUUID& participant_id, const std::string& message);
+		
+		// close any existing text IM session with the specified user
+		void endUserIMSession(const LLUUID &uuid);
+		
+		bool answerInvite(std::string &sessionHandle);
+		void declineInvite(std::string &sessionHandle);
+		void leaveNonSpatialChannel();
 
-	bool isVoiceWorking() const; // connected to a voice server and voice channel
+		// Returns the URI of the current channel, or an empty string if not currently in a channel.
+		// NOTE that it will return an empty string if it's in the process of joining a channel.
+		std::string getCurrentChannel();
+		
+		// returns true iff the user is currently in a proximal (local spatial) channel.
+		// Note that gestures should only fire if this returns true.
+		bool inProximalChannel();
 
-	// tuning
-	void tuningStart();
-	void tuningStop();
-	bool inTuningMode();
+		std::string sipURIFromID(const LLUUID &id);
+				
+		// Returns true if the indicated user is online via SIP presence according to SLVoice.
+		// Note that we only get SIP presence data for other users that are in our vivox buddy list.
+		bool isOnlineSIP(const LLUUID &id);
+
+		// Returns true if the indicated participant is really an SL avatar.
+		// This should be used to control the state of the "profile" button.
+		// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
+		bool isParticipantAvatar(const LLUUID &id);
+		
+		// Returns true if calling back the session URI after the session has closed is possible.
+		// Currently this will be false only for PSTN P2P calls.		
+		// NOTE: this will return true if the session can't be found. 
+		bool isSessionCallBackPossible(const LLUUID &session_id);
+		
+		// Returns true if the session can accepte text IM's.
+		// Currently this will be false only for PSTN P2P calls.
+		// NOTE: this will return true if the session can't be found. 
+		bool isSessionTextIMPossible(const LLUUID &session_id);
+		
+	private:
+
+		// internal state for a simple state machine.  This is used to deal with the asynchronous nature of some of the messages.
+		// Note: if you change this list, please make corresponding changes to LLVoiceClient::state2string().
+		enum state
+		{
+			stateDisableCleanup,
+			stateDisabled,				// Voice is turned off.
+			stateStart,					// Class is initialized, socket is created
+			stateDaemonLaunched,		// Daemon has been launched
+			stateConnecting,			// connect() call has been issued
+			stateConnected,				// connection to the daemon has been made, send some initial setup commands.
+			stateIdle,					// socket is connected, ready for messaging
+			stateMicTuningStart,
+			stateMicTuningRunning,		
+			stateMicTuningStop,
+			stateConnectorStart,		// connector needs to be started
+			stateConnectorStarting,		// waiting for connector handle
+			stateConnectorStarted,		// connector handle received
+			stateLoginRetry,			// need to retry login (failed due to changing password)
+			stateLoginRetryWait,		// waiting for retry timer
+			stateNeedsLogin,			// send login request
+			stateLoggingIn,				// waiting for account handle
+			stateLoggedIn,				// account handle received
+			stateCreatingSessionGroup,	// Creating the main session group
+			stateNoChannel,				// 
+			stateJoiningSession,		// waiting for session handle
+			stateSessionJoined,			// session handle received
+			stateRunning,				// in session, steady state
+			stateLeavingSession,		// waiting for terminate session response
+			stateSessionTerminated,		// waiting for terminate session response
+
+			stateLoggingOut,			// waiting for logout response
+			stateLoggedOut,				// logout response received
+			stateConnectorStopping,		// waiting for connector stop
+			stateConnectorStopped,		// connector stop received
+			
+			// We go to this state if the login fails because the account needs to be provisioned.
+			
+			// error states.  No way to recover from these yet.
+			stateConnectorFailed,
+			stateConnectorFailedWaiting,
+			stateLoginFailed,
+			stateLoginFailedWaiting,
+			stateJoinSessionFailed,
+			stateJoinSessionFailedWaiting,
+
+			stateJail					// Go here when all else has failed.  Nothing will be retried, we're done.
+		};
+		
+		state mState;
+		bool mSessionTerminateRequested;
+		bool mRelogRequested;
+		// Number of times (in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine().
+		// The larger it is the greater is possibility there is a problem with connection to voice server.
+		// Introduced while fixing EXT-4313.
+		int mSpatialJoiningNum;
+		
+		void setState(state inState);
+		state getState(void)  { return mState; };
+		static std::string state2string(state inState);
+		
+		void stateMachine();
+		static void idle(void *user_data);
+		
+		LLHost mDaemonHost;
+		LLSocket::ptr_t mSocket;
+		bool mConnected;
+		
+		void closeSocket(void);
 		
-	void tuningSetMicVolume(float volume);
-	void tuningSetSpeakerVolume(float volume);
-	float tuningGetEnergy(void);
+		LLPumpIO *mPump;
+		friend class LLVivoxProtocolParser;
+		
+		std::string mAccountName;
+		std::string mAccountPassword;
+		std::string mAccountDisplayName;
+		std::string mAccountFirstName;
+		std::string mAccountLastName;
 				
-	// devices
-	
-	// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
-	// i.e. when the daemon is running and connected, and the device lists are populated.
-	bool deviceSettingsAvailable();
+		bool mTuningMode;
+		float mTuningEnergy;
+		std::string mTuningAudioFile;
+		int mTuningMicVolume;
+		bool mTuningMicVolumeDirty;
+		int mTuningSpeakerVolume;
+		bool mTuningSpeakerVolumeDirty;
+		state mTuningExitState;					// state to return to when we leave tuning mode.
 		
-	// Requery the vivox daemon for the current list of input/output devices.
-	// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
-	// (use this if you want to know when it's done).
-	// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
-	void refreshDeviceLists(bool clearCurrentList = true);
+		std::string mSpatialSessionURI;
+		std::string mSpatialSessionCredentials;
 
-	void setCaptureDevice(const std::string& name);
-	void setRenderDevice(const std::string& name);
+		std::string mMainSessionGroupHandle; // handle of the "main" session group.
+		
+		std::string mChannelName;			// Name of the channel to be looked up 
+		bool mAreaVoiceDisabled;
+		sessionState *mAudioSession;		// Session state for the current audio session
+		bool mAudioSessionChanged;			// set to true when the above pointer gets changed, so observers can be notified.
 
-	const LLVoiceDeviceList& getCaptureDevices();
-	const LLVoiceDeviceList& getRenderDevices();
+		sessionState *mNextAudioSession;	// Session state for the audio session we're trying to join
 
-	////////////////////////////
-	// Channel stuff
-	//
-	
-	// returns true iff the user is currently in a proximal (local spatial) channel.
-	// Note that gestures should only fire if this returns true.
-	bool inProximalChannel();
-	void setNonSpatialChannel(
-							  const std::string &uri,
-							  const std::string &credentials);
-	void setSpatialChannel(
-						   const std::string &uri,
-						   const std::string &credentials);
-	void leaveNonSpatialChannel();
-	
-	// Returns the URI of the current channel, or an empty string if not currently in a channel.
-	// NOTE that it will return an empty string if it's in the process of joining a channel.
-	std::string getCurrentChannel();
-	// start a voice channel with the specified user
-	void callUser(const LLUUID &uuid);
-	bool isValidChannel(std::string& channelHandle);
-	bool answerInvite(std::string &channelHandle);
-	void declineInvite(std::string &channelHandle);	
-	void leaveChannel(void);		// call this on logout or teleport begin
-	
-	
-	/////////////////////////////
-	// Sending updates of current state
+//		std::string mSessionURI;			// URI of the session we're in.
+//		std::string mSessionHandle;		// returned by ?
+		
+		S32 mCurrentParcelLocalID;			// Used to detect parcel boundary crossings
+		std::string mCurrentRegionName;		// Used to detect parcel boundary crossings
+		
+		std::string mConnectorHandle;	// returned by "Create Connector" message
+		std::string mAccountHandle;		// returned by login message		
+		int 		mNumberOfAliases;
+		U32 mCommandCookie;
 	
+		std::string mVoiceAccountServerURI;
+		std::string mVoiceSIPURIHostName;
+		
+		int mLoginRetryCount;
+		
+		sessionMap mSessionsByHandle;				// Active sessions, indexed by session handle.  Sessions which are being initiated may not be in this map.
+		sessionSet mSessions;						// All sessions, not indexed.  This is the canonical session list.
+		
+		bool mBuddyListMapPopulated;
+		bool mBlockRulesListReceived;
+		bool mAutoAcceptRulesListReceived;
+		buddyListMap mBuddyListMap;
+		
+		deviceList mCaptureDevices;
+		deviceList mRenderDevices;
 
-	void setVoiceVolume(F32 volume);
-	void setMicGain(F32 volume);
-	void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)		
-	bool voiceEnabled();
-	void setLipSyncEnabled(BOOL enabled);
-	void setMuteMic(bool muted);		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
-	void setUserPTTState(bool ptt);
-	bool getUserPTTState();
-	void toggleUserPTTState(void);
-	void inputUserControlState(bool down);  // interpret any sort of up-down mic-open control input according to ptt-toggle prefs	
-	void setVoiceEnabled(bool enabled);
-
-	void setUsePTT(bool usePTT);
-	void setPTTIsToggle(bool PTTIsToggle);
-	bool getPTTIsToggle();	
-	
-	BOOL lipSyncEnabled();
-	
-	// PTT key triggering
-	void keyDown(KEY key, MASK mask);
-	void keyUp(KEY key, MASK mask);
-	void middleMouseState(bool down);
-	
-	
-	/////////////////////////////
-	// Accessors for data related to nearby speakers
-	BOOL getVoiceEnabled(const LLUUID& id);		// true if we've received data for this avatar
-	std::string getDisplayName(const LLUUID& id);	
-	BOOL isOnlineSIP(const LLUUID &id);
-	BOOL isParticipantAvatar(const LLUUID &id);
-	BOOL getIsSpeaking(const LLUUID& id);
-	BOOL getIsModeratorMuted(const LLUUID& id);
-	F32 getCurrentPower(const LLUUID& id);		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
-	BOOL getOnMuteList(const LLUUID& id);
-	F32 getUserVolume(const LLUUID& id);
-
-	/////////////////////////////
-	BOOL getAreaVoiceDisabled();		// returns true if the area the avatar is in is speech-disabled.
-													  // Use this to determine whether to show a "no speech" icon in the menu bar.
-	void getParticipantList(std::set<LLUUID> &participants);
-	bool isParticipant(const LLUUID& speaker_id);
-	
-	//////////////////////////
-	/// @name text chat
-	//@{
-	BOOL isSessionTextIMPossible(const LLUUID& id);
-	BOOL isSessionCallBackPossible(const LLUUID& id);
-	BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message);
-	void endUserIMSession(const LLUUID &uuid);	
-	//@}
-	
+		std::string mCaptureDevice;
+		std::string mRenderDevice;
+		bool mCaptureDeviceDirty;
+		bool mRenderDeviceDirty;
+		
+		// This should be called when the code detects we have changed parcels.
+		// It initiates the call to the server that gets the parcel channel.
+		void parcelChanged();
+		
+	void switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
+		void joinSession(sessionState *session);
+		
+static 	std::string nameFromAvatar(LLVOAvatar *avatar);
+static	std::string nameFromID(const LLUUID &id);
+static	bool IDFromName(const std::string name, LLUUID &uuid);
+static	std::string displayNameFromAvatar(LLVOAvatar *avatar);
+		std::string sipURIFromAvatar(LLVOAvatar *avatar);
+		std::string sipURIFromName(std::string &name);
+		
+		// Returns the name portion of the SIP URI if the string looks vaguely like a SIP URI, or an empty string if not.
+static	std::string nameFromsipURI(const std::string &uri);		
 
-	void userAuthorized(const std::string& user_id,
-			const LLUUID &agentID);
-	
-	void addObserver(LLVoiceClientStatusObserver* observer);
-	void removeObserver(LLVoiceClientStatusObserver* observer);
-	void addObserver(LLFriendObserver* observer);
-	void removeObserver(LLFriendObserver* observer);
-	void addObserver(LLVoiceClientParticipantObserver* observer);
-	void removeObserver(LLVoiceClientParticipantObserver* observer);
-	
-	std::string sipURIFromID(const LLUUID &id);	
+		bool inSpatialChannel(void);
+		std::string getAudioSessionURI();
+		std::string getAudioSessionHandle();
+				
+		void sendPositionalUpdate(void);
+		
+		void buildSetCaptureDevice(std::ostringstream &stream);
+		void buildSetRenderDevice(std::ostringstream &stream);
+		void buildLocalAudioUpdates(std::ostringstream &stream);
+		
+		void clearAllLists();
+		void checkFriend(const LLUUID& id);
+		void sendFriendsListUpdates();
+
+		// start a text IM session with the specified user
+		// This will be asynchronous, the session may be established at a future time.
+		sessionState* startUserIMSession(const LLUUID& uuid);
+		void sendQueuedTextMessages(sessionState *session);
+		
+		void enforceTether(void);
+		
+		bool		mSpatialCoordsDirty;
+		
+		LLVector3d	mCameraPosition;
+		LLVector3d	mCameraRequestedPosition;
+		LLVector3	mCameraVelocity;
+		LLMatrix3	mCameraRot;
+
+		LLVector3d	mAvatarPosition;
+		LLVector3	mAvatarVelocity;
+		LLMatrix3	mAvatarRot;
+		
+		bool		mPTTDirty;
+		bool		mPTT;
+		
+		bool		mUsePTT;
+		bool		mPTTIsMiddleMouse;
+		KEY			mPTTKey;
+		bool		mPTTIsToggle;
+		bool		mUserPTTState;
+		bool		mMuteMic;
+				
+		// Set to true when the friends list is known to have changed.
+		bool		mFriendsListDirty;
+		
+		enum
+		{
+			earLocCamera = 0,		// ear at camera
+			earLocAvatar,			// ear at avatar
+			earLocMixed				// ear at avatar location/camera direction
+		};
+		
+		S32			mEarLocation;  
+		
+		bool		mSpeakerVolumeDirty;
+		bool		mSpeakerMuteDirty;
+		int			mSpeakerVolume;
 
-	//////////////////////////
-	/// @name Voice effects
-	//@{
-	bool getVoiceEffectEnabled() const { return mVoiceEffectEnabled; };
-	LLUUID getVoiceEffectDefault() const { return LLUUID(mVoiceEffectDefault); };
+		int			mMicVolume;
+		bool		mMicVolumeDirty;
+		
+		bool		mVoiceEnabled;
+		bool		mWriteInProgress;
+		std::string mWriteString;
+		
+		LLTimer		mUpdateTimer;
+		
+		BOOL		mLipSyncEnabled;
 
-	// Returns NULL if voice effects are not supported, or not enabled.
-	LLVoiceEffectInterface* getVoiceEffectInterface() const;
-	//@}
+		std::string	mAPIVersion;
 
-protected:
-	LLVoiceModuleInterface* mVoiceModule;
-	LLPumpIO *m_servicePump;
+		typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
+		observer_set_t mParticipantObservers;
 
-	LLCachedControl<bool> mVoiceEffectEnabled;
-	LLCachedControl<std::string> mVoiceEffectDefault;
-};
+		void notifyParticipantObservers();
 
-/**
- * Speaker volume storage helper class
- **/
-class LLSpeakerVolumeStorage : public LLSingleton<LLSpeakerVolumeStorage>
-{
-	LOG_CLASS(LLSpeakerVolumeStorage);
-public:
+		typedef std::set<LLVoiceClientStatusObserver*> status_observer_set_t;
+		status_observer_set_t mStatusObservers;
+		
+		void notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status);
 
-	/**
-	 * Stores volume level for specified user.
-	 *
-	 * @param[in] speaker_id - LLUUID of user to store volume level for.
-	 * @param[in] volume - volume level to be stored for user.
-	 */
-	void storeSpeakerVolume(const LLUUID& speaker_id, F32 volume);
-
-	/**
-	 * Gets stored volume level for specified speaker
-	 *
-	 * @param[in] speaker_id - LLUUID of user to retrieve volume level for.
-	 * @param[out] volume - set to stored volume if found, otherwise unmodified.
-	 * @return - true if a stored volume is found.
-	 */
-	bool getSpeakerVolume(const LLUUID& speaker_id, F32& volume);
-
-	/**
-	 * Removes stored volume level for specified user.
-	 *
-	 * @param[in] speaker_id - LLUUID of user to remove.
-	 */
-	void removeSpeakerVolume(const LLUUID& speaker_id);
-
-private:
-	friend class LLSingleton<LLSpeakerVolumeStorage>;
-	LLSpeakerVolumeStorage();
-	~LLSpeakerVolumeStorage();
-
-	const static std::string SETTINGS_FILE_NAME;
-
-	void load();
-	void save();
-
-	static F32 transformFromLegacyVolume(F32 volume_in);
-	static F32 transformToLegacyVolume(F32 volume_in);
-
-	typedef std::map<LLUUID, F32> speaker_data_map_t;
-	speaker_data_map_t mSpeakersData;
+		typedef std::set<LLFriendObserver*> friend_observer_set_t;
+		friend_observer_set_t mFriendObservers;
+		void notifyFriendObservers();
 };
 
+extern LLVoiceClient *gVoiceClient;
+
 #endif //LL_VOICE_CLIENT_H
 
 
diff --git a/indra/newview/llvoinventorylistener.h b/indra/newview/llvoinventorylistener.h
index bf14d19b019f0aa44b035babcc3c58c730e2135b..1531e6e33964776828d8d0b5cbe3b96a5d903d65 100644
--- a/indra/newview/llvoinventorylistener.h
+++ b/indra/newview/llvoinventorylistener.h
@@ -2,25 +2,31 @@
  * @file llvoinventorylistener.h
  * @brief Interface for classes that wish to receive updates about viewer object inventory
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 346fc0c4e4f26eb535b0a5406bb82b60eac7e518..e6de33c459b22047b3a635aa0db14836e83f81ab 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -369,7 +369,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
 			S32 res2 = unpackTEMessage(*dp);
 			if (TEM_INVALID == res2)
 			{
-				// Well, crap, there's something bogus in the data that we're unpacking.
+				// There's something bogus in the data that we're unpacking.
 				dp->dumpBufferToLog();
 				llwarns << "Flushing cache files" << llendl;
 				std::string mask;
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index 59c9a692fe1f58b47e13c0fbf0bbae8b7c0feec4..63f99273fe1a9823476663c9abc6be566bc55d18 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -2,50 +2,54 @@
  * @file llwearable.cpp
  * @brief LLWearable class implementation
  *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
 
 #include "llagent.h"
-#include "llagentcamera.h"
 #include "llagentwearables.h"
-#include "lldictionary.h"
+#include "llfloatercustomize.h"
 #include "lllocaltextureobject.h"
 #include "llnotificationsutil.h"
 #include "llviewertexturelist.h"
 #include "llinventorymodel.h"
 #include "llinventoryobserver.h"
-#include "llsidepanelappearance.h"
-#include "llsidetray.h"
-#include "lltexlayer.h"
-#include "lltexglobalcolor.h"
-#include "lltrans.h"
 #include "llviewerregion.h"
-#include "llvisualparam.h"
 #include "llvoavatar.h"
 #include "llvoavatarself.h"
 #include "llvoavatardefines.h"
 #include "llwearable.h"
+#include "lldictionary.h"
+#include "lltrans.h"
+#include "lltexlayer.h"
+#include "llvisualparam.h"
+#include "lltexglobalcolor.h"
 
 using namespace LLVOAvatarDefines;
 
@@ -84,7 +88,7 @@ static std::string asset_id_to_filename(const LLUUID &asset_id);
 
 LLWearable::LLWearable(const LLTransactionID& transaction_id) :
 	mDefinitionVersion(LLWearable::sCurrentDefinitionVersion),
-	mType(LLWearableType::WT_INVALID)
+	mType(WT_INVALID)
 {
 	mTransactionID = transaction_id;
 	mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
@@ -92,7 +96,7 @@ LLWearable::LLWearable(const LLTransactionID& transaction_id) :
 
 LLWearable::LLWearable(const LLAssetID& asset_id) :
 	mDefinitionVersion( LLWearable::sCurrentDefinitionVersion ),
-	mType(LLWearableType::WT_INVALID)
+	mType(WT_INVALID)
 {
 	mAssetID = asset_id;
 	mTransactionID.setNull();
@@ -104,17 +108,17 @@ LLWearable::~LLWearable()
 
 const std::string& LLWearable::getTypeLabel() const
 {
-	return LLWearableType::getTypeLabel(mType);
+	return LLWearableDictionary::getTypeLabel(mType);
 }
 
 const std::string& LLWearable::getTypeName() const
 {
-	return LLWearableType::getTypeName(mType);
+	return LLWearableDictionary::getTypeName(mType);
 }
 
 LLAssetType::EType LLWearable::getAssetType() const
 {
-	return LLWearableType::getAssetType(mType);
+	return LLWearableDictionary::getAssetType(mType);
 }
 
 BOOL LLWearable::exportFile(LLFILE* file) const
@@ -359,13 +363,13 @@ BOOL LLWearable::importFile( LLFILE* file )
 		llwarns << "Bad Wearable asset: bad type" << llendl;
 		return FALSE;
 	}
-	if( 0 <= type && type < LLWearableType::WT_COUNT )
+	if( 0 <= type && type < WT_COUNT )
 	{
-		setType((LLWearableType::EType)type);
+		setType((EWearableType)type);
 	}
 	else
 	{
-		mType = LLWearableType::WT_COUNT;
+		mType = WT_COUNT;
 		llwarns << "Bad Wearable asset: bad type #" << type <<  llendl;
 		return FALSE;
 	}
@@ -438,8 +442,6 @@ BOOL LLWearable::importFile( LLFILE* file )
 			delete mSavedTEMap[te];
 		}
 
-		image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te), NULL);
-
 		LLUUID textureid(text_buffer);
 		mTEMap[te] = new LLLocalTextureObject(image, textureid);
 		mSavedTEMap[te] = new LLLocalTextureObject(image, textureid);
@@ -476,7 +478,7 @@ BOOL LLWearable::isOldVersion() const
 		param;
 		param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
 	{
-		if( (param->getWearableType() == mType) && (param->isTweakable() ) )
+		if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
 			param_count++;
 			if( !is_in_map(mVisualParamIndexMap, param->getID() ) )
@@ -527,7 +529,7 @@ BOOL LLWearable::isDirty() const
 		param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
 	{
 		if( (param->getWearableType() == mType) 
-			&& (param->isTweakable() ) 
+			&& (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) 
 			&& !param->getCrossWearable())
 		{
 			F32 current_weight = getVisualParamWeight(param->getID());
@@ -571,6 +573,14 @@ BOOL LLWearable::isDirty() const
 		}
 	}
 
+	//if( gFloaterCustomize )
+	//{
+	//	if( mDescription != gFloaterCustomize->getWearableDescription( mType ) )
+	//	{
+	//		return TRUE;
+	//	}
+	//}
+
 	return FALSE;
 }
 
@@ -581,7 +591,7 @@ void LLWearable::setParamsToDefaults()
 
 	for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
 	{
-		if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->isTweakable() ) )
+		if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
 			setVisualParamWeight(param->getID(),param->getDefaultWeight(), FALSE);
 		}
@@ -649,7 +659,7 @@ void LLWearable::writeToAvatar()
 				image_id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te);
 			}
 			LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE );
-			// MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this.
+			// MULTI-WEARABLE: replace hard-coded 0
 			gAgentAvatarp->setLocalTextureTE(te, image, 0);
 		}
 	}
@@ -669,15 +679,15 @@ void LLWearable::writeToAvatar()
 
 // Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values.
 // static 
-void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake )
+void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
 {
 	if (!isAgentAvatarValid()) return;
 
 	// You can't just remove body parts.
-	if( (type == LLWearableType::WT_SHAPE) ||
-		(type == LLWearableType::WT_SKIN) ||
-		(type == LLWearableType::WT_HAIR) ||
-		(type == LLWearableType::WT_EYES) )
+	if( (type == WT_SHAPE) ||
+		(type == WT_SKIN) ||
+		(type == WT_HAIR) ||
+		(type == WT_EYES) )
 	{
 		return;
 	}
@@ -685,20 +695,20 @@ void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake
 	// Pull params
 	for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
 	{
-		if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->isTweakable() ) )
+		if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
 			S32 param_id = param->getID();
 			gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake );
 		}
 	}
 
-	if(gAgentCamera.cameraCustomizeAvatar())
+	if( gFloaterCustomize )
 	{
-		LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit"));
+		gFloaterCustomize->setWearable(type, NULL, PERM_ALL, TRUE);
 	}
 
 	gAgentAvatarp->updateVisualParams();
-	gAgentAvatarp->wearableUpdated(type, FALSE);
+	gAgentAvatarp->wearableUpdated(type, TRUE);
 
 //	if( upload_bake )
 //	{
@@ -746,12 +756,12 @@ void LLWearable::copyDataFrom(const LLWearable* src)
 			LLViewerFetchedTexture *image = NULL;
 			if(iter != src->mTEMap.end())
 			{
-				image = src->getLocalTextureObject(te)->getImage();
-				image_id = src->getLocalTextureObject(te)->getID();
+				image = src->getConstLocalTextureObject(te)->getImage();
+				image_id = src->getConstLocalTextureObject(te)->getID();
 				mTEMap[te] = new LLLocalTextureObject(image, image_id);
 				mSavedTEMap[te] = new LLLocalTextureObject(image, image_id);
-				mTEMap[te]->setBakedReady(src->getLocalTextureObject(te)->getBakedReady());
-				mTEMap[te]->setDiscard(src->getLocalTextureObject(te)->getDiscard());
+				mTEMap[te]->setBakedReady(src->getConstLocalTextureObject(te)->getBakedReady());
+				mTEMap[te]->setDiscard(src->getConstLocalTextureObject(te)->getDiscard());
 			}
 			else
 			{
@@ -779,7 +789,7 @@ const LLUUID& LLWearable::getItemID() const
 	return mItemID;
 }
 
-void LLWearable::setType(LLWearableType::EType type) 
+void LLWearable::setType(EWearableType type) 
 { 
 	mType = type; 
 	createVisualParams();
@@ -796,7 +806,7 @@ LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index)
 	return NULL;
 }
 
-const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const
+const LLLocalTextureObject* LLWearable::getConstLocalTextureObject(S32 index) const
 {
 	te_map_t::const_iterator iter = mTEMap.find(index);
 	if( iter != mTEMap.end() )
@@ -963,11 +973,9 @@ void LLWearable::revertValues()
 
 	syncImages(mSavedTEMap, mTEMap);
 
-
-	LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
-	if( panel )
+	if( gFloaterCustomize )
 	{
-		panel->updateScrollingPanelList();
+		gFloaterCustomize->updateScrollingPanelList(TRUE);
 	}
 }
 
@@ -1004,11 +1012,9 @@ void LLWearable::saveValues()
 	// Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
 	syncImages(mTEMap, mSavedTEMap);
 
-
-	LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
-	if( panel )
+	if( gFloaterCustomize )
 	{
-		panel->updateScrollingPanelList();
+		gFloaterCustomize->updateScrollingPanelList(TRUE);
 	}
 }
 
@@ -1112,7 +1118,7 @@ void LLWearable::refreshName()
 
 struct LLWearableSaveData
 {
-	LLWearableType::EType mType;
+	EWearableType mType;
 };
 
 void LLWearable::saveNewAsset() const
@@ -1175,7 +1181,7 @@ void LLWearable::saveNewAsset() const
 void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
 {
 	LLWearableSaveData* data = (LLWearableSaveData*)userdata;
-	const std::string& type_name = LLWearableType::getTypeName(data->mType);
+	const std::string& type_name = LLWearableDictionary::getTypeName(data->mType);
 	if(0 == status)
 	{
 		// Success
@@ -1201,7 +1207,7 @@ void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userda
 
 std::ostream& operator<<(std::ostream &s, const LLWearable &w)
 {
-	s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n";
+	s << "wearable " << LLWearableDictionary::getTypeName(w.mType) << "\n";
 	s << "    Name: " << w.mName << "\n";
 	s << "    Desc: " << w.mDescription << "\n";
 	//w.mPermissions
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index 54accfe4ee5f3c91dc7954ef7e2784d0f457dc33..1a64f9d881e5fa8881065d7d94d94e49befa5347 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -3,25 +3,31 @@
  * @brief Functions dealing with web browsers
  * @author James Cook
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -48,10 +54,6 @@
 #include "llviewerparcelmgr.h"
 #include "llviewerregion.h"
 #include "llviewerwindow.h"
-#include "llnotificationsutil.h"
-
-bool on_load_url_external_response(const LLSD& notification, const LLSD& response, bool async );
-
 
 class URLLoader : public LLToastAlertPanel::URLLoader
 {
@@ -108,26 +110,11 @@ void LLWeb::loadURLExternal(const std::string& url)
 // static
 void LLWeb::loadURLExternal(const std::string& url, bool async)
 {
-	LLSD payload;
-	payload["url"] = url;
-	LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, boost::bind(on_load_url_external_response, _1, _2, async));
-}
-
-// static 
-bool on_load_url_external_response(const LLSD& notification, const LLSD& response, bool async )
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if ( 0 == option )
+	std::string escaped_url = escapeURL(url);
+	if (gViewerWindow)
 	{
-		LLSD payload = notification["payload"];
-		std::string url = payload["url"].asString();
-		std::string escaped_url = LLWeb::escapeURL(url);
-		if (gViewerWindow)
-		{
-			gViewerWindow->getWindow()->spawnWebBrowser(escaped_url, async);
-		}
+		gViewerWindow->getWindow()->spawnWebBrowser(escaped_url, async);
 	}
-	return false;
 }
 
 
@@ -168,7 +155,7 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
 	substitution["VERSION_PATCH"] = LLVersionInfo::getPatch();
 	substitution["VERSION_BUILD"] = LLVersionInfo::getBuild();
 	substitution["CHANNEL"] = LLVersionInfo::getChannel();
-	substitution["GRID"] = LLGridManager::getInstance()->getGridLabel();
+	substitution["GRID"] = LLViewerLogin::getInstance()->getGridLabel();
 	substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
 	substitution["SESSION_ID"] = gAgent.getSessionID();
 	substitution["FIRST_LOGIN"] = gAgent.isFirstLogin();
diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h
index 1ba856babebaffe6c00ec2f97f99cb50bcf83c33..1119b80bb4f94ad327ff5918275eaa72d892dce0 100644
--- a/indra/newview/llweb.h
+++ b/indra/newview/llweb.h
@@ -3,25 +3,31 @@
  * @brief Functions dealing with web browsers
  * @author James Cook
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 5cd01d337bd2be8a4aa0b67d978744cff3d17825..0b63f5efbde8023e9dba3b608cbd33bb2bdf7fcc 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -2,25 +2,31 @@
  * @file llworld.cpp
  * @brief Initial test structure to organize viewer regions
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -85,8 +91,7 @@ LLWorld::LLWorld() :
 	mLastPacketsIn(0),
 	mLastPacketsOut(0),
 	mLastPacketsLost(0),
-	mSpaceTimeUSec(0),
-	mClassicCloudsEnabled(TRUE)
+	mSpaceTimeUSec(0)
 {
 	for (S32 i = 0; i < 8; i++)
 	{
@@ -128,11 +133,10 @@ void LLWorld::destroyClass()
 LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
 {
 	LLMemType mt(LLMemType::MTYPE_REGIONS);
-	llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl;
+	
 	LLViewerRegion *regionp = getRegionFromHandle(region_handle);
 	if (regionp)
 	{
-		llinfos << "Region exists, removing it " << llendl;
 		LLHost old_host = regionp->getHost();
 		// region already exists!
 		if (host == old_host && regionp->isAlive())
@@ -657,41 +661,16 @@ void LLWorld::updateClouds(const F32 dt)
 	static LLFastTimer::DeclareTimer ftm("World Clouds");
 	LLFastTimer t(ftm);
 
-	if ( gSavedSettings.getBOOL("FreezeTime") )
+	if (gSavedSettings.getBOOL("FreezeTime") ||
+		!gSavedSettings.getBOOL("SkyUseClassicClouds"))
 	{
 		// don't move clouds in snapshot mode
 		return;
 	}
-
-	if (
-		mClassicCloudsEnabled !=
-		gSavedSettings.getBOOL("SkyUseClassicClouds") )
-	{
-		// The classic cloud toggle has been flipped
-		// gotta update all of the cloud layers
-		mClassicCloudsEnabled =
-			gSavedSettings.getBOOL("SkyUseClassicClouds");
-
-		if ( !mClassicCloudsEnabled && mActiveRegionList.size() )
-		{
-			// We've transitioned to having classic clouds disabled
-			// reset all cloud layers.
-			for (
-				region_list_t::iterator iter = mActiveRegionList.begin();
-				iter != mActiveRegionList.end();
-				++iter)
-			{
-				LLViewerRegion* regionp = *iter;
-				regionp->mCloudLayer.reset();
-			}
-
-			return;
-		}
-	}
-	else if ( !mClassicCloudsEnabled ) return;
-
 	if (mActiveRegionList.size())
 	{
+		// Update all the cloud puff positions, and timer based stuff
+		// such as death decay
 		for (region_list_t::iterator iter = mActiveRegionList.begin();
 			 iter != mActiveRegionList.end(); ++iter)
 		{
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index 4465fde210885eb77890928f1540c0e4955a86b3..502f7b0320bef2e1d4fdfa0924f8eaee86c4690d 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -7,25 +7,31 @@
  * neighboring regions. As the user crosses region boundaries, new
  * regions are added to the world and distant ones are rolled up.
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -178,8 +184,6 @@ class LLWorld : public LLSingleton<LLWorld>
 
 	U64 mSpaceTimeUSec;
 
-	BOOL mClassicCloudsEnabled;
-
 	////////////////////////////
 	//
 	// Data for "Fake" objects
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 0c17b5e297c00e4001b731d62fa3b5d9e6758718..0c37bb6eb1b7a63fef50c799247d17e0bae6d6e9 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -2,25 +2,31 @@
  * @file llworldmapview.cpp
  * @brief LLWorldMapView class implementation
  *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -894,32 +900,14 @@ void LLWorldMapView::drawFrustum()
 		// fade out in distance.
 		gGL.begin( LLRender::TRIANGLES  );
 		{
-			// get camera look at and left axes
-			LLVector3 at_axis = LLViewerCamera::instance().getAtAxis();
-			LLVector3 left_axis = LLViewerCamera::instance().getLeftAxis();
-
-			// grab components along XY plane
-			LLVector2 cam_lookat(at_axis.mV[VX], at_axis.mV[VY]);
-			LLVector2 cam_left(left_axis.mV[VX], left_axis.mV[VY]);
-
-			// but, when looking near straight up or down...
-			if (is_approx_zero(cam_lookat.magVecSquared()))
-			{
-				//...just fall back to looking down the x axis
-				cam_lookat = LLVector2(1.f, 0.f); // x axis
-				cam_left = LLVector2(0.f, 1.f); // y axis
-			}
-
-			// normalize to unit length
-			cam_lookat.normVec();
-			cam_left.normVec();
+			LLVector2 cam_lookat(LLViewerCamera::instance().getAtAxis().mV[VX], LLViewerCamera::instance().getAtAxis().mV[VY]);
+			LLVector2 cam_left(LLViewerCamera::instance().getLeftAxis().mV[VX], LLViewerCamera::instance().getLeftAxis().mV[VY]);
 
 			gGL.color4f(1.f, 1.f, 1.f, 0.25f);
 			gGL.vertex2f( 0, 0 );
 
 			gGL.color4f(1.f, 1.f, 1.f, 0.02f);
 			
-			// use 2d camera vectors to render frustum triangle
 			LLVector2 vert = cam_lookat * far_clip_pixels + cam_left * half_width_pixels;
 			gGL.vertex2f(vert.mV[VX], vert.mV[VY]);
 
@@ -1066,10 +1054,18 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, MASK mask )
 			// zoomed out, so don't display anything about the count. JC
 			if (agent_count > 0)
 			{
-				LLStringUtil::format_map_t string_args;
-				string_args["[NUMBER]"] = llformat("%d", agent_count);
-				message += '\n';
-				message += getString((agent_count == 1 ? "world_map_person" : "world_map_people") , string_args);
+				// Merov: i18n horror!!! Even using gettext(), concatenating strings is not localizable. 
+				// The singular/plural switch form here under might make no sense in some languages. Don't do that.
+				message += llformat("\n%d ", agent_count);
+
+				if (agent_count == 1)
+				{
+					message += "person";
+				}
+				else
+				{
+					message += "people";
+				}
 			}
 		}
 		tooltip_msg.assign( message );
diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp
index 2596f239ca539401d5a8da17e546372724bfa0a9..15417614af905117eb42c2ab66d9d837ccb1ef38 100644
--- a/indra/newview/llxmlrpclistener.cpp
+++ b/indra/newview/llxmlrpclistener.cpp
@@ -4,25 +4,8 @@
  * @date   2009-03-18
  * @brief  Implementation for llxmlrpclistener.
  * 
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
  * $/LicenseInfo$
  */
 
@@ -45,7 +28,6 @@
 #include "llerror.h"
 #include "stringize.h"
 #include "llxmlrpctransaction.h"
-#include "llsecapi.h"
 
 #if LL_WINDOWS
 #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
@@ -374,22 +356,7 @@ class Poller
                                      << data["errorcode"].asString()
                                      << " (" << data["error"].asString() << ")"
                                      << LL_ENDL;
-		
-		switch (curlcode)
-		{
-			case CURLE_SSL_PEER_CERTIFICATE:
-			case CURLE_SSL_CACERT:
-			{
-				LLPointer<LLCertificate> error_cert(mTransaction->getErrorCert());
-				if(error_cert)
-				{
-					data["certificate"] = error_cert->getPem();
-				}
-				break;
-			}
-			default:
-				break;
-		}
+        // In addition to CURLE_OK, LLUserAuth distinguishes different error
         // values of 'curlcode':
         // CURLE_COULDNT_RESOLVE_HOST,
         // CURLE_SSL_PEER_CERTIFICATE,
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index 257884d921ba1f887e45a4034c9eb1fa08429524..5884cdd1c39bad95514a96487aaf22322526060c 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -2,32 +2,35 @@
  * @file llxmlrpctransaction.cpp
  * @brief LLXMLRPCTransaction and related class implementations 
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
 #include "llviewerprecompiledheaders.h"
-#include <openssl/x509_vfy.h>
-#include <openssl/ssl.h>
-#include "llsecapi.h"
 
 #include "llxmlrpctransaction.h"
 #include "llxmlrpclistener.h"
@@ -39,7 +42,6 @@
 #include <xmlrpc-epi/xmlrpc.h>
 
 #include "llappviewer.h"
-#include "lltrans.h"
 
 // Static instance of LLXMLRPCListener declared here so that every time we
 // bring in this code, we instantiate a listener. If we put the static
@@ -174,8 +176,6 @@ class LLXMLRPCTransaction::Impl
 
 	std::string			mResponseText;
 	XMLRPC_REQUEST		mResponse;
-	std::string         mCertStore;
-	LLPointer<LLCertificate> mErrorCert;
 	
 	Impl(const std::string& uri, XMLRPC_REQUEST request, bool useGzip);
 	Impl(const std::string& uri,
@@ -190,8 +190,7 @@ class LLXMLRPCTransaction::Impl
 
 private:
 	void init(XMLRPC_REQUEST request, bool useGzip);
-	static int _sslCertVerifyCallback(X509_STORE_CTX *ctx, void *param);
-	static CURLcode _sslCtxFunction(CURL * curl, void *sslctx, void *param);
+
 	static size_t curlDownloadCallback(
 		char* data, size_t size, size_t nmemb, void* user_data);
 };
@@ -229,75 +228,8 @@ LLXMLRPCTransaction::Impl::Impl(const std::string& uri,
     XMLRPC_RequestFree(request, 1);
 }
 
-// _sslCertVerifyCallback
-// callback called when a cert verification is requested.
-// calls SECAPI to validate the context
-int LLXMLRPCTransaction::Impl::_sslCertVerifyCallback(X509_STORE_CTX *ctx, void *param)
-{
-	LLXMLRPCTransaction::Impl *transaction = (LLXMLRPCTransaction::Impl *)param;
-	LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(transaction->mCertStore);
-	LLPointer<LLCertificateChain> chain = gSecAPIHandler->getCertificateChain(ctx);
-	LLSD validation_params = LLSD::emptyMap();
-	LLURI uri(transaction->mURI);
-	validation_params[CERT_HOSTNAME] = uri.hostName();
-	try
-	{
-		// don't validate hostname.  Let libcurl do it instead.  That way, it'll handle redirects
-		store->validate(VALIDATION_POLICY_SSL & (~VALIDATION_POLICY_HOSTNAME), chain, validation_params);
-	}
-	catch (LLCertValidationTrustException& cert_exception)
-	{
-		// this exception is is handled differently than the general cert
-		// exceptions, as we allow the user to actually add the certificate
-		// for trust.
-		// therefore we pass back a different error code
-		// NOTE: We're currently 'wired' to pass around CURL error codes.  This is
-		// somewhat clumsy, as we may run into errors that do not map directly to curl
-		// error codes.  Should be refactored with login refactoring, perhaps.
-		transaction->mCurlCode = CURLE_SSL_CACERT;
-		// set the status directly.  set curl status generates error messages and we want
-		// to use the fixed ones from the exceptions
-		transaction->setStatus(StatusCURLError, cert_exception.getMessage(), std::string());
-		// We should probably have a more generic way of passing information
-		// back to the error handlers.
-		transaction->mErrorCert = cert_exception.getCert();
-		return 0;		
-	}
-	catch (LLCertException& cert_exception)
-	{
-		transaction->mCurlCode = CURLE_SSL_PEER_CERTIFICATE;
-		// set the status directly.  set curl status generates error messages and we want
-		// to use the fixed ones from the exceptions
-		transaction->setStatus(StatusCURLError, cert_exception.getMessage(), std::string());
-		transaction->mErrorCert = cert_exception.getCert();
-		return 0;
-	}
-	catch (...)
-	{
-		// any other odd error, we just handle as a connect error.
-		transaction->mCurlCode = CURLE_SSL_CONNECT_ERROR;
-		transaction->setCurlStatus(CURLE_SSL_CONNECT_ERROR);
-		return 0;
-	}
-	return 1;
-}
 
-// _sslCtxFunction
-// Callback function called when an SSL Context is created via CURL
-// used to configure the context for custom cert validate(<, <#const & xs#>, <#T * #>, <#long #>)tion
-// based on SECAPI
 
-CURLcode LLXMLRPCTransaction::Impl::_sslCtxFunction(CURL * curl, void *sslctx, void *param)
-{
-	SSL_CTX * ctx = (SSL_CTX *) sslctx;
-	// disable any default verification for server certs
-	SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
-	// set the verification callback.
-	SSL_CTX_set_cert_verify_callback(ctx, _sslCertVerifyCallback, param);
-	// the calls are void
-	return CURLE_OK;
-	
-}
 
 void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 {
@@ -305,7 +237,6 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 	{
 		mCurlRequest = new LLCurlEasyRequest();
 	}
-	mErrorCert = NULL;
 	
 	if (gSavedSettings.getBOOL("BrowserProxyEnabled"))
 	{
@@ -321,13 +252,12 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 //	mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging
 	mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
 	mCurlRequest->setWriteCallback(&curlDownloadCallback, (void*)this);
-	BOOL vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
-	mCertStore = gSavedSettings.getString("CertStore");
-	mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, vefifySSLCert);
-	mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, vefifySSLCert ? 2 : 0);
+	BOOL verifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
+	mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, LLCurl::getSSLVerify() ? 2 : 0);
+	mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, verifySSLCert);
+	mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, verifySSLCert ? 2 : 0);
 	// Be a little impatient about establishing connections.
 	mCurlRequest->setopt(CURLOPT_CONNECTTIMEOUT, 40L);
-	mCurlRequest->setSSLCtxCallback(_sslCtxFunction, (void *)this);
 
 	/* Setting the DNS cache timeout to -1 disables it completely.
 	   This might help with bug #503 */
@@ -413,19 +343,11 @@ bool LLXMLRPCTransaction::Impl::process()
 		{
 			if (result != CURLE_OK)
 			{
-				if ((result != CURLE_SSL_PEER_CERTIFICATE) &&
-					(result != CURLE_SSL_CACERT))
-				{
-					// if we have a curl error that's not already been handled
-					// (a non cert error), then generate the error message as
-					// appropriate
-					setCurlStatus(result);
-				
-					llwarns << "LLXMLRPCTransaction CURL error "
-					<< mCurlCode << ": " << mCurlRequest->getErrorString() << llendl;
-					llwarns << "LLXMLRPCTransaction request URI: "
-					<< mURI << llendl;
-				}
+				setCurlStatus(result);
+				llwarns << "LLXMLRPCTransaction CURL error "
+						<< mCurlCode << ": " << mCurlRequest->getErrorString() << llendl;
+				llwarns << "LLXMLRPCTransaction request URI: "
+						<< mURI << llendl;
 					
 				return true;
 			}
@@ -503,11 +425,17 @@ void LLXMLRPCTransaction::Impl::setStatus(EStatus status,
 			case StatusComplete:
 				mStatusMessage = "(done)";
 				break;
+				
 			default:
 				// Usually this means that there's a problem with the login server,
 				// not with the client.  Direct user to status page.
-				mStatusMessage = LLTrans::getString("server_is_down");
-				mStatusURI = "http://status.secondlifegrid.net/";
+				mStatusMessage =
+					"Despite our best efforts, something unexpected has gone wrong. \n"
+					" \n"
+					"Please check secondlife.com/status \n"
+					"to see if there is a known problem with the service.";
+
+				mStatusURI = "http://secondlife.com/status/";
 		}
 	}
 }
@@ -541,7 +469,7 @@ void LLXMLRPCTransaction::Impl::setCurlStatus(CURLcode code)
 				"Often this means that your computer\'s clock is set incorrectly.\n"
 				"Please go to Control Panels and make sure the time and date\n"
 				"are set correctly.\n"
-				"Also check that your network and firewall are set up correctly.\n"
+				"\n"
 				"If you continue to receive this error, please go\n"
 				"to the Support section of the SecondLife.com web site\n"
 				"and report the problem.";
@@ -613,11 +541,6 @@ std::string LLXMLRPCTransaction::statusMessage()
 	return impl.mStatusMessage;
 }
 
-LLPointer<LLCertificate> LLXMLRPCTransaction::getErrorCert()
-{
-	return impl.mErrorCert;
-}
-
 std::string LLXMLRPCTransaction::statusURI()
 {
 	return impl.mStatusURI;
diff --git a/indra/newview/llxmlrpctransaction.h b/indra/newview/llxmlrpctransaction.h
index f2589c7f411640aa7b5e8f2ff99b518cdd11c0a6..c835423d67c6fe719541a4fc3aa8f74303a9a5c5 100644
--- a/indra/newview/llxmlrpctransaction.h
+++ b/indra/newview/llxmlrpctransaction.h
@@ -2,25 +2,31 @@
  * @file llxmlrpctransaction.h
  * @brief LLXMLRPCTransaction and related class header file
  *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -32,7 +38,6 @@
 typedef struct _xmlrpc_request* XMLRPC_REQUEST;
 typedef struct _xmlrpc_value* XMLRPC_VALUE;
 	// foward decl of types from xmlrpc.h (this usage is type safe)
-class LLCertificate;
 
 class LLXMLRPCValue
 	// a c++ wrapper around XMLRPC_VALUE
@@ -110,8 +115,6 @@ class LLXMLRPCTransaction
 		
 	EStatus status(int* curlCode);
 		// return status, and extended CURL code, if code isn't null
-	
-	LLPointer<LLCertificate> getErrorCert();
 	std::string statusMessage();
 		// return a message string, suitable for showing the user
 	std::string statusURI();
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 5e54d4ab78f3f405bf6ee797c75294f1a5ec2406..5940b354f48b53a03ff150509b1216955944cfdc 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -3844,15 +3844,14 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects, BOOL render
 	}
 
 	// pick HUD objects
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp && sShowHUDAttachments)
+	if (isAgentAvatarValid() && sShowHUDAttachments)
 	{
 		glh::matrix4f save_proj(glh_get_current_projection());
 		glh::matrix4f save_model(glh_get_current_modelview());
 
 		setup_hud_matrices(screen_rect);
-		for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
-			 iter != avatarp->mAttachmentPoints.end(); )
+		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+			 iter != gAgentAvatarp->mAttachmentPoints.end(); )
 		{
 			LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 			LLViewerJointAttachment* attachment = curiter->second;
@@ -3952,9 +3951,9 @@ void LLPipeline::rebuildPools()
 		max_count--;
 	}
 
-	if (gAgent.getAvatarObject())
+	if (isAgentAvatarValid())
 	{
-		gAgent.getAvatarObject()->rebuildHUD();
+		gAgentAvatarp->rebuildHUD();
 	}
 }
 
@@ -4586,8 +4585,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
 		glLightfv(gllight, GL_SPECULAR, LLColor4::black.mV);
 	}
 
-	if (gAgent.getAvatarObject() &&
-		gAgent.getAvatarObject()->mSpecialRenderMode == 3)
+	if (isAgentAvatarValid() &&
+		gAgentAvatarp->mSpecialRenderMode == 3)
 	{
 		LLColor4  light_color = LLColor4::white;
 		light_color.mV[3] = 0.0f;
@@ -4696,15 +4695,13 @@ void LLPipeline::enableLightsDynamic()
 		glColor4f(0.f, 0.f, 0.f, 1.f); // no local lighting by default
 	}
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-
-	if (avatarp && getLightingDetail() <= 0)
+	if (isAgentAvatarValid() && getLightingDetail() <= 0)
 	{
-		if (avatarp->mSpecialRenderMode == 0) // normal
+		if (gAgentAvatarp->mSpecialRenderMode == 0) // normal
 		{
 			gPipeline.enableLightsAvatar();
 		}
-		else if (avatarp->mSpecialRenderMode >= 1)  // anim preview
+		else if (gAgentAvatarp->mSpecialRenderMode >= 1)  // anim preview
 		{
 			gPipeline.enableLightsAvatarEdit(LLColor4(0.7f, 0.6f, 0.3f, 1.f));
 		}
@@ -7113,15 +7110,15 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 {
 	if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
 	{
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+		BOOL skip_avatar_update = FALSE;
 		if (gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
 		{
-			avatarp = NULL;
+			skip_avatar_update = TRUE;
 		}
 
-		if (avatarp)
+		if (!skip_avatar_update)
 		{
-			avatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
+			gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
 		}
 		LLVertexBuffer::unbind();
 
@@ -7345,9 +7342,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 		LLGLState::checkTextureChannels();
 		LLGLState::checkClientArrays();
 
-		if (avatarp)
+		if (!skip_avatar_update)
 		{
-			avatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+			gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
 		}
 	}
 }
diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc
index a575aabbca4c372b6c7d60d469ff4cd9e4757395..ecdcacec4638f2c3ef639ca352b48dc3df86b45f 100644
--- a/indra/newview/res/viewerRes.rc
+++ b/indra/newview/res/viewerRes.rc
@@ -119,9 +119,9 @@ TOOLPIPETTE             CURSOR                  "toolpipette.cur"
 TOOLPLAY                CURSOR                  "toolplay.cur"
 TOOLPAUSE               CURSOR                  "toolpause.cur"
 TOOLMEDIAOPEN           CURSOR                  "toolmediaopen.cur"
-TOOLBUY                 CURSOR                  "toolbuy.cur"
 TOOLOPEN                CURSOR                  "toolopen.cur"
 TOOLSIT                 CURSOR                  "toolsit.cur"
+TOOLBUY                 CURSOR                  "toolbuy.cur"
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -129,8 +129,8 @@ TOOLSIT                 CURSOR                  "toolsit.cur"
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 2,1,1,0
- PRODUCTVERSION 2,1,1,0
+ FILEVERSION 2,0,0,203110
+ PRODUCTVERSION 2,0,0,203110
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -147,12 +147,12 @@ BEGIN
         BEGIN
             VALUE "CompanyName", "Linden Lab"
             VALUE "FileDescription", "Second Life"
-            VALUE "FileVersion", "2.1.1.0"
+            VALUE "FileVersion", "2.0.0.203110"
             VALUE "InternalName", "Second Life"
-            VALUE "LegalCopyright", "Copyright © 2001-2010, Linden Research, Inc."
+            VALUE "LegalCopyright", "Copyright © 2001-2008, Linden Research, Inc."
             VALUE "OriginalFilename", "SecondLife.exe"
             VALUE "ProductName", "Second Life"
-            VALUE "ProductVersion", "2.1.1.0"
+            VALUE "ProductVersion", "2.0.0.203110"
         END
     END
     BLOCK "VarFileInfo"
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 2188c71ff9e39ffefe637af2d3a0307d98c7042b..99603530d8f1f1ceb698fa6c865a1575e75bc0c9 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -96,9 +96,6 @@
 
   <!-- UI Definitions -->
 
-    <color
-     name="AccordionHeaderTextColor"
-     reference="LtGray" />
     <color
      name="AgentChatColor"
      reference="White" />
@@ -362,7 +359,7 @@
      reference="White"/>
     <color
      name="GroupNotifyDimmedTextColor"
-     reference="LtGray" />
+     reference="DkGray" />
     <color
      name="GroupOverTierColor"
      value="0.43 0.06 0.06 1" />
@@ -426,9 +423,6 @@
     <color
      name="InventoryItemLibraryColor"
      reference="EmphasisColor" />
-    <color
-     name="InventoryItemLinkColor"
-     reference="LtGray_50" />
     <color
      name="InventorySearchStatusColor"
      reference="EmphasisColor" />
@@ -533,7 +527,7 @@
      reference="Unused?" />
     <color
      name="NetMapBackgroundColor"
-     value="0 0 0 1" />
+     value="0 0 0 0" />
     <color
      name="NetMapGroupOwnAboveWater"
      reference="Purple" />
@@ -648,9 +642,6 @@
     <color
      name="ScrollbarTrackColor"
      reference="Black" />
-    <color
-     name="SelectedOutfitTextColor"
-     reference="EmphasisColor" />
     <color
      name="SilhouetteChildColor"
      value="0.13 0.42 0.77 1" />
diff --git a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png b/indra/newview/skins/default/textures/icons/Generic_Group_Large.png
deleted file mode 100644
index de8a39fc8a43fb5b77ddd17f535a8d68ff95ce39..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_1.png b/indra/newview/skins/default/textures/icons/Progress_1.png
deleted file mode 100644
index 5d6efbfa2ae80add256e73a672d941a79d95e96d..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_1.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_10.png b/indra/newview/skins/default/textures/icons/Progress_10.png
deleted file mode 100644
index 28203324f1fcbe025c1d7f070ab325b6e27d70d5..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_10.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_11.png b/indra/newview/skins/default/textures/icons/Progress_11.png
deleted file mode 100644
index 6b87be0c3ff66074655678640932eaf9540eaf20..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_11.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_12.png b/indra/newview/skins/default/textures/icons/Progress_12.png
deleted file mode 100644
index 089d58b09049192ad9ad8a9ad1356615de711bd6..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_12.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_2.png b/indra/newview/skins/default/textures/icons/Progress_2.png
deleted file mode 100644
index 94cb73b1f7d3bdf3627fb388258882968c042e69..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_2.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_3.png b/indra/newview/skins/default/textures/icons/Progress_3.png
deleted file mode 100644
index a04a5b52638da9e839b52d9fcc019c759428a7b1..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_3.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_4.png b/indra/newview/skins/default/textures/icons/Progress_4.png
deleted file mode 100644
index a467098d8232e2b64bafa93e2b9c4b9aa3672b2b..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_4.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_5.png b/indra/newview/skins/default/textures/icons/Progress_5.png
deleted file mode 100644
index ea64f1d907b18e62feb91b8a7582fa0b705cc686..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_5.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_6.png b/indra/newview/skins/default/textures/icons/Progress_6.png
deleted file mode 100644
index fe4447935fb50671d118b53038de40d9d3ba56a1..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_6.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_7.png b/indra/newview/skins/default/textures/icons/Progress_7.png
deleted file mode 100644
index 64fa2947714fd2ecacb4e60c8761ea9e6ca118ee..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_7.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_8.png b/indra/newview/skins/default/textures/icons/Progress_8.png
deleted file mode 100644
index a1c9a7f2eb9deb1176f32fd3eda4470874ed27e2..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_8.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_9.png b/indra/newview/skins/default/textures/icons/Progress_9.png
deleted file mode 100644
index f3e9723184fcbaba963de87fe3651b049b1e0b72..0000000000000000000000000000000000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_9.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 082b37d80b9dba749e39bec43620822c2d71d175..41bcc622207d7de573858e9874ff17b32de4ea83 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -68,10 +68,6 @@ with the same filename but different name
 
   <texture name="BackArrow_Off" file_name="icons/BackArrow_Off.png" preload="false" />
 
-  <texture name="BackButton_Off" file_name="icons/back_arrow_off.png" preload="false" scale.left="22" scale.top="12" scale.right="25" scale.bottom="12" />
-  <texture name="BackButton_Over" file_name="icons/back_arrow_over.png" preload="false" scale.left="22" scale.top="12" scale.right="25" scale.bottom="12" />
-  <texture name="BackButton_Press" file_name="icons/back_arrow_press.png" preload="false" scale.left="22" scale.top="12" scale.right="25" scale.bottom="12" />
-
   <texture name="Blank" file_name="Blank.png" preload="false" />
 
 
@@ -114,8 +110,6 @@ with the same filename but different name
   <texture name="DisclosureArrow_Opened_Off" file_name="widgets/DisclosureArrow_Opened_Off.png" preload="true" />
 
   <texture name="DownArrow" file_name="bottomtray/DownArrow.png" preload="false" />
-  <texture name="DownArrow_Off" file_name="icons/DownArrow_Off.png" preload="false" />
-  <texture name="Dragbar" file_name="windows/Dragbar.png" preload="false" scale.left="35" scale.top="5" scale.right="29" scale.bottom="5" />
 
   <texture name="DropDown_Disabled" file_name="widgets/DropDown_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" />
   <texture name="DropDown_Press" file_name="widgets/DropDown_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" />
@@ -125,7 +119,6 @@ with the same filename but different name
   <texture name="DropTarget" file_name="widgets/DropTarget.png" preload="false" />
 
   <texture name="ExternalBrowser_Off" file_name="icons/ExternalBrowser_Off.png" preload="false" />
-  <texture name="Edit_Wrench" file_name="icons/Edit_Wrench.png" preload="false" />
 
   <texture name="Favorite_Star_Active" file_name="navbar/Favorite_Star_Active.png" preload="false" />
   <texture name="Favorite_Star_Off" file_name="navbar/Favorite_Star_Off.png" preload="false" />
@@ -142,16 +135,14 @@ with the same filename but different name
   <texture name="ForwardArrow_Press" file_name="icons/ForwardArrow_Press.png" preload="false" />
 
   <texture name="Generic_Group" file_name="icons/Generic_Group.png" preload="false" />
-  <texture name="Generic_Group_Large" file_name="icons/Generic_Group_Large.png" preload="false" />
   <texture name="icon_group.tga" file_name="icons/Generic_Group.png" preload="false" />
   <texture name="Generic_Object_Small" file_name="icons/Generic_Object_Small.png" preload="false" />
   <texture name="Generic_Person" file_name="icons/Generic_Person.png" preload="false" />
   <texture name="Generic_Person_Large" file_name="icons/Generic_Person_Large.png" preload="false" />
 
-  <texture name="Help_Press" file_name="navbar/Help_Press.png" preload="false" />
+  <texture name="Health" file_name="icons/Health.png" preload="false" />
 
-  <texture name="Hierarchy_View_Disabled" file_name="icons/Hierarchy_View_Disabled.png" preload="false" />
-  <texture name="Hierarchy_View_On" file_name="icons/Hierarchy_View_On.png" preload="false" />
+  <texture name="Help_Press" file_name="navbar/Help_Press.png" preload="false" />
 
 
   <texture name="Home_Off" file_name="navbar/Home_Off.png" preload="false" />
@@ -205,8 +196,6 @@ with the same filename but different name
   <texture name="Inv_Jacket" file_name="icons/Inv_Jacket.png" preload="false" />
   <texture name="Inv_LookFolderOpen" file_name="icons/Inv_LookFolderOpen.png" preload="false" />
   <texture name="Inv_LookFolderClosed" file_name="icons/Inv_LookFolderClosed.png" preload="false" />
-  <texture name="Inv_LostClosed" file_name="icons/Inv_LostClosed.png" preload="false" />
-  <texture name="Inv_LostOpen" file_name="icons/Inv_LostOpen.png" preload="false" />
   <texture name="Inv_Landmark" file_name="icons/Inv_Landmark.png" preload="false" />
   <texture name="Inv_Notecard" file_name="icons/Inv_Notecard.png" preload="false" />
   <texture name="Inv_Object" file_name="icons/Inv_Object.png" preload="false" />
@@ -220,15 +209,10 @@ with the same filename but different name
   <texture name="Inv_Snapshot" file_name="icons/Inv_Snapshot.png" preload="false" />
   <texture name="Inv_Socks" file_name="icons/Inv_Socks.png" preload="false" />
   <texture name="Inv_Sound" file_name="icons/Inv_Sound.png" preload="false" />
-  <texture name="Inv_SysClosed" file_name="icons/Inv_SysClosed.png" preload="false" />
-  <texture name="Inv_SysOpen" file_name="icons/Inv_SysOpen.png" preload="false" />
   <texture name="Inv_Tattoo" file_name="icons/Inv_Tattoo.png" preload="false" />
   <texture name="Inv_Texture" file_name="icons/Inv_Texture.png" preload="false" />
-  <texture name="Inv_TrashClosed" file_name="icons/Inv_TrashClosed.png" preload="false" />
-  <texture name="Inv_TrashOpen" file_name="icons/Inv_TrashOpen.png" preload="false" />
   <texture name="Inv_Underpants" file_name="icons/Inv_Underpants.png" preload="false" />
   <texture name="Inv_Undershirt" file_name="icons/Inv_Undershirt.png" preload="false" />
-  <texture name="Inv_Link" file_name="icons/Inv_Link.png" preload="false" />
 
   <texture name="Linden_Dollar_Alert" file_name="widgets/Linden_Dollar_Alert.png"/>
   <texture name="Linden_Dollar_Background" file_name="widgets/Linden_Dollar_Background.png"/>
@@ -236,14 +220,9 @@ with the same filename but different name
   <texture name="ListItem_Select" file_name="widgets/ListItem_Select.png" preload="true" scale.left="2" scale.bottom="2" scale.top="22" scale.right="278" />
   <texture name="ListItem_Over" file_name="widgets/ListItem_Over.png" preload="true" scale.left="2" scale.bottom="2" scale.top="22" scale.right="278" />
 
-  <texture name="List_View_Disabled" file_name="icons/List_View_Disabled.png" preload="false" />
-  <texture name="List_View_On" file_name="icons/List_View_On.png" preload="false" />
-
   <texture name="Lock" file_name="icons/Lock.png" preload="false" />
   <texture name="Lock2" file_name="navbar/Lock.png" preload="false" />
 
-  <texture name="Locked_Icon" file_name="icons/Locked_Icon.png" preload="false" />
-
 
   <texture name="Microphone_On" file_name="icons/Microphone_On.png" preload="false" />
 
@@ -253,9 +232,6 @@ with the same filename but different name
 
   <texture name="menu_separator" file_name="navbar/FileMenu_Divider.png" scale.left="4" scale.top="166" scale.right="0" scale.bottom="0" />
 
-  <texture name="MouseLook_View_Off" file_name="bottomtray/MouseLook_view_off.png" preload="false" />
-  <texture name="MouseLook_View_On" file_name="bottomtray/MouseLook_view_on.png" preload="false" />
-
   <texture name="Move_Fly_Off" file_name="bottomtray/Move_Fly_Off.png" preload="false" />
   <texture name="Move_Run_Off" file_name="bottomtray/Move_Run_Off.png" preload="false" />
   <texture name="Move_Walk_Off" file_name="bottomtray/Move_Walk_Off.png" preload="false" />
@@ -265,10 +241,6 @@ with the same filename but different name
   <texture name="Movement_Down_On" file_name="bottomtray/Movement_Down_On.png" preload="false" />
   <texture name="Movement_Forward_Off" file_name="bottomtray/Movement_Forward_Off.png" preload="false" />
   <texture name="Movement_Forward_On" file_name="bottomtray/Movement_Forward_On.png" preload="false" />
-  <texture name="Movement_Left_Off" file_name="bottomtray/Movement_Left_Off.png" preload="false" />
-  <texture name="Movement_Left_On" file_name="bottomtray/Movement_Left_On.png" preload="false" />
-  <texture name="Movement_Right_Off" file_name="bottomtray/Movement_Right_Off.png" preload="false" />
-  <texture name="Movement_Right_On" file_name="bottomtray/Movement_Right_On.png" preload="false" />
   <texture name="Movement_TurnLeft_Off" file_name="bottomtray/Movement_TurnLeft_Off.png" preload="false" />
   <texture name="Movement_TurnLeft_On" file_name="bottomtray/Movement_TurnLeft_On.png" preload="false" />
   <texture name="Movement_TurnRight_Off" file_name="bottomtray/Movement_TurnRight_Off.png" preload="false" />
@@ -276,9 +248,9 @@ with the same filename but different name
   <texture name="Movement_Up_Off" file_name="bottomtray/Movement_Up_Off.png" preload="false" />
   <texture name="Movement_Up_On" file_name="bottomtray/Movement_Up_On.png" preload="false" />
 
+  <texture name="NavBar_BG_NoFav" file_name="navbar/NavBar_BG_NoFav.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" />
   <texture name="NavBar_BG" file_name="navbar/NavBar_BG.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" />
-  <texture name="NavBar_BG_NoFav_Bevel" file_name="navbar/NavBar_BG_NoFav_Bevel.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" />
-  <texture name="NavBar_BG_NoNav_Bevel" file_name="navbar/NavBar_BG_NoNav_Bevel.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" />
+
 
   <texture name="Notices_Unread" file_name="bottomtray/Notices_Unread.png" preload="true" />
 
@@ -316,14 +288,10 @@ with the same filename but different name
   <texture name="Object_Tube" file_name="build/Object_Tube.png" preload="false" />
   <texture name="Object_Tube_Selected" file_name="build/Object_Tube_Selected.png" preload="false" />
 
-  <texture name="Object_View_Off" file_name="bottomtray/Object_View_Off.png" preload="false" />
-  <texture name="Object_View_On" file_name="bottomtray/Object_View_On.png" preload="false" />
-
   <texture name="OptionsMenu_Disabled" file_name="icons/OptionsMenu_Disabled.png" preload="false" />
   <texture name="OptionsMenu_Off" file_name="icons/OptionsMenu_Off.png" preload="false" />
   <texture name="OptionsMenu_Press" file_name="icons/OptionsMenu_Press.png" preload="false" />
 
-  <texture name="PanOrbit_Off" file_name="bottomtray/PanOrbit_Off.png" preload="false" />
 
   <texture name="Parcel_Exp_Color" file_name="icons/Parcel_Exp_Color.png" preload="false" />
 
@@ -403,8 +371,6 @@ with the same filename but different name
 
   <texture name="Search" file_name="navbar/Search.png" preload="false" />
 
-  <texture name="Search_Icon" file_name="icons/Search_Icon.png" preload="false" />
-
   <texture name="SegmentedBtn_Left_Off" file_name="widgets/SegmentedBtn_Left_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
   <texture name="SegmentedBtn_Left_Over" file_name="widgets/SegmentedBtn_Left_Over.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
   <texture name="SegmentedBtn_Left_Press" file_name="widgets/SegmentedBtn_Left_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
@@ -427,9 +393,6 @@ with the same filename but different name
   <texture name="SegmentedBtn_Right_Selected_Press" file_name="widgets/SegmentedBtn_Right_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
   <texture name="SegmentedBtn_Right_Selected_Disabled" file_name="widgets/SegmentedBtn_Right_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
 
-  <texture name="Shirt_Large" file_name="icons/Shirt_Large.png" preload="false" />
-  <texture name="Shop" file_name="icons/Shop.png" preload="false" />
-
   <texture name="SkipBackward_Off" file_name="icons/SkipBackward_Off.png" preload="false" />
   <texture name="SkipForward_Off" file_name="icons/SkipForward_Off.png" preload="false" />
 
@@ -502,18 +465,15 @@ with the same filename but different name
   <texture name="Tool_Grab" file_name="build/Tool_Grab.png" preload="false" />
   <texture name="Tool_Zoom" file_name="build/Tool_Zoom.png" preload="false" />
 
-  <texture name="Toolbar_Left_Flash" file_name="containers/Toolbar_Left_Flash.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Off" file_name="containers/Toolbar_Left_Off.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Over" file_name="containers/Toolbar_Left_Over.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Selected" file_name="containers/Toolbar_Left_Selected.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Off" file_name="containers/Toolbar_Middle_Off.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Over" file_name="containers/Toolbar_Middle_Over.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Selected" file_name="containers/Toolbar_Middle_Selected.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
-  <texture name="Toolbar_Middle_Flash" file_name="containers/Toolbar_Middle_Flash.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Right_Off" file_name="containers/Toolbar_Right_Off.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
   <texture name="Toolbar_Right_Over" file_name="containers/Toolbar_Right_Over.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
   <texture name="Toolbar_Right_Selected" file_name="containers/Toolbar_Right_Selected.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
-  <texture name="Toolbar_Right_Flash" file_name="containers/Toolbar_Right_Flash.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
 
   <texture name="Tooltip" file_name="widgets/Tooltip.png" preload="true" scale.left="2" scale.top="16" scale.right="100" scale.bottom="3" />
 
@@ -524,8 +484,6 @@ with the same filename but different name
   <texture name="Unread_Chiclet" file_name="bottomtray/Unread_Chiclet.png" preload="false" />
   <texture name="Unread_IM" file_name="bottomtray/Unread_IM.png" preload="false" />
 
-  <texture name="UpArrow_Off" file_name="icons/UpArrow_Off.png" preload="false" />
-
     <texture name="Volume_Background" file_name="windows/Volume_Background.png" preload="false"
            scale.left="6" scale.top="33" scale.right="63" scale.bottom="10" />
 
@@ -535,8 +493,6 @@ with the same filename but different name
   <texture name="VoicePTT_Off" file_name="bottomtray/VoicePTT_Off.png" preload="false" />
   <texture name="VoicePTT_On" file_name="bottomtray/VoicePTT_On.png" preload="false" />
 
-  <texture name="Wearables_Divider" file_name="windows/Wearables_Divider.png" preload="false" />
-
   <texture name="WellButton_Lit" file_name="bottomtray/WellButton_Lit.png"  preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
   <texture name="WellButton_Lit_Selected" file_name="bottomtray/WellButton_Lit_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
 
@@ -566,6 +522,8 @@ with the same filename but different name
   <!--WARNING OLD ART BELOW *do not use*-->
   <texture name="icn_media_web.tga" preload="true" />
   <texture name="icn_media_movie.tga" preload="true" />
+  <texture name="icn_speaker-muted_dark.tga" />
+  <texture name="icn_speaker_dark.tga" />
   <texture name="icn_voice-localchat.tga" />
   <texture name="icn_voice-groupfocus.tga" />
   <texture name="icn_voice-pvtfocus.tga" />
@@ -579,10 +537,6 @@ with the same filename but different name
   <texture name="scrollbutton_left_in_blue.tga" file_name="widgets/ScrollArrow_Left_Over_Opaque.png" />
   <texture name="scrollbutton_right_out_blue.tga" file_name="widgets/ScrollArrow_Right_Opaque.png" />
   <texture name="scrollbutton_right_in_blue.tga" file_name="widgets/ScrollArrow_Right_Over_Opaque.png" />
-  <texture name="scrollbutton_up_out_blue.tga" file_name="widgets/ScrollArrow_Up_Opaque.png" />
-  <texture name="scrollbutton_up_in_blue.tga" file_name="widgets/ScrollArrow_Up_Over_Opaque.png" />
-  <texture name="scrollbutton_down_out_blue.tga" file_name="widgets/ScrollArrow_Down_Opaque.png" />
-  <texture name="scrollbutton_down_in_blue.tga" file_name="widgets/ScrollArrow_Down_Over_Opaque.png" />
 
   <texture name="up_arrow.tga" file_name="up_arrow.png" />
   <texture name="down_arrow.tga" file_name="down_arrow.png" />
@@ -591,6 +545,10 @@ with the same filename but different name
   <texture name="tearoffbox.tga" />
   <texture name="tearoff_pressed.tga" />
 
+  <texture name="icn_label_music.tga" />
+  <texture name="icn_label_media.tga" />
+  <texture name="icn_rounded-text-field.tga" scale.left="14" scale.bottom="16" scale.top="16" scale.right="114" />
+
   <texture name="color_swatch_alpha.tga" preload="true" />
 
   <texture name="button_anim_pause.tga" />
@@ -604,7 +562,7 @@ with the same filename but different name
   <texture name="icon_avatar_online.tga" />
   <texture name="icon_day_cycle.tga" />
   <texture name="icon_diurnal.tga" />
-  <texture name="icon_for_sale.tga" file_name="icons/Icon_For_Sale.png" />
+  <texture name="icon_for_sale.tga" />
   <texture name="icon_top_pick.tga" />
 
   <texture name="lag_status_critical.tga" />
@@ -624,26 +582,22 @@ with the same filename but different name
 
   <texture name="notify_caution_icon.tga" />
 
+  <texture name="icn_active-speakers-dot-lvl0.tga" />
+  <texture name="icn_active-speakers-dot-lvl1.tga" />
+  <texture name="icn_active-speakers-dot-lvl2.tga" />
+
+  <texture name="icn_voice_ptt-off.tga" />
+  <texture name="icn_voice_ptt-on.tga" />
+  <texture name="icn_voice_ptt-on-lvl1.tga" />
+  <texture name="icn_voice_ptt-on-lvl2.tga" />
+  <texture name="icn_voice_ptt-on-lvl3.tga" />
+  <texture name="icn_voice-call-end.tga" />
+  <texture name="icn_voice-call-start.tga" />
+
+  <texture name="mute_icon.tga" />
+
   <texture name="default_land_picture.j2c" />
   <texture name="default_profile_picture.j2c" />
   <texture name="locked_image.j2c" />
 
-  <texture name="Progress_1" file_name="icons/Progress_1.png" preload="true" />
-  <texture name="Progress_2" file_name="icons/Progress_2.png" preload="true" />
-  <texture name="Progress_3" file_name="icons/Progress_3.png" preload="true" />
-  <texture name="Progress_4" file_name="icons/Progress_4.png" preload="true" />
-  <texture name="Progress_5" file_name="icons/Progress_5.png" preload="true" />
-  <texture name="Progress_6" file_name="icons/Progress_6.png" preload="true" />
-  <texture name="Progress_7" file_name="icons/Progress_7.png" preload="true" />
-  <texture name="Progress_8" file_name="icons/Progress_8.png" preload="true" />
-  <texture name="Progress_9" file_name="icons/Progress_9.png" preload="true" />
-  <texture name="Progress_10" file_name="icons/Progress_10.png" preload="true" />
-  <texture name="Progress_11" file_name="icons/Progress_11.png" preload="true" />
-  <texture name="Progress_12" file_name="icons/Progress_12.png" preload="true" />
-
-  <texture name="bevel_background" file_name="widgets/bevel_background.png" preload="true" scale.left="12" scale.top="15" scale.right="108" scale.bottom="2"/>
-  <texture name="buy_off" file_name="widgets/buy_off.png" preload="true" scale.left="2" scale.top="15" scale.right="67" scale.bottom="4"/>
-  <texture name="buy_over" file_name="widgets/buy_over.png" preload="true" scale.left="2" scale.top="15" scale.right="67" scale.bottom="4"/>
-  <texture name="buy_press" file_name="widgets/buy_press.png" preload="true" scale.left="2" scale.top="15" scale.right="67" scale.bottom="4"/>
-  
 </textures>
diff --git a/indra/newview/skins/default/xui/da/floater_tools.xml b/indra/newview/skins/default/xui/da/floater_tools.xml
index a84af9adc0985af1a492f18eccccea1960b6cc94..a39a7e869830b579ba95b1798ff1ee14f49b3cd5 100644
--- a/indra/newview/skins/default/xui/da/floater_tools.xml
+++ b/indra/newview/skins/default/xui/da/floater_tools.xml
@@ -67,10 +67,7 @@
 	<text name="RenderingCost" tool_tip="Hvis beregnede rendering omkostninger for dette objekt">
 		þ: [COUNT]
 	</text>
-	<check_box label="" name="checkbox uniform"/>
-	<text label="Stræk begge sider" name="checkbox uniform label">
-		Stræk begge sider
-	</text>
+	<check_box label="Stræk begge sider" name="checkbox uniform"/>
 	<check_box initial_value="true" label="Stræk teksturer" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Benyt gitter" name="checkbox snap to grid"/>
 	<combo_box name="combobox grid mode" tool_tip="Vælg hvilken type lineal der skal bruges til positionering af objekt">
@@ -443,6 +440,8 @@
 			<check_box label="Vend" name="checkbox flip s"/>
 			<spinner label="Lodret (V)" name="TexScaleV"/>
 			<check_box label="Vend" name="checkbox flip t"/>
+			<spinner label="RotationËš"/>
+			<spinner label="Gentagelser pr. m."/>
 			<button label="Gem" label_selected="Gem" left_delta="62" name="button apply"/>
 			<text name="tex offset">
 				Tekstur offset
@@ -475,7 +474,14 @@
 			Areal: [AREA] m²
 		</text>
 		<button label="Om land" label_selected="Om land" name="button about land"/>
-		<check_box label="Vis ejere" name="checkbox show owners" tool_tip="Farver grunde afhængigt af ejerskab:   Grøn = Dit land  Turkis = Din gruppes land  Rød = Ejet af andre  Gul = Til salg  Lilla = På auktion  Grå = Offentligt ejet"/>
+		<check_box label="Vis ejere" name="checkbox show owners" tool_tip="Farver grunde afhængigt af ejerskab: 
+
+Grøn = Dit land 
+Turkis = Din gruppes land 
+Rød = Ejet af andre 
+Gul = Til salg 
+Lilla = PÃ¥ auktion 
+Grå = Offentligt ejet"/>
 		<text name="label_parcel_modify">
 			Redigere grund
 		</text>
diff --git a/indra/newview/skins/default/xui/da/language_settings.xml b/indra/newview/skins/default/xui/da/language_settings.xml
index 3e46f69af1e40febcb2dae6c61f25bc996ad836c..fa8a788605495c567d21c1f9d095bbe57f79ddf3 100644
--- a/indra/newview/skins/default/xui/da/language_settings.xml
+++ b/indra/newview/skins/default/xui/da/language_settings.xml
@@ -17,7 +17,6 @@
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
diff --git a/indra/newview/skins/default/xui/da/menu_viewer.xml b/indra/newview/skins/default/xui/da/menu_viewer.xml
index fa74568c2d6957764b01fae732b47e457a5b23ee..7e7d1b190a71412d76017da555c92bf6b6969bf9 100644
--- a/indra/newview/skins/default/xui/da/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/da/menu_viewer.xml
@@ -5,11 +5,10 @@
 		<menu_item_call label="Mit instrumentpanel" name="Manage My Account"/>
 		<menu_item_call label="Køb L$" name="Buy and Sell L$"/>
 		<menu_item_call label="Profil" name="Profile"/>
-		<menu_item_call label="Skift sæt" name="ChangeOutfit"/>
+		<menu_item_call label="Udseende" name="Appearance"/>
 		<menu_item_check label="Beholdning" name="Inventory"/>
 		<menu_item_check label="Min beholdning" name="ShowSidetrayInventory"/>
 		<menu_item_check label="Mine bevægelser" name="Gestures"/>
-		<menu_item_check label="Min stemme" name="ShowVoice"/>
 		<menu label="Min status" name="Status">
 			<menu_item_call label="Væk" name="Set Away"/>
 			<menu_item_call label="Optaget" name="Set Busy"/>
@@ -30,7 +29,6 @@
 		<menu_item_call label="Foto" name="Take Snapshot"/>
 		<menu_item_call label="Opret landemærke for dette sted" name="Create Landmark Here"/>
 		<menu label="Profil for sted" name="Land">
-			<menu_item_call label="Profil for sted" name="Place Profile"/>
 			<menu_item_call label="Om land" name="About Land"/>
 			<menu_item_call label="Region/Estate" name="Region/Estate"/>
 		</menu>
@@ -66,15 +64,20 @@
 			<menu_item_call label="Byg værktøj" name="Create"/>
 			<menu_item_call label="Land værktøj" name="Land"/>
 		</menu>
+		<menu label="Redigér" name="Edit">
+			<menu_item_call label="Fortryd" name="Undo"/>
+			<menu_item_call label="Gendan" name="Redo"/>
+			<menu_item_call label="Klip" name="Cut"/>
+			<menu_item_call label="Kopiér" name="Copy"/>
+			<menu_item_call label="Sæt ind" name="Paste"/>
+			<menu_item_call label="Slet" name="Delete"/>
+			<menu_item_call label="Duplikér" name="Duplicate"/>
+			<menu_item_call label="Vælg alt" name="Select All"/>
+			<menu_item_call label="Fravælg" name="Deselect"/>
+		</menu>
 		<menu_item_call label="Sammenkæd" name="Link"/>
 		<menu_item_call label="Adskil" name="Unlink"/>
 		<menu_item_check label="Redigér sammekædede objekter" name="Edit Linked Parts"/>
-		<menu label="Vis lænkede dele" name="Select Linked Parts">
-			<menu_item_call label="Vælg næste del" name="Select Next Part"/>
-			<menu_item_call label="Vælg forrige del" name="Select Previous Part"/>
-			<menu_item_call label="Inkludér næste del" name="Include Next Part"/>
-			<menu_item_call label="Inkludér forrige del" name="Include Previous Part"/>
-		</menu>
 		<menu_item_call label="Fokusér på valgte" name="Focus on Selection"/>
 		<menu_item_call label="Zoom til valgte" name="Zoom to Selection"/>
 		<menu label="Objekt" name="Object">
@@ -92,7 +95,7 @@
 			<menu_item_call label="Sæt scripts til &quot;Not Running&quot;" name="Set Scripts to Not Running"/>
 		</menu>
 		<menu label="Valg" name="Options">
-			<menu_item_call label="Sæt standard rettigher for upload" name="perm prefs"/>
+			<menu_item_call label="Sæt standard rettigheder" name="perm prefs"/>
 			<menu_item_check label="Vis avancerede rettigheder" name="DebugPermissions"/>
 			<menu_item_check label="Vælg kun egne objekter" name="Select Only My Objects"/>
 			<menu_item_check label="Vis kun flytbare objekter" name="Select Only Movable Objects"/>
@@ -105,21 +108,19 @@
 			<menu_item_call label="Benyt valgte som grundlag for gitter" name="Use Selection for Grid"/>
 			<menu_item_call label="Gitter indstillinger" name="Grid Options"/>
 		</menu>
-		<menu label="Send" name="Upload">
-			<menu_item_call label="Billede (L$[COST])..." name="Upload Image"/>
-			<menu_item_call label="Lyd (L$[COST])..." name="Upload Sound"/>
-			<menu_item_call label="Animation (L$[COST])..." name="Upload Animation"/>
-			<menu_item_call label="Mange (L$[COST] pr. fil)..." name="Bulk Upload"/>
+		<menu label="Vis lænkede dele" name="Select Linked Parts">
+			<menu_item_call label="Vælg næste del" name="Select Next Part"/>
+			<menu_item_call label="Vælg forrige del" name="Select Previous Part"/>
+			<menu_item_call label="Inkludér næste del" name="Include Next Part"/>
+			<menu_item_call label="Inkludér forrige del" name="Include Previous Part"/>
 		</menu>
 	</menu>
 	<menu label="Hjælp" name="Help">
 		<menu_item_call label="[SECOND_LIFE] Help" name="Second Life Help"/>
 		<menu_item_call label="Rapporter misbrug" name="Report Abuse"/>
 		<menu_item_call label="Rapportér fejl" name="Report Bug"/>
-		<menu_item_call label="Om [APP_NAME]" name="About Second Life"/>
 	</menu>
 	<menu label="Avanceret" name="Advanced">
-		<menu_item_check label="Vis avanceret menu" name="Show Advanced Menu"/>
 		<menu_item_call label="Stop animering af min avatar" name="Stop Animating My Avatar"/>
 		<menu_item_call label="Gendan teksturer" name="Rebake Texture"/>
 		<menu_item_call label="Sæt UI størrelse til standard" name="Set UI Size to Default"/>
@@ -141,6 +142,7 @@
 			<menu_item_check label="Fremhæv gennemsigtigt" name="Highlight Transparent"/>
 			<menu_item_check label="Vis HUD vedhæftninger" name="Show HUD Attachments"/>
 			<menu_item_check label="Vis muse-sigte" name="ShowCrosshairs"/>
+			<menu_item_check label="Vis tips om land" name="Land Tips"/>
 		</menu>
 		<menu label="Gengivelsestyper" name="Rendering Types">
 			<menu_item_check label="Simpel" name="Simple"/>
@@ -166,8 +168,7 @@
 			<menu_item_check label="TÃ¥ge" name="Fog"/>
 			<menu_item_check label="Fleksible objekter" name="Flexible Objects"/>
 		</menu>
-		<menu_item_check label="Kør flere &apos;threats&apos;" name="Run Multiple Threads"/>
-		<menu_item_check label="Benyt &quot;Plugin Read Thread&quot;" name="Use Plugin Read Thread"/>
+		<menu_item_check label="Kør flere 'threats'" name="Run Multiple Threads"/>
 		<menu_item_call label="Tøm gruppe cache" name="ClearGroupCache"/>
 		<menu_item_check label="Muse udjævning" name="Mouse Smoothing"/>
 		<menu label="Shortcuts" name="Shortcuts">
@@ -175,7 +176,6 @@
 			<menu_item_check label="Søg" name="Search"/>
 			<menu_item_call label="Frigør taster" name="Release Keys"/>
 			<menu_item_call label="Sæt UI størrelse til standard" name="Set UI Size to Default"/>
-			<menu_item_check label="Vis avanceret menu" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_check label="Løb altid" name="Always Run"/>
 			<menu_item_check label="Flyv" name="Fly"/>
 			<menu_item_call label="Luk vindue" name="Close Window"/>
@@ -195,6 +195,7 @@
 			<menu_item_call label="Zoom ind" name="Zoom In"/>
 			<menu_item_call label="Zoom standard" name="Zoom Default"/>
 			<menu_item_call label="Zoom ud" name="Zoom Out"/>
+			<menu_item_call label="Skift fuld-skærm" name="Toggle Fullscreen"/>
 		</menu>
 		<menu_item_call label="Vis debug valg" name="Debug Settings"/>
 		<menu_item_check label="Vis udviklingsmenu" name="Debug Mode"/>
diff --git a/indra/newview/skins/default/xui/da/notifications.xml b/indra/newview/skins/default/xui/da/notifications.xml
index 62d9c5a203c4bdeeb2631005d0f4830c9b85854d..30e19ee901dcc3209c610cec2a016840cef60953 100644
--- a/indra/newview/skins/default/xui/da/notifications.xml
+++ b/indra/newview/skins/default/xui/da/notifications.xml
@@ -208,9 +208,6 @@ Du skal skrive både fornavn og efternavn på din figur.
 Du har brug for en konto for at logge ind i [SECOND_LIFE]. Vil du oprette en nu?
 		<usetemplate name="okcancelbuttons" notext="Prøv igen" yestext="Lav ny konto"/>
 	</notification>
-	<notification name="InvalidCredentialFormat">
-		Du skal indtaste både fornavn og efternavn i din avatars brugernavn felt og derefter logge på igen.
-	</notification>
 	<notification name="AddClassified">
 		Annoncer vil vises i &apos;Annoncer&apos; sektionen i søge biblioteket og på [http://secondlife.com/community/classifieds secondlife.com] i en uge.
 Udfyld din annonce og klik på &apos;Udgiv...&apos; for at tilf&apos;je den til biblioteket.				
@@ -227,13 +224,6 @@ Er du sikker på at du vil fortsætte?
 		Ikke nok penge til at oprette annonce.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
-	<notification name="DeleteAvatarPick">
-		Slet favorit &lt;nolink&gt;[PICK]&lt;/nolink&gt;?
-	</notification>
-	<notification name="DeleteOutfits">
-		Slet valgte sæt?
-		<usetemplate name="okcancelbuttons" notext="Annullér" yestext="OK"/>
-	</notification>
 	<notification name="CacheWillClear">
 		Cache vil blive tømt ved næste genstart af [APP_NAME].
 	</notification>
@@ -271,11 +261,6 @@ Dette skyldes ofte nyt hardware som endnu ikke er blevet testet med [APP_NAME].
 Grafik kvaliteten sættes til &apos;lav&apos; for at undgå typiske problemer med drivere. Dette vil slå visse grafik funktioner fra.
 Vi anbefaler at opdatere driverne til dit grafikkort.
 Grafik kvaliteten kan forbedres i indstillinger &gt; Grafik.
-	</notification>
-	<notification name="CannotCopyWarning">
-		Du har ikke rettigheder til at kopiere følgende genstande:
-[ITEMS]
-og du vil miste dem fra din beholdning hvis du forærer dem væk. Er du sikker på at du vil tilbyde disse genstande?
 	</notification>
 	<notification name="CannotGiveCategory">
 		Du har ikke tilladelse til at videreføre den valgte mappe.
@@ -291,10 +276,6 @@ Gå til [_URL] for information om køb af L$?
 	<notification name="CannotEncodeFile">
 		Kunne ikke &apos;forstå&apos; filen: [FILE]
 	</notification>
-	<notification name="CorruptedProtectedDataStore">
-		Vi kan ikke udfylde dit brugernavn og password.  Dette kan ske hvis du ændrer netværksopsætning
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
 	<notification name="DoNotSupportBulkAnimationUpload">
 		[APP_NAME] understøtter p.t. ikke at send flere animationsfiler ad gangen.
 	</notification>
@@ -410,42 +391,6 @@ Tilbyd venskab til [NAME]?
 			<button name="Cancel" text="Annullér"/>
 		</form>
 	</notification>
-	<notification label="Gem sæt" name="SaveOutfitAs">
-		Gem det som jeg har på som nyt sæt:
-		<form name="form">
-			<input name="message">
-				[DESC] (ny)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Annullér"/>
-		</form>
-	</notification>
-	<notification label="Gem" name="SaveWearableAs">
-		Gem genstand til beholdning som:
-		<form name="form">
-			<input name="message">
-				[DESC] (ny)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Annullér"/>
-		</form>
-	</notification>
-	<notification label="Omdøb sæt" name="RenameOutfit">
-		Nyt navn til sæt:
-		<form name="form">
-			<input name="new_name">
-				[NAME]
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Annullér"/>
-		</form>
-	</notification>
-	<notification name="ConfirmItemDeleteHasLinks">
-		Mindst en af genstandene har lænkede genstande der peger på den. Hvis du sletter denne genstand, vil lænkninger ikke virke mere.  Det anbefales kraftigt at fjerne lænkninger først.
-
-Er du sikker på at du vil slette disse genstande?
-		<usetemplate name="okcancelbuttons" notext="Annullér" yestext="OK"/>
-	</notification>
 	<notification name="ErrorMessage">
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
@@ -480,42 +425,6 @@ Vend tilbage til [http://join.secondlife.com secondlife.com] for at oprette en n
 
 Du kan enten checke din Internet forbindelse og prøve igen om lidt, klikke på Hjælp for at se [SUPPORT_SITE] siden, eller klikke på Teleport for at forsøge at teleportere hjem.
 	</notification>
-	<notification name="CantTeleportToGrid">
-		Kunne ikke teleportere til [SLURL] da den er på et andet net ([GRID]) end det nuværende net ([CURRENT_GRID]).  Luk venligst din klient og prøv igen.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="GeneralCertificateError">
-		Kunne ikke opnå forbindelse til server.
-[REASON]
-
-Vedrørende: [SUBJECT_NAME_STRING]
-Fra: [ISSUER_NAME_STRING]
-Valid fra: [VALID_FROM]
-Valid til: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-SHA1 Fingerprint: [MD5_DIGEST]
-Key Usage: [KEYUSAGE]
-Extended Key Usage: [EXTENDEDKEYUSAGE]
-Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="TrustCertificateError">
-		Certifikationsmyndighed for denne server er ikke kendt.
-
-Certifikat information:
-Vedrørende: [SUBJECT_NAME_STRING]
-Fra: [ISSUER_NAME_STRING]
-Valid fra: [VALID_FROM]
-Valid til: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-SHA1 Fingerprint: [MD5_DIGEST]
-Key Usage: [KEYUSAGE]
-Extended Key Usage: [EXTENDEDKEYUSAGE]
-Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
-
-Ønsker du at stole på denne myndighed?
-		<usetemplate name="okcancelbuttons" notext="Annullér" yestext="Stol på"/>
-	</notification>
 	<notification name="NotEnoughCurrency">
 		[NAME] L$ [PRICE] Du har ikke nok L$ til dette.
 	</notification>
@@ -675,10 +584,6 @@ Chat og personlige beskeder vil blive skjult. Personlige beskeder vil få din &a
 		Teleport til [CLASSIFIED]?
 		<usetemplate ignoretext="Bekræft at du ønsker at teleportere til lokation in annoncer" name="okcancelignore" notext="Annullér" yestext="Teleport"/>
 	</notification>
-	<notification name="TeleportToHistoryEntry">
-		Teleport til [HISTORY_ENTRY]?
-		<usetemplate ignoretext="Bekræft at du ønsker at teleportere til en lokation i din historik" name="okcancelignore" notext="Annullér" yestext="Teleport"/>
-	</notification>
 	<notification label="Change Linden Estate" name="ChangeLindenEstate">
 		Du er i færd med at ændre et Linden ejet estate (mainland, teeen grid, orientation etc.).
 
@@ -705,18 +610,15 @@ GÃ¥ til &apos;Knowledge Base&apos; for mere information om indholdsratings.
 		Du har ikke adgang til denne region på grund af din valgte indholdsrating.
 	</notification>
 	<notification name="RegionEntryAccessBlocked_Change">
-		Du har ikke adgang til denne region på grund af din opsætning af indholdsrating.
+		Du har ikke adgang til denne region på grund af din indholdsrating præferencer.
 
-For at få adgang til den ønskede region skal du ændre din indholdsrating. Dette vil give dig ret til at søge og får tilgang til indhold af typen [REGIONMATURITY]. For at omgøre ændringer gå til Mig &gt; Indstillinger &gt; Generelt.
+Du kan klikke på &apos;Ændre præference&apos; for at ændre din indholdsrating nu og dermed opnå adgang. Du vil så få mulighed for at søge og tilgå [REGIONMATURITY] fra da af. Hvis du senere ønsker at ændre denne opsætning tilbage, gå til Mig &gt; Indstillinger &gt; Generelt.
 		<form name="form">
 			<button name="OK" text="Ændre indstillinger"/>
 			<button name="Cancel" text="Luk"/>
 			<ignore name="ignore" text="Din valgte indholdsrating forhindrer dig i at kommer til en region"/>
 		</form>
 	</notification>
-	<notification name="PreferredMaturityChanged">
-		Din indholdsrating er nu [RATING].
-	</notification>
 	<notification name="LandClaimAccessBlocked">
 		Du kan ikke kræve dette land på grund af din nuværende indholdsrating indstillinge . Dette kan skyldes manglende validering af din alder.
 
@@ -911,9 +813,6 @@ Henvis til dette fra en hjemmeside for at give andre nem adgang til denne lokati
 	<notification name="SystemMessageTip">
 		[MESSAGE]
 	</notification>
-	<notification name="IMSystemMessageTip">
-		[MESSAGE]
-	</notification>
 	<notification name="Cancelled">
 		Annulléret
 	</notification>
@@ -1242,6 +1141,15 @@ Prøv igen om lidt.
 	</notification>
 	<notification name="ObjectGiveItem">
 		Et objekt med navnet [OBJECTFROMNAME] ejet af [NAME_SLURL] har givet dig denne/dette [OBJECTTYPE]:
+[ITEM_SLURL]
+		<form name="form">
+			<button name="Keep" text="Behold"/>
+			<button name="Discard" text="Smid væk"/>
+			<button name="Mute" text="Blokér"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItemUnknownUser">
+		Et objekt med navnet [OBJECTFROMNAME] ejet af (en ukendt beboer) har givet dig denne/dette [OBJECTTYPE]:
 [ITEM_SLURL]
 		<form name="form">
 			<button name="Keep" text="Behold"/>
@@ -1272,9 +1180,9 @@ Prøv igen om lidt.
 		</form>
 	</notification>
 	<notification name="TeleportOffered">
-		[NAME_SLURL] har tilbudt en teleport til deres lokation:
+		[NAME] har tilbudt dig en teleport til lokationen:
 
-[MESSAGE] - [MATURITY_STR] &lt;icon&gt;[MATURITY_ICON]&lt;/icon&gt;
+[MESSAGE]
 		<form name="form">
 			<button name="Teleport" text="Teleportér"/>
 			<button name="Cancel" text="Annullér"/>
@@ -1292,11 +1200,9 @@ Prøv igen om lidt.
 		</form>
 	</notification>
 	<notification name="OfferFriendship">
-		[NAME_SLURL] tilbyder venskab.
-
-[MESSAGE]
+		[NAME] tilbyder venskab.
 
-(Som udgangspunkt vil I være i stand til at se hinandens online status.)
+Som standard vil du kunne se andres onlinestatus.
 		<form name="form">
 			<button name="Accept" text="Acceptér"/>
 			<button name="Decline" text="Afvis"/>
@@ -1480,21 +1386,6 @@ Klik på Acceptér for at deltage eller Afvis for at afvise invitationen. Klik p
 	<notification name="VoiceLoginRetry">
 		Vi laver en stemmekanal til dig. Det kan tage op til et minut.
 	</notification>
-	<notification name="VoiceEffectsExpired">
-		En eller flere af dine stemme &quot;morphs&quot; er udløbet.
-[[URL] Click here] for at forny dit abbonnement.
-	</notification>
-	<notification name="VoiceEffectsExpiredInUse">
-		Den aktive stemme &quot;morph&quot; er udløbet og din normale stemme opsætning er genaktiveret.
-[[URL] Click here] for at forny dit abbonnement.
-	</notification>
-	<notification name="VoiceEffectsWillExpire">
-		En eller flere af dine stemme &quot;morphs&quot; vil udløbe om mindre end [INTERVAL] dage.
-[[URL] Click here] for at forny dit abbonnement.
-	</notification>
-	<notification name="VoiceEffectsNew">
-		Nye stemme &quot;morphs&quot; er tilgængelige!
-	</notification>
 	<notification name="Cannot enter parcel: not a group member">
 		Kun medlemmer af en bestemt gruppe kan besøge dette område.
 	</notification>
@@ -1560,97 +1451,6 @@ De vil blive blokeret nogle få sekunder af sikkerhedsmæssige årsager.
 		Den valgte knap kan ikke vises lige nu.
 Knappen vil blive vist når der er nok plads til den.
 	</notification>
-	<notification name="ShareNotification">
-		Vælg beboere at dele med.
-	</notification>
-	<notification name="ShareItemsConfirmation">
-		Er du sikker på at du vil dele følgende genstande:
-
-[ITEMS]
-
-Med følgende beboere:
-
-[RESIDENTS]
-		<usetemplate name="okcancelbuttons" notext="Annullér" yestext="Ok"/>
-	</notification>
-	<notification name="ItemsShared">
-		Genstande er nu delt.
-	</notification>
-	<notification name="DeedToGroupFail">
-		Dedikering til gruppe fejlede.
-	</notification>
-	<notification name="AvatarRezNotification">
-		( [EXISTENCE] sekunder i live )
-Avatar &apos;[NAME]&apos; var ikke sky mere, efter [TIME] sekunder.
-	</notification>
-	<notification name="AvatarRezSelfBakedDoneNotification">
-		( [EXISTENCE] seconds alive )
-Du blev færdig med at fremvise dit sæt efter [TIME] sekunder.
-	</notification>
-	<notification name="AvatarRezSelfBakedUpdateNotification">
-		( [EXISTENCE] seconds alive )
-Du sendte en opdatering af dit udseende efter [TIME] sekunder.
-[STATUS]
-	</notification>
-	<notification name="AvatarRezCloudNotification">
-		( [EXISTENCE] sekunder i live )
-Avatar &apos;[NAME]&apos; blev til &quot;sky&quot;.
-	</notification>
-	<notification name="AvatarRezArrivedNotification">
-		( [EXISTENCE] sekunder i live )
-Avatar &apos;[NAME]&apos; appeared.
-	</notification>
-	<notification name="AvatarRezLeftCloudNotification">
-		( [EXISTENCE] sekunder i live )
-Avatar &apos;[NAME]&apos; forsvandt efter [TIME] sekunder som &quot;sky&quot;.
-	</notification>
-	<notification name="AvatarRezEnteredAppearanceNotification">
-		( [EXISTENCE] sekunder i live )
-Avatar &apos;[NAME]&apos; skiftede til udseende modus.
-	</notification>
-	<notification name="AvatarRezLeftAppearanceNotification">
-		( [EXISTENCE] sekunder i live )
-Avatar &apos;[NAME]&apos; har forladt udseende modus.
-	</notification>
-	<notification name="NoConnect">
-		Vi har problemer med at oprette forbindelse via [PROTOCOL] [HOSTID].
-Check venligst din netværks- og firewallsetup.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="NoVoiceConnect">
-		Vi har problemer med at oprette forbindelse til din stemme server:
-
-[HOSTID]
-
-Stemme kommunikation vil ikke være tilgængelig.
-Check venligst din netværks- og firewall setup.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="AvatarRezLeftNotification">
-		( [EXISTENCE] sekunder i live )
-Avatar &apos;[NAME]&apos; forsvandt helt &quot;uploaded&quot;.
-	</notification>
-	<notification name="AvatarRezSelfBakeNotification">
-		( [EXISTENCE] sekunder i live )
-You [ACTION] a [RESOLUTION] baked texture for &apos;[BODYREGION]&apos; after [TIME] seconds.
-	</notification>
-	<notification name="ConfirmLeaveCall">
-		Er du sikker på at du vil forlade dette opkald?
-		<usetemplate ignoretext="Bekræft før jeg forlader opkald" name="okcancelignore" notext="Nej" yestext="Ja"/>
-	</notification>
-	<notification name="ConfirmMuteAll">
-		Du har valgt at slukke for lyden for alle deltagere i gruppeopkaldet.
-Dette vil også betyde, at alle beboere der slutter sig til opkaldet
-vil have lyden slukket - selv efter de har forladt kaldet.
-
-
-Sluk for alles lyd?
-		<usetemplate ignoretext="Bekræft før jeg slukker for alle deltageres lyd i gruppe-kald" name="okcancelignore" notext="Annullér" yestext="Ok"/>
-	</notification>
 	<global name="UnsupportedGLRequirements">
 		Det ser ikke ud til at din hardware opfylder minimumskravene til [APP_NAME]. [APP_NAME] kræver et OpenGL grafikkort som understøter &apos;multitexture&apos;. Check eventuelt om du har de nyeste drivere for grafikkortet, og de nyeste service-packs og patches til dit operativsystem.
 
@@ -1660,7 +1460,4 @@ Hvis du bliver ved med at have problemer, besøg venligst [SUPPORT_SITE].
 		Hvis du selv ejer land, kan du benytte det til hjemme lokation.
 Ellers kan du se på verdenskortet og finde steder markeret med &quot;Infohub&quot;.
 	</global>
-	<global name="You died and have been teleported to your home location">
-		Du døde og er blevet teleporteret til din hjemmelokation.
-	</global>
 </notifications>
diff --git a/indra/newview/skins/default/xui/da/panel_nearby_media.xml b/indra/newview/skins/default/xui/da/panel_nearby_media.xml
index b4be70a22a75592a054f16f8f943f0e8b8632f56..7a8b5a6389315704a91caebaf75894c5ff4ae553 100644
--- a/indra/newview/skins/default/xui/da/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/da/panel_nearby_media.xml
@@ -1,8 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_media">
-	<string name="media_item_count_format">
-		(%ld media items)
-	</string>
 	<string name="empty_item_text">
 		&lt;tom&gt;
 	</string>
@@ -19,14 +16,13 @@
 		<button label="Stop alt" name="all_nearby_media_disable_btn" tool_tip="Stop al media tæt på"/>
 		<button label="Start alt" name="all_nearby_media_enable_btn" tool_tip="Tænd al media tæt på"/>
 		<button name="open_prefs_btn" tool_tip="Vis media preferencer"/>
-		<button label="Mere &gt;&gt;" label_selected="Mindre &lt;&lt;" name="more_btn" tool_tip="Advancerede kontroller"/>
-		<button label="Mere &gt;&gt;" label_selected="Mindre &lt;&lt;" name="less_btn" tool_tip="Advancerede kontroller"/>
+		<button label="Mere &gt;&gt;" label_selected="Mindre &lt;&lt;" name="more_less_btn" tool_tip="Avanceret opsætning"/>
 	</panel>
 	<panel name="nearby_media_panel">
-		<text name="nearby_media_title">
-			Media tæt på
+		<text name="nearby_media">
+			Media i nærheden
 		</text>
-		<text name="show_text">
+		<text name="show">
 			Vis:
 		</text>
 		<combo_box name="show_combo">
@@ -45,25 +41,25 @@
 		<panel name="media_controls_panel">
 			<layout_stack name="media_controls">
 				<layout_panel name="stop">
-					<button name="stop_btn" tool_tip="Stop valgte media"/>
+					<button name="stop_btn" tool_tip="Stop valgte medie"/>
 				</layout_panel>
 				<layout_panel name="play">
-					<button name="play_btn" tool_tip="Afspil valgte media"/>
+					<button name="play_btn" tool_tip="Afspil valgte medie"/>
 				</layout_panel>
 				<layout_panel name="pause">
-					<button name="pause_btn" tool_tip="Pause valgte media"/>
+					<button name="pause_btn" tool_tip="Pause valgte medie"/>
 				</layout_panel>
 				<layout_panel name="volume_slider_ctrl">
-					<slider_bar initial_value="0.5" name="volume_slider" tool_tip="Lydstyrke for valgte media"/>
+					<slider_bar initial_value="0.5" name="volume_slider" tool_tip="Volumen for valgte medie"/>
 				</layout_panel>
 				<layout_panel name="mute">
-					<button name="mute_btn" tool_tip="Sluk lyd for valgte media"/>
+					<button name="mute_btn" tool_tip="Sluk for lyd for valgte medie"/>
 				</layout_panel>
 				<layout_panel name="zoom">
-					<button name="zoom_btn" tool_tip="Zoom til valgte media"/>
+					<button name="zoom_btn" tool_tip="Zoom ind til valgte medie"/>
 				</layout_panel>
 				<layout_panel name="unzoom">
-					<button name="unzoom_btn" tool_tip="Zoom tilbage fra valgte media"/>
+					<button name="unzoom_btn" tool_tip="Zoom tilbage fra valgte medie"/>
 				</layout_panel>
 			</layout_stack>
 		</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml
index b267c75673a2c49aace3c7321234df1ca4e7206c..1570960745b73dc7ac8f1ead8ec7e935654c2026 100644
--- a/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml
@@ -13,7 +13,6 @@
 	</text>
 	<check_box label="Byg/Redigér" name="edit_camera_movement" tool_tip="Benyt automatisk kamera positionering ved start og slut af editerings modus"/>
 	<check_box label="Udseende" name="appearance_camera_movement" tool_tip="Benyt automatisk kamera positionering ved redigering"/>
-	<check_box initial_value="sand" label="Sidepanel" name="appearance_sidebar_positioning" tool_tip="Benyt automatisk positionering af kamera"/>
 	<check_box label="Vis avatar i førsteperson" name="first_person_avatar_visible"/>
 	<check_box label="Piletaster bruges altid til bevægelse" name="arrow_keys_move_avatar_check"/>
 	<check_box label="Tast-tast-hold for at løbe" name="tap_tap_hold_to_run"/>
@@ -21,9 +20,6 @@
 	<check_box label="Talebobler" name="bubble_text_chat"/>
 	<slider label="Synlighed" name="bubble_chat_opacity"/>
 	<color_swatch name="background" tool_tip="Vælg farve for talebobler"/>
-	<text name="UI Size:">
-		Brugerflade størrelse
-	</text>
 	<check_box label="Vis script fejl i:" name="show_script_errors"/>
 	<radio_group name="show_location">
 		<radio_item label="Chat" name="0"/>
@@ -33,5 +29,4 @@
 	<line_editor label="Brug walkie-talkie modus" name="modifier_combo"/>
 	<button label="Angiv taste" name="set_voice_hotkey_button"/>
 	<button label="Midterste museknap" name="set_voice_middlemouse_button" tool_tip="Nulstil til midterste musetaste"/>
-	<button label="Andre enheder" name="joystick_setup_button"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/da/sidepanel_item_info.xml b/indra/newview/skins/default/xui/da/sidepanel_item_info.xml
index 2350af8d494593994f9a66566f23861db435abed..701a59bade9a15ec058cc9613d427e4589f74bae 100644
--- a/indra/newview/skins/default/xui/da/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/da/sidepanel_item_info.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="item properties" title="Profil for genstand">
+<panel name="item properties" title="Objekt profil">
 	<panel.string name="unknown">
 		(ukendt)
 	</panel.string>
@@ -15,15 +15,9 @@
 	<panel.string name="acquiredDate">
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
-	<panel.string name="origin_inventory">
-		(Beholdning)
-	</panel.string>
-	<panel.string name="origin_inworld">
-		(I Second Life)
-	</panel.string>
-	<text name="title" value="Profil for genstand"/>
-	<text name="origin" value="(Beholdning)"/>
-	<panel label="" name="item_profile">
+	<text name="title" value="Objekt profil"/>
+	<text name="where" value="(Beholdning)"/>
+	<panel label="">
 		<text name="LabelItemNameTitle">
 			Navn:
 		</text>
@@ -39,30 +33,32 @@
 		</text>
 		<button label="Profil..." name="BtnOwner"/>
 		<text name="LabelAcquiredTitle">
-			Anskaffet:
+			Erhvervet:
+		</text>
+		<text name="LabelAcquiredDate">
+			Ons Maj 24 12:50:46 2006
 		</text>
-		<text name="LabelAcquiredDate"/>
 		<panel name="perms_inv">
 			<text name="perm_modify">
 				Du kan:
 			</text>
 			<check_box label="Redigere" name="CheckOwnerModify"/>
 			<check_box label="Kopiere" name="CheckOwnerCopy"/>
-			<check_box label="Overfør" name="CheckOwnerTransfer"/>
+			<check_box label="Give væk" name="CheckOwnerTransfer"/>
 			<text name="AnyoneLabel">
-				Alle:
+				Enhver:
 			</text>
 			<check_box label="Kopiere" name="CheckEveryoneCopy"/>
 			<text name="GroupLabel">
 				Gruppe:
 			</text>
-			<check_box label="Del" name="CheckShareWithGroup" tool_tip="Giver alle medlemmer adgang til at give gruppen ret til at ændre rettigheder for dette objekt. Du skal dedikere for at åbne for rolle begrænsninger."/>
+			<check_box label="Dele" name="CheckShareWithGroup" tool_tip="Tillad alle medlemmer i den aktive gruppe at dele dine &apos;redigere&apos; rettigheder for dette objekt. Du skal dedikere for at åbne for rolle begrænsninger."/>
 			<text name="NextOwnerLabel">
 				Næste ejer:
 			</text>
 			<check_box label="Redigere" name="CheckNextOwnerModify"/>
 			<check_box label="Kopiere" name="CheckNextOwnerCopy"/>
-			<check_box label="Overføre" name="CheckNextOwnerTransfer" tool_tip="Næste ejer kan give væk eller sælge dette objekt"/>
+			<check_box label="Give væk" name="CheckNextOwnerTransfer" tool_tip="Næste ejer kan give væk eller sælge dette objekt"/>
 		</panel>
 		<check_box label="Til salg" name="CheckPurchase"/>
 		<combo_box name="combobox sale copy">
diff --git a/indra/newview/skins/default/xui/da/sidepanel_task_info.xml b/indra/newview/skins/default/xui/da/sidepanel_task_info.xml
index 746cf201bc7433a2a7ea17cccb80b3ec56efa652..bec97734e434a0bba80cb57b9cd5113de4220373 100644
--- a/indra/newview/skins/default/xui/da/sidepanel_task_info.xml
+++ b/indra/newview/skins/default/xui/da/sidepanel_task_info.xml
@@ -37,7 +37,7 @@
 		Blandet salg
 	</panel.string>
 	<text name="title" value="Objekt profil"/>
-	<text name="where" value="(I Second Life)"/>
+	<text name="where" value="(verden)"/>
 	<panel label="" name="properties_panel">
 		<text name="Name:">
 			Navn:
diff --git a/indra/newview/skins/default/xui/da/strings.xml b/indra/newview/skins/default/xui/da/strings.xml
index 3152661fd48542d82277f38139d27926e9aa9778..37501a35345d5ac3b0a6437e01a673ecb58d1181 100644
--- a/indra/newview/skins/default/xui/da/strings.xml
+++ b/indra/newview/skins/default/xui/da/strings.xml
@@ -88,24 +88,6 @@
 	<string name="LoginDownloadingClothing">
 		Henter tøj...
 	</string>
-	<string name="InvalidCertificate">
-		Serveren returnerede et ugyldigt eller ødelagt certifikat. Kontakt venligst administrator af dette net.
-	</string>
-	<string name="CertInvalidHostname">
-		Et ugyldig hostnavn blev brugt for at få adgang til serveren. Check venligst din SLURL eller navnet på hosten.
-	</string>
-	<string name="CertExpired">
-		Det certifikat der blev returneret ser ud til at være udløbet. Check venligst din systemtid på computeren.
-	</string>
-	<string name="CertKeyUsage">
-		Det certifikat der blev returneret af serveren kan ikke benyttes til SSL.  Kontakt venligst administrator af dette net.
-	</string>
-	<string name="CertBasicConstraints">
-		For mange certifikater i serverens certifikat streng.  Kontakt venligst administrator af dette net.
-	</string>
-	<string name="CertInvalidSignature">
-		Signaturen på certifkat der blev returneret af Second Life serveren kunne ikke bekræftes.
-	</string>
 	<string name="LoginFailedNoNetwork">
 		Netværksfejl: Kunne ikke etablere forbindelse, check venligst din netværksforbindelse.
 	</string>
@@ -181,7 +163,6 @@
 	<string name="TooltipMustSingleDrop">
 		Kun et enkelt element kan trækkes ind her
 	</string>
-	<string name="TooltipPrice" value="L$[BELØB]:"/>
 	<string name="TooltipHttpUrl">
 		Klik for at se denne hjemmeside
 	</string>
@@ -234,6 +215,7 @@
 		Klik for at starte secondlife:// kommando
 	</string>
 	<string name="CurrentURL" value=" Nuværende URL: [CurrentURL]"/>
+	<string name="TooltipPrice" value="L$[PRICE]-"/>
 	<string name="SLurlLabelTeleport">
 		Teleportér til
 	</string>
@@ -264,9 +246,6 @@
 	<string name="BUTTON_CLOSE_WIN">
 		Luk (Ctrl+W)
 	</string>
-	<string name="BUTTON_CLOSE_CHROME">
-		Luk
-	</string>
 	<string name="BUTTON_RESTORE">
 		Gendan
 	</string>
@@ -294,9 +273,6 @@
 	<string name="ReleaseNotes">
 		Noter om version
 	</string>
-	<string name="RELEASE_NOTES_BASE_URL">
-		http://wiki.secondlife.com/wiki/Release_Notes/
-	</string>
 	<string name="LoadingData">
 		Henter...
 	</string>
@@ -309,9 +285,6 @@
 	<string name="GroupNameNone">
 		(ingen)
 	</string>
-	<string name="AvalineCaller">
-		Avaline opkalder [ORDER]
-	</string>
 	<string name="AssetErrorNone">
 		Ingen fejl
 	</string>
@@ -642,9 +615,6 @@
 	<string name="worldmap_offline">
 		Offline
 	</string>
-	<string name="worldmap_item_tooltip_format">
-		[AREA] m² L$[PRICE]
-	</string>
 	<string name="worldmap_results_none_found">
 		Ingen fundet.
 	</string>
@@ -735,12 +705,6 @@
 	<string name="land_type_unknown">
 		(ukendt)
 	</string>
-	<string name="Estate / Full Region">
-		Estate / Hel region
-	</string>
-	<string name="Mainland / Full Region">
-		Mainland / Hel region
-	</string>
 	<string name="all_files">
 		Alle filer
 	</string>
@@ -846,93 +810,6 @@
 	<string name="invalid">
 		ugyldig
 	</string>
-	<string name="none">
-		ingen
-	</string>
-	<string name="shirt_not_worn">
-		Trøje - ikke på
-	</string>
-	<string name="pants_not_worn">
-		Bukser - ikke på
-	</string>
-	<string name="shoes_not_worn">
-		Sko - ikke på
-	</string>
-	<string name="socks_not_worn">
-		Strømper - ikke på
-	</string>
-	<string name="jacket_not_worn">
-		Jakke - ikke på
-	</string>
-	<string name="gloves_not_worn">
-		Handsker - ikke på
-	</string>
-	<string name="undershirt_not_worn">
-		Undertrøje - ikke på
-	</string>
-	<string name="underpants_not_worn">
-		Underbukser - ikke på
-	</string>
-	<string name="skirt_not_worn">
-		Nederdel - ikke på
-	</string>
-	<string name="alpha_not_worn">
-		Alpha ikke benyttet
-	</string>
-	<string name="tattoo_not_worn">
-		Tatovering ikke benyttet
-	</string>
-	<string name="invalid_not_worn">
-		ugyldig
-	</string>
-	<string name="create_new_shape">
-		Opret ny figur
-	</string>
-	<string name="create_new_skin">
-		Opret nyt hud
-	</string>
-	<string name="create_new_hair">
-		Opret nyt hår
-	</string>
-	<string name="create_new_eyes">
-		Opret nye øjne
-	</string>
-	<string name="create_new_shirt">
-		Opret ny trøje
-	</string>
-	<string name="create_new_pants">
-		Opret nye bukser
-	</string>
-	<string name="create_new_shoes">
-		Opret nye sko
-	</string>
-	<string name="create_new_socks">
-		Opret nye strømper
-	</string>
-	<string name="create_new_jacket">
-		Opret ny jakke
-	</string>
-	<string name="create_new_gloves">
-		Opret nye handsker
-	</string>
-	<string name="create_new_undershirt">
-		Opret ny undertrøje
-	</string>
-	<string name="create_new_underpants">
-		Opret nye underbukser
-	</string>
-	<string name="create_new_skirt">
-		Opret ny nederdel
-	</string>
-	<string name="create_new_alpha">
-		Opret ny alpha
-	</string>
-	<string name="create_new_tattoo">
-		Opret ny tatovering
-	</string>
-	<string name="create_new_invalid">
-		ugyldig
-	</string>
 	<string name="NewWearable">
 		Ny [WEARABLE_ITEM]
 	</string>
@@ -1003,10 +880,7 @@
 		Tryk ESC for at skift til normalt udsyn
 	</string>
 	<string name="InventoryNoMatchingItems">
-		Fandt du ikke hvad du søgte? Prøv [secondlife:///app/search/all/[SEARCH_TERM] Search].
-	</string>
-	<string name="PlacesNoMatchingItems">
-		Fandt du ikke hvad du søgte? Prøv [secondlife:///app/search/places/[SEARCH_TERM] Search].
+		Ingen matchende genstande fundet i beholdning.  Prøv evt. [secondlife:///app/search/groups &quot;Search&quot;].
 	</string>
 	<string name="FavoritesNoMatchingItems">
 		Træk et landemærke hertil for at tilføje den som favorit.
@@ -1034,10 +908,8 @@
 	<string name="AnimFlagStop" value=" Stop Animation :   "/>
 	<string name="AnimFlagStart" value=" Start Animation :   "/>
 	<string name="Wave" value=" Vink "/>
-	<string name="GestureActionNone" value="Ingen"/>
 	<string name="HelloAvatar" value=" Hej, avatar! "/>
 	<string name="ViewAllGestures" value=" Se alle &gt;&gt;"/>
-	<string name="GetMoreGestures" value="FÃ¥ mere &gt;&gt;"/>
 	<string name="Animations" value=" Animationer,"/>
 	<string name="Calling Cards" value=" Visitkort,"/>
 	<string name="Clothing" value=" Tøj,"/>
@@ -1114,15 +986,12 @@
 	<string name="InvFolder Gestures">
 		Bevægelser
 	</string>
-	<string name="InvFolder Favorite">
+	<string name="InvFolder favorite">
 		Favoritter
 	</string>
 	<string name="InvFolder Current Outfit">
 		Nuværende sæt
 	</string>
-	<string name="InvFolder Initial Outfits">
-		Start sæt
-	</string>
 	<string name="InvFolder My Outfits">
 		Mine sæt
 	</string>
@@ -1442,7 +1311,6 @@
 	<string name="SummaryForTheWeek" value="Opsummering for denne uge, begyndende med "/>
 	<string name="NextStipendDay" value="Næste stipendie dag er "/>
 	<string name="GroupIndividualShare" value="                      Gruppe     Individuel Delt"/>
-	<string name="GroupColumn" value="Gruppe"/>
 	<string name="Balance">
 		Balance
 	</string>
@@ -1638,44 +1506,32 @@
 	<string name="ATTACH_HUD_BOTTOM_RIGHT">
 		HUD Nederst til højre
 	</string>
-	<string name="Bad attachment point">
-		Ugyldig fæste-punkt
-	</string>
 	<string name="CursorPos">
 		Linie [LINE], Kolonne [COLUMN]
 	</string>
 	<string name="PanelDirCountFound">
 		[COUNT] fundet
 	</string>
-	<string name="PanelContentsTooltip">
-		Indhold i objekt
-	</string>
 	<string name="PanelContentsNewScript">
 		Nyt script
 	</string>
+	<string name="PanelContentsTooltip">
+		Indhold i objekt
+	</string>
 	<string name="BusyModeResponseDefault">
 		Beboeren du sendte en besked er &apos;optaget&apos;, hvilket betyder at han/hun ikke vil forstyrres. Din besked vil blive vis i hans/hendes IM panel til senere visning.
 	</string>
-	<string name="NoOutfits">
-		You don&apos;t have any outfits yet. Try [secondlife:///app/search/all/ Search]
-	</string>
-	<string name="NoOutfitsTabsMatched">
-		Fandt du ikke hvad du søgte? Prøv [secondlife:///app/search/all/[SEARCH_TERM] Search].
-	</string>
 	<string name="MuteByName">
-		(Efter navn)
+		(efter navn)
 	</string>
 	<string name="MuteAgent">
 		(beboer)
 	</string>
 	<string name="MuteObject">
-		(Objekt)
+		(objekt)
 	</string>
 	<string name="MuteGroup">
-		(Gruppe)
-	</string>
-	<string name="MuteExternal">
-		(Ekstern)
+		(gruppe)
 	</string>
 	<string name="RegionNoCovenant">
 		Der er ingen regler for dette estate.
@@ -1683,7 +1539,9 @@
 	<string name="RegionNoCovenantOtherOwner">
 		Der er ingen regler for dette estate. Land på dette estate sælges af estate ejeren, ikke af Linden Lab.  Kontakt venligst estate ejeren for detaljer om salg.
 	</string>
-	<string name="covenant_last_modified" value="Sidst rettet:"/>
+	<string name="covenant_last_modified">
+		Sidst ændret:
+	</string>
 	<string name="none_text" value=" (ingen) "/>
 	<string name="never_text" value=" (aldrig) "/>
 	<string name="GroupOwned">
@@ -3360,15 +3218,6 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
 	<string name="LocationCtrlComboBtnTooltip">
 		Min lokationshistorik
 	</string>
-	<string name="LocationCtrlAdultIconTooltip">
-		Adult region
-	</string>
-	<string name="LocationCtrlModerateIconTooltip">
-		Moderate region
-	</string>
-	<string name="LocationCtrlGeneralIconTooltip">
-		Generel region
-	</string>
 	<string name="UpdaterWindowTitle">
 		[APP_NAME] Opdatér
 	</string>
@@ -3399,12 +3248,6 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
 	<string name="UpdaterFailStartTitle">
 		Opstart af klient fejlede
 	</string>
-	<string name="ItemsComingInTooFastFrom">
-		[APP_NAME]: Genstande modtages for hurtigt fra [FROM_NAME], automatisk visning er slået fra i [TIME] sekunder
-	</string>
-	<string name="ItemsComingInTooFast">
-		[APP_NAME]: Genstande modtages for hurtigt, automatisk visning er slået fra i [TIME] sekunder
-	</string>
 	<string name="IM_logging_string">
 		-- Logning af IM aktiveret --
 	</string>
@@ -3432,17 +3275,11 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
 	<string name="IM_moderator_label">
 		(Moderator)
 	</string>
-	<string name="answered_call">
-		Dit opkald er blevet besvaret
+	<string name="started_call">
+		startede et stemme opkald
 	</string>
-	<string name="you_started_call">
-		Du startede dette stemme kald
-	</string>
-	<string name="you_joined_call">
-		Du er nu med i stemme opkald
-	</string>
-	<string name="name_started_call">
-		[NAME] startede et stemmekald
+	<string name="joined_call">
+		tilsluttede stemme opkald
 	</string>
 	<string name="ringing-im">
 		Tilslutter stemme opkald...
@@ -3519,21 +3356,12 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
 	<string name="unread_chat_multiple">
 		[SOURCES] har sagt noget nyt
 	</string>
-	<string name="session_initialization_timed_out_error">
-		Initialisering af session er &quot;timed out&quot;
-	</string>
-	<string name="voice_morphing_url">
-		http://secondlife.com/landing/voicemorphing
-	</string>
 	<string name="paid_you_ldollars">
 		[NAME] betalte dig L$[AMOUNT]
 	</string>
 	<string name="you_paid_ldollars">
 		Du betalte [NAME] L$[AMOUNT] [REASON].
 	</string>
-	<string name="you_paid_ldollars_no_info">
-		Du betalte L$[AMOUNT].
-	</string>
 	<string name="you_paid_ldollars_no_reason">
 		Du betalte [NAME] L$[AMOUNT].
 	</string>
@@ -3582,9 +3410,6 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
 	<string name="group_role_owners">
 		Ejere
 	</string>
-	<string name="group_member_status_online">
-		Online
-	</string>
 	<string name="uploading_abuse_report">
 		Uploader...
   
@@ -3638,203 +3463,13 @@ Krænkelsesanmeldelse
 	<string name="Invalid Wearable">
 		Kan ikke tages på
 	</string>
-	<string name="New Gesture">
-		Ny bevægelse
-	</string>
 	<string name="New Script">
 		Nyt script
 	</string>
-	<string name="New Note">
-		Ny note
-	</string>
 	<string name="New Folder">
 		Ny folder
 	</string>
 	<string name="Contents">
 		Indhold
 	</string>
-	<string name="Gesture">
-		Bevægelse
-	</string>
-	<string name="Male Gestures">
-		Mandlige bevægelser
-	</string>
-	<string name="Female Gestures">
-		Kvindelige bevægelser
-	</string>
-	<string name="Other Gestures">
-		Andre bevægelser
-	</string>
-	<string name="Speech Gestures">
-		Tale bevægelser
-	</string>
-	<string name="Common Gestures">
-		Almindelige bevægelser
-	</string>
-	<string name="Male - Excuse me">
-		Mand - Undskyld mig
-	</string>
-	<string name="Male - Get lost">
-		Mand - Skrid!
-	</string>
-	<string name="Male - Blow kiss">
-		Mand - Pust et kys
-	</string>
-	<string name="Male - Boo">
-		Mand - Boo
-	</string>
-	<string name="Male - Bored">
-		Mand - Keder sig
-	</string>
-	<string name="Male - Hey">
-		Mand - Hey
-	</string>
-	<string name="Male - Laugh">
-		Mand - Latter
-	</string>
-	<string name="Male - Repulsed">
-		Mand - Frastødt
-	</string>
-	<string name="Male - Shrug">
-		Mand - Skuldertræk
-	</string>
-	<string name="Male - Stick tougue out">
-		Mand - Stik tunge ud
-	</string>
-	<string name="Male - Wow">
-		Mand - Wow
-	</string>
-	<string name="Female - Chuckle">
-		Kvinde - Kluklatter
-	</string>
-	<string name="Female - Cry">
-		Kvinde - gråd
-	</string>
-	<string name="Female - Embarrassed">
-		Kvinde - Flov
-	</string>
-	<string name="Female - Excuse me">
-		Kvinde - Undskyld mig
-	</string>
-	<string name="Female - Get lost">
-		Kvinde - Skrid!
-	</string>
-	<string name="Female - Blow kiss">
-		Kvinde - Pust et kys
-	</string>
-	<string name="Female - Boo">
-		Kvinde - Boo
-	</string>
-	<string name="Female - Bored">
-		Kvinde - Keder sig
-	</string>
-	<string name="Female - Hey">
-		Kvinde - Hey
-	</string>
-	<string name="Female - Hey baby">
-		Kvinde - Hey baby
-	</string>
-	<string name="Female - Laugh">
-		Kvinde - Latter
-	</string>
-	<string name="Female - Looking good">
-		Kvinde - &quot;Ser godt ud&quot;
-	</string>
-	<string name="Female - Over here">
-		Kvinde - Herovre
-	</string>
-	<string name="Female - Please">
-		Kvinde - Be´ om
-	</string>
-	<string name="Female - Repulsed">
-		Kvinde - Frastødt
-	</string>
-	<string name="Female - Shrug">
-		Kvinde - Skuldertræk
-	</string>
-	<string name="Female - Stick tougue out">
-		Kvinde - Stik tungen ud
-	</string>
-	<string name="Female - Wow">
-		Kvinde - Wow
-	</string>
-	<string name="AvatarBirthDateFormat">
-		[mthnum,datetime,slt]/[day,datetime,slt]/[year,datetime,slt]
-	</string>
-	<string name="DefaultMimeType">
-		ingen/ingen
-	</string>
-	<string name="texture_load_dimensions_error">
-		Kan ikke hente billeder større end  [WIDTH]*[HEIGHT]
-	</string>
-	<string name="words_separator" value=","/>
-	<string name="server_is_down">
-		Desværre er noget gået galt.
-
-	Check venligst status.secondlifegrid.net for at se om der skulle være driftsproblemer.
-	Hvis du bliver ved med at have problemer, check venligst din firewall- og netværksopsætning.
-	</string>
-	<string name="dateTimeWeekdaysNames">
-		Søndag:Mandag:Tirsdag:Onsdag:Torsdag:Fredag:Lørdag
-	</string>
-	<string name="dateTimeWeekdaysShortNames">
-		Søn:Man:Tir:Ons:Tor:Fre:Lør
-	</string>
-	<string name="dateTimeMonthNames">
-		Januar:Februar:Marts:April:Maj:Juni:Juli:August:September:Oktober:November:December
-	</string>
-	<string name="dateTimeMonthShortNames">
-		Jan:Feb:Mar:Apr:Maj:Jun:Jul:Aug:Sep:Okt:Nov:Dec
-	</string>
-	<string name="dateTimeDayFormat">
-		[MDAY]
-	</string>
-	<string name="dateTimeAM">
-		AM
-	</string>
-	<string name="dateTimePM">
-		PM
-	</string>
-	<string name="LocalEstimateUSD">
-		US$ [AMOUNT]
-	</string>
-	<string name="Membership">
-		Medlemsskab
-	</string>
-	<string name="Roles">
-		Roller
-	</string>
-	<string name="Group Identity">
-		Gruppe identitet
-	</string>
-	<string name="Parcel Management">
-		Parcel håndtering
-	</string>
-	<string name="Parcel Identity">
-		Parcel identitet
-	</string>
-	<string name="Parcel Settings">
-		Parcel opsætning
-	</string>
-	<string name="Parcel Powers">
-		Parcel beføjelser
-	</string>
-	<string name="Parcel Access">
-		Parcel adgang
-	</string>
-	<string name="Parcel Content">
-		Parcel indhold
-	</string>
-	<string name="Object Management">
-		Objekt håndtering
-	</string>
-	<string name="Accounting">
-		Regnskab
-	</string>
-	<string name="Notices">
-		Beskeder
-	</string>
-	<string name="Chat">
-		Chat
-	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/de/language_settings.xml b/indra/newview/skins/default/xui/de/language_settings.xml
index d54f548fe135494240f9ae206785a9059a77842c..3e357007fff470d8126717f6306cabd8cb9581d5 100644
--- a/indra/newview/skins/default/xui/de/language_settings.xml
+++ b/indra/newview/skins/default/xui/de/language_settings.xml
@@ -17,7 +17,6 @@
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
diff --git a/indra/newview/skins/default/xui/de/panel_nearby_media.xml b/indra/newview/skins/default/xui/de/panel_nearby_media.xml
index ef66148902abecb34582c0f61a152709e09f3f59..32750f14d4a93a8e5e6286a416115e39ffaecf8d 100644
--- a/indra/newview/skins/default/xui/de/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/de/panel_nearby_media.xml
@@ -1,8 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_media">
-	<string name="media_item_count_format">
-		(%ls Medien-Objekte)
-	</string>
 	<string name="empty_item_text">
 		&lt;leer&gt;
 	</string>
@@ -19,14 +16,13 @@
 		<button label="Stoppen" name="all_nearby_media_disable_btn" tool_tip="Alle Medien in der Nähe ausschalten"/>
 		<button label="Starten" name="all_nearby_media_enable_btn" tool_tip="Alle Medien in der Nähe einschalten"/>
 		<button name="open_prefs_btn" tool_tip="Medien-Einstellungen öffnen"/>
-		<button label="Mehr &gt;&gt;" label_selected="Weniger &lt;&lt;" name="more_btn" tool_tip="Erweiterte Steuerung"/>
-		<button label="Mehr &gt;&gt;" label_selected="Weniger &lt;&lt;" name="less_btn" tool_tip="Erweiterte Steuerung"/>
+		<button label="Mehr &gt;&gt;" label_selected="Weniger &lt;&lt;" name="more_less_btn" tool_tip="Erweiterte Steuerung"/>
 	</panel>
 	<panel name="nearby_media_panel">
-		<text name="nearby_media_title">
+		<text name="nearby_media">
 			Medien in der Nähe
 		</text>
-		<text name="show_text">
+		<text name="show">
 			Anzeigen:
 		</text>
 		<combo_box name="show_combo">
diff --git a/indra/newview/skins/default/xui/de/panel_status_bar.xml b/indra/newview/skins/default/xui/de/panel_status_bar.xml
index 005290c1ff70e914dc1d5c1c1e72b429f31ae801..803bd1b5ab8b26e35d1b5d8b2f07da3ffc44af80 100644
--- a/indra/newview/skins/default/xui/de/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/de/panel_status_bar.xml
@@ -21,10 +21,8 @@
 	<panel.string name="buycurrencylabel">
 		[AMT] L$
 	</panel.string>
-	<panel name="balance_bg">
-		<text name="balance" tool_tip="Mein Kontostand" value="20 L$"/>
-		<button label="L$ kaufen" name="buyL" tool_tip="Hier klicken, um mehr L$ zu kaufen"/>
-	</panel>
+	<button label="" label_selected="" name="buycurrency" tool_tip="Mein Kontostand"/>
+	<button label=" " name="buyL" tool_tip="Hier klicken, um mehr L$ zu kaufen"/>
 	<text name="TimeText" tool_tip="Aktuelle Zeit (Pazifik)">
 		24:00 H PST
 	</text>
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index b5be03346e2b46ea91d8fe95f8f2610c322d3b98..a6a4c79da454925e6aa644ae8c353472877aa8e1 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -49,7 +49,7 @@ libcurl Version: [LIBCURL_VERSION]
 J2C Decoder Version: [J2C_VERSION]
 Audio Driver Version: [AUDIO_DRIVER_VERSION]
 Qt Webkit Version: [QT_WEBKIT_VERSION]
-Voice Server Version: [VOICE_VERSION]
+Vivox Version: [VIVOX_VERSION]
 </floater.string>
   <floater.string
      name="none">
diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml
index 99bf3e6bc124ea74add262b27b5fdd809d101f52..59f188980810e56947883e27dda0aa5b822c6640 100644
--- a/indra/newview/skins/default/xui/en/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_about_land.xml
@@ -108,9 +108,6 @@
              name="no_selection_text">
                 No parcel selected.
             </panel.string>
-            <panel.string name="time_stamp_template">
-				[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
-			</panel.string>
             <text
              type="string"
              length="1"
@@ -191,10 +188,9 @@
              type="string"
              length="1"
              follows="left|top"
-             height="20"
+             height="16"
              layout="topleft"
              left_pad="2"
-             valign="center" 
              name="ContentRatingText"
              top_delta="0"
              width="250">
@@ -208,7 +204,7 @@
              layout="topleft"
              left="10"
              name="Owner:"
-             top_pad="1"
+             top_pad="5"
              width="100">
                 Owner:
             </text>
@@ -730,10 +726,8 @@ Leyla Linden               </text>
              height="16"
              layout="topleft"
              left_pad="10"
-             top_delta="-3" 
              mouse_opaque="false"
              name="region_maturity_text"
-             valign="center" 
              width="150">
                 Adult
             </text>
@@ -746,7 +740,6 @@ Leyla Linden               </text>
              left="10"
              mouse_opaque="false"
              name="resellable_lbl"
-             top_pad="9" 
              width="100">
                 Resale:
             </text>
@@ -760,7 +753,7 @@ Leyla Linden               </text>
              mouse_opaque="false"
              name="resellable_clause"
              word_wrap="true"
-             width="360">
+             width="330">
                 Land in this region may not be resold.
             </text>
             <text
@@ -829,7 +822,7 @@ Leyla Linden               </text>
              name="Simulator primitive usage:"
              top_pad="4"
              width="364">
-               Primitive usage:
+               Primative usage:
             </text>
             <text
              type="string"
@@ -1068,8 +1061,7 @@ Leyla Linden               </text>
              left="10"
              name="Autoreturn"
              top_pad="0"
-             width="412"
-             wrap="true">
+             width="310">
                 Auto return other Residents&apos; objects (minutes, 0 for off):
             </text>
             <line_editor
@@ -1081,9 +1073,9 @@ Leyla Linden               </text>
              layout="topleft"
              max_length="6"
              name="clean other time"
-             left_pad="0"
-             width="46"
-             top_delta="-2"/>
+             right="-72"
+             width="56"
+             top_delta="-6"/>
             <text
              type="string"
              length="1"
@@ -1472,10 +1464,8 @@ Only large parcels can be listed in search.
              left="14"
              name="MatureCheck"
              top="177"
-             label_text.valign="center" 
-             label_text.v_pad="-5" 
              tool_tip=" "
-             width="200" />
+             width="107" />
             <text
              type="string"
              length="1"
@@ -1495,7 +1485,6 @@ Only large parcels can be listed in search.
              layout="topleft"
              left="14"
              name="snapshot_ctrl"
-             fallback_image="default_land_picture.j2c" 
              tool_tip="Click to choose a picture"
              width="195" />
             <text
@@ -1930,8 +1919,6 @@ Only large parcels can be listed in search.
              left_delta="0"
              name="public_access"
              top_pad="5"
-             label_text.valign="center"
-             label_text.v_pad="-7" 
              width="278" />
             <text
              type="string"
@@ -1942,7 +1929,7 @@ Only large parcels can be listed in search.
              left_delta="20"
              name="Only Allow"
              top="49"
-             width="325">
+             width="278">
                 Restrict Access to Residents verified by:
             </text>
             <check_box
diff --git a/indra/newview/skins/default/xui/en/floater_buy_land.xml b/indra/newview/skins/default/xui/en/floater_buy_land.xml
index c88de878f49ad2330ad2afd62f87781ae5f8692e..df44b616327571c6f6da42ce5b443a0706602a07 100644
--- a/indra/newview/skins/default/xui/en/floater_buy_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_buy_land.xml
@@ -174,15 +174,12 @@ supports [AMOUNT2] objects
     </floater.string>
     <floater.string
      name="icon_PG"
-     translate="false"
      value="Parcel_PG_Dark"/>
     <floater.string
      name="icon_M"
-     translate="false"
      value="Parcel_M_Dark"/>
     <floater.string
      name="icon_R"
-     translate="false"
      value="Parcel_R_Dark"/>
     <text
      type="string"
@@ -380,7 +377,6 @@ supports [AMOUNT2] objects
      width="275" />
     <texture_picker
      enabled="false"
-     fallback_image="default_land_picture.j2c"
      follows="top|left"
      height="135"
      layout="topleft"
@@ -529,14 +525,13 @@ sold with objects
      length="1"
      follows="top|left"
      font="SansSerifBig"
-     height="32"
+     height="16"
      layout="topleft"
      left="72"
      name="account_action"
      right="438"
      top="200"
-     width="218"
-     wrap="true">
+     width="218">
         Upgrade you to premium membership.
     </text>
     <text
@@ -578,21 +573,19 @@ sold with objects
      layout="topleft"
      left="0"
      name="step_2"
-     top_pad="-10"
      width="64" />
     <text
      type="string"
      length="1"
      follows="top|left"
      font="SansSerifBig"
-     height="32"
+     height="16"
      layout="topleft"
      left="72"
      name="land_use_action"
      right="438"
      top="284"
-     width="218"
-     wrap="true">
+     width="218">
         Increase your monthly land use fees to US$ 40/month.
     </text>
     <text
@@ -623,15 +616,14 @@ This parcel is 512 m² of land.
     <text
      type="string"
      length="1"
-     bottom_delta="-22"
+     bottom_delta="-38"
      follows="top|left"
      font="SansSerifBig"
-     height="32"
+     height="16"
      layout="topleft"
      left="72"
      name="purchase_action"
-     right="438"
-     wrap="true">
+     right="438">
         Pay Joe Resident L$ 4000 for the land
     </text>
     <text
@@ -669,7 +661,7 @@ This parcel is 512 m² of land.
      layout="topleft"
      left="170"
      name="currency_amt"
-     top="424"
+     top="408"
      width="80">
         1000
     </line_editor>
@@ -685,7 +677,7 @@ This parcel is 512 m² of land.
      layout="topleft"
      left="260"
      name="currency_est"
-     top="425"
+     top="409"
      width="178">
         for approx. [LOCAL_AMOUNT]
     </text>
@@ -717,7 +709,7 @@ This parcel is 512 m² of land.
      layout="topleft"
      left="70"
      name="buy_btn"
-     top="460"
+     top="448"
      width="100" />
     <button
      follows="bottom|right"
diff --git a/indra/newview/skins/default/xui/en/floater_event.xml b/indra/newview/skins/default/xui/en/floater_event.xml
index 887cedc33fbff0d7af4eb112b04a8faf41e5037c..d9c9d63c72da802e87608fbb77ceb4b5d011bdbe 100644
--- a/indra/newview/skins/default/xui/en/floater_event.xml
+++ b/indra/newview/skins/default/xui/en/floater_event.xml
@@ -266,6 +266,7 @@
            layout="topleft"
            left="6"
        name="create_event_btn"
+           picture_style="true"
            tool_tip="Create Event"
            width="18" />
       <button
@@ -279,6 +280,7 @@
            left="6"
            top_pad="-7" 
           name="god_delete_event_btn"
+           picture_style="true"
            tool_tip="Delete Event"
            width="18" />
       <button
diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml
index e123de46c2046b6f3c63a142ce16f6182e7d3e7f..65a05f3ec58e3b3c945d0642ce391bdf89bade96 100644
--- a/indra/newview/skins/default/xui/en/floater_im_container.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_container.xml
@@ -11,7 +11,7 @@
  save_visibility="true"
  single_instance="true"
  title="CONVERSATIONS"
- width="396">
+ width="392">
     <tab_container
      follows="left|right|top|bottom"
      height="390"
@@ -27,14 +27,7 @@
      halign="left"
      use_ellipses="true"
      top="0"
-     width="394">
-      <first_tab
-       tab_bottom_image_flash="Toolbar_Left_Flash"/>
-      <middle_tab
-       tab_bottom_image_flash="Toolbar_Middle_Flash"/>
-      <last_tab
-       tab_bottom_image_flash="Toolbar_Right_Flash"/>
-    </tab_container>
+     width="390" />
     <icon
      color="DefaultShadowLight"
      enabled="false"
@@ -45,5 +38,5 @@
      left="1"
      name="im_box_tab_container_icon"
      bottom="10"
-     width="394" />
+     width="390" />
 </multi_floater>
diff --git a/indra/newview/skins/default/xui/en/floater_map.xml b/indra/newview/skins/default/xui/en/floater_map.xml
index efd96624ab0026d0cbf298824050fd6fadbca19e..e21e44204d47767058ac0875c7bbfb1a9cc26388 100644
--- a/indra/newview/skins/default/xui/en/floater_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_map.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
  bg_alpha_image_overlay="DkGray_66"
- legacy_header_height="0"
+ legacy_header_height="18"
  can_minimize="true" 
  can_resize="true"
  follows="top|right"
- height="174"
+ height="218"
  layout="topleft"
  min_height="174"
  min_width="174"
  name="Map"
- title=""
+ title="Mini Map"
  help_topic="map"
  save_rect="true"
  save_visibility="true"
@@ -54,9 +54,6 @@
      name="ToolTipMsg">
         [AGENT][REGION](Double-click to open Map)
     </floater.string>
-    <floater.string name="mini_map_caption">
-	MINIMAP
-    </floater.string>
     <net_map
      bg_color="NetMapBackgroundColor"
      follows="top|left|bottom|right"
@@ -65,8 +62,8 @@
      mouse_opaque="false"
      name="Net Map"
      width="200"
-     height="218"
-     top="0"/>
+     height="200"
+     top="18"/>
     <text
      type="string"
      length="1"
diff --git a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
index 0e8eef2a21b80018df7aa20e6746c3a96523fb07..14c0081c0df57675b6064f5f9af6ffd9db37fdf0 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
@@ -84,18 +84,8 @@
      label="Save"
      label_selected="Save"
      layout="topleft"
-     left="178"
-     name="Save"
-     top="332"
-     width="100" />
-    <button
-     follows="right|bottom"
-     height="22"
-     label="Delete"
-     label_selected="Delete"
-     layout="topleft"
      left="288"
-     name="Delete"
+     name="Save"
      top="332"
      width="100" />
 </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index a96dbe3553487ac379f0f1ce573bc9c111a13c78..cc9e72cfb581d82211546942a9fdf207b59feb08 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -11,7 +11,6 @@
  save_rect="true"
  short_title="BUILD TOOLS"
  single_instance="true"
- save_visibility="true"
  sound_flags="0"
  width="295">
     <floater.string
@@ -220,8 +219,8 @@
 	</radio_group>
 	<radio_group
      follows="left|top"
-	 left="5"
-	 top="59"
+	 left="10"
+	 top="54"
 	 height="70"
      layout="topleft"
 	 name="edit_radio_group">
@@ -254,8 +253,7 @@
 	 control_name="EditLinkedParts"
      label="Edit linked"
      layout="topleft"     
-     name="checkbox edit linked parts"
-     top_pad="0">
+     name="checkbox edit linked parts" >
 		  <check_box.commit_callback
 			function="BuildTool.selectComponent"/>
 	</check_box>
@@ -275,31 +273,20 @@
 	<check_box
      control_name="ScaleUniform"
      height="19"
-     label=""
+     label="Stretch Both Sides"
      layout="topleft"
      left="143"
      name="checkbox uniform"
 	 top="50"
-     width="20" />
-    <text
-     height="19"
-     label="Stretch Both Sides"
-     left="163"
-     name="checkbox uniform label"
-     top="55"
-     width="120"
-     wrap="true">
-     	Stretch Both Sides
-    </text>
+     width="134" />
     <check_box
      control_name="ScaleStretchTextures"
      height="19"
      initial_value="true"
      label="Stretch Textures"
      layout="topleft"
-     left="143"
      name="checkbox stretch textures"
-     top_pad="7"
+     top_pad="0"
      width="134" />
    <check_box
      control_name="SnapEnabled"
@@ -307,7 +294,7 @@
      initial_value="true"
      label="Snap to grid"
      layout="topleft"
-     top_pad="0"
+     top_pad="7"
      name="checkbox snap to grid"
      width="134" />
     <combo_box
@@ -316,7 +303,6 @@
      follows="left|top"
      name="combobox grid mode"
      tool_tip="Choose the type of grid ruler for positioning the object"
-     top_pad="0"
      width="108">
         <combo_box.item
          label="World grid"
@@ -335,6 +321,7 @@
     </combo_box>
     <button
      left_pad="0"
+     image_disabled="ForwardArrow_Disabled"
      image_selected="ForwardArrow_Press"
      image_unselected="ForwardArrow_Off"
      layout="topleft"
@@ -593,7 +580,7 @@
          layout="topleft"
          left="0"
          name="radio select land"
-         top="-106"
+         top="-1"
          width="134" />
         <radio_item
          height="19"
@@ -823,7 +810,7 @@
              height="10"
              left="10"
              name="Name:"
-             top="5"
+             top="0"
              width="90">
                 Name:
             </text>
@@ -910,34 +897,29 @@
              width="75">
                 Group:
             </text>
-            <name_box
-             follows="left|top"
-             height="18"
-             initial_value="Loading..."
-             layout="topleft"
-             left_pad="23"
-             name="Group Name Proxy"
-             width="142" />
             <button
 			 follows="top|left"
-			 height="23"
-			 image_overlay="Edit_Wrench"
+			 height="10"
+			 image_disabled="Activate_Checkmark"
+			 image_selected="Activate_Checkmark"
+			 image_unselected="Activate_Checkmark"
+			 image_color="White_50"
 			 layout="topleft"
-			 left_pad="3"
+			 left_pad="0"
+			 top_delta="0"
 			 name="button set group"
 			 tab_stop="false"
 			 tool_tip="Choose a group to share this object's permissions"
-			 width="23" />
-            <check_box
-             height="19"
+			 width="10" />
+            <name_box
              follows="left|top"
-             label="Share"
+             height="18"
+             initial_value="Loading..."
              layout="topleft"
-             name="checkbox share with group"
-             tool_tip="Allow all members of the set group to share your modify permissions for this object. You must Deed to enable role restrictions."
-             top_pad="10"
-             left="106"
-             width="87" />
+             left_pad="5"
+             top_delta="-1"
+             name="Group Name Proxy"
+             width="150" />
             <button
              follows="top|left"
              height="23"
@@ -945,16 +927,26 @@
              label_selected="Deed"
              layout="topleft"
              name="button deed"
-             left_pad="3"
+             top_pad="0"
+             left="108"
              tool_tip="Deeding gives this item away with next owner permissions. Group shared objects can be deeded by a group officer."
              width="80" />
+            <check_box
+             height="19"
+             follows="left|top"
+             label="Share"
+             layout="topleft"
+             name="checkbox share with group"
+             tool_tip="Allow all members of the set group to share your modify permissions for this object. You must Deed to enable role restrictions."
+             left_pad="3"
+             width="100" />
             <text
              type="string"
              length="1"
              follows="left|top"
              height="16"
              layout="topleft"
-             top_pad="10"
+             top_pad="15"
              left="10"
              name="label click action"
              width="98">
@@ -1006,7 +998,7 @@
             follows="left|top"
             allow_text_entry="false"
             height="23"
-            initial_value="2"
+            intial_value="2"
             max_chars="20"
             mouse_opaque="true"
             name="sale type"
@@ -2170,6 +2162,8 @@ even though the user gets a free copy.
              width="60" />
             <color_swatch
              can_apply_immediately="true"
+	     bevel_style="none"
+	     border_style="line"
              color="0.5 0.5 0.5 1"
 	     border.border_thickness="0"
              follows="left|top"
@@ -2204,71 +2198,43 @@ even though the user gets a free copy.
              name="Light Intensity"
              top_pad="3"
              width="128" />
-          <spinner bottom_delta="0"
-                   decimal_digits="3"
-                   follows="left|top"
-                   height="16"
-                   increment="0.1"
-                   initial_value="0.5"
-                   label="FOV"
-                   label_width="55"
-                   left="144"
-                   max_val="3"
-                   min_val="0"
-                   mouse_opaque="true"
-                   name="Light FOV"
-                   width="120" />
-          <spinner follows="left|top"
-                   height="19"
-                   initial_value="5"
-                   label="Radius"
-                   label_width="70"
-                   layout="topleft"
-                   left="10"
-                   max_val="20"
-                   name="Light Radius"
-                   top_pad="3"
-                   width="128" />
-          <spinner bottom_delta="0"
-                   decimal_digits="3"
-                   follows="left|top"
-                   height="16"
-                   increment="0.5"
-                   initial_value="0.5"
-                   label="Focus"
-                   label_width="55"
-                   left="144"
-                   max_val="20"
-                   min_val="-20"
-                   mouse_opaque="true"
-                   name="Light Focus"
-                   width="120" />
-          <spinner follows="left|top"
-                   height="19"
-                   increment="0.25"
-                   initial_value="1"
-                   label="Falloff"
-                   label_width="70"
-                   layout="topleft"
-                   left="10"
-                   max_val="2"
-                   name="Light Falloff"
-                   top_pad="3"
-                   width="128" />
-          <spinner bottom_delta="0"
-                   decimal_digits="3"
-                   follows="left|top"
-                   height="16"
-                   increment="0.05"
-                   initial_value="1"
-                   label="Ambiance"
-                   label_width="55"
-                   left="144"
-                   max_val="1"
-                   min_val="0"
-                   mouse_opaque="true"
-                   name="Light Ambiance"
-                   width="120" />
+          <spinner bottom_delta="0" decimal_digits="3" follows="left|top" height="16"
+ increment="0.1" initial_val="0.5" label="FOV" label_width="55"
+ left="144" max_val="3" min_val="0" mouse_opaque="true"
+ name="Light FOV" width="120" />
+          <spinner
+             follows="left|top"
+             height="19"
+             initial_value="5"
+             label="Radius"
+             label_width="70"
+             layout="topleft"
+             left="10"
+             max_val="20"
+             name="Light Radius"
+             top_pad="3"
+             width="128" />
+          <spinner bottom_delta="0" decimal_digits="3" follows="left|top" height="16"
+        increment="0.5" initial_val="0.5" label="Focus" label_width="55"
+        left="144" max_val="20" min_val="-20" mouse_opaque="true"
+        name="Light Focus" width="120" />
+            <spinner
+             follows="left|top"
+             height="19"
+             increment="0.25"
+             initial_value="1"
+             label="Falloff"
+             label_width="70"
+             layout="topleft"
+             left="10"
+             max_val="2"
+             name="Light Falloff"
+             top_pad="3"
+             width="128" />
+          <spinner bottom_delta="0" decimal_digits="3" follows="left|top" height="16"
+           increment="0.05" initial_val="1" label="Ambiance" label_width="55"
+           left="144" max_val="1" min_val="0" mouse_opaque="true"
+           name="Light Ambiance" width="120" />
         </panel>
          <panel
          border="false"
@@ -2293,7 +2259,6 @@ even though the user gets a free copy.
             <texture_picker
              can_apply_immediately="true"
              default_image_name="Default"
-             fallback_image="locked_image.j2c"
              follows="left|top"
              height="80"
              label="Texture"
@@ -2364,7 +2329,7 @@ even though the user gets a free copy.
              height="19"
              label="Full Bright"
              layout="topleft"
-             left_delta="-5"
+             left_delta="0"
              name="checkbox fullbright"
              top_pad="4"
              width="81" />
diff --git a/indra/newview/skins/default/xui/en/inspect_object.xml b/indra/newview/skins/default/xui/en/inspect_object.xml
index 8aeec46ba37080405c37af0b06927319fcd37a19..b8a7222e8e8fcfda5877bb8960937bf25dd488f8 100644
--- a/indra/newview/skins/default/xui/en/inspect_object.xml
+++ b/indra/newview/skins/default/xui/en/inspect_object.xml
@@ -18,8 +18,8 @@
  width="228">
   <string name="Creator">By [CREATOR]</string>
   <string name="CreatorAndOwner">
-By [CREATOR]
-Owner [OWNER]
+by [CREATOR]
+owner [OWNER]
   </string>
   <string name="Price">L$[AMOUNT]</string>
   <string name="PriceFree">Free!</string>
@@ -29,50 +29,61 @@ Owner [OWNER]
      allow_html="false"
      follows="all"
      font="SansSerifLarge"
-     height="30"
+     height="16"
      left="8"
      name="object_name"
      text_color="White"
-     top="6"
+     top="10"
      use_ellipses="true"
-     word_wrap="true"
+     value="Test Object Name That Is Really Long"
      width="220" />
   <text
    follows="all"
-   height="50"
+   height="33"
    left="8"
    name="object_creator"
-   top_pad="6"
+   top_pad="0"
    use_ellipses="true"
    width="220">
     by secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
 owner secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
   </text>
+  <!-- *TODO: Replace this icon -->
+  <icon
+  name="price_icon"
+  image_name="Icon_For_Sale"
+  right="-5"
+  width="16"
+  height="16"
+  top="56"
+  follows="left|top"
+  />
   <text
    follows="all"
    font="SansSerifSmall"
    font.style="BOLD"
-   height="14"
+   height="16"
    halign="right"
-   right="-5"
+   left="5"
    name="price_text"
    text_color="white"
-   top="60"
+   top="58"
    font_shadow="none"
-   width="60">
-L$30,000
+   width="196">
+L$300,000
   </text>
   <text
-   clip_partial="true"
+   clip_partial="true" 
    follows="all"
    font="SansSerifSmall"
-   height="25"
+   height="37"
    left="8"
    name="object_description"
-   top="76"
-   use_ellipses="true"
+   top_pad="0"
+   use_ellipses="true" 
    width="220"
    word_wrap="true">
+This is a really long description for an object being as how it is at least 80 characters in length and maybe more like 120 at this point. Who knows, really?
   </text>
   <!-- Overlapping buttons for all default actions.  Show "Buy" if
   for sale, "Sit" if can sit, etc. -->
@@ -80,9 +91,10 @@ L$30,000
    follows="all"
    font="SansSerifSmall"
    height="13"
+   left_delta="0"
    name="object_media_url"
-   width="220"
-   top_pad="0"
+   bottom_pad="2"
+   width="200"
    max_length = "50"
    use_ellipses="true">
    http://www.superdupertest.com
diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml
index a1ca910cbbb96b7d84d29d5526f675b980dba296..b2e4a7ad95db448774f2199567bf9747660c8140 100644
--- a/indra/newview/skins/default/xui/en/main_view.xml
+++ b/indra/newview/skins/default/xui/en/main_view.xml
@@ -64,7 +64,8 @@
                         left="0"
                         mouse_opaque="false"
                         name="world_stack"
-                        orientation="vertical">
+                        orientation="vertical"
+                        tab_stop="false">
             <panel auto_resize="true"
                    follows="all"
                    height="500"
@@ -73,17 +74,6 @@
                    mouse_opaque="false"
                 name="hud container"
                    width="500">
-            <panel auto_resize="false"
-                   follows="left|top"
-                   height="19"
-                   left="0"
-                   mouse_opaque="false"
-                   name="topinfo_bar_container"
-                   tab_stop="false"
-                   top="0"
-                   user_resize="false"
-                   visible="false"
-                   width="1024"/>
               <panel follows="right|top|bottom"
                      height="500"
                      mouse_opaque="false"
@@ -166,6 +156,13 @@
         top="0"
         width="1024"
         height="768"/>
+  <notify_box_view top="0"
+                   follows="all"
+                   height="768"
+                   mouse_opaque="false"
+                   name="notify_container"
+                   tab_group="-2"
+                   width="1024"/>
   <panel top="0"
         follows="all"
         mouse_opaque="false"
@@ -199,15 +196,7 @@
          mouse_opaque="false"
          name="popup_holder"
          class="popup_holder"
-         width="1024">
-    <icon follows="right|bottom"
-          image_name="Resize_Corner"
-          right="-1"
-          name="resize_corner"
-          width="11"
-          bottom="-1"
-          height="11" />
-  </panel>
+         width="1024"/>
   <menu_holder top="0"
                follows="all"
                height="768"
diff --git a/indra/newview/skins/default/xui/en/menu_edit.xml b/indra/newview/skins/default/xui/en/menu_edit.xml
index fab76c497cff0a6d0ca4614bb83f051780d48074..68f3cb532cadfbf63de5efa181ff57ad54ac50a9 100644
--- a/indra/newview/skins/default/xui/en/menu_edit.xml
+++ b/indra/newview/skins/default/xui/en/menu_edit.xml
@@ -52,7 +52,6 @@
   <menu_item_call
    label="Delete"
    name="Delete"
-   allow_key_repeat="true" 
    shortcut="Del">
     <menu_item_call.on_click
      function="Edit.Delete" />
diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
index 334decdf58eacb988148ab9b3658ccc54f00feae..a5ac5f76e1ff3e7f8bf681693fa851c8f5330c63 100644
--- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
@@ -89,7 +89,7 @@
      function="InspectAvatar.VisibleFreezeEject"/>
   </menu_item_call>
   <menu_item_call
-   label="Debug Textures"
+   label="Debug"
    name="debug">
     <menu_item_call.on_click
      function="Avatar.Debug"/>
diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml
index 9fac296e26cd7aaba7b15a840b30a6b790c80f53..4655fa8c4607895eac9b066c8cfe0945bd76089e 100644
--- a/indra/newview/skins/default/xui/en/menu_login.xml
+++ b/indra/newview/skins/default/xui/en/menu_login.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <menu_bar
- follows="left|top"
+ follows="left|top|right"
  height="18"
  layout="topleft"
  left_delta="0"
@@ -22,7 +22,7 @@
         </menu_item_call>
         <menu_item_separator />
         <menu_item_call
-         label="Exit [APP_NAME]"
+         label="Quit [APP_NAME]"
          name="Quit"
          shortcut="control|Q">
             <menu_item_call.on_click
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 63ff7047b48ff06f807bd49181adbe0acbaf46c5..3af80f63fe28fefc468079fde7fa695a1114703c 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -38,8 +38,8 @@
              parameter="agent" />
         </menu_item_call>
         <menu_item_call
-         label="Change Outfit"
-         name="ChangeOutfit">
+         label="My Appearance"
+         name="Appearance">
             <menu_item_call.on_click
              function="CustomizeAvatar" />
             <menu_item_call.on_enable
@@ -80,17 +80,6 @@
              function="Floater.Toggle"
              parameter="gestures" />
         </menu_item_check>
-        <menu_item_check
-         label="My Voice"
-         name="ShowVoice"
-         visibility_control="VoiceMorphingEnabled">
-            <menu_item_check.on_check
-             function="Floater.Visible"
-             parameter="voice_effect" />
-            <menu_item_check.on_click
-             function="Floater.Toggle"
-             parameter="voice_effect" />
-        </menu_item_check>
         <menu
          label="My Status"
          name="Status"
@@ -101,6 +90,7 @@
                 <menu_item_call.on_click
                  function="World.SetAway" />
             </menu_item_call>
+          <menu_item_separator/>
             <menu_item_call
              label="Busy"
              name="Set Busy">
@@ -126,7 +116,7 @@
         </menu_item_call>
         <menu_item_separator/>
         <menu_item_call
-         label="Exit [APP_NAME]"
+         label="Quit [APP_NAME]"
          name="Quit"
          shortcut="control|Q">
             <menu_item_call.on_click
@@ -532,52 +522,6 @@
                 <menu_item_check.on_enable
                  function="Tools.EnableToolNotPie" />
             </menu_item_check>
-        <menu
-         create_jump_keys="true"
-         label="Select Linked Parts"
-         name="Select Linked Parts"
-         tear_off="true">
-            <menu_item_call
-             label="Select Next Part"
-             name="Select Next Part"
-	     shortcut="control|.">
-                <menu_item_call.on_click
-                 function="Tools.SelectNextPart"
-                 parameter="next" />
-                <menu_item_call.on_enable
-                 function="Tools.EnableSelectNextPart" />
-            </menu_item_call>
-            <menu_item_call
-             label="Select Previous Part"
-             name="Select Previous Part"
-	     shortcut="control|,">
-                <menu_item_call.on_click
-                 function="Tools.SelectNextPart"
-                 parameter="previous" />
-                <menu_item_call.on_enable
-                 function="Tools.EnableSelectNextPart" />
-            </menu_item_call>
-            <menu_item_call
-             label="Include Next Part"
-             name="Include Next Part"
-	     shortcut="control|shift|.">
-                <menu_item_call.on_click
-                 function="Tools.SelectNextPart"
-                 parameter="includenext" />
-                <menu_item_call.on_enable
-                 function="Tools.EnableSelectNextPart" />
-            </menu_item_call>
-            <menu_item_call
-             label="Include Previous Part"
-             name="Include Previous Part"
-	     shortcut="control|shift|,">
-                <menu_item_call.on_click
-                 function="Tools.SelectNextPart"
-                 parameter="includeprevious" />
-                <menu_item_call.on_enable
-                 function="Tools.EnableSelectNextPart" />
-            </menu_item_call>
-        </menu>
         <menu_item_separator/>
         <menu_item_call
            label="Focus on Selection"
@@ -707,6 +651,13 @@
          label="Options"
          name="Options"
          tear_off="true">
+            <menu_item_call
+             label="Set Default Upload Permissions"
+             name="perm prefs">
+                <menu_item_call.on_click
+                 function="Floater.Toggle"
+                 parameter="perm_prefs" />
+            </menu_item_call>
 	   <menu_item_check
 	       label="Show Advanced Permissions"
 	       name="DebugPermissions">
@@ -814,64 +765,48 @@
         </menu>
         <menu
          create_jump_keys="true"
-         label="Upload"
-         layout="topleft"
-         name="Upload"
+         label="Select Linked Parts"
+         name="Select Linked Parts"
          tear_off="true">
             <menu_item_call
-             label="Image (L$[COST])..."
-             layout="topleft"
-             name="Upload Image"
-             shortcut="control|U">
+             label="Select Next Part"
+             name="Select Next Part"
+	     shortcut="control|.">
                 <menu_item_call.on_click
-                 function="File.UploadImage"
-                 parameter="" />
+                 function="Tools.SelectNextPart"
+                 parameter="next" />
                 <menu_item_call.on_enable
-                 function="File.EnableUpload" />
-                <menu_item_call.on_visible
-                 function="Upload.CalculateCosts"
-                 parameter="Upload Image" />
+                 function="Tools.EnableSelectNextPart" />
             </menu_item_call>
             <menu_item_call
-             label="Sound (L$[COST])..."
-             layout="topleft"
-             name="Upload Sound">
+             label="Select Previous Part"
+             name="Select Previous Part"
+	     shortcut="control|,">
                 <menu_item_call.on_click
-                 function="File.UploadSound"
-                 parameter="" />
+                 function="Tools.SelectNextPart"
+                 parameter="previous" />
                 <menu_item_call.on_enable
-                 function="File.EnableUpload" />
-                <menu_item_call.on_visible
-                 function="Upload.CalculateCosts"
-                 parameter="Upload Sound" />
+                 function="Tools.EnableSelectNextPart" />
             </menu_item_call>
             <menu_item_call
-             label="Animation (L$[COST])..."
-             layout="topleft"
-             name="Upload Animation">
+             label="Include Next Part"
+             name="Include Next Part"
+	     shortcut="control|shift|.">
                 <menu_item_call.on_click
-                 function="File.UploadAnim"
-                 parameter="" />
+                 function="Tools.SelectNextPart"
+                 parameter="includenext" />
                 <menu_item_call.on_enable
-                 function="File.EnableUpload" />
-                <menu_item_call.on_visible
-                 function="Upload.CalculateCosts"
-                 parameter="Upload Animation" />
-            </menu_item_call>
-            <menu_item_call
-             label="Bulk (L$[COST] per file)..."
-             layout="topleft"
-             name="Bulk Upload">
-                <menu_item_call.on_click
-                 function="File.UploadBulk"
-                 parameter="" />
+                 function="Tools.EnableSelectNextPart" />
             </menu_item_call>
             <menu_item_call
-             label="Set Default Upload Permissions"
-             name="perm prefs">
+             label="Include Previous Part"
+             name="Include Previous Part"
+	     shortcut="control|shift|,">
                 <menu_item_call.on_click
-                 function="Floater.Toggle"
-                 parameter="perm_prefs" />
+                 function="Tools.SelectNextPart"
+                 parameter="includeprevious" />
+                <menu_item_call.on_enable
+                 function="Tools.EnableSelectNextPart" />
             </menu_item_call>
         </menu>
     </menu>
@@ -925,7 +860,7 @@
         <menu_item_check
          label="Show Advanced Menu"
          name="Show Advanced Menu"
-         shortcut="control|alt|shift|D">
+         shortcut="control|alt|D">
           <on_check
            function="CheckControl"
            parameter="UseDebugMenus" />
@@ -1404,16 +1339,6 @@
              function="ToggleControl"
              parameter="RunMultipleThreads" />
         </menu_item_check>
-        <menu_item_check
-         label="Use Plugin Read Thread"
-         name="Use Plugin Read Thread">
-            <menu_item_check.on_check
-             function="CheckControl"
-             parameter="PluginUseReadThread" />
-            <menu_item_check.on_click
-             function="ToggleControl"
-             parameter="PluginUseReadThread" />
-        </menu_item_check>
         <menu_item_call
          label="Clear Group Cache"
          name="ClearGroupCache">
@@ -1475,18 +1400,6 @@
                 <menu_item_call.on_click
                  function="View.DefaultUISize" />
             </menu_item_call>
-            <!-- This second, alternative shortcut for Show Advanced Menu is for backward compatibility.  The main shortcut has been changed so it's Linux-friendly, where the old shortcut is typically eaten by the window manager. -->
-            <menu_item_check
-               label="Show Advanced Menu - legacy shortcut"
-               name="Show Advanced Menu - legacy shortcut"
-               shortcut="control|alt|D">
-              <on_check
-		 function="CheckControl"
-		 parameter="UseDebugMenus" />
-              <on_click
-		 function="ToggleControl"
-		 parameter="UseDebugMenus" />
-            </menu_item_check>
             <menu_item_separator/>
             <menu_item_check
              label="Always Run"
@@ -1642,6 +1555,15 @@
                 <menu_item_call.on_click
                  function="View.ZoomOut" />
             </menu_item_call>
+            <menu_item_separator/>
+            <menu_item_call
+             label="Toggle Fullscreen"
+             name="Toggle Fullscreen"
+             >
+               <!-- Note: shortcut="alt|Enter" was deleted from the preceding node-->
+                <menu_item_call.on_click
+                 function="View.Fullscreen" />
+            </menu_item_call>
         </menu>
         <menu_item_separator/>
         <menu_item_call
@@ -1662,6 +1584,7 @@
              function="ToggleControl"
              parameter="QAMode" />
         </menu_item_check>
+    
     </menu>
     <menu
      create_jump_keys="true"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 3576462cca57611a3c2f797a97d7d6ed8d53a0ce..e8ba8c683df497d40fa8fe6da605586382c7faf0 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -733,14 +733,6 @@ You need an account to enter [SECOND_LIFE]. Would you like to create one now?
      yestext="Create a new account"/>
   </notification>
 
-  <notification
-   icon="alertmodal.tga"
-   name="InvalidCredentialFormat"
-   type="alertmodal">
-You need to enter both the First and Last name of your avatar into the Username field, then login again.
-  </notification>
-  
-
   <notification
    icon="alertmodal.tga"
    name="AddClassified"
@@ -808,18 +800,7 @@ Insufficient funds to create classified.
    icon="alertmodal.tga"
    name="DeleteAvatarPick"
    type="alertmodal">
-Delete pick &lt;nolink&gt;[PICK]&lt;/nolink&gt;?
-    <usetemplate
-     name="okcancelbuttons"
-     notext="Cancel"
-     yestext="OK"/>
-  </notification>
-
-  <notification
-   icon="alertmodal.tga"
-   name="DeleteOutfits"
-   type="alertmodal">
-    Delete the selected outfit?
+Delete pick [PICK]?
     <usetemplate
      name="okcancelbuttons"
      notext="Cancel"
@@ -1101,9 +1082,7 @@ The region [REGION] does not allow terraforming.
    icon="alertmodal.tga"
    name="CannotCopyWarning"
    type="alertmodal">
-You do not have permission to copy the following items:
-[ITEMS]
-and will lose it from your inventory if you give it away. Do you really want to offer these items?
+You do not have permission to copy this item and will lose it from your inventory if you give it away. Do you really want to offer this item?
     <usetemplate
      name="okcancelbuttons"
      notext="No"
@@ -1220,7 +1199,6 @@ Eject [AVATAR_NAME] from your land?
   <notification
    icon="alertmodal.tga"
    name="EjectAvatarFromGroup"
-   persist="true"
    type="notify">
 You ejected [AVATAR_NAME] from group [GROUP_NAME]
   </notification>
@@ -1404,17 +1382,6 @@ Unknown Vorbis encode failure on: [FILE]
 Unable to encode file: [FILE]
   </notification>
 
-  <notification
-   icon="alertmodal.tga"
-   name="CorruptedProtectedDataStore"
-   type="alertmodal">
-   We can't fill in your username and password.  This may happen when you change network setup
-
-    <usetemplate
-     name="okbutton"
-     yestext="OK"/>
-  </notification>
-    
   <notification
    icon="alertmodal.tga"
    name="CorruptResourceFile"
@@ -2076,52 +2043,6 @@ Would you be my friend?
        name="Cancel"
        text="Cancel"/>
     </form>
-    <unique/>
-  </notification>
-
-  <notification
- icon="alertmodal.tga"
- label="Save Wearable"
- name="SaveWearableAs"
- type="alertmodal">
-    Save item to my inventory as:
-    <form name="form">
-      <input name="message" type="text">
-        [DESC] (new)
-      </input>
-      <button
-       default="true"
-       index="0"
-       name="Offer"
-       text="OK"/>
-      <button
-       index="1"
-       name="Cancel"
-       text="Cancel"/>
-    </form>
-  </notification>
-
-
-  <notification
-   icon="alertmodal.tga"
-   label="Rename Outfit"
-   name="RenameOutfit"
-   type="alertmodal">
-    New outfit name:
-    <form name="form">
-      <input name="new_name" type="text" width="300">
-        [NAME]
-      </input>
-      <button
-       default="true"
-       index="0"
-       name="Offer"
-       text="OK"/>
-      <button
-       index="1"
-       name="Cancel"
-       text="Cancel"/>
-    </form>
   </notification>
 
   <notification
@@ -2201,19 +2122,6 @@ Price to pay for listing must be at least L$[MIN_PRICE].
 Please enter a higher price.
   </notification>
 
-  <notification
-   icon="alertmodal.tga"
-   name="ConfirmItemDeleteHasLinks"
-   type="alertmodal">
-At least one of the items you has link items that point to it.  If you delete this item, its links will permanently stop working.  It is strongly advised to delete the links first.
-
-Are you sure you want to delete these items?
-    <usetemplate
-     name="okcancelbuttons"
-     notext="Cancel"
-     yestext="OK"/>
-  </notification>
-
   <notification
    icon="alertmodal.tga"
    name="ConfirmObjectDeleteLock"
@@ -2509,57 +2417,6 @@ Please choose the male or female avatar. You can change your mind later.
      notext="Female"
      yestext="Male"/>
   </notification>
-  <notification icon="alertmodal.tga"
-		name="CantTeleportToGrid"
-		type="alertmodal">
-Could not teleport to [SLURL] as it's on a different grid ([GRID]) than the current grid ([CURRENT_GRID]).  Please close your viewer and try again.
-    <usetemplate
-     name="okbutton"
-     yestext="OK"/>
-  </notification>
-
-  <notification icon="alertmodal.tga"
-		name="GeneralCertificateError"
-		type="alertmodal">
-Could not connect to the server.
-[REASON]
-
-SubjectName: [SUBJECT_NAME_STRING]
-IssuerName: [ISSUER_NAME_STRING]
-Valid From: [VALID_FROM]
-Valid To: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-SHA1 Fingerprint: [MD5_DIGEST]
-Key Usage: [KEYUSAGE]
-Extended Key Usage: [EXTENDEDKEYUSAGE]
-Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
-    <usetemplate
-     name="okbutton"
-     yestext="OK"/>
-   </notification>
-
-  <notification icon="alertmodal.tga"
-		name="TrustCertificateError"
-		type="alertmodal">
-The certification authority for this server is not known.
-
-Certificate Information:
-SubjectName: [SUBJECT_NAME_STRING]
-IssuerName: [ISSUER_NAME_STRING]
-Valid From: [VALID_FROM]
-Valid To: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-SHA1 Fingerprint: [MD5_DIGEST]
-Key Usage: [KEYUSAGE]
-Extended Key Usage: [EXTENDEDKEYUSAGE]
-Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
-
-Would you like to trust this authority?
-    <usetemplate
-     name="okcancelbuttons"
-     notext="Cancel"
-     yestext="Trust"/>
-  </notification>
 
   <notification
    icon="alertmodal.tga"
@@ -2571,7 +2428,6 @@ Would you like to trust this authority?
   <notification
    icon="alertmodal.tga"
    name="GrantedModifyRights"
-   persist="true"
    type="notify">
 [NAME] has given you permission to edit their objects.
   </notification>
@@ -2579,7 +2435,6 @@ Would you like to trust this authority?
   <notification
    icon="alertmodal.tga"
    name="RevokedModifyRights"
-   persist="true"
    type="notify">
 Your privilege to modify [NAME]&apos;s objects has been revoked
   </notification>
@@ -3509,7 +3364,7 @@ You are not allowed in that region due to your maturity Rating.
    type="alertmodal">
 You are not allowed in that Region due to your maturity Rating preference.
 
-To enter the desired region, please change your maturity Rating preference. This will allow you to search for and access [REGIONMATURITY] content. To undo any changes, go to Me &gt; Preferences &gt; General.
+You can click &apos;Change Preference&apos; to raise your maturity Rating preference now and allow you to enter. You will be able to search and access [REGIONMATURITY] content from now on. If you later want to change this setting back, go to Me &gt; Preferences &gt; General.
 	 <form name="form">
       <button
        index="0"
@@ -3524,13 +3379,6 @@ To enter the desired region, please change your maturity Rating preference. This
     </form>
   </notification>
 
-  <notification
-   icon="notifytip.tga"
-   name="PreferredMaturityChanged"
-   type="notifytip">
-Your maturity Rating preference is now [RATING].
-  </notification>
-
   <notification
    icon="alertmodal.tga"
    name="LandClaimAccessBlocked"
@@ -4494,7 +4342,6 @@ Replaced missing clothing/body part with default.
   <notification
    icon="groupnotify"
    name="GroupNotice"
-   persist="true"
    type="groupnotify">
 Topic: [SUBJECT], Message: [MESSAGE]
   </notification>
@@ -4531,7 +4378,6 @@ Uploading in-world and web site snapshots...
   <notification
    icon="notify.tga"
    name="UploadPayment"
-   persist="true"
    type="notify">
 You paid L$[AMOUNT] to upload.
   </notification>
@@ -4819,7 +4665,6 @@ Please select at least one type of content to search (General, Moderate, or Adul
   <notification
    icon="notify.tga"
    name="SystemMessage"
-   persist="true"
    type="notify">
 [MESSAGE]
   </notification>
@@ -4827,13 +4672,10 @@ Please select at least one type of content to search (General, Moderate, or Adul
   <notification
    icon="notify.tga"
    name="PaymentRecived"
-   persist="true"
    type="notify">
 [MESSAGE]
   </notification>
 
-   <!-- EventNotification couldn't be persist since server decide is it necessary to notify 
-   user about subscribed event via LLEventNotifier-->
   <notification
    icon="notify.tga"
    name="EventNotification"
@@ -4861,7 +4703,6 @@ Event Notification:
   <notification
    icon="notify.tga"
    name="TransferObjectsHighlighted"
-   persist="true"
    type="notify">
 All objects on this parcel that will transfer to the purchaser of this parcel are now highlighted.
 
@@ -4877,7 +4718,6 @@ All objects on this parcel that will transfer to the purchaser of this parcel ar
   <notification
    icon="notify.tga"
    name="DeactivatedGesturesTrigger"
-   persist="true"
    type="notify">
 Deactivated gestures with same trigger:
 [NAMES]
@@ -4886,7 +4726,6 @@ Deactivated gestures with same trigger:
   <notification
    icon="notify.tga"
    name="NoQuickTime"
-   persist="true"
    type="notify">
 Apple&apos;s QuickTime software does not appear to be installed on your system.
 If you want to view streaming media on parcels that support it you should go to the [http://www.apple.com/quicktime QuickTime site] and install the QuickTime Player.
@@ -4894,13 +4733,8 @@ If you want to view streaming media on parcels that support it you should go to
   <notification
    icon="notify.tga"
    name="NoPlugin"
-   persist="true"
    type="notify">
 No Media Plugin was found to handle the "[MIME_TYPE]" mime type.  Media of this type will be unavailable.
-    <unique>
-      <context key="[MIME_TYPE]"/>
-    </unique>
-
   </notification>
   <notification
    icon="alertmodal.tga"
@@ -4918,7 +4752,6 @@ Please re-install the plugin or contact the vendor if you continue to experience
   <notification
    icon="notify.tga"
    name="OwnedObjectsReturned"
-   persist="true"
    type="notify">
 The objects you own on the selected parcel of land have been returned back to your inventory.
   </notification>
@@ -4926,7 +4759,6 @@ The objects you own on the selected parcel of land have been returned back to yo
   <notification
    icon="notify.tga"
    name="OtherObjectsReturned"
-   persist="true"
    type="notify">
 The objects on the selected parcel of land that is owned by [FIRST] [LAST] have been returned to his or her inventory.
   </notification>
@@ -4934,7 +4766,6 @@ The objects on the selected parcel of land that is owned by [FIRST] [LAST] have
   <notification
    icon="notify.tga"
    name="OtherObjectsReturned2"
-   persist="true"
    type="notify">
 The objects on the selected parcel of land owned by the Resident &apos;[NAME]&apos; have been returned to their owner.
   </notification>
@@ -4942,7 +4773,6 @@ The objects on the selected parcel of land owned by the Resident &apos;[NAME]&ap
   <notification
    icon="notify.tga"
    name="GroupObjectsReturned"
-   persist="true"
    type="notify">
 The objects on the selected parcel of land shared with the group [GROUPNAME] have been returned back to their owner&apos;s inventory.
 Transferable deeded objects have been returned to their previous owners.
@@ -4952,7 +4782,6 @@ Non-transferable objects that are deeded to the group have been deleted.
   <notification
    icon="notify.tga"
    name="UnOwnedObjectsReturned"
-   persist="true"
    type="notify">
 The objects on the selected parcel that are NOT owned by you have been returned to their owners.
   </notification>
@@ -4960,7 +4789,6 @@ The objects on the selected parcel that are NOT owned by you have been returned
   <notification
    icon="notify.tga"
    name="ServerObjectMessage"
-   persist="true"
    type="notify">
 Message from [NAME]:
 &lt;nolink&gt;[MSG]&lt;/nolink&gt;
@@ -4969,7 +4797,6 @@ Message from [NAME]:
   <notification
    icon="notify.tga"
    name="NotSafe"
-   persist="true"
    type="notify">
 This land has damage enabled.
 You can be hurt here. If you die, you will be teleported to your home location.
@@ -4979,7 +4806,6 @@ You can be hurt here. If you die, you will be teleported to your home location.
   <notification
    icon="notify.tga"
    name="NoFly"
-   persist="true"
    type="notify">
 This area has flying disabled.
 You can&apos;t fly here.
@@ -4989,7 +4815,6 @@ You can&apos;t fly here.
   <notification
    icon="notify.tga"
    name="PushRestricted"
-   persist="true"
    type="notify">
 This area does not allow pushing. You can&apos;t push others here unless you own the land.
     <unique/>
@@ -4998,7 +4823,6 @@ This area does not allow pushing. You can&apos;t push others here unless you own
   <notification
    icon="notify.tga"
    name="NoVoice"
-   persist="true"
    type="notify">
 This area has voice chat disabled. You won&apos;t be able to hear anyone talking.
     <unique/>
@@ -5007,7 +4831,6 @@ This area has voice chat disabled. You won&apos;t be able to hear anyone talking
   <notification
    icon="notify.tga"
    name="NoBuild"
-   persist="true"
    type="notify">
 This area has building disabled. You can&apos;t build or rez objects here.
     <unique/>
@@ -5016,7 +4839,6 @@ This area has building disabled. You can&apos;t build or rez objects here.
   <notification
    icon="notify.tga"
    name="ScriptsStopped"
-   persist="true"
    type="notify">
 An administrator has temporarily stopped scripts in this region.
   </notification>
@@ -5024,7 +4846,6 @@ An administrator has temporarily stopped scripts in this region.
   <notification
    icon="notify.tga"
    name="ScriptsNotRunning"
-   persist="true"
    type="notify">
 This region is not running any scripts.
   </notification>
@@ -5032,7 +4853,6 @@ This region is not running any scripts.
   <notification
    icon="notify.tga"
    name="NoOutsideScripts"
-   persist="true"
    type="notify">
 This land has outside scripts disabled.
 
@@ -5042,7 +4862,6 @@ No scripts will work here except those belonging to the land owner.
   <notification
    icon="notify.tga"
    name="ClaimPublicLand"
-   persist="true"
    type="notify">
 You can only claim public land in the Region you&apos;re in.
   </notification>
@@ -5050,7 +4869,6 @@ You can only claim public land in the Region you&apos;re in.
   <notification
    icon="notify.tga"
    name="RegionTPAccessBlocked"
-   persist="true"
    type="notify">
 You aren&apos;t allowed in that Region due to your maturity Rating. You may need to validate your age and/or install the latest Viewer.
 
@@ -5060,7 +4878,6 @@ Please go to the Knowledge Base for details on accessing areas with this maturit
   <notification
 	icon="notify.tga"
 	name="URBannedFromRegion"
-   persist="true"
 	type="notify">
 You are banned from the region.
   </notification>
@@ -5068,7 +4885,6 @@ You are banned from the region.
   <notification
 	icon="notify.tga"
 	name="NoTeenGridAccess"
-   persist="true"
 	type="notify">
 Your account cannot connect to this teen grid region.
   </notification>
@@ -5076,7 +4892,6 @@ Your account cannot connect to this teen grid region.
   <notification
 	icon="notify.tga"
 	name="ImproperPaymentStatus"
-   persist="true"
 	type="notify">
 You do not have proper payment status to enter this region.
   </notification>
@@ -5084,7 +4899,6 @@ You do not have proper payment status to enter this region.
   <notification
 	icon="notify.tga"
 	name="MustGetAgeRgion"
-   persist="true"
 	type="notify">
 You must be age-verified to enter this region.
   </notification>
@@ -5092,7 +4906,6 @@ You must be age-verified to enter this region.
   <notification
 	icon="notify.tga"
 	name="MustGetAgeParcel"
-   persist="true"
 	type="notify">
 You must be age-verified to enter this parcel.
   </notification>
@@ -5100,7 +4913,6 @@ You must be age-verified to enter this parcel.
   <notification
 	icon="notify.tga"
 	name="NoDestRegion"
-   persist="true"
 	type="notify">
 No destination region found.
   </notification>
@@ -5108,7 +4920,6 @@ No destination region found.
   <notification
 	icon="notify.tga"
 	name="NotAllowedInDest"
-   persist="true"
 	type="notify">
 You are not allowed into the destination.
   </notification>
@@ -5116,7 +4927,6 @@ You are not allowed into the destination.
   <notification
 	icon="notify.tga"
 	name="RegionParcelBan"
-   persist="true"
 	type="notify">
 Cannot region cross into banned parcel. Try another way.
   </notification>
@@ -5124,7 +4934,6 @@ Cannot region cross into banned parcel. Try another way.
   <notification
 	icon="notify.tga"
 	name="TelehubRedirect"
-   persist="true"
 	type="notify">
 You have been redirected to a telehub.
   </notification>
@@ -5132,7 +4941,6 @@ You have been redirected to a telehub.
   <notification
 	icon="notify.tga"
 	name="CouldntTPCloser"
-   persist="true"
 	type="notify">
 Could not teleport closer to destination.
   </notification>
@@ -5140,7 +4948,6 @@ Could not teleport closer to destination.
   <notification
 	icon="notify.tga"
 	name="TPCancelled"
-   persist="true"
 	type="notify">
 Teleport cancelled.
   </notification>
@@ -5148,7 +4955,6 @@ Teleport cancelled.
   <notification
 	icon="notify.tga"
 	name="FullRegionTryAgain"
-   persist="true"
 	type="notify">
 The region you are attempting to enter is currently full.
 Please try again in a few moments.
@@ -5157,7 +4963,6 @@ Please try again in a few moments.
   <notification
 	icon="notify.tga"
 	name="GeneralFailure"
-   persist="true"
 	type="notify">
 General failure.
   </notification>
@@ -5165,7 +4970,6 @@ General failure.
   <notification
 	icon="notify.tga"
 	name="RoutedWrongRegion"
-   persist="true"
 	type="notify">
 Routed to wrong region. Please try again.
   </notification>
@@ -5173,7 +4977,6 @@ Routed to wrong region. Please try again.
   <notification
 	icon="notify.tga"
 	name="NoValidAgentID"
-   persist="true"
 	type="notify">
 No valid agent id.
   </notification>
@@ -5181,7 +4984,6 @@ No valid agent id.
   <notification
 	icon="notify.tga"
 	name="NoValidSession"
-   persist="true"
 	type="notify">
 No valid session id.
   </notification>
@@ -5189,7 +4991,6 @@ No valid session id.
   <notification
 	icon="notify.tga"
 	name="NoValidCircuit"
-   persist="true"
 	type="notify">
 No valid circuit code.
   </notification>
@@ -5197,7 +4998,6 @@ No valid circuit code.
   <notification
 	icon="notify.tga"
 	name="NoValidTimestamp"
-   persist="true"
 	type="notify">
 No valid timestamp.
   </notification>
@@ -5205,7 +5005,6 @@ No valid timestamp.
   <notification
 	icon="notify.tga"
 	name="NoPendingConnection"
-   persist="true"
 	type="notify">
 Unable to create pending connection.
   </notification>
@@ -5213,7 +5012,6 @@ Unable to create pending connection.
   <notification
 	icon="notify.tga"
 	name="InternalUsherError"
-   persist="true"
 	type="notify">
 Internal error attempting to connect agent usher.
   </notification>
@@ -5221,7 +5019,6 @@ Internal error attempting to connect agent usher.
   <notification
 	icon="notify.tga"
 	name="NoGoodTPDestination"
-   persist="true"
 	type="notify">
 Unable to find a good teleport destination in this region.
   </notification>
@@ -5229,7 +5026,6 @@ Unable to find a good teleport destination in this region.
   <notification
 	icon="notify.tga"
 	name="InternalErrorRegionResolver"
-   persist="true"
 	type="notify">
 Internal error attempting to activate region resolver.
   </notification>
@@ -5237,7 +5033,6 @@ Internal error attempting to activate region resolver.
   <notification
 	icon="notify.tga"
 	name="NoValidLanding"
-   persist="true"
 	type="notify">
 A valid landing point could not be found.
   </notification>
@@ -5245,7 +5040,6 @@ A valid landing point could not be found.
   <notification
 	icon="notify.tga"
 	name="NoValidParcel"
-   persist="true"
 	type="notify">
 No valid parcel could be found.
   </notification>
@@ -5272,6 +5066,28 @@ An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you this [OBJEC
     </form>
   </notification>
 
+  <notification
+   icon="notify.tga"
+   name="ObjectGiveItemUnknownUser"
+   type="offer">
+An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you this [OBJECTTYPE]:
+[ITEM_SLURL]
+    <form name="form">
+      <button
+       index="0"
+       name="Keep"
+       text="Keep"/>
+      <button
+       index="1"
+       name="Discard"
+       text="Discard"/>
+      <button
+       index="2"
+       name="Mute"
+       text="Block"/>
+    </form>
+  </notification>
+
   <notification
    icon="notify.tga"
    name="UserGiveItem"
@@ -5297,7 +5113,6 @@ An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you this [OBJEC
   <notification
    icon="notify.tga"
    name="GodMessage"
-   persist="true"
    type="notify">
 [NAME]
 
@@ -5307,7 +5122,6 @@ An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you this [OBJEC
   <notification
    icon="notify.tga"
    name="JoinGroup"
-   persist="true"
    type="notify">
 [MESSAGE]
     <form name="form">
@@ -5332,7 +5146,7 @@ An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you this [OBJEC
    type="offer">
 [NAME_SLURL] has offered to teleport you to their location:
 
-[MESSAGE] - [MATURITY_STR] &lt;icon&gt;[MATURITY_ICON]&lt;/icon&gt;
+[MESSAGE]
     <form name="form">
       <button
        index="0"
@@ -5356,7 +5170,6 @@ An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you this [OBJEC
   <notification
    icon="notify.tga"
    name="GotoURL"
-   persist="true"
    type="notify">
 [MESSAGE]
 [URL]
@@ -5403,7 +5216,6 @@ An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you this [OBJEC
   <notification
    icon="notify.tga"
    name="OfferFriendshipNoMessage"
-   persist="true"
    type="notify">
 [NAME] is offering friendship.
 
@@ -5430,7 +5242,6 @@ An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you this [OBJEC
   <notification
    icon="notify.tga"
    name="FriendshipDeclined"
-   persist="true"
    type="notify">
 [NAME] declined your friendship offer.
   </notification>
@@ -5452,7 +5263,6 @@ Friendship offer declined.
   <notification
    icon="notify.tga"
    name="OfferCallingCard"
-   persist="true"
    type="notify">
 [FIRST] [LAST] is offering their calling card.
 This will add a bookmark in your inventory so you can quickly IM this Resident.
@@ -5473,7 +5283,6 @@ This will add a bookmark in your inventory so you can quickly IM this Resident.
    name="RegionRestartMinutes"
    priority="high"
    sound="UISndAlert"
-   persist="true"
    type="notify">
 This region will restart in [MINUTES] minutes.
 If you stay in this region you will be logged out.
@@ -5484,7 +5293,6 @@ If you stay in this region you will be logged out.
    name="RegionRestartSeconds"
    priority="high"
    sound="UISndAlert"
-   persist="true"
    type="notify">
 This region will restart in [SECONDS] seconds.
 If you stay in this region you will be logged out.
@@ -5514,7 +5322,6 @@ From object: [OBJECTNAME], owner: [NAME]?
   <notification
    icon="notify.tga"
    name="FailedToFindWearableUnnamed"
-   persist="true"
    type="notify">
 Failed to find [TYPE] in database.
   </notification>
@@ -5522,15 +5329,20 @@ Failed to find [TYPE] in database.
   <notification
    icon="notify.tga"
    name="FailedToFindWearable"
-   persist="true"
    type="notify">
 Failed to find [TYPE] named [DESC] in database.
   </notification>
 
+  <notification
+   icon="notify.tga"
+   name="ShareToWebFailed"
+   type="notify">
+    Failed to upload image to web.
+  </notification>
+  
   <notification
    icon="notify.tga"
    name="InvalidWearable"
-   persist="true"
    type="notify">
 The item you are trying to wear uses a feature that your Viewer can&apos;t read. Please upgrade your version of [APP_NAME] to wear this item.
   </notification>
@@ -5538,7 +5350,6 @@ The item you are trying to wear uses a feature that your Viewer can&apos;t read.
   <notification
    icon="notify.tga"
    name="ScriptQuestion"
-   persist="true"
    type="notify">
 &apos;[OBJECTNAME]&apos;, an object owned by &apos;[NAME]&apos;, would like to:
 
@@ -5564,7 +5375,6 @@ Is this OK?
    icon="notify.tga"
    name="ScriptQuestionCaution"
    priority="high"
-   persist="true"
    type="notify">
 An object named &apos;[OBJECTNAME]&apos;, owned by &apos;[NAME]&apos; would like to:
 
@@ -5621,7 +5431,6 @@ Grant this request?
   <notification
    icon="notify.tga"
    name="FirstBalanceIncrease"
-   persist="true"
    type="notify">
 You just received L$[AMOUNT].
 Your L$ balance is shown in the upper-right.
@@ -5630,7 +5439,6 @@ Your L$ balance is shown in the upper-right.
   <notification
    icon="notify.tga"
    name="FirstBalanceDecrease"
-   persist="true"
    type="notify">
 You just paid L$[AMOUNT].
 Your L$ balance is shown in the upper-right.
@@ -5640,7 +5448,6 @@ Your L$ balance is shown in the upper-right.
   <notification
    icon="notify.tga"
    name="BuyLindenDollarSuccess"
-   persist="true"
    type="notify">
 Thank you for your payment!
 
@@ -5653,7 +5460,6 @@ The status of your payment can be checked on your Transaction History page on yo
   <notification
    icon="notify.tga"
    name="FirstSit"
-   persist="true"
    type="notify">
 You are sitting.
 Use your arrow keys (or AWSD) to look around.
@@ -5663,7 +5469,6 @@ Click the &apos;Stand Up&apos; button to stand.
   <notification
    icon="notify.tga"
    name="FirstMap"
-   persist="true"
    type="notify">
 Click and drag the map to look around.
 Double-click to teleport.
@@ -5673,7 +5478,6 @@ Use the controls on the right to find things and display different backgrounds.
   <notification
    icon="notify.tga"
    name="FirstBuild"
-   persist="true"
    type="notify">
 You have opened the Build Tools. Every object you see around you was created using these tools.
   </notification>
@@ -5683,7 +5487,6 @@ You have opened the Build Tools. Every object you see around you was created usi
   <notification
    icon="notify.tga"
    name="FirstLeftClickNoHit"
-   persist="true"
    type="notify">
     Left-clicking interacts with special objects.
     If the mouse pointer changes to a hand, you can interact with the object.
@@ -5693,7 +5496,6 @@ You have opened the Build Tools. Every object you see around you was created usi
   <notification
    icon="notify.tga"
    name="FirstTeleport"
-   persist="true"
    type="notify">
 You can only teleport to certain areas in this region. The arrow points to your specific destination. Click the arrow to dismiss it.
   </notification>
@@ -5703,7 +5505,6 @@ You can only teleport to certain areas in this region. The arrow points to your
   <notification
    icon="notify.tga"
    name="FirstOverrideKeys"
-   persist="true"
    type="notify">
 Your movement keys are now being handled by an object.
 Try the arrow keys or AWSD to see what they do.
@@ -5715,7 +5516,6 @@ Press &apos;M&apos; to do this.
   <notification
    icon="notify.tga"
    name="FirstAppearance"
-   persist="true"
    type="notify">
 You are editing your Appearance.
 Use the arrow keys to look around.
@@ -5725,7 +5525,6 @@ When you are done, press &apos;Save All&apos;.
   <notification
    icon="notify.tga"
    name="FirstInventory"
-   persist="true"
    type="notify">
 This is your Inventory, which contains items you own.
 
@@ -5738,7 +5537,6 @@ This is your Inventory, which contains items you own.
   <notification
    icon="notify.tga"
    name="FirstSandbox"
-   persist="true"
    type="notify">
 This is a sandbox area, and is meant to help Residents learn how to build.
 
@@ -5749,7 +5547,6 @@ Things you build here will be deleted after you leave, so don&apos;t forget to r
   <notification
    icon="notify.tga"
    name="FirstFlexible"
-   persist="true"
    type="notify">
 This object is flexible. Flexis must be phantom and not physical.
   </notification>
@@ -5757,7 +5554,6 @@ This object is flexible. Flexis must be phantom and not physical.
   <notification
    icon="notify.tga"
    name="FirstDebugMenus"
-   persist="true"
    type="notify">
 You opened the Advanced menu.
 
@@ -5770,7 +5566,6 @@ To toggle this menu,
   <notification
    icon="notify.tga"
    name="FirstSculptedPrim"
-   persist="true"
    type="notify">
 You are editing a Sculpted prim. Sculpties require a special texture to define their shape.
   </notification>
@@ -5780,7 +5575,6 @@ You are editing a Sculpted prim. Sculpties require a special texture to define t
   <notification
    icon="notify.tga"
    name="FirstMedia"
-   persist="true"
    type="notify">
     You have begun playing media.  Media can set to play automatically in the preferences window under Audio / Video. Note that this can be a security risk for media sites you do not trust.
   </notification>
@@ -5821,7 +5615,6 @@ Click Accept to join the call or Decline to decline the invitation. Click Block
   <notification
    icon="notify.tga"
    name="AutoUnmuteByIM"
-   persist="true"
    type="notify">
 [FIRST] [LAST] was sent an instant message and has been automatically unblocked.
   </notification>
@@ -5829,7 +5622,6 @@ Click Accept to join the call or Decline to decline the invitation. Click Block
   <notification
    icon="notify.tga"
    name="AutoUnmuteByMoney"
-   persist="true"
    type="notify">
 [FIRST] [LAST] was given money and has been automatically unblocked.
   </notification>
@@ -5837,7 +5629,6 @@ Click Accept to join the call or Decline to decline the invitation. Click Block
   <notification
    icon="notify.tga"
    name="AutoUnmuteByInventory"
-   persist="true"
    type="notify">
 [FIRST] [LAST] was offered inventory and has been automatically unblocked.
   </notification>
@@ -5995,50 +5786,6 @@ We are creating a voice channel for you. This may take up to one minute.
     <unique/>
   </notification>
 
-  <notification
-   icon="notify.tga"
-   name="VoiceEffectsExpired"
-   sound="UISndAlert"
-   persist="true"
-   type="notify">
-One or more of your subscribed Voice Morphs has expired.
-[[URL] Click here] to renew your subscription.
-    <unique/>
-  </notification>
-
-  <notification
-   icon="notify.tga"
-   name="VoiceEffectsExpiredInUse"
-   sound="UISndAlert"
-   persist="true"
-   type="notify">
-The active Voice Morph has expired, your normal voice settings have been applied.
-[[URL] Click here] to renew your subscription.
-    <unique/>
-  </notification>
-
-  <notification
-   icon="notify.tga"
-   name="VoiceEffectsWillExpire"
-   sound="UISndAlert"
-   persist="true"
-   type="notify">
-One or more of your Voice Morphs will expire in less than [INTERVAL] days.
-[[URL] Click here] to renew your subscription.
-    <unique/>
-  </notification>
-		LLNotificationsUtil::add("VoiceEffectsNew");
-
-  <notification
-   icon="notify.tga"
-   name="VoiceEffectsNew"
-   sound="UISndAlert"
-   persist="true"
-   type="notify">
-New Voice Morphs are available!
-    <unique/>
-  </notification>
-
   <notification
    icon="notifytip.tga"
    name="Cannot enter parcel: not a group member"
@@ -6195,194 +5942,6 @@ Selected button can not be shown right now.
 The button will be shown when there is enough space for it.
   </notification>
 
-  <notification
-   icon="notifytip.tga"
-   name="ShareNotification"
-   type="notifytip">
-Select residents to share with.
-  </notification>
-  <notification
-   icon="notifytip.tga"
-   name="ShareItemsConfirmation"
-   type="alertmodal">
-Are you sure you want to share the following items:
-
-[ITEMS]
-
-With the following Residents:
-
-[RESIDENTS]
-	<usetemplate
-     name="okcancelbuttons"
-     notext="Cancel"
-     yestext="Ok"/>
-  </notification>
-  <notification
-   icon="notifytip.tga"
-   name="ItemsShared"
-   type="notifytip">
-Items successfully shared.
-  </notification>
-  <notification
-   icon="notifytip.tga"
-   name="DeedToGroupFail"
-   type="notifytip">
-Deed to group failed.
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-Avatar '[NAME]' declouded after [TIME] seconds.
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezSelfBakedDoneNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-You finished baking your outfit after [TIME] seconds.
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezSelfBakedUpdateNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-You sent out an update of your appearance after [TIME] seconds.
-[STATUS]
-  </notification>
-
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezCloudNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-Avatar '[NAME]' became cloud.
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezArrivedNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-Avatar '[NAME]' appeared.
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezLeftCloudNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-Avatar '[NAME]' left after [TIME] seconds as cloud.
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezEnteredAppearanceNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-Avatar '[NAME]' entered appearance mode.
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezLeftAppearanceNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-Avatar '[NAME]' left appearance mode.
-  </notification>
-
-  <notification
-   icon="alertmodal.tga"
-   name="NoConnect"
-   type="alertmodal">
-We're having trouble connecting using [PROTOCOL] [HOSTID].
-Please check your network and firewall setup.
-    <form name="form">
-      <button
-       default="true"
-       index="0"
-       name="OK"
-       text="OK"/>
-    </form>
-  </notification>
-
-  <notification
-   icon="alertmodal.tga"
-   name="NoVoiceConnect"
-   type="alertmodal">
-We're having trouble connecting to your voice server:
-
-[HOSTID]
-
-Voice communications will not be available.
-Please check your network and firewall setup.
-    <form name="form">
-      <button
-       default="true"
-       index="0"
-       name="OK"
-       text="OK"/>
-    </form>
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezLeftNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-Avatar '[NAME]' left as fully loaded.
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezSelfBakedTextureUploadNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-You uploaded a [RESOLUTION] baked texture for '[BODYREGION]' after [TIME] seconds.
-  </notification>
-
-  <notification
-   icon="notifytip.tga"
-   name="AvatarRezSelfBakedTextureUpdateNotification"
-   type="notifytip">
-( [EXISTENCE] seconds alive )
-You locally updated a [RESOLUTION] baked texture for '[BODYREGION]' after [TIME] seconds.
-  </notification>
-
-  <notification
-   icon="alertmodal.tga"
-   name="ConfirmLeaveCall"
-   type="alert">
-Are you sure you want to leave this call?
-    <usetemplate
-     ignoretext="Confirm before I leave call"
-     name="okcancelignore"
-     notext="No"
-     yestext="Yes"/>
-    <unique/>
-  </notification>
-
-  <notification
-   icon="alertmodal.tga"
-   name="ConfirmMuteAll"
-   type="alert">
-You have selected to mute all participants in a group call.
-This will also cause all residents that later join the call to be
-muted, even after you have left the call.
-
-Mute everyone?
-    <usetemplate
-     ignoretext="Confirm before I mute all participants in a group call"
-     name="okcancelignore"
-     yestext="Ok"
-     notext="Cancel"/>
-    <unique/>
-  </notification>
 
   <global name="UnsupportedCPU">
 - Your CPU speed does not meet the minimum requirements.
@@ -6410,14 +5969,11 @@ If you continue to have problems, please visit the [SUPPORT_SITE].
 - Your system memory does not meet the minimum requirements.
   </global>
 
-<!-- these are alert strings from server. the name needs to match entire the server string, and needs to be changed
+<!-- this is alert string from server. the name needs to match entire the server string, and needs to be changed
 	whenever the server string changes -->
    <global name="You can only set your 'Home Location' on your land or at a mainland Infohub.">
 If you own a piece of land, you can make it your home location.
 Otherwise, you can look at the Map and find places marked &quot;Infohub&quot;.
   </global>
-  <global name="You died and have been teleported to your home location">
-You died and have been teleported to your home location.
-  </global>
 
 </notifications>
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index 4b622691b383fc34a9dc565c0b6366de2c4200f8..c34a367c32fad52c0268f88ab303d7c174492046 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -1,401 +1,320 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
+ mouse_opaque="true"
  background_visible="true"
  bg_alpha_color="DkGray"
  bg_opaque_color="DkGray"
- chrome="true"
  follows="left|bottom|right"
  height="33"
  layout="topleft"
  left="0"
  name="bottom_tray"
  top="28"
- width="1310">
-    <string
-     name="SpeakBtnToolTip"
-     value="Turns microphone on/off" />
-    <string
-     name="VoiceControlBtnToolTip"
-     value="Shows/hides voice control panel" />
+ chrome="true"
+ border_visible="false"
+ width="1000">
+  <string name="SpeakBtnToolTip">Turns microphone on/off</string>
+  <string name="VoiceControlBtnToolTip">Shows/hides voice control panel</string>
     <layout_stack
+     mouse_opaque="false"
      border_size="0"
      clip="false"
      follows="all"
      height="28"
      layout="topleft"
      left="0"
-     mouse_opaque="false"
      name="toolbar_stack"
      orientation="horizontal"
      top="0"
-     width="1310">
+     width="1000">
         <icon
          auto_resize="false"
          follows="left|right"
          height="10"
          image_name="spacer24.tga"
          layout="topleft"
-         left="0"
          min_width="2"
+         left="0"
          top="0"
          width="2" />
         <layout_panel
+ 	mouse_opaque="false"
          auto_resize="false"
-         filename="panel_nearby_chat_bar.xml"
          follows="left|right"
          height="28"
          layout="topleft"
          left="0"
-         max_width="320"
          min_height="23"
-         min_width="214"
-         mouse_opaque="false"
-         name="chat_bar"
+         width="310"
          top="4"
-         user_resize="true"
-         width="308" />
-        <!--
-        There is resize bar between chatbar and Speak button. It has 2px width (is is set as 2*UIResizeBarOverlap)
-        -->
+         max_width="320"
+         min_width="216"
+         name="chat_bar"
+         user_resize="false"
+         filename="panel_nearby_chat_bar.xml" />
         <layout_panel
+         mouse_opaque="false"
          auto_resize="false"
          follows="right"
          height="28"
          layout="topleft"
          min_height="28"
-         min_width="59"
-         mouse_opaque="false"
-         name="speak_panel"
+         width="105"
          top_delta="0"
-         user_resize="true"
-         width="110">
-            <talk_button
-             follows="left|right"
-             height="23"
-             layout="topleft"
-             left="2"
-             name="talk"
-             top="5"
-             width="105">
-                <show_button
-                 tab_stop="true">
-                    <init_callback
-                     function="Button.SetDockableFloaterToggle"
-                     parameter="voice_controls" />
-                </show_button>
-                <!-- do not remove halign attribute with default value. otherwise it can't be overridden in other locales.
-                 & pad_right is default value for long label which can be right aligned. See EXT-6318 -->
-                <speak_button
-                 halign="center"
-                 label="Speak"
-                 label_selected="Speak"
-                 name="speak_btn"
-                 pad_right="20"
-                 tab_stop="true"
-                 use_ellipses="true" />
-            </talk_button>
+         min_width="54"
+         name="speak_panel"
+         user_resize="false">
+          <talk_button
+           follows="left|right"
+           height="23"
+           speak_button.tab_stop="true"
+           show_button.tab_stop="true"
+           layout="topleft"
+           left="0"
+           name="talk"
+           top="5"
+          width="105">
+            <!-- do not remove halign attribute with default value. otherwise it can't be overridden in other locales.
+             & pad_right is default value for long label which can be right aligned. See EXT-6318 -->
+  <speak_button
+    halign="center"
+    name="speak_btn"
+    label="Speak"
+    label_selected="Speak"
+    pad_right="22"
+    use_ellipses="true"
+    />
+              <show_button>
+                  <show_button.init_callback
+                   function="Button.SetDockableFloaterToggle"
+                   parameter="voice_controls" />
+              </show_button>
+          </talk_button>
         </layout_panel>
+        <icon
+            auto_resize="false"
+            follows="left|right"
+            height="10"
+            image_name="spacer24.tga"
+            layout="topleft"
+            left="0"
+            name="after_speak_panel"
+            min_width="3"
+            top="0"
+            width="3"/>
         <layout_panel
+         mouse_opaque="false"
          auto_resize="false"
          follows="right"
          height="28"
          layout="topleft"
          min_height="28"
-         min_width="65"
-         mouse_opaque="false"
-         name="gesture_panel"
+         width="82"
          top_delta="0"
-         user_resize="false"
-         width="85">
-            <gesture_combo_list
-             follows="left|right"
-             height="23"
-             label="Gesture"
-             layout="topleft"
-             left="0"
-             name="Gesture"
-             tool_tip="Shows/hides gestures"
-             top="5"
-             width="82">
-                <combo_button
-                 pad_right="10"
-                 use_ellipses="true" />
-                <combo_list
-                 page_lines="17" />
-            </gesture_combo_list>
+         min_width="62"
+         name="gesture_panel"
+         user_resize="false">
+         <gesture_combo_list
+          follows="left|right"
+          height="23"
+          label="Gesture"
+          layout="topleft"
+          name="Gesture"
+          left="0"
+          top="5"
+          width="82"
+          tool_tip="Shows/hides gestures">
+             <gesture_combo_list.combo_button
+              pad_right="10"
+              use_ellipses="true" />
+         </gesture_combo_list>
         </layout_panel>
+		 <icon
+         auto_resize="false"
+         color="0 0 0 0"
+         follows="left|right"
+         height="10"
+         image_name="spacer24.tga"
+         layout="topleft"
+         left="0"
+         min_width="3"
+         name="after_gesture_panel"
+         top="0"
+         width="3"/>
         <layout_panel
+         mouse_opaque="false"
          auto_resize="false"
          follows="right"
          height="28"
          layout="topleft"
          min_height="28"
-         min_width="52"
-         mouse_opaque="false"
          name="movement_panel"
          user_resize="false"
-         width="83">
+         width="80"
+         min_width="49">
             <button
+                 image_selected="PushButton_Selected_Press"
+                 image_pressed="PushButton_Press"
+		 image_pressed_selected="PushButton_Selected_Press"
              follows="left|right"
              height="23"
-             image_pressed="PushButton_Press"
-             image_pressed_selected="PushButton_Selected_Press"
-             image_selected="PushButton_Selected_Press"
+             use_ellipses="true"
              is_toggle="true"
              label="Move"
              layout="topleft"
              name="movement_btn"
              tool_tip="Shows/hides movement controls"
              top="5"
-             use_ellipses="true"
              width="80">
-                <init_callback
+                <button.init_callback
                  function="Button.SetDockableFloaterToggle"
                  parameter="moveview" />
             </button>
         </layout_panel>
+         <icon
+         auto_resize="false"
+         color="0 0 0 0"
+         follows="left|right"
+         height="10"
+         image_name="spacer24.tga"
+         layout="topleft"
+         left="0"
+         min_width="3"
+         name="after_movement_panel"
+         top="0"
+         width="3"/>
         <layout_panel
+         mouse_opaque="false"
          auto_resize="false"
          follows="left|right"
          height="28"
          layout="topleft"
          min_height="28"
-         min_width="52"
-         mouse_opaque="false"
+         min_width="49"
          name="cam_panel"
          user_resize="false"
-         width="83">
+         width="80">
             <button
+                 image_selected="PushButton_Selected_Press"
+                 image_pressed="PushButton_Press"
+		 image_pressed_selected="PushButton_Selected_Press"
              follows="left|right"
              height="23"
-             image_pressed="PushButton_Press"
-             image_pressed_selected="PushButton_Selected_Press"
-             image_selected="PushButton_Selected_Press"
+             use_ellipses="true"
              is_toggle="true"
              label="View"
              layout="topleft"
              left="0"
-             name="camera_btn"
              tool_tip="Shows/hides camera controls"
              top="5"
-             use_ellipses="true"
+             name="camera_btn"
              width="80">
-                <init_callback
+                <button.init_callback
                  function="Button.SetDockableFloaterToggle"
                  parameter="camera" />
             </button>
         </layout_panel>
-        <layout_panel
+        <icon
          auto_resize="false"
+         color="0 0 0 0"
          follows="left|right"
-         height="28"
+         height="10"
+         image_name="spacer24.tga"
          layout="topleft"
-         min_width="40"
-         mouse_opaque="false"
-         name="snapshot_panel"
-         user_resize="false"
-         width="39">
-            <button
-             follows="left|right"
-             height="23"
-             image_overlay="Snapshot_Off"
-             image_pressed="PushButton_Press"
-             image_pressed_selected="PushButton_Selected_Press"
-             image_selected="PushButton_Selected_Press"
-             is_toggle="true"
-             layout="topleft"
-             left="0"
-             name="snapshots"
-             tool_tip="Take snapshot"
-             top="5"
-             width="36">
-                <init_callback
-                 function="Button.SetFloaterToggle"
-                 parameter="snapshot" />
-            </button>
-        </layout_panel>
+         left="0"
+         min_width="3"
+         name="after_cam_panel"
+         top="0"
+         width="3"/>
         <layout_panel
-         auto_resize="false"
-         follows="left|right"
-         height="28"
-         layout="topleft"
-         min_height="28"
-         min_width="52"
          mouse_opaque="false"
-         name="build_btn_panel"
-         user_resize="false"
-         width="83">
-<!--*FIX: Build Floater is not opened with default registration. Will be fixed soon.
-Disabled for now.
--->
-            <button
-             follows="left|right"
-             height="23"
-             image_pressed="PushButton_Press"
-             image_pressed_selected="PushButton_Selected_Press"
-             image_selected="PushButton_Selected_Press"
-             is_toggle="true"
-             label="Build"
-             layout="topleft"
-             left="0"
-             name="build_btn"
-             tool_tip="Shows/hides Build Tools"
-             top="5"
-             use_ellipses="true"
-             width="80">
-                <commit_callback
-                 function="Build.Toggle"
-                 parameter="build" />
-            </button>
-        </layout_panel>
-        <layout_panel
          auto_resize="false"
          follows="left|right"
          height="28"
          layout="topleft"
-         min_height="28"
-         min_width="52"
-         mouse_opaque="false"
-         name="search_btn_panel"
-         user_resize="false"
-         width="83">
+         min_width="40"
+         name="snapshot_panel"
+         width="40">
             <button
-             follows="left|right"
+			 follows="left|right"
              height="23"
-             image_pressed="PushButton_Press"
-             image_pressed_selected="PushButton_Selected_Press"
              image_selected="PushButton_Selected_Press"
-             is_toggle="true"
-             label="Search"
-             layout="topleft"
-             left="0"
-             name="search_btn"
-             tool_tip="Shows/hides Search"
-             top="5"
-             use_ellipses="true"
-             width="80">
-                <init_callback
-                 function="Button.SetFloaterToggle"
-                 parameter="search" />
-            </button>
-        </layout_panel>
-        <layout_panel
-         auto_resize="false"
-         follows="left|right"
-         height="28"
-         layout="topleft"
-         min_height="28"
-         min_width="52"
-         mouse_opaque="false"
-         name="world_map_btn_panel"
-         user_resize="false"
-         width="83">
-            <button
-             follows="left|right"
-             height="23"
              image_pressed="PushButton_Press"
              image_pressed_selected="PushButton_Selected_Press"
-             image_selected="PushButton_Selected_Press"
-             is_toggle="true"
-             label="Map"
-             layout="topleft"
              left="0"
-             name="world_map_btn"
-             tool_tip="Shows/hides World Map"
-             top="5"
-             use_ellipses="true"
-             width="80">
-                <init_callback
-                 function="Button.SetFloaterToggle"
-                 parameter="world_map" />
-            </button>
-        </layout_panel>
-        <layout_panel
-         auto_resize="false"
-         follows="left|right"
-         height="28"
-         layout="topleft"
-         min_height="28"
-         min_width="52"
-         mouse_opaque="false"
-         name="mini_map_btn_panel"
-         user_resize="false"
-         width="83">
-            <button
-             follows="left|right"
-             height="23"
-             image_pressed="PushButton_Press"
-             image_pressed_selected="PushButton_Selected_Press"
-             image_selected="PushButton_Selected_Press"
-             is_toggle="true"
-             label="Mini-Map"
+             label=""
              layout="topleft"
-             left="0"
-             name="mini_map_btn"
-             tool_tip="Shows/hides Mini-Map"
+             name="snapshots"
+             width="36"
              top="5"
-             use_ellipses="true"
-             width="80">
-                <init_callback
-                 function="Button.SetFloaterToggle"
-                 parameter="mini_map" />
-            </button>
-        </layout_panel>
+             is_toggle="true"
+             image_overlay="Snapshot_Off"
+             tool_tip="Take snapshot">
+				<button.init_callback
+				 function="Button.SetFloaterToggle"
+				 parameter="snapshot" />
+			</button>
+		</layout_panel>
         <layout_panel
+         mouse_opaque="false"
          follows="left|right"
          height="30"
          layout="topleft"
-         min_width="95"
-         mouse_opaque="false"
-         name="chiclet_list_panel"
          top="0"
+         name="chiclet_list_panel"
+         width="189"
+         min_width="95"
          user_resize="false"
-         width="189">
+         auto_resize="true">
 <!--*NOTE: min_width of the chiclet_panel (chiclet_list) must be the same
 as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. EXT-991-->
             <chiclet_panel
-             chiclet_padding="4"
+	    mouse_opaque="false"
              follows="left|right"
              height="24"
              layout="topleft"
              left="1"
              min_width="95"
-             mouse_opaque="false"
              name="chiclet_list"
              top="7"
+             chiclet_padding="4"
+             scrolling_offset="40"
              width="189">
                 <button
                  auto_resize="true"
                  follows="right"
                  height="29"
-                 image_hover_selected="SegmentedBtn_Left_Over"
-                 image_hover_unselected="SegmentedBtn_Left_Over"
-                 image_overlay="Arrow_Small_Left"
-                 image_pressed="SegmentedBtn_Left_Press"
-                 image_pressed_selected="SegmentedBtn_Left_Press"
                  image_selected="SegmentedBtn_Left_Off"
                  image_unselected="SegmentedBtn_Left_Off"
+		 image_hover_selected="SegmentedBtn_Left_Over"
+		 image_hover_unselected="SegmentedBtn_Left_Over"
+		 image_pressed="SegmentedBtn_Left_Press"
+		 image_pressed_selected="SegmentedBtn_Left_Press"
+		 image_overlay="Arrow_Small_Left"
                  layout="topleft"
                  name="chicklet_left_scroll_button"
+        scale_image="true"
                  tab_stop="false"
-                 top="-28"
+                 top="-4"
+                 right_pad="2"
                  visible="false"
                  width="7" />
                 <button
                  auto_resize="true"
                  follows="right"
                  height="29"
-                 image_hover_selected="SegmentedBtn_Right_Over"
-                 image_hover_unselected="SegmentedBtn_Right_Over"
-                 image_overlay="Arrow_Small_Right"
-                 image_pressed="SegmentedBtn_Right_Press"
-                 image_pressed_selected="SegmentedBtn_Right_Press"
                  image_selected="SegmentedBtn_Right_Off"
                  image_unselected="SegmentedBtn_Right_Off"
+		 image_hover_selected="SegmentedBtn_Right_Over"
+		 image_hover_unselected="SegmentedBtn_Right_Over"
+		 image_pressed="SegmentedBtn_Right_Press"
+		 image_pressed_selected="SegmentedBtn_Right_Press"
+		 image_overlay="Arrow_Small_Right"
                  layout="topleft"
                  name="chicklet_right_scroll_button"
+        scale_image="true"
                  tab_stop="false"
-                 top="-28"
+                 top="-4"
                  visible="false"
                  width="7" />
             </chiclet_panel>
@@ -411,24 +330,25 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly.
          min_width="4"
          name="DUMMY"
          top="0"
-         width="4" />
+         width="4"/>
         <layout_panel
          auto_resize="false"
          follows="right"
          height="28"
          layout="topleft"
          min_height="28"
-         min_width="37"
-         name="im_well_panel"
          top="0"
-         user_resize="false"
-         width="37">
+         name="im_well_panel"
+         width="37"
+         min_width="37"
+         user_resize="false">
             <chiclet_im_well
+             max_displayed_count="99"
+             flash_period="0.3"
              follows="right"
              height="28"
              layout="topleft"
              left="0"
-             max_displayed_count="99"
              name="im_well"
              top="0"
              width="35">
@@ -454,8 +374,8 @@ image_pressed_selected  "Lit" + "Selected" - there are new messages and the Well
                  left="0"
                  name="Unread IM messages"
                  tool_tip="Conversations"
-                 width="34">
-                    <init_callback
+                 width="34" >
+                    <button.init_callback
                      function="Button.SetDockableFloaterToggle"
                      parameter="im_well_window" />
                 </button>
@@ -467,12 +387,13 @@ image_pressed_selected  "Lit" + "Selected" - there are new messages and the Well
          height="28"
          layout="topleft"
          min_height="28"
-         min_width="37"
-         name="notification_well_panel"
          top="0"
-         user_resize="false"
-         width="37">
+         name="notification_well_panel"
+         width="37"
+         min_width="37"
+         user_resize="false">
             <chiclet_notification
+             flash_period="0.25"
              follows="right"
              height="23"
              layout="topleft"
@@ -481,39 +402,27 @@ image_pressed_selected  "Lit" + "Selected" - there are new messages and the Well
              name="notification_well"
              top="5"
              width="35">
-                <button
-                 auto_resize="true"
+              <button
                  bottom_pad="3"
-                 follows="right"
-                 halign="center"
-                 height="23"
-                 image_overlay="Notices_Unread"
-                 image_overlay_alignment="center"
                  image_pressed="WellButton_Lit"
                  image_pressed_selected="WellButton_Lit_Selected"
                  image_selected="PushButton_Press"
-                 label_color="Black"
-                 left="0"
-                 name="Unread"
-                 tool_tip="Notifications"
-                 width="34">
-                    <init_callback
-                     function="Button.SetDockableFloaterToggle"
-                     parameter="notification_well_window" />
-                </button>
-            </chiclet_notification>
+              auto_resize="true"
+               halign="center"
+               height="23"
+               follows="right"
+                label_color="Black"
+               left="0"
+               name="Unread"
+               image_overlay="Notices_Unread"
+               image_overlay_alignment="center"
+               tool_tip="Notifications"
+               width="34" >
+                  <button.init_callback
+                   function="Button.SetDockableFloaterToggle"
+                   parameter="notification_well_window" />
+              </button>
+	    </chiclet_notification>
         </layout_panel>
-      <icon
-         auto_resize="false"
-         color="0 0 0 0"
-         follows="left|right"
-         height="10"
-         image_name="spacer24.tga"
-         layout="topleft"
-         left="0"
-         min_width="4"
-         name="DUMMY2"
-         top="0"
-         width="8" />
     </layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml b/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml
index e390b9e8367fa69fd19f762fb05110e42b775f0a..af3315ebfe1db4ca57e1d0663d924dfdea0f79e4 100644
--- a/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml
@@ -33,7 +33,7 @@
     <texture_picker
      allow_no_texture="true"
      border_enabled="true"
-     fallback_image="default_land_picture.j2c"
+     default_image_name="TabIcon_Places_Large"
      enabled="false"
      follows="left|top"
      height="80"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_alpha.xml b/indra/newview/skins/default/xui/en/panel_edit_alpha.xml
index 7bcd4962d2e81f5a502bf4a23151b3e35f1df6e5..1d0c0a02b0ebc1afa4ae0c934fa4493a2d6dd97b 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_alpha.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_alpha.xml
@@ -21,131 +21,111 @@
       name="avatar_alpha_color_panel"
       top="0"
       width="313" >
-       <check_box
-        control_name="LowerAlphaTextureInvisible"
-        follows="left"
-        height="16"
-        layout="topleft"
-        left="5"
-        name="lower alpha texture invisible"
-        top="10"
-        width="16" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="115"
+        height="100"
         label="Lower Alpha"
         layout="topleft"
-        left_pad="5"
+        left="30"
         name="Lower Alpha"
         tool_tip="Click to choose a picture"
         top="10"
-        width="115" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
-
+        width="94" />
        <check_box
-        control_name="UpperAlphaTextureInvisible"
+        control_name="LowerAlphaTextureInvisible"
         follows="left"
         height="16"
         layout="topleft"
-        left_pad="20"
-        name="upper alpha texture invisible"
-        top="10"
+        left_pad="6"
+        name="lower alpha texture invisible"
+        top_delta="4"
         width="16" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="115"
+        height="100"
         label="Upper Alpha"
         layout="topleft"
-        left_pad="5"
+        left_pad="20"
         name="Upper Alpha"
         tool_tip="Click to choose a picture"
         top="10"
-        width="115">
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
-
+        width="94" />
        <check_box
-        control_name="HeadAlphaTextureInvisible"
+        control_name="UpperAlphaTextureInvisible"
         follows="left"
         height="16"
         layout="topleft"
-        left="5"
-        name="head alpha texture invisible"
-        top_pad="15"
+        left_pad="6"
+        name="upper alpha texture invisible"
+        top_delta="4"
         width="16" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="115"
+        height="100"
         label="Head Alpha"
         layout="topleft"
-        left_pad="5"
+        left="30"
         name="Head Alpha"
         tool_tip="Click to choose a picture"
-        top_delta="0"
-        width="115" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
-
+        top="120"
+        width="94" />
        <check_box
-        control_name="Eye AlphaTextureInvisible"
+        control_name="HeadAlphaTextureInvisible"
         follows="left"
         height="16"
         layout="topleft"
-        left_pad="20"
-        name="eye alpha texture invisible"
-        top_delta="0"
+        left_pad="6"
+        name="head alpha texture invisible"
+        top_delta="4"
         width="16" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="115"
+        height="100"
         label="Eye Alpha"
         layout="topleft"
-        left_pad="5"
+        left_pad="20"
         name="Eye Alpha"
         tool_tip="Click to choose a picture"
-        top_delta="0"
-        width="115" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
-
+        top="120"
+        width="94" />
        <check_box
-        control_name="HairAlphaTextureInvisible"
+        control_name="Eye AlphaTextureInvisible"
         follows="left"
         height="16"
         layout="topleft"
-        left="5"
-        name="hair alpha texture invisible"
-        top_pad="15"
+        left_pad="6"
+        name="eye alpha texture invisible"
+        top_delta="4"
         width="16" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="115"
+        height="100"
         label="Hair Alpha"
         layout="topleft"
         left="30"
         name="Hair Alpha"
         tool_tip="Click to choose a picture"
-        top_delta="0"
-        width="115" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
-
+        top="230"
+        width="94" />
+       <check_box
+        control_name="HairAlphaTextureInvisible"
+        follows="left"
+        height="16"
+        layout="topleft"
+        left_pad="6"
+        name="hair alpha texture invisible"
+        top_delta="4"
+        width="16" />
 	 </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_eyes.xml b/indra/newview/skins/default/xui/en/panel_edit_eyes.xml
index f173a2f3cb03c82df93678c8ca841c93d08c4b4f..f11ef43c76f4d289d3b5dd3e508a4964f0e85e41 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_eyes.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_eyes.xml
@@ -32,11 +32,8 @@
              name="Iris"
              tool_tip="Click to choose a picture"
              top="10"
-             width="64" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
-     </panel>
+             width="64" />
+	 </panel>
      <panel
          border="false"
          bg_alpha_color="DkGray2"
@@ -51,7 +48,6 @@
          top_pad="10"
          width="313">
      <accordion
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_gloves.xml b/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
index a490f27b9facffd2d4fe5d886e91b2b72010c125..7d8eed50854ac4846da928247abda8fa6afeca4d 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
@@ -32,10 +32,7 @@
         name="Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="64" />
        <color_swatch
         can_apply_immediately="true"
         follows="left|top"
@@ -46,12 +43,9 @@
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
-        width="64" >
-         <color_swatch.commit_callback
-             function="ColorSwatch.Commit" />
-       </color_swatch>
-     </panel>
-     <panel
+        width="64" />
+	 </panel>
+	 <panel
          border="false"
          bg_alpha_color="DkGray2"
          bg_opaque_color="DkGray2"
@@ -65,7 +59,6 @@
          top_pad="10"
          width="313">
      <accordion
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_hair.xml b/indra/newview/skins/default/xui/en/panel_edit_hair.xml
index 6bb5d2fa9bec58d4202664fb1598d5be45c0c2f5..cd81aa2c4fdc2bd520bb00adc375d605dd77d952 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_hair.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_hair.xml
@@ -32,11 +32,8 @@
              name="Texture"
              tool_tip="Click to choose a picture"
              top="10"
-             width="64" >
-              <texture_picker.commit_callback
-                  function="TexturePicker.Commit" />
-            </texture_picker>
-     </panel>
+             width="64" />
+	 </panel>
    <panel
          border="false"
          bg_alpha_color="DkGray2"
@@ -51,7 +48,6 @@
          top_pad="10"
          width="313">
    <accordion 
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_jacket.xml b/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
index 929cdffb3d558c579b4edb85168d4440830d08e0..ba038659376d2a5e97e1a6d5a30eb73bce71c5d0 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
@@ -32,10 +32,7 @@
         name="Upper Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="74" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="74" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -47,10 +44,7 @@
         name="Lower Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="74" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="74" />
        <color_swatch
         can_apply_immediately="true"
         follows="left|top"
@@ -61,10 +55,7 @@
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
-        width="74" >
-         <color_swatch.commit_callback
-             function="ColorSwatch.Commit" />
-       </color_swatch>
+        width="74" />
 	 </panel>
 	 <panel
          border="false"
@@ -80,7 +71,6 @@
          top_pad="10"
          width="313">
      <accordion
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_pants.xml b/indra/newview/skins/default/xui/en/panel_edit_pants.xml
index f22cf983aa99f89dcf408df7b1750ff0dfa9f15d..5b02d1f96866d580e85ba5b88b4e00846a9548c2 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_pants.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_pants.xml
@@ -32,10 +32,7 @@
         name="Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="64" />
        <color_swatch
         can_apply_immediately="true"
         follows="left|top"
@@ -46,10 +43,7 @@
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
-        width="64" >
-         <color_swatch.commit_callback
-             function="ColorSwatch.Commit" />
-       </color_swatch>
+        width="64" />
 	 </panel>
      <panel
          border="false"
@@ -65,7 +59,6 @@
          top_pad="10"
          width="313">
    <accordion 
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shape.xml b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
index d295f5fe4a7b496e57b5ce9f5bf02c6d3369bfdf..e1c574001a79344a10065872d2217cbec27dfdc7 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shape.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
@@ -8,22 +8,54 @@
 	 name="edit_shape_panel"
 	 top_pad="10"
 	 width="333" >
-     <string name="meters">Meters</string>
-     <string name="feet">Feet</string>
-     <string name="height">Height:</string>
-     <string name="heigth_label_color" translate="false">White_50</string>
-     <string name="heigth_value_label_color" translate="false">White</string>
-     <text
-         follows="top|left|right"
-         font="SansSerifSmallBold"
-         halign="right"
-         height="12"
-         layout="topleft"
-         left="0"
-         name="avatar_height"
-         top="0"
-         width="310">
-     </text>
+	 <panel
+		 border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+		 follows="top|left|right"
+		 height="50"
+		 left="10"
+		 layout="topleft"
+		 name="avatar_sex_panel"
+		 top="0"
+		 width="313" >
+   			<text 
+			 follows="top|left"
+			 height="16"
+			 layout="topleft"
+			 left="10"
+			 name="gender_text"
+			 width="313">
+				Gender:
+			</text>
+		   <radio_group
+			 follows="left|top|right"
+			 left="10"
+             height="28"
+             layout="topleft"
+             name="sex_radio"
+			 top_pad="3"
+			 width="303" >
+                <radio_item
+					follows="all"
+                 height="16"
+                 label="Female"
+                 layout="topleft"
+                 left="10"
+                 name="radio"
+                 width="82" />
+                <radio_item
+					follows="all"
+                 height="16"
+                 label="Male"
+                 layout="topleft"
+                 left_pad="10"
+                 name="radio2"
+                 width="82" />
+            </radio_group>
+	 </panel>
      <panel
          border="false"
          bg_alpha_color="DkGray2"
@@ -31,22 +63,22 @@
          background_visible="true"
          background_opaque="true"
          follows="all"
-         height="388"
+         height="345"
          label="Shirt"
          layout="topleft"
 		 left="10"
          name="accordion_panel"
-		 top_pad="0"
+		 top_pad="10"
          width="313">
 	 <accordion
         layout="topleft"
 		follows="all"
-		height ="388"
+		height ="345"
 		left="0"
 		name="wearable_accordion"
 		top="0"
         single_expansion="true"
-        fit_parent="true"
+        fit_parent="false"
 		width="313">
 		<accordion_tab
 			layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shirt.xml b/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
index 85823073b5948bbddffcdb1cb31fad3ac7e5124a..7da8de4c0bfd110df9b13d1b84748e80d1443084 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
@@ -32,10 +32,7 @@
         name="Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="64" />
        <color_swatch
         can_apply_immediately="true"
         follows="left|top"
@@ -46,10 +43,7 @@
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
-        width="64" >
-         <color_swatch.commit_callback
-             function="ColorSwatch.Commit" />
-       </color_swatch>
+        width="64" />
 	 </panel>
      <panel
          border="false"
@@ -65,7 +59,6 @@
          top_pad="10"
          width="313">
 	 <accordion
-		fit_parent="true"
 		follows="all"
 		height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shoes.xml b/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
index b26fde68f187d4da393ae367e600fa12d0a7e957..84fe26f7f6366589c79ae62e936ab1774b92eecf 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
@@ -32,10 +32,7 @@
         name="Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="64" />
        <color_swatch
         can_apply_immediately="true"
         follows="left|top"
@@ -46,10 +43,7 @@
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
-        width="64" >
-         <color_swatch.commit_callback
-             function="ColorSwatch.Commit" />
-       </color_swatch>
+        width="64" />
 	 </panel>
      <panel
          border="false"
@@ -65,7 +59,6 @@
          top_pad="10"
          width="313">
    <accordion 
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_skin.xml b/indra/newview/skins/default/xui/en/panel_edit_skin.xml
index 45591ba2ad754ec7580174dc964b530d47fed02f..b5c8c954730fe56562d340f15139fd01768fc0e0 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_skin.xml
@@ -33,10 +33,7 @@
         name="Head Tattoos"
         tool_tip="Click to choose a picture"
         top="10"
-        width="74" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="74" />
        <texture_picker
         allow_no_texture="true"
         can_apply_immediately="true"
@@ -49,10 +46,7 @@
         name="Upper Tattoos"
         tool_tip="Click to choose a picture"
         top="10"
-        width="74" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="74" />
        <texture_picker
         allow_no_texture="true"
         can_apply_immediately="true"
@@ -65,11 +59,8 @@
         name="Lower Tattoos"
         tool_tip="Click to choose a picture"
         top="10"
-        width="74" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
-     </panel>
+        width="74" />
+	 </panel>
      <panel
          border="false"
          bg_alpha_color="DkGray2"
@@ -85,7 +76,6 @@
          width="313">    
 	 <accordion
         layout="topleft"
-		fit_parent="true"
 		follows="all"
 		height ="300"
 		left="0"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_skirt.xml b/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
index bb8e0dca07c8265f010186340a1aa6863e5c39d5..16f6950bd522ad294801be1f5e8a5cec85ac5163 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
@@ -32,10 +32,7 @@
         name="Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="64" />
        <color_swatch
         can_apply_immediately="true"
         follows="left|top"
@@ -46,10 +43,7 @@
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
-        width="64" >
-         <color_swatch.commit_callback
-             function="ColorSwatch.Commit" />
-       </color_swatch>
+        width="64" />
 	 </panel>
 	 <panel
          border="false"
@@ -65,7 +59,6 @@
          top_pad="10"
          width="313">
      <accordion
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_socks.xml b/indra/newview/skins/default/xui/en/panel_edit_socks.xml
index d813d94d93f0e6660ded0daee09af76a9f27579a..e4f916703b0c81f7cddd31e0cbad7d6aaba304c2 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_socks.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_socks.xml
@@ -32,10 +32,7 @@
         name="Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="64" />
        <color_swatch
         can_apply_immediately="true"
         follows="left|top"
@@ -46,10 +43,7 @@
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
-        width="64" >
-         <color_swatch.commit_callback
-             function="ColorSwatch.Commit" />
-       </color_swatch>
+        width="64" />
 	 </panel>
 	 <panel
          border="false"
@@ -65,7 +59,6 @@
          top_pad="10"
          width="313">
      <accordion
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_tattoo.xml b/indra/newview/skins/default/xui/en/panel_edit_tattoo.xml
index 23a08344eab5f056367b7d453ba85218f957a5e3..ed990eb0956468d35d1a9b91b809a032b401802d 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_tattoo.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_tattoo.xml
@@ -25,61 +25,38 @@
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="115"
+        height="100"
         label="Head Tattoo"
         layout="topleft"
-        left="20"
+        left="30"
         name="Head Tattoo"
         tool_tip="Click to choose a picture"
         top="10"
-        width="115" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="94" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="115"
+        height="100"
         label="Upper Tattoo"
         layout="topleft"
         left_pad="30"
         name="Upper Tattoo"
         tool_tip="Click to choose a picture"
         top="10"
-        width="115" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="94" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="115"
+        height="100"
         label="Lower Tattoo"
         layout="topleft"
-        left="20"
+        left="30"
         name="Lower Tattoo"
         tool_tip="Click to choose a picture"
         top_pad="10"
-        width="115" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
-       <color_swatch
-        can_apply_immediately="true"
-        follows="left|top"
-        height="115"
-        label="Color/Tint"
-        layout="topleft"
-        left_pad="30"
-        name="Color/Tint"
-        tool_tip="Click to open color picker"
-        top_delta="0"
-        width="115" >
-         <color_swatch.commit_callback
-             function="ColorSwatch.Commit" />
-       </color_swatch>
+        width="94" />
 	 </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_underpants.xml b/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
index 19225e975717889a9a42c9860d3c33a24eedb0e3..d43497c943d6825abc1dd3202422c0c1c6f0af4f 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
@@ -32,10 +32,7 @@
              name="Fabric"
              tool_tip="Click to choose a picture"
              top="10"
-             width="64" >
-              <texture_picker.commit_callback
-                  function="TexturePicker.Commit" />
-            </texture_picker>
+             width="64" />
             <color_swatch
              can_apply_immediately="true"
              follows="left|top"
@@ -46,10 +43,7 @@
              name="Color/Tint"
              tool_tip="Click to open color picker"
              top="10"
-             width="64" >
-              <color_swatch.commit_callback
-                  function="ColorSwatch.Commit" />
-            </color_swatch>
+             width="64" />
 	 </panel>
 	 <panel
          border="false"
@@ -65,7 +59,6 @@
          top_pad="10"
          width="313">
      <accordion
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml b/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
index 720a55dcc201b145ed08440740cd129660982a2f..45c6ef4526dafd4fc61cdd17b091242c5f353a26 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
@@ -32,10 +32,7 @@
         name="Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" >
-         <texture_picker.commit_callback
-             function="TexturePicker.Commit" />
-       </texture_picker>
+        width="64" />
        <color_swatch
         can_apply_immediately="true"
         follows="left|top"
@@ -46,10 +43,7 @@
         name="Color/Tint"
         tool_tip="Click to open Color Picker"
         top="10"
-        width="64" >
-         <color_swatch.commit_callback
-             function="ColorSwatch.Commit" />
-       </color_swatch>
+        width="64" />
        </panel>
 	 <panel
          border="false"
@@ -65,7 +59,6 @@
          top_pad="10"
          width="313">
      <accordion
-        fit_parent="true"
         follows="all"
         height ="300"
         layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
index 9fb777e0e795530b86eb3fb2799164c35b0420e4..dc2f085356d36ecbfbee841c93261e152a179389 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
@@ -1,437 +1,414 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
  background_visible="true"
- bevel_style="in"
+	bevel_style="in"
  follows="all"
  height="570"
- help_topic="edit_wearable"
  label="Wearable"
  layout="topleft"
- left="0"
+left="0"
  name="panel_edit_wearable"
- top="0"
+	top="0"
  width="333">
-    <string
-     name="edit_shape_title">
-        Editing Shape
-    </string>
-    <string
-     name="edit_skin_title">
-        Editing Skin
-    </string>
-    <string
-     name="edit_hair_title">
-        Editing Hair
-    </string>
-    <string
-     name="edit_eyes_title">
-        Editing Eyes
-    </string>
-    <string
-     name="edit_shirt_title">
-        Editing Shirt
-    </string>
-    <string
-     name="edit_pants_title">
-        Editing Pants
-    </string>
-    <string
-     name="edit_shoes_title">
-        Editing Shoes
-    </string>
-    <string
-     name="edit_socks_title">
-        Editing Socks
-    </string>
-    <string
-     name="edit_jacket_title">
-        Editing Jacket
-    </string>
-    <string
-     name="edit_skirt_title">
-        Editing Skirt
-    </string>
-    <string
-     name="edit_gloves_title">
-        Editing Gloves
-    </string>
-    <string
-     name="edit_undershirt_title">
-        Editing Undershirt
-    </string>
-    <string
-     name="edit_underpants_title">
-        Editing Underpants
-    </string>
-    <string
-     name="edit_alpha_title">
-        Editing Alpha Mask
-    </string>
-    <string
-     name="edit_tattoo_title">
-        Editing Tattoo
-    </string>
-    <string
-     name="shape_desc_text">
-        Shape:
-    </string>
-    <string
-     name="skin_desc_text">
-        Skin:
-    </string>
-    <string
-     name="hair_desc_text">
-        Hair:
-    </string>
-    <string
-     name="eyes_desc_text">
-        Eyes:
-    </string>
-    <string
-     name="shirt_desc_text">
-        Shirt:
-    </string>
-    <string
-     name="pants_desc_text">
-        Pants:
-    </string>
-    <string
-     name="shoes_desc_text">
-        Shoes:
-    </string>
-    <string
-    name="socks_desc_text">
-        Socks:
-    </string>
-    <string
-     name="jacket_desc_text">
-        Jacket:
-    </string>
-    <string
-     name="skirt_desc_text">
-        Skirt:
-    </string>
-    <string
-    name="gloves_desc_text">
-        Gloves:
-    </string>
-    <string
-     name="undershirt_desc_text">
-        Undershirt:
-    </string>
-    <string
-     name="underpants_desc_text">
-        Underpants:
-    </string>
-    <string
-     name="alpha_desc_text">
-        Alpha Mask:
-    </string>
-    <string
-     name="tattoo_desc_text">
-        Tattoo:
-    </string>
-    <!-- Default width of the button should be to show it without label.
-     Button will be extedned in code to show whole label when wearable is being changed.
-    -->
-    <labeled_back_button
+	<string
+		name="edit_shape_title">
+		Editing Shape
+	</string>
+	<string
+		name="edit_skin_title">
+		Editing Skin
+	</string>
+	<string
+		name="edit_hair_title">
+		Editing Hair
+	</string>
+	<string
+		name="edit_eyes_title">
+		Editing Eyes
+	</string>
+	<string
+		name="edit_shirt_title">
+		Editing Shirt
+	</string>
+	<string
+		name="edit_pants_title">
+		Editing Pants
+	</string>
+	<string
+		name="edit_shoes_title">
+		Editing Shoes
+	</string>
+	<string
+		name="edit_socks_title">
+		Editing Socks
+	</string>
+	<string
+		name="edit_jacket_title">
+		Editing Jacket
+	</string>
+	<string
+		name="edit_skirt_title">
+		Editing Skirt
+	</string>
+	<string
+		name="edit_gloves_title">
+		Editing Gloves
+	</string>
+	<string
+		name="edit_undershirt_title">
+		Editing Undershirt
+	</string>
+	<string
+		name="edit_underpants_title">
+		Editing Underpants
+	</string>
+	<string
+		name="edit_alpha_title">
+		Editing Alpha Mask
+	</string>
+	<string
+		name="edit_tattoo_title">
+		Editing Tattoo
+	</string>
+	<string
+		name="shape_desc_text">
+		Shape:
+	</string>
+	<string
+		name="skin_desc_text">
+		Skin:
+	</string>
+	<string
+		name="hair_desc_text">
+		Hair:
+	</string>
+	<string
+		name="eyes_desc_text">
+		Eyes:
+	</string>
+	<string
+		name="shirt_desc_text">
+		Shirt:
+	</string>
+	<string
+		name="pants_desc_text">
+		Pants:
+	</string>
+	<string
+		name="shoes_desc_text">
+		Shoes:
+	</string>
+	<string
+		name="socks_desc_text">
+		Socks:
+	</string>
+	<string
+		name="jacket_desc_text">
+		Jacket:
+	</string>
+	<string
+		name="skirt_skirt_desc_text">
+		Skirt:
+	</string>
+	<string
+		name="gloves_desc_text">
+		Gloves:
+	</string>
+	<string
+		name="undershirt_desc_text">
+		Undershirt:
+	</string>
+	<string
+		name="underpants_desc_text">
+		Underpants:
+	</string>
+	<string
+		name="alpha_desc_text">
+		Alpha Mask:
+	</string>
+	<string
+		name="tattoo_desc_text">
+		Tattoo:
+	</string>
+    <button
      follows="top|left"
-     height="24"
-     image_hover_unselected="BackButton_Over"
-     image_pressed="BackButton_Press"
-     image_unselected="BackButton_Off"
+     height="25"
+     width="25"
+     image_overlay="BackArrow_Off"
      layout="topleft"
-     label="Save"
-     left="11"
      name="back_btn"
-     pad_left="24"
-     tool_tip="Return to Edit Outfit"
-     top="3"
-     width="30" />
-    <text
-     follows="top|left|right"
-     font="SansSerifHugeBold"
-     height="22"
-     layout="topleft"
-     left_pad="8"
-     name="edit_wearable_title"
-     text_color="white"
-     top="3"
-     value="Editing Shape"
-     use_ellipses="true"
-     width="274" />
-    <panel
-     background_opaque="true"
-     background_visible="true"
-     bg_alpha_color="DkGray2"
-     bg_opaque_color="DkGray2"
-     border="false"
-     follows="top|left|right"
-     height="60"
-     label="Shirt"
-     layout="topleft"
      left="10"
-     name="wearable_type_panel"
-     top_pad="10"
-     width="313">
-        <text
+     top="7" />
+	<text
+	 follows="top|left"
+	 font="SansSerifHugeBold"
+	 height="22"
+	 layout="topleft"
+	 left_pad="15"
+	 name="edit_wearable_title"
+	 text_color="white"
+	 value="Editing Shape"
+	 width="270" />
+     <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
          follows="top|left|right"
-         font="SansSerifSmallBold"
-         height="16"
-         layout="topleft"
-         left="10"
-         name="description_text"
-         text_color="white"
-         top="10"
-         value="Shape:"
-         width="150" />
-        <radio_group
-         control_name="AvatarSex"
-         follows="left|top|right"
-         height="20"
-         layout="topleft"
-         left="210"
-         name="sex_radio"
-         top="5"
-         width="110">
-            <radio_item
-             follows="all"
-             height="16"
-             label=""
-             layout="topleft"
-             left="0"
-             name="sex_male"
-             tool_tip="Male"
-             value="1"
-             width="40" />
-            <radio_item
-             follows="all"
-             height="16"
-             label=""
-             layout="topleft"
-             left_pad="10"
-             name="sex_female"
-             tool_tip="Female"
-             value="0"
-             width="40"/>
-        </radio_group>
-        <!--  graphical labels for the radio buttons above -->
-        <icon
-         height="16"
-         image_name="icons/Male.png"
-         layout="topleft"
-         left="230"
-         name="male_icon"
-         tool_tip="Male"
-         top="7"
-         width="16" />
-        <icon
-         height="16"
-         image_name="icons/Female.png"
-         layout="topleft"
-         left="280"
-         name="female_icon"
-         tool_tip="Female"
-         top="7"
-         width="16" />
-        <line_editor
-         follows="all"
-         height="23"
-         layout="topleft"
-         left="10"
-         max_length="63"
-         name="description"
-         prevalidate_callback="ascii"
-         select_on_focus="true"
-         text_color="black"
-         top_pad="3"
-         width="290" />
-    </panel>
-    <panel
-     follows="all"
-     height="433"
-     layout="topleft"
-     left="0"
-     name="edit_subpanel_container"
-     top_pad="2"
-     width="333">
-    <!-- the shape editing panel is taller than the others
-		      because it also displays avatar height -->
-        <panel
-         filename="panel_edit_shape.xml"
-         follows="all"
-         height="433"
-         layout="topleft"
-         left="0"
-         name="edit_shape_panel"
-         top="0"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_skin.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_skin_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_hair.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_hair_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_eyes.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_eyes_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_shirt.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_shirt_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_pants.xml"
-         follows="all"
-         height="425"
+         height="60"
+         label="Shirt"
          layout="topleft"
-         left="0"
-         name="edit_pants_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_shoes.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_shoes_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_socks.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_socks_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_jacket.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_jacket_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_skirt.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_skirt_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_gloves.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_gloves_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_undershirt.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_undershirt_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_underpants.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_underpants_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_alpha.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_alpha_panel"
-         top="8"
-         visible="false"
-         width="333" />
-        <panel
-         filename="panel_edit_tattoo.xml"
-         follows="all"
-         height="425"
-         layout="topleft"
-         left="0"
-         name="edit_tattoo_panel"
-         top="8"
-         visible="false"
-         width="333" />
-    </panel>
-    <panel
-     follows="bottom|left|right"
-     height="23"
-     layout="topleft"
-     left="2"
-     name="button_panel"
-     top_pad="6"
-     width="333">
+		 left="10"
+         name="wearable_type_panel"
+		 top_pad="10"
+         width="313">
+		 <text
+		 follows="top|left|right"
+		 height="16"
+		 layout="topleft"
+		 left="10"
+		 name="description_text"
+		 value="Shape:"
+		 width="303" />
+		 <text_editor
+			 follows="all"
+			 height="23"
+			 left="10"
+			 layout="topleft"
+			 max_length="300"
+			 name="description"
+			 width="290" />
+	 </panel>
+	 <panel
+		 follows="all"
+		 height="400"
+		 layout="topleft"
+		 left="0"
+		 name="edit_subpanel_container"
+		 top_pad="10"
+		 width="333">
+		 <panel
+			 filename="panel_edit_shape.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_shape_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_skin.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_skin_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_hair.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_hair_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_eyes.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_eyes_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_shirt.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_shirt_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_pants.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_pants_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_shoes.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_shoes_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_socks.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_socks_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_jacket.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_jacket_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_skirt.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_skirt_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_gloves.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_gloves_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_undershirt.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_undershirt_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_underpants.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_underpants_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_alpha.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_alpha_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+		 <panel
+			 filename="panel_edit_tattoo.xml"
+			 follows="all"
+			 height="400"
+			 layout="topleft"
+			 left="0"
+			 name="edit_tattoo_panel"
+			 top="0"
+			 visible="false"
+			 width="333" />
+	 </panel>
+     <panel
+        follows="left|right|bottom"
+        height="38"
+        label="gear_buttom_panel"
+        layout="bottom|left|right"
+        left="0"
+        bottom="25"
+        name="gear_buttom_panel"
+        width="333">
         <button
-         follows="bottomleft"
-         height="23"
-         label="Save As"
-         layout="topleft"
-         left="8"
-         name="save_as_button"
-         top="0"
-         width="153" />
+            follows="bottom|left"
+            tool_tip="Options"
+            height="18"
+            image_disabled="OptionsMenu_Disabled"
+            image_selected="OptionsMenu_Press"
+            image_unselected="OptionsMenu_Off"
+            layout="topleft"
+            left="10"
+            name="friends_viewsort_btn"
+            top="10"
+            width="18" />
         <button
-         follows="bottomleft"
-         height="23"
-         label="Undo Changes"
-         layout="topleft"
-         left_pad="7"
-         name="revert_button"
-         width="152" />
-    </panel>
+            follows="bottom|left"
+            height="18"
+            image_selected="AddItem_Press"
+            image_unselected="AddItem_Off"
+            image_disabled="AddItem_Disabled"
+            layout="topleft"
+            left_pad="10"
+            name="add_btn"
+            tool_tip="TODO"
+            width="18" />
+        <button
+            follows="bottom|left"
+            height="18"
+            image_selected="TrashItem_Press"
+            image_unselected="TrashItem_Off"
+            image_disabled="TrashItem_Disabled"
+            layout="topleft"
+            left_pad="10"
+            right="-10"
+            name="del_btn"
+            tool_tip="TODO"
+            top_delta="0"
+            width="18" />
+     </panel>
+	 <panel
+		 follows="bottom|left|right"
+		 height="25"
+		 layout="bottom|left|right"
+		 left="0"
+		 name="button_panel"
+		 bottom="5"
+		 width="333" >
+		 <button
+			 follows="bottomleft"
+			 layout="topleft"
+			 height="23"
+			 label="Save As"
+			 left="8"
+			 name="save_as_button"
+			 top="0"
+			 width="153" />
+		 <button
+			 follows="bottomleft"
+			 layout="topleft"
+			 height="23"
+			 label="Revert"
+			 left_pad="7"
+			 name="revert_button"
+			 width="153" />
+	 </panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_group_general.xml b/indra/newview/skins/default/xui/en/panel_group_general.xml
index 2af1a84400fb82da7d45253e09fe0f34dbc1c01e..9341d433e8992a6dbd6785a1025a2f3fc9197ff5 100644
--- a/indra/newview/skins/default/xui/en/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_general.xml
@@ -28,7 +28,6 @@ Hover your mouse over the options for more help.
       width="304"
       layout="topleft">
     <texture_picker
-     default_image_name="Generic_Group_Large"
      follows="left|top"
      height="110"
      label=""
@@ -243,7 +242,7 @@ Hover your mouse over the options for more help.
          top_pad="4"
          width="190">
 			<combo_item name="select_mature" value="Select">
-			- Select maturity rating -
+			- Select Mature -
 			</combo_item>
             <combo_box.item
              label="Moderate Content"
diff --git a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
index 4998322d62c11951425ff0a297781a21feb00695..789d69bc687f0ef6233cc075dd974126bdb499ed 100644
--- a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
@@ -36,16 +36,14 @@ background_visible="true"
       layout="topleft">
     <button
      follows="top|right"
-     height="24"
-     image_hover_unselected="BackButton_Over"
-     image_pressed="BackButton_Press"
-     image_unselected="BackButton_Off"
+     height="23"
+     image_overlay="BackArrow_Off"
      layout="topleft"
      name="back"
-     left="7"
+     left="8"
      tab_stop="false"
      top="2"
-     width="30" />
+     width="23" />
     <text_editor
      allow_scroll="false"
      bg_visible="false"
@@ -57,9 +55,9 @@ background_visible="true"
       font="SansSerifHugeBold"
      h_pad="0"
       height="26"
-      left_pad="8"
+      left_pad="10"
      text_color="LtGray"
-      top="1"
+      top="0"
      use_ellipses="true"
       width="275"
       follows="top|left|right"
@@ -95,9 +93,7 @@ background_visible="true"
        name="group_accordions"
        follows="all"
        layout="topleft"
-       auto_resize="true"
-       height="513"
-       width="313">
+       auto_resize="true">
    <accordion
      left="0"
      top="0"
@@ -105,9 +101,7 @@ background_visible="true"
      fit_parent="true"
      follows="all"
      layout="topleft"
-     name="groups_accordion"
-     height="513"
-     width="313">
+     name="groups_accordion">
          <accordion_tab
             expanded="true"
             layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_group_notices.xml b/indra/newview/skins/default/xui/en/panel_group_notices.xml
index 41f2b28004ad97a98051403d73bfd6347c4cdaf8..479629f6eac23cdc59fff9ae1f4447d38fa76a5a 100644
--- a/indra/newview/skins/default/xui/en/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_notices.xml
@@ -74,24 +74,23 @@ Maximum 200 per group daily
     </text>
       <button
        follows="top|left"
-       height="23"
-       image_overlay="AddItem_Off"
-       image_overlay_alignment="left"
-       imgoverlay_label_space="-10"
-       label="New Notice"
+       height="18"
+       image_selected="AddItem_Press"
+       image_unselected="AddItem_Off"
+       image_disabled="AddItem_Disabled"
        layout="topleft"
        left="5"
        name="create_new_notice"
        tool_tip="Create a new notice"
-       top_delta="0"
-       width="93" />
+     top_delta="-3"
+       width="18" />
      <button
      follows="top|left"
      height="23"
      image_overlay="Refresh_Off"
      layout="topleft"
      name="refresh_notices"
-     left="260"
+     left_pad="230"
      tool_tip="Refresh list of notices"
      top_delta="0"
      width="23" />
@@ -116,7 +115,7 @@ Maximum 200 per group daily
          mouse_opaque="false"
          name="lbl"
          text_color="EmphasisColor"
-         top="5"
+         top="0"
          width="200">
             Create a Notice
         </text>
@@ -208,26 +207,12 @@ Maximum 200 per group daily
          name="drop_icon"
          top_delta="-10"
          width="72" />
-        <button
-         follows="left|top"
-         layout="topleft"
-         left="20"
-         top_delta="50"
-         height="23"
-         width="100"
-         name="open_inventory"
-         label="Inventory"
-         tool_tip="Open Inventory">
-			<button.init_callback
-				 function="Button.SetFloaterToggle"
-				 parameter="inventory"/>
-		</button>
         <button
          follows="left|top"
          layout="topleft"
          left="140"
          name="remove_attachment"
-         top_delta="0"
+         top_delta="50"
                  height="18"
                  image_selected="TrashItem_Press"
                  image_unselected="TrashItem_Off"
@@ -245,7 +230,7 @@ Maximum 200 per group daily
          name="send_notice"
          width="100" />
       <group_drop_target
-         height="75"
+         height="95"
          top="160"
          left="10"
          layout="topleft"
@@ -273,7 +258,7 @@ Maximum 200 per group daily
          mouse_opaque="false"
          name="lbl"
          text_color="EmphasisColor"
-         top_pad="5"
+         top_pad="0"
          width="265">
             Archived Notice
         </text>
diff --git a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
index 33a5e01e4c48f6c6f7f84c1e4bc80064abeb734b..29c6a17c31de13a0580f2e3ffb62b05c1c8f603f 100644
--- a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
+++ b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
@@ -3,14 +3,14 @@
  border="false"
  height="300"
  name="panel_im_control_panel"
- width="119">
+ width="110">
     <avatar_icon
      follows="left|top"
      height="105"
      left_delta="5"
      name="avatar_icon"
      top="-5"
-     width="114"/>
+     width="105"/>
     <layout_stack
      mouse_opaque="false"
      border_size="0"
@@ -22,7 +22,7 @@
      name="button_stack"
      orientation="vertical"
      top_pad="5"
-     width="114">
+     width="105">
         <layout_panel
          mouse_opaque="false"
          auto_resize="true"
@@ -31,7 +31,7 @@
          layout="topleft"
          left="2"
          min_height="0"
-         width="109"
+         width="100"
          top="0"
          name="spacer"
          user_resize="false" />
@@ -41,7 +41,7 @@
          height="20"
          layout="topleft"
          min_height="20"
-         width="109"
+         width="100"
          name="view_profile_btn_panel"
          user_resize="false">
             <button
@@ -50,7 +50,7 @@
              label="Profile"
              name="view_profile_btn"
              top="0"
-             width="109" />
+             width="100" />
         </layout_panel>
         <layout_panel
          auto_resize="false"
@@ -58,7 +58,7 @@
          height="25"
          layout="topleft"
          min_height="25"
-         width="109"
+         width="100"
          name="add_friend_btn_panel"
          user_resize="false">
             <button
@@ -67,7 +67,7 @@
              label="Add Friend"
              name="add_friend_btn"
              top="5"
-             width="109" />
+             width="100" />
         </layout_panel>
         <layout_panel
          auto_resize="false"
@@ -75,7 +75,7 @@
          height="25"
          layout="topleft"
          min_height="25"
-         width="109"
+         width="100"
          name="teleport_btn_panel"
          user_resize="false">
         <button
@@ -85,7 +85,7 @@
              label="Teleport"
              name="teleport_btn"
              tool_tip = "Offer to teleport this person"
-             width="109" />
+             width="100" />
         </layout_panel>
         <layout_panel
          auto_resize="false"
@@ -93,7 +93,7 @@
          height="25"
          layout="topleft"
          min_height="25"
-         width="109"
+         width="100"
          name="share_btn_panel"
          user_resize="false">
            <button
@@ -102,7 +102,7 @@
              height="23"
              label="Share"
              name="share_btn"
-             width="109" />
+             width="100" />
         </layout_panel>
         <layout_panel
          auto_resize="false"
@@ -110,7 +110,7 @@
          height="25"
          layout="topleft"
          min_height="25"
-         width="109"
+         width="100"
          name="pay_btn_panel"
          user_resize="false">
            <button
@@ -119,7 +119,7 @@
              height="23"
              label="Pay"
              name="pay_btn"
-             width="109" />
+             width="100" />
         </layout_panel>
         <layout_panel
          auto_resize="false"
@@ -127,7 +127,7 @@
          height="25"
          layout="topleft"
          min_height="25"
-         width="109"
+         width="100"
          name="call_btn_panel"
          user_resize="false">
             <button
@@ -135,7 +135,7 @@
              height="23"
              label="Call"
              name="call_btn"
-             width="109" />
+             width="100" />
         </layout_panel>
         <layout_panel
          auto_resize="false"
@@ -143,7 +143,7 @@
          height="25"
          layout="topleft"
          min_height="25"
-         width="109"
+         width="100"
          name="end_call_btn_panel"
          user_resize="false"
          visible="false">
@@ -152,7 +152,7 @@
              height="23"
              label="End Call"
              name="end_call_btn"
-             width="109" />
+             width="100" />
         </layout_panel>
         <layout_panel
          auto_resize="false"
@@ -160,7 +160,7 @@
          height="25"
          layout="topleft"
          min_height="25"
-         width="109"
+         width="100"
          name="voice_ctrls_btn_panel"
          user_resize="false"
          visible="false">
@@ -169,7 +169,7 @@
              height="23"
              label="Voice Controls"
              name="voice_ctrls_btn"
-             width="109" />
+             width="100" />
         </layout_panel>
     </layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_landmark_info.xml b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
index a0a1e2963a95f84fbd10cae7d56df1942cd166f8..31ba539c44336e8dd57354ecf744f9d3eac20036 100644
--- a/indra/newview/skins/default/xui/en/panel_landmark_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
@@ -46,38 +46,33 @@
     <!-- Texture names for rating icons -->
     <string
      name="icon_PG"
-     translate="false"
      value="Parcel_PG_Dark" />
     <string
      name="icon_M"
-     translate="false"
      value="Parcel_M_Dark" />
     <string
      name="icon_R"
-     translate="false"
      value="Parcel_R_Dark" />
     <button
      follows="top|right"
-     height="24"
-     image_hover_unselected="BackButton_Over"
-     image_pressed="BackButton_Press"
-     image_unselected="BackButton_Off"
+     height="23"
+     image_overlay="BackArrow_Off"
      layout="topleft"
-     left="9"
+     left="11"
      name="back_btn"
      tool_tip="Back"
      tab_stop="false"
      top="4"
-     width="30" />
+     width="23" />
     <text
      follows="top|left|right"
      font="SansSerifHugeBold"
      height="26"
      layout="topleft"
-     left_pad="7"
+     left_pad="10"
      name="title"
      text_color="LtGray"
-     top="3"
+     top="2"
      use_ellipses="true"
      value="Place Profile"
      width="280" />
@@ -103,8 +98,7 @@
          width="310">
             <texture_picker
              enabled="false"
-             fallback_image="default_land_picture.j2c"
-             follows="left|top|right"
+         follows="left|top|right"
              height="197"
              layout="topleft"
              left="11"
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index 0499873fb071365dd126ca161374489917f1dc72..01adc00e1a16f3a42d1fdc48737597afe8d51333 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -56,23 +56,42 @@ height="80">
 follows="left|bottom"
 font="SansSerifSmall"
 height="16"
-name="username_text"
+name="first_name_text"
 top="20"
 left="20"
 width="150">
-Username:
+First name:
 </text>
 <line_editor
 follows="left|bottom"
 height="22"
-label="Username"
+label="First"
 left_delta="0"
 max_length="31"
-name="username_edit"
+name="first_name_edit"
 select_on_focus="true"
-tool_tip="[SECOND_LIFE] Username"
+tool_tip="[SECOND_LIFE] First Name"
 top_pad="0"
-width="150" />
+   width="135" />
+  <text
+   follows="left|bottom"
+   font="SansSerifSmall"
+   height="16"
+   left_pad="8"
+   name="last_name_text"
+   top="20"
+   width="150">
+    Last name:   </text>
+<line_editor
+follows="left|bottom"
+height="22"
+label="Last"
+max_length="31"
+name="last_name_edit"
+select_on_focus="true"
+tool_tip="[SECOND_LIFE] Last Name"
+  top_pad="0"
+  width="135" />
 <text
 follows="left|bottom"
 font="SansSerifSmall"
@@ -148,7 +167,6 @@ allow_text_entry="true"
 font="SansSerifSmall"
    follows="left|right|bottom"
    height="23"
-   max_chars="256"
 layout="topleft"
 top_pad="2"
 name="server_combo"
@@ -156,7 +174,6 @@ width="135"
   visible="false" />
 </layout_panel>
 <layout_panel
-tab_stop="false"
 follows="right|bottom"
 name="links"
 width="200"
@@ -184,7 +201,7 @@ height="16"
 name="forgot_password_text"
 top_pad="12"
 right="-10"
-  width="180">
+  width="210">
        Forgot your name or password?
 </text>
 <text
@@ -196,7 +213,7 @@ height="16"
 name="login_help"
 top_pad="2"
 right="-10"
-    width="180">
+    width="190">
        Need help logging in?   </text>
 <!--  <text
     follows="right|bottom"
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index 16529f4064b0c30d97265c22b5ce86aeefade544..1b04d01abf4fa51b06c09520440c18fc53d77bbf 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
  background_visible="true"
- default_tab_group="1"
  follows="all"
- height="423"
+ height="408"
  label="Things"
  layout="topleft"
  min_height="350"
@@ -42,13 +41,13 @@
   <filter_editor
    text_pad_left="10"
    follows="left|top|right"
-   height="23"
+ height="23"
    label="Filter Inventory"
    layout="topleft"
    left="10"
    max_length="300"
    name="inventory search editor"
-   top="18"
+   top="3"
    width="303" />
   <tab_container
      bg_alpha_color="DkGray"
@@ -62,16 +61,15 @@
      left="7"
      name="inventory filter tabs"
      tab_height="30"
-     tab_group="1"
      tab_position="top"
      tab_min_width="100"
      top_pad="10"
      width="312">
     <inventory_panel
-     bg_opaque_color="DkGray2"
-     bg_alpha_color="DkGray2"
-     background_visible="true"
-     background_opaque="true"
+        bg_opaque_color="DkGray2"
+   bg_alpha_color="DkGray2"
+   background_visible="true"
+   background_opaque="true"
      border="false"
      bevel_style="none"
      follows="all"
@@ -82,14 +80,13 @@
      left="0"
      name="All Items"
      sort_order_setting="InventorySortOrder"
-	 show_item_link_overlays="true"
      top="16"
      width="288" />
-    <recent_inventory_panel
-     bg_opaque_color="DkGray2"
-     bg_alpha_color="DkGray2"
-     background_visible="true"
-     background_opaque="true"
+    <inventory_panel
+        bg_opaque_color="DkGray2"
+   bg_alpha_color="DkGray2"
+   background_visible="true"
+   background_opaque="true"
      border="false"
      bevel_style="none"
      follows="all"
@@ -99,95 +96,64 @@
      layout="topleft"
      left_delta="0"
      name="Recent Items"
-	 show_item_link_overlays="true"
      width="290" />
   </tab_container>
-  <layout_stack
-   animate="false"
-   border_size="0"
+
+  <panel
+     background_visible="true"
+   bevel_style="none"
    follows="left|right|bottom"
-   height="25"
+   height="27"
    layout="topleft"
-   orientation="horizontal"
-   top_pad="0"
+   top_pad="-1"
    left="10"
    name="bottom_panel"
-   width="307">
-      <layout_panel
-       auto_resize="false"
-       height="25"
-       layout="topleft"
-       name="options_gear_btn_panel"
-       width="32">
-          <button
-           follows="bottom|left"
-           tool_tip="Show additional options"
-           height="25"
-           image_hover_unselected="Toolbar_Left_Over"
-           image_overlay="OptionsMenu_Off"
-           image_selected="Toolbar_Left_Selected"
-           image_unselected="Toolbar_Left_Off"
-           layout="topleft"
-           left="0"
-           name="options_gear_btn"
-           top="0"
-           width="31" />
-      </layout_panel>
-      <layout_panel
-       auto_resize="false"
-       height="25"
-       layout="topleft"
-       name="add_btn_panel"
-       width="32">
-          <button
-           follows="bottom|left"
-           height="25"
-           image_hover_unselected="Toolbar_Middle_Over"
-           image_overlay="AddItem_Off"
-           image_selected="Toolbar_Middle_Selected"
-           image_unselected="Toolbar_Middle_Off"
-           layout="topleft"
-           left="0"
-           name="add_btn"
-           tool_tip="Add new item"
-           top="0"
-           width="31" />
-      </layout_panel>
-      <layout_panel
-       auto_resize="true"
-       height="25"
-       layout="topleft"
-       name="dummy_panel"
-       width="212">
-          <icon
-           follows="bottom|left|right"
-           height="25"
-           image_name="Toolbar_Middle_Off"
-           layout="topleft"
-           left="0"
-           top="0"
-           name="dummy_icon"
-           width="211" />
-      </layout_panel>
-      <layout_panel
-       auto_resize="false"
-       height="25"
-       layout="topleft"
-       name="trash_btn_panel"
-       width="31">
-          <dnd_button
-           follows="bottom|left"
-           height="25"
-           image_hover_unselected="Toolbar_Right_Over"
-           image_overlay="TrashItem_Off"
-           image_selected="Toolbar_Right_Selected"
-           image_unselected="Toolbar_Right_Off"
-           left="0"
-           layout="topleft"
-           name="trash_btn"
-           tool_tip="Remove selected item"
-           top="0"
-           width="31"/>
-      </layout_panel>
-  </layout_stack>
+   width="310">
+    <button
+     follows="bottom|left"
+     tool_tip="Show additional options"
+     height="25"
+     image_hover_unselected="Toolbar_Left_Over"
+     image_overlay="OptionsMenu_Off"
+     image_selected="Toolbar_Left_Selected"
+     image_unselected="Toolbar_Left_Off"
+     layout="topleft"
+     left="0"
+     name="options_gear_btn"
+     top="1"
+     width="31" />
+    <button
+     follows="bottom|left"
+     height="25"
+     image_hover_unselected="Toolbar_Middle_Over"
+     image_overlay="AddItem_Off"
+     image_selected="Toolbar_Middle_Selected"
+     image_unselected="Toolbar_Middle_Off"
+     layout="topleft"
+     left_pad="1"
+     name="add_btn"
+     tool_tip="Add new item"
+     width="31" />
+    <icon
+     follows="bottom|left"
+     height="25"
+     image_name="Toolbar_Middle_Off"
+     layout="topleft"
+     left_pad="1"
+     name="dummy_icon"
+     width="209"
+       />
+    <dnd_button
+     follows="bottom|left"
+     height="25"
+     image_hover_unselected="Toolbar_Right_Over"
+     image_overlay="TrashItem_Off"
+     image_selected="Toolbar_Right_Selected"
+     image_unselected="Toolbar_Right_Off"
+     left_pad="1"
+     layout="topleft"
+     name="trash_btn"
+     tool_tip="Remove selected item"
+     width="31"/>
+  </panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_my_profile.xml b/indra/newview/skins/default/xui/en/panel_my_profile.xml
index 2e49fc8d6fff39c648a68a507a90bb884bda6b48..5e41d65720946b5aaae0f49e8aaa251699a4cd2c 100644
--- a/indra/newview/skins/default/xui/en/panel_my_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_my_profile.xml
@@ -83,7 +83,6 @@
                allow_no_texture="true"
                default_image_name="None"
                enabled="false"
-               fallback_image="Generic_Person_Large" 
                follows="top|left"
                height="124"
                layout="topleft"
@@ -141,7 +140,6 @@
                allow_no_texture="true"
                default_image_name="None"
                enabled="false"
-               fallback_image="Generic_Person_Large"
                follows="top|left"
                height="124"
                layout="topleft"
@@ -403,6 +401,14 @@
          name="edit_profile_btn"
          tool_tip="Edit your personal information"
          width="152" />
+        <button
+         follows="bottom|right"
+         height="23"
+         label="Edit Appearance"
+         left_pad="3"
+         name="edit_appearance_btn"
+         tool_tip="Create/edit your appearance: physical data, clothes and etc."
+         width="153" />
  </layout_panel>
 </layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
index cf174da2f07d2b5dd928f30f8282dbbe78f40050..c1800384a38a6e53b402aed89b24a7dc34291718 100644
--- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -5,8 +5,8 @@
  border="false"
  height="600"
  follows="all"
+ label="Outfit Edit"
  layout="topleft"
- help_topic="edit_outfit"
  left="0"
  min_height="350"
  name="outfit_edit"
@@ -15,28 +15,6 @@
     <string
      name="No Outfit"
      value="No Outfit"/>
-    <string
-     name="unsaved_changes"
-     value="Unsaved Changes"/>
-    <string
-     name="now_editing"
-     value="Now Editing"/>
-    <string
-     name="folder_view_off"
-     value="Hierarchy_View_Disabled"
-     translate="false"/>
-    <string
-     name="folder_view_on"
-     value="Hierarchy_View_On"
-     translate="false"/>
-    <string
-     name="list_view_off"
-     value="List_View_Disabled"
-     translate="false"/>
-    <string
-     name="list_view_on"
-     value="List_View_On"
-     translate="false"/>
 	
 	<panel.string
 		name="not_available">
@@ -47,35 +25,23 @@
 		(unknown)
 	</panel.string>
 
-    <!-- Wearables filtering strings -->
-    <string name="Filter.All" value="All"/>
-    <string name="Filter.Clothes/Body" value="Clothes/Body"/>
-    <string name="Filter.Objects" value="Objects"/>
-    <string name="Filter.Clothing" value="Clothing"/>
-    <string name="Filter.Bodyparts" value="Body parts"/>
-
-    <string
-     name="replace_body_part"
-     value="Click to replace your existing shape"/>
 
     <button
      follows="top|left"
-     height="24"
-     image_hover_unselected="BackButton_Over"
-     image_pressed="BackButton_Press"
-     image_unselected="BackButton_Off"
+     height="23"
+     image_overlay="BackArrow_Off"
      layout="topleft"
      name="back_btn"
      left="5"
      tab_stop="false"
-     top="1"
-     width="30" />
+     top="2"
+     width="23" />
     <text
      follows="top|right"
      font="SansSerifHugeBold"
      height="26"
      layout="topleft"
-     left_pad="10"
+     left_pad="20"
      name="title"
      text_color="LtGray"
      top="0"
@@ -85,448 +51,299 @@
 
 <!-- "HEADER WITH ICON, STATUS TEXT AND OUTFIT NAME" -->
     <panel
-     background_visible="true"
-     bg_alpha_color="DkGray2"
      bevel_style="none"
      follows="top|left|right"
-     height="40"
+     height="45"
+     label="bottom_panel"
      layout="topleft"
-     left="6"
+     left="5"
      name="header_panel"
      top_pad="5" 
-     width="311">
+     width="300">
         <icon
          follows="left|top"
-         height="31"
-         image_name="Shirt_Large"
+         height="40"
+         image_name="t-shirt-image"
          left="2"
          mouse_opaque="false"
          name="outfit_icon"
-         top="2"
+         top="1"
          scale_image="true"
          visible="true"
-         width="31" />
+         width="35" />
             <panel
              bevel_style="none"
              follows="top|right"
-             height="37"
+             height="40"
+             label="bottom_panel"
              layout="topleft"
-             left_pad="5"
+             left_pad="10"
              name="outfit_name_and_status"
              top="2"
-             width="270">
+             width="200">
                 <text
                  follows="top|left|right"
-                 font="SansSerifSmallBold"
+                 font="SansSerif"
                  height="13"
                  layout="topleft"
                  name="status"
-                 text_color="EmphasisColor"
-                 top="2"
-                 value="Now editing..."
+                 text_color="Green"
+                 top="0"
+                 value="Editing..."
                  use_ellipses="true"
-                 width="245" /> 
+                 width="275" /> 
                 <text
                  follows="bottom|left|right"
-                 font="SansSerifLargeBold"
-                 height="18"
+                 font="SansSerifHugeBold"
+                 height="26"
                  layout="topleft"
                  name="curr_outfit_name"
                  text_color="LtGray"
-                 top_pad="2"
+                 top_pad="0"
                  value="[Current Outfit]"
                  use_ellipses="true"
-                 width="245" /> 
-                <loading_indicator
-                 follows="right|top"
-                 height="24"
-                 layout="topleft"
-                 right="-2"
-                 name="edit_outfit_loading_indicator"
-                 top="6"
-                 width="24" />
+                 width="275" /> 
             </panel>
     </panel>
 
 
 <!-- LIST OF WEARABLES (CURRENT OUTFIT/ WEARABLES TO ADD) -->
-<!-- *NOTE: border_size is used to calculate space between layout panels and also to calculate resize bar's height.
-Required height for dragbar (icon in spec) is 10, so resizebar height should be 10 px.
-It is calculated as border_size + 2*UIResizeBarOverlap
--->
     <layout_stack
-     animate="true"
-     border_size="8"
-     clip="false"
+     animate="false"
      default_tab_group="2"
      follows="all"
-     height="465"
-     width="313"
+     height="470"
+     width="300"
      layout="topleft"
      orientation="vertical"
      name="im_panels"
      tab_group="1"
-     top_pad="5"
+     top_pad="10"
      left="5">
         <layout_panel
          layout="topleft"
-         height="187"
-         min_height="155"
+         follows="left|top|right"
+         height="220"
+         label="IM Control Panel"
+         min_height="100"
          name="outfit_wearables_panel"
-         width="313"
+         width="300"
          auto_resize="true"
          user_resize="true">
 
-            <layout_stack
-             animate="true"
-             border_size="0"
-             follows="all"
-             height="185"
-             width="313"
+            <scroll_list
+             width="300"
+             column_padding="0"
+             draw_heading="false"
+             draw_stripes="false"
+             follows="left|top|right|bottom"
              layout="topleft"
-             name="filter_panels"
-             top="0"
-             left="0">
-                <layout_panel
-                 auto_resize="true" 
-                 background_visible="false"
-                 layout="topleft"
-                 height="154"
-                 name="add_button_and_combobox"
-                 width="311"
-                 user_resize="false"
-                 visible="true">
-
-                    <!-- List containing items from the COF and Base outfit -->
-                    <panel
-                     background_visible="false"
-                     class="cof_wearables"
-                     filename="panel_cof_wearables.xml"
-                     follows="all" 
-                     height="129"
-                     layout="topleft"
-                     left="1"
-                     name="cof_wearables_list"
-                     top="0"
-                     width="311" />
-                    
-                    <button
-                     follows="left|bottom" 
-                     height="22"
-                     image_pressed="PushButton_Press"
-                     image_pressed_selected="PushButton_Selected_Press"
-                     image_selected="PushButton_Selected_Press"
-                     is_toggle="true"
-                     label="Add More..."
-                     layout="topleft"
-                     left="2"
-                     name="show_add_wearables_btn"
-                     top_pad="2"
-                     tool_tip="Open/Close"
-                     width="125" />
-
-                    <combo_box
-                     follows="left|right|bottom"
-                     height="22"
-                     layout="topleft"
-                     left_pad="5"
-                     name="list_view_filter_combobox"
-                     top_delta="0"
-                     visible="false"
-                     width="152"/>
-                    <combo_box
-                     follows="left|right|bottom"
-                     height="22"
-                     layout="topleft"
-                     left_delta="0"
-                     name="folder_view_filter_combobox"
-                     top_delta="0"
-                     visible="false"
-                     width="152"/>
-                    
-                    <button
-                     follows="bottom|right"
-                     height="22"
-                     image_overlay="Search_Icon"
-                     image_pressed="PushButton_Press"
-                     image_pressed_selected="PushButton_Selected_Press"
-                     image_selected="PushButton_Selected_Press"
-                     is_toggle="true"
-                     layout="topleft"
-                     name="filter_button"
-                     right="-5"
-                     top_delta="0"
-                     visible="false"
-                     width="20" />
-                </layout_panel>
-
-                <layout_panel
-                 auto_resize="false"
-                 background_visible="true"
-                 bg_alpha_color="DkGray2"
-                 height="30"
-                 name="filter_panel"
-                 width="311"
-                 visible="false"
-                 user_resize="false">
+             name="look_items_list"
+             search_column="1"
+             sort_column="2"
+             left="0"
+             height="193"
+             top="0">
+                <scroll_list.columns
+                 label="Look Item"
+                 name="look_item"
+                 width="285" />
+                <scroll_list.columns
+                 label="Outfit Item Sort"
+                 width="0"
+                 sort_column="look_item_sort"
+                 name="look_item_sort" />
+            </scroll_list>
 
-                    <filter_editor
-		             background_image="TextField_Search_Off"
-		             enabled="true"
-		             follows="left|right|top"
-		             label="Filter Inventory Wearables"
-		             layout="topleft"
-		             left="5"
-		             width="290"
-		             height="25"
-		             name="look_item_filter"
-		             search_button_visible="true"
-		             text_color="black"
-		             visible="true"/>
-                    
-                </layout_panel>
-            </layout_stack>
+            <panel
+             background_visible="true"
+             bevel_style="none"
+             follows="bottom|left|right"
+             height="27"
+             label="bottom_panel"
+             layout="topleft"
+             left="0"
+             name="edit_panel"
+             top_pad="0"
+             width="300">
+                <button
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Left_Over"
+                 image_overlay="OptionsMenu_Off"
+                 image_selected="Toolbar_Left_Selected"
+                 image_unselected="Toolbar_Left_Off"
+                 layout="topleft"
+                 left="0"
+                 name="gear_menu_btn"
+                 top="1"
+                 width="31" />
+                <button
+                 is_toggle="true"
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay="AddItem_Off"
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 layout="topleft"
+                 left_pad="1"
+                 name="add_btn"
+                 top="1"
+                 width="31" />
+                <button
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay=""
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 layout="topleft"
+                 left_pad="1"
+                 name="new_btn"
+                 top="1"
+                 width="31" />
+                <button
+                 follows="bottom|right"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay="TrashItem_Off"
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 layout="topleft"
+                 name="trash_btn"
+                 right="-1"
+                 top="1"
+                 width="31" />
+            </panel>
         </layout_panel>
 
 
         <layout_panel
-         background_visible="false"
-         bg_alpha_color="DkGray2"
          auto_resize="true"
          default_tab_group="3"
-         height="450"
-         min_height="53"
+         height="250" 
+         min_height="120"
          name="add_wearables_panel"
-         width="313"
+         width="300"
          tab_group="2"
          user_resize="true"
          visible="false">
 
-			<!-- this icon represent dragbar between layout panels.
-          	 This is a workaround implemented in EXT-7255 becouse of an issue with layout stack (EXT-7471) -->
-            <icon
+            <text
+             follows="top|left|right"
+             font="SansSerifBold"
+             height="13"
+             layout="topleft"
+             left="5"
+             name="status"
+             text_color="LtGray"
+             top="5"
+             value="Add Wearables"
+             use_ellipses="true"
+             width="275" />
+
+            <filter_editor
+             background_image="TextField_Search_Off"
              follows="left|top|right"
-             height="10"
-             image_name="Dragbar"
-             left="0"
-             top_pad="-9"
-             width="313" />
+             font="SansSerif"
+             label="Filter"
+             layout="topleft"
+             left="5"
+             width="290"
+             height="20"
+             name="look_item_filter"
+             text_color="black"
+             text_pad_left="25" />
 
             <inventory_panel
              allow_multi_select="true"
-             background_visible="false"
              border="false"
              follows="left|top|right|bottom"
-             height="418"
+             height="176"
              layout="topleft"
              left="0"
              mouse_opaque="false"
-             name="folder_view"
-             top_pad="0"
-             width="313"
-             visible="false"/>
+             name="inventory_items"
+             top_pad="5"
+             width="300"/>
+
             <panel
-             name="filtered_wearables_panel"
-             background_opaque="true"
-             background_visible="false"
+             background_visible="true"
+             bevel_style="none"
+             follows="left|right|bottom"
+             height="27"
+             label="add_wearables_button_bar"
              layout="topleft"
-             follows="left|top|right|bottom"
-             border="false"
-             height="418"
              left="0"
-             mouse_opaque="false"
-             width="310"
-             top_delta="0"
-             visible="true">
-                <wearable_items_list
-                 color="0.107 0.107 0.107 1"
-                 name="list_view"
-                 allow_select="true"
+             name="add_wearables_button_bar"
+             top_pad="0"
+             width="300">
+                <button
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Left_Over"
+                 image_overlay="OptionsMenu_Off"
+                 image_selected="Toolbar_Left_Selected"
+                 image_unselected="Toolbar_Left_Off"
                  layout="topleft"
-                 follows="all"
-                 multi_select="true"
-                 width="313"
-                 height="418"
                  left="0"
-                 top="0"/>
+                 name="wearables_gear_menu_btn"
+                 top="1"
+                 width="31" />
+                <button
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay=""
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 label="F"
+                 layout="topleft"
+                 left_pad="1"
+                 name="folder_view_btn"
+                 top="1"
+                 width="31" />
+                <button
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay=""
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 label="L"
+                 layout="topleft"
+                 left_pad="1"
+                 name="list_view_btn"
+                 top="1"
+                 width="31" />
             </panel>
-            <button
-	         follows="bottom|left"
-	         height="22"
-	         left="2"
-	         label="Wear Item"
-	         layout="topleft"
-	         name="plus_btn"
-	         top_pad="5"
-	         width="130" />
-
         </layout_panel>
     </layout_stack>
 
-
-    <!-- BUTTON BAR -->
-    <panel
-     background_visible="true"
-     bevel_style="none"
-     follows="bottom|left|right"
-     height="27"
-     layout="topleft"
-     left="5"
-     name="no_add_wearables_button_bar"
-     top_pad="0"
-     width="313">
-        <button
-         follows="bottom|left"
-         height="25"
-         image_hover_unselected="Toolbar_Left_Over"
-         image_overlay="OptionsMenu_Off"
-         image_selected="Toolbar_Left_Selected"
-         image_unselected="Toolbar_Left_Off"
-         layout="topleft"
-         left="0"
-         name="gear_menu_btn"
-         top="1"
-         width="31" />
-        <icon
-         follows="bottom|left|right"
-         height="25"
-         image_name="Toolbar_Middle_Off"
-         layout="topleft"
-         left_pad="1"
-         name="dummy_right_icon"
-         width="250" />
-        <button
-         follows="bottom|right"
-         height="25"
-         image_hover_unselected="Toolbar_Right_Over"
-         image_overlay="Shop"
-         image_selected="Toolbar_Right_Selected"
-         image_unselected="Toolbar_Right_Off"
-         layout="topleft"
-         left_pad="1"
-         name="shop_btn_1"
-         top="1"
-         tool_tip="Visit the SL Marketplace. You can also select something you are wearing, then click here to see more things like it"
-         width="31" />
-    </panel>
-    
-    
-    <!-- BUTTON BAR - WEARABLES ADDING MODE -->
-    <panel
-     background_visible="true"
-     bevel_style="none"
-     follows="left|right|bottom"
-     height="27"
-     layout="topleft"
-     left="5"
-     name="add_wearables_button_bar"
-     top_delta="0"
-     visible="false"
-     width="313">
-        <button
-         follows="bottom|left"
-         height="25"
-         image_hover_unselected="Toolbar_Left_Over"
-         image_overlay="OptionsMenu_Off"
-         image_selected="Toolbar_Left_Selected"
-         image_unselected="Toolbar_Left_Off"
-         layout="topleft"
-         left="0"
-         name="wearables_gear_menu_btn"
-         top="1"
-         width="31" />
-        <button
-         follows="bottom|left"
-         height="25"
-         image_hover_unselected="Toolbar_Middle_Over"
-         image_overlay="Hierarchy_View_Disabled"
-         image_selected="Toolbar_Middle_Selected"
-         image_unselected="Toolbar_Middle_Off"
-         is_toggle="true"
-         layout="topleft"
-         left_pad="1"
-         name="folder_view_btn"
-         top="1"
-         width="31" />
-        <button
-         follows="bottom|left"
-         height="25"
-         image_hover_unselected="Toolbar_Middle_Over"
-         image_overlay="List_View_On"
-         image_selected="Toolbar_Middle_Selected"
-         image_unselected="Toolbar_Middle_Off"
-         is_toggle="true"
-         layout="topleft"
-         left_pad="1"
-         name="list_view_btn"
-         top="1"
-         width="31" />
-        <icon
-         follows="bottom|left|right"
-         height="25"
-         image_name="Toolbar_Middle_Off"
-         layout="topleft"
-         left_pad="1"
-         name="dummy_right_icon"
-         width="186" >
-        </icon>
-        <button
-         follows="bottom|right"
-         height="25"
-         image_hover_unselected="Toolbar_Right_Over"
-         image_overlay="Shop"
-         image_selected="Toolbar_Right_Selected"
-         image_unselected="Toolbar_Right_Off"
-         layout="topleft"
-         left_pad="1"
-         name="shop_btn_2"
-         top="1"
-         tool_tip="Visit the SL Marketplace. You can also select something you are wearing, then click here to see more things like it"
-         width="31" />
-    </panel>
-    
-    <!-- SAVE AND REVERT BUTTONS -->
     <panel
      follows="left|right|bottom"
      height="30"
      layout="topleft"
-     left="4"
-     top_pad="2"
+     left="5"
+     top_pad="10"
      name="save_revert_button_bar"
      width="300">
         <button
-         follows="bottom|left"
+         follows="bottom|left|right"
          height="23"
          label="Save"
          left="0"
          layout="topleft"
          name="save_btn"
-         top="0"
-         width="155" />
-        <button
-         follows="bottom|left"
-         height="23"
-         name="save_flyout_btn"
-         label=""
-         layout="topleft"
-         left_pad="-20"
-         tab_stop="false"
-         top="0"
-         image_selected="SegmentedBtn_Right_Selected_Press"
-         image_unselected="SegmentedBtn_Right_Off"
-         image_pressed="SegmentedBtn_Right_Press"
-         image_pressed_selected="SegmentedBtn_Right_Selected_Press"
-         image_overlay="Arrow_Small_Up"
-         width="20"/>
+         width="145" />
         <button
          follows="bottom|left|right"
          height="23"
-         left_pad="12"
-         label="Undo Changes"
+         left_pad="15"
+         label="Revert"
          layout="topleft"
          name="revert_btn"
-         top="0"
-         tool_tip="Revert to last saved version"
-         width="147" />
+         width="145" />
     </panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
index 82b69ba8dcecc47375c7e7a3b871792c2ffc6e53..66ed43efecc6cd5c7c3dd3501b4644e611d2fc35 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
@@ -5,98 +5,127 @@
  background_opaque="true"
  background_visible="true"
   follows="all"
- height="575"
+ height="570"
  label="Things"
  layout="topleft"
  min_height="350"
  min_width="240"
  width="320"
  border="false">
-   <panel.string
-     name="wear_outfit_tooltip">
-     Wear selected outfit
-   </panel.string>
-   <panel.string
-     name="wear_items_tooltip">
-     Wear selected items
-   </panel.string>
    <tab_container
      follows="all"
-     height="539"
+     height="501"
      layout="topleft"
-     left="5"
+     left="7"
      name="appearance_tabs"
-     tab_min_width="150"
+     tab_min_width="140"
      tab_height="30"
      tab_position="top"
      halign="center"
-     top="8"
-     width="315">
-         <panel
-           class="outfits_list"
-           filename="panel_outfits_list.xml"
-           height="520"
-           name="outfitslist_tab"
+     width="312">
+         <inventory_panel
            background_visible="true"
+           background_opaque="true"
+           label="MY OUTFITS"
            help_topic="my_outfits_tab"
+           allow_multi_select="true"
            follows="all"
-           label="MY OUTFITS"
-           layout="topleft"
-           width="315" />
-         <panel
-           background_visible="true"
-           bg_alpha_color="DkGray"
-           class="panel_wearing"
-           filename="panel_outfits_wearing.xml"
+           border="false"
+           left="0"
+           top="0"
+           width="315"
+           mouse_opaque="true"
+           name="outfitslist_tab"
+           start_folder="My Outfits" /> 
+         <inventory_panel
            follows="all"
-           height="520"
-           help_topic="now_wearing_tab"
+           background_visible="true"
+           background_opaque="true"
            label="WEARING"
-           layout="topleft"
+           help_topic="now_wearing_tab"
+          allow_multi_select="true"
+           border="false"
+           left="0"
+           top="0"
+           mouse_opaque="true"
            name="cof_tab"
+           start_folder="Current Outfit"
            width="315" />
    </tab_container>
-
-   <panel
+	 <panel
        background_visible="true"
-       follows="bottom|left|right"
-       height="27"
-       layout="topleft"
-       left="9"
-       top_pad="1"
-       visible="true"
-       name="bottom_panel"
-       width="310">
-      <button
-           follows="bottom|left"
-           height="23"
-           label="Save As"
-           left="0"
-           layout="topleft"
-           name="save_btn"
-           top_pad="0"
-           width="155" />
-      <button
-           follows="bottom|left"
-          height="23"
-           name="save_flyout_btn"
-           label=""
-           layout="topleft"
-           left_pad="-20"
-           tab_stop="false"
-           image_selected="SegmentedBtn_Right_Selected_Press"
-           image_unselected="SegmentedBtn_Right_Off"
-           image_pressed="SegmentedBtn_Right_Press"
-           image_pressed_selected="SegmentedBtn_Right_Selected_Press"
-           image_overlay="Arrow_Small_Up"
-           width="20"/>
-      <button
-          follows="bottom|left|right" 
-          height="23" 
-          label="Wear"
-          layout="topleft"
-          name="wear_btn"
-          left_pad="3"
-          width="152" />
-   </panel>
-</panel>
+	  follows="bottom|left"
+	  height="73"
+	  layout="topleft"
+	  left="9"
+	  top_pad="-1"
+	  visible="true"
+	  name="bottom_panel"
+	  width="310">
+        <button
+         follows="bottom|left"
+         tool_tip="Show additional options"
+         height="25"
+         image_hover_unselected="Toolbar_Left_Over"
+         image_overlay="OptionsMenu_Off"
+         image_selected="Toolbar_Left_Selected"
+         image_unselected="Toolbar_Left_Off"
+         layout="topleft"
+         left="1"
+         name="options_gear_btn"
+         top="1"
+         width="31" />
+     <icon
+      follows="bottom|left"
+      height="25"
+      image_name="Toolbar_Middle_Off"
+      layout="topleft"
+      left_pad="1"
+      name="dummy_icon"
+      width="241"
+        />
+
+        <dnd_button
+         follows="bottom|left"
+         height="25"
+         image_hover_unselected="Toolbar_Right_Over"
+          image_overlay="TrashItem_Off"
+          image_selected="Toolbar_Right_Selected"
+          image_unselected="Toolbar_Right_Off"
+         layout="topleft"
+         left_pad="1"
+         name="trash_btn"
+         tool_tip="Remove selected item"
+         width="31"/>
+	 <button
+	  follows="bottom|left"
+		height="23" 
+      label="Save Outfit" 
+      layout="topleft"
+      name="make_outfit_btn"
+      tool_tip="Save appearance as an outfit"
+       top_pad="6"
+       left="0"
+      width="153" />
+     <button
+      follows="bottom|right" 
+      height="23" 
+      label="Wear"
+      layout="topleft"
+      name="wear_btn"
+      left_pad="3"
+      tool_tip="Wear selected outfit"
+      width="152" />
+	 <button
+	  follows="bottom|left"
+		height="23" 
+		label="Edit Outfit" 
+		layout="topleft"
+        right="-140"
+		name="edit_current_outfit_btn"
+        top="26"
+        visible="false" 
+		width="50" />
+	 </panel>
+       
+</panel>
\ No newline at end of file
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index 7cd0d5b5f04a5c50ec08f43cadffb8ea50df86db..6152dd1587f31dd736930f2d7cad03d3129151e8 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <!-- Side tray panel -->
 <panel
- default_tab_group="1"
  follows="all"
  height="449"
  label="People"
@@ -12,32 +11,17 @@
  top="0"
  width="333">
     <string
-     name="no_recent_people"
-     value="No recent people. Looking for people to hang out with? Try [secondlife:///app/search/people Search] or the [secondlife:///app/worldmap World Map]." />
-    <string
-     name="no_filtered_recent_people"
-     value="Didn't find what you're looking for? Try [secondlife:///app/search/people/[SEARCH_TERM] Search]." />
+     name="no_people"
+     value="No people" />
     <string
      name="no_one_near"
-     value="No one nearby. Looking for people to hang out with? Try [secondlife:///app/search/people Search] or the [secondlife:///app/worldmap World Map]." />
-    <string
-     name="no_one_filtered_near"
-     value="Didn't find what you're looking for? Try [secondlife:///app/search/people/[SEARCH_TERM] Search]." />
+     value="No one near" />
     <string
      name="no_friends_online"
      value="No friends online" />
     <string
      name="no_friends"
      value="No friends" />
-    <string
-     name="no_friends_msg">
-         Find friends using [secondlife:///app/search/people Search] or right-click on a Resident to add them as a friend.
-Looking for people to hang out with? Try the [secondlife:///app/worldmap World Map].
-    </string>
-    <string
-     name="no_filtered_friends_msg">
-         Didn't find what you're looking for? Try [secondlife:///app/search/people/[SEARCH_TERM] Search].
-    </string>
     <string
      name="people_filter_label"
      value="Filter People" />
@@ -45,15 +29,15 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
      name="groups_filter_label"
      value="Filter Groups" />
      <!--
-     *WORKAROUND: for group_list.no_items_msg & group_list.no_filtered_items_msg attributes.
+     *WORKAROUND: for group_list.no_groups_msg & group_list.no_filtered_groups_msg attributes.
      They are not defined as translatable in VLT. See EXT-5931
      -->
     <string
      name="no_filtered_groups_msg"
-     value="Didn't find what you're looking for? Try [secondlife:///app/search/groups/[SEARCH_TERM] Search]." />
+     value="[secondlife:///app/search/groups Try finding the group in search?]" />
     <string
      name="no_groups_msg"
-     value="Looking for Groups to join? Try [secondlife:///app/search/groups Search]." />
+     value="[secondlife:///app/search/groups Try searching for some groups to join.]" />
     <filter_editor
      follows="left|top|right"
      height="23"
@@ -72,7 +56,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
      layout="topleft"
      left="5"
      name="tabs"
-     tab_group="1"
      tab_min_width="70"
      tab_height="30"
      tab_position="top"
@@ -95,6 +78,8 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
          width="313">
             <avatar_list
              allow_select="true"
+       		 bg_alpha_color="DkGray2"
+             bg_opaque_color="DkGray2"
              follows="all"
              height="356"
              ignore_online_status="true"
@@ -272,11 +257,14 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
             <text
              follows="all"
              height="450"
-             left="13"
-             name="no_friends_help_text"
+             left="10"
+             name="no_friends_msg"
              top="10"
              width="293"
-             wrap="true" />
+             wrap="true">
+                To add friends try [secondlife:///app/search/people global search] or use right-click on a Resident to add them as a friend.
+If you're looking for people to hang out with, [secondlife:///app/worldmap try the Map].
+             </text>
         </panel>
         <panel
          background_opaque="true"
@@ -297,12 +285,16 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
      Values are set from appropriate strings at the top of file via LLPeoplePanel::postBuild()
     -->
             <group_list
-             allow_select="true" 
+             background_visible="true"
+             bg_alpha_color="DkGray2"
+             bg_opaque_color="DkGray2"
              follows="all"
              height="356"
              layout="topleft"
              left="3"
              name="group_list"
+             no_filtered_groups_msg="[secondlife:///app/search/groups Try finding the group in search?]"
+             no_groups_msg="[secondlife:///app/search/groups Try searching for some groups to join.]"
              top="0"
              width="307" />
             <panel
@@ -379,6 +371,9 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
          width="313">
             <avatar_list
              allow_select="true"
+       		 background_visible="true"
+       		 bg_alpha_color="DkGray2"
+             bg_opaque_color="DkGray2"
              follows="all"
              height="356"
              layout="topleft"
@@ -454,7 +449,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
          name="view_profile_btn"
          tool_tip="Show picture, groups, and other Residents information"
          top="0"
-         width="67" />
+         width="70" />
         <button
          follows="bottom|left"
          left_pad="3"
@@ -463,7 +458,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
          layout="topleft"
          name="im_btn"
          tool_tip="Open instant message session"
-         width="40" />
+         width="43" />
         <button
          follows="bottom|left"
          left_pad="3"
@@ -480,8 +475,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
          label="Share"
          layout="topleft"
          name="share_btn"
-         tool_tip="Share an inventory item"
-         width="65" />
+         width="62" />
         <button
          follows="bottom|left"
          left_pad="3"
diff --git a/indra/newview/skins/default/xui/en/panel_pick_list_item.xml b/indra/newview/skins/default/xui/en/panel_pick_list_item.xml
index 292bd472071bc957c3f75c0cd2d9cf3d3ea8970c..41651edaa02bdae8d8f7dc0751e46632f2aa942d 100644
--- a/indra/newview/skins/default/xui/en/panel_pick_list_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_pick_list_item.xml
@@ -33,7 +33,7 @@
     <texture_picker
      allow_no_texture="true"
      border_enabled="true"
-     fallback_image="default_land_picture.j2c"
+     default_image_name="TabIcon_Places_Large"
      enabled="false"
      follows="left|top"
      height="80"
diff --git a/indra/newview/skins/default/xui/en/panel_place_profile.xml b/indra/newview/skins/default/xui/en/panel_place_profile.xml
index 35e80758966623665c40d42ee93d918a60e21c7c..a43b244fa0970c6530f21fe2911f10c694865626 100644
--- a/indra/newview/skins/default/xui/en/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_place_profile.xml
@@ -2,7 +2,7 @@
 <panel
  background_visible="true"
  follows="all"
- height="610"
+ height="570"
  layout="topleft"
  left="0"
  min_height="350"
@@ -95,77 +95,60 @@
     <!-- Texture names for parcel permissions icons -->
     <string
      name="icon_PG"
-     translate="false"
      value="Parcel_PG_Dark" />
     <string
      name="icon_M"
-     translate="false"
      value="Parcel_M_Dark" />
     <string
      name="icon_R"
-     translate="false"
      value="Parcel_R_Dark" />
     <string
      name="icon_Voice"
-     translate="false"
      value="Parcel_Voice_Dark" />
     <string
      name="icon_VoiceNo"
-     translate="false"
      value="Parcel_VoiceNo_Dark" />
     <string
      name="icon_Fly"
-     translate="false"
      value="Parcel_Fly_Dark" />
     <string
      name="icon_FlyNo"
-     translate="false"
      value="Parcel_FlyNo_Dark" />
     <string
      name="icon_Push"
-     translate="false"
      value="Parcel_Push_Dark" />
     <string
      name="icon_PushNo"
-     translate="false"
      value="Parcel_PushNo_Dark" />
     <string
      name="icon_Build"
-     translate="false"
      value="Parcel_Build_Dark" />
     <string
      name="icon_BuildNo"
-     translate="false"
      value="Parcel_BuildNo_Dark" />
     <string
      name="icon_Scripts"
-     translate="false"
      value="Parcel_Scripts_Dark" />
     <string
      name="icon_ScriptsNo"
-     translate="false"
      value="Parcel_ScriptsNo_Dark" />
     <string
      name="icon_Damage"
-     translate="false"
      value="Parcel_Damage_Dark" />
     <string
      name="icon_DamageNo"
-     translate="false"
      value="Parcel_DamageNo_Dark" />
     <button
      follows="top|right"
-     height="24"
-     image_hover_unselected="BackButton_Over"
-     image_pressed="BackButton_Press"
-     image_unselected="BackButton_Off"
+     height="23"
+     image_overlay="BackArrow_Off"
      layout="topleft"
-     left="8"
+     left="11"
      name="back_btn"
      tool_tip="Back"
      tab_stop="false"
      top="4"
-     width="30" />
+     width="23" />
     <text
      follows="top|left|right"
      font="SansSerifHugeBold"
@@ -174,14 +157,14 @@
      left_pad="10"
      name="title"
      text_color="LtGray"
-     top="4"
+     top="2"
      use_ellipses="true"
      value="Place Profile"
      width="280" />
     <scroll_container
      color="DkGray2"
      follows="all"
-     height="572"
+     height="532"
      layout="topleft"
      left="9"
      name="place_scroll"
@@ -191,7 +174,7 @@
         <panel
          bg_alpha_color="DkGray2"
          follows="left|top|right"
-         height="580"
+         height="540"
          layout="topleft"
          left="0"
          min_height="300"
@@ -200,8 +183,7 @@
          width="310">
             <texture_picker
              enabled="false"
-             fallback_image="default_land_picture.j2c"
-             follows="left|top|right"
+         follows="left|top|right"
              height="197"
              layout="topleft"
              left="11"
@@ -336,24 +318,21 @@
              value="unknown"
              width="268" />
             <accordion
-             fit_parent="true"
              follows="all"
-             height="268"
+             height="223"
              layout="topleft"
-             single_expansion="true"
              left="0"
              name="advanced_info_accordion"
-             top_pad="5"
+             top_pad="10"
              width="313">
                 <accordion_tab
-                 fit_panel="false"
-                 height="175"
+                 height="170"
                  layout="topleft"
                  name="parcel_characteristics_tab"
                  title="Parcel">
                     <panel
                      follows="all"
-                     height="175"
+                     height="160"
                      layout="topleft"
                      left="0"
                      name="parcel_characteristics_panel"
@@ -550,8 +529,8 @@
                          name="about_land_btn"
                          right="-5"
                          tab_stop="false"
-                         top_pad="2"
-                         width="140">
+                         top="138"
+                         width="90">
                             <click_callback
                              function="Floater.Show"
                              parameter="about_land" />
@@ -560,8 +539,7 @@
                 </accordion_tab>
                 <accordion_tab
                  expanded="false"
-                 fit_panel="false"
-                 height="125"
+                 height="150"
                  layout="topleft"
                  name="region_information_tab"
                  title="Region">
@@ -680,8 +658,7 @@
                          name="region_info_btn"
                          right="-5"
                          tab_stop="false"
-                         top_pad="2"
-                         width="180">
+                         width="105">
                             <click_callback
                              function="Floater.Show"
                              parameter="region_info" />
@@ -690,14 +667,13 @@
                 </accordion_tab>
                 <accordion_tab
                  expanded="false"
-                 fit_panel="false"
-                 height="180"
+                 height="190"
                  layout="topleft"
                  name="estate_information_tab"
                  title="Estate">
                     <panel
                      follows="all"
-                     height="180"
+                     height="189"
                      layout="topleft"
                      left="0"
                      name="estate_information_panel"
@@ -780,14 +756,13 @@
                 </accordion_tab>
                 <accordion_tab
                  expanded="false"
-                 fit_panel="false"
-                 height="290"
+                 height="320"
                  layout="topleft"
                  name="sales_tab"
                  title="For Sale">
                     <panel
                      follows="all"
-                     height="290"
+                     height="300"
                      layout="topleft"
                      left="0"
                      name="sales_panel"
diff --git a/indra/newview/skins/default/xui/en/panel_places.xml b/indra/newview/skins/default/xui/en/panel_places.xml
index 638e190e8f6ee2e00415e21dbadf380db0f6865f..c61007a9e1a3fa2a150044074f6f12c5b56c0443 100644
--- a/indra/newview/skins/default/xui/en/panel_places.xml
+++ b/indra/newview/skins/default/xui/en/panel_places.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
 background_visible="true"
- default_tab_group="1"
  follows="all"
  height="570"
  label="Places"
@@ -37,9 +36,7 @@ background_visible="true"
      left="6"
      name="Places Tabs"
      tab_min_width="80"
-     tab_max_width="157"
      tab_height="30"
-     tab_group="1"
      tab_position="top"
      top_pad="10"
      width="315" />
@@ -90,7 +87,6 @@ background_visible="true"
          layout="topleft"
          left_pad="3"
          name="map_btn"
-         tool_tip="Show the corresponding area on the World Map"
          width="85" />
         <button
          follows="bottom|left"
@@ -136,15 +132,5 @@ background_visible="true"
          right="-10"
          top="1"
          width="60" />
-        <button
-         follows="bottom|left"
-         height="23"
-         label="Profile"
-         layout="topleft"
-         name="profile_btn"
-         right="-1"
-         tool_tip="Show place profile"
-         top="1"
-         width="111" />
     </panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
index 31d8ea27d98c65ec993177413172f4cad0e4e253..69e8e6fdcc9f21db7f3bb17b53dcf3821a5de085 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
@@ -93,16 +93,6 @@ Automatic position for:
      layout="topleft"
      name="appearance_camera_movement"
      tool_tip="Use automatic camera positioning while in edit mode"
-     width="242" />
-    <check_box
-     control_name="SidebarCameraMovement"
-     follows="left|top"
-     height="16"
-     initial_value="true"
-     label="Sidebar"
-     layout="topleft"
-     name="appearance_sidebar_positioning"
-     tool_tip="Use automatic camera positioning for sidebar"
      width="242" />
      	<icon
 	 follows="left|top"
@@ -174,10 +164,9 @@ Automatic position for:
      label="Opacity"
      layout="topleft"
      left="80"
-     label_width="156"
+     label_width="60"
      name="bubble_chat_opacity"
-     top_pad = "10"
-     width="347" />
+     width="200" />
     <color_swatch
      can_apply_immediately="true"
      color="0 0 0 1"
@@ -185,7 +174,7 @@ Automatic position for:
      follows="left|top"
      height="50"
      layout="topleft"
-     left_pad="30"
+     left_pad="10"
      top="190"
      name="background"
      tool_tip="Choose color for bubble chat"
@@ -203,10 +192,10 @@ Automatic position for:
    follows="left|top"
    height="12"
    layout="topleft"
-   left="80"
+   left="30"
    name="UI Size:"
-   top_pad="25"
-   width="160">
+   top_pad="5"
+   width="300">
     UI size
   </text>
   <slider
@@ -217,7 +206,7 @@ Automatic position for:
    increment="0.025"
    initial_value="1"
    layout="topleft"
-   left_pad="0"
+   left_delta="52"
    max_val="1.4"
    min_val="0.75"
    name="ui_scale_slider"
@@ -315,7 +304,7 @@ Automatic position for:
  label="Other Devices"
  left="30"
  name="joystick_setup_button"
- top="27"
+ top_pad="12"
  width="155">
     <button.commit_callback
      function="Floater.Show"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
index a69e8d29b0a8807a7c19190d9827558c70cfa861..9eaabbe77b0b519799cb0ccd649dd18eda74e351 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
@@ -348,10 +348,11 @@
        Busy mode response:
     </text>
     <text_editor
-     control_name="BusyModeResponse"
+     control_name="BusyModeResponse2"
       text_readonly_color="LabelDisabledColor"
       bg_writeable_color="LtGray"
       use_ellipses="false"
+      hover="false"
      commit_on_focus_lost = "true"
      follows="left|top|right"
      height="60"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
index f4694180a121d36fc2eebbfba1f2a607f610da69..44c44f5f59cbc2913db57a3208fd430931d6eac4 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
@@ -160,7 +160,7 @@
      layout="topleft"
      left="5"
      name="CustomGraphics Panel"
-     top="76"
+     top="124"
      width="485">
 		<text
 		type="string"
@@ -287,7 +287,7 @@
 		left_delta="2"
 		name="AvatarRenderingText"
 		top_pad="5"
-		width="158">
+		width="128">
 			Avatar rendering:
 		</text>
 		<check_box
@@ -332,26 +332,26 @@
 		increment="8"
 		initial_value="160"
 		label="Draw distance:"
-		label_width="185"
+		label_width="140"
 		layout="topleft"
-		left="200"
+		left="216"
 		max_val="512"
 		min_val="64"
 		name="DrawDistance"
 		top="3"
-		width="296" />
+		width="255" />
 		<text
 		type="string"
 		length="1"
 		follows="left|top"
 		height="12"
 		layout="topleft"
-		left_delta="291"
+		left_delta="250"
 		name="DrawDistanceMeterText2"
 		top_delta="0"
 		width="128">
 			m
-		</text>    
+		</text>
 		<slider
 		control_name="RenderMaxPartCount"
 		decimal_digits="0"
@@ -360,29 +360,13 @@
 		increment="256"
 		initial_value="4096"
 		label="Max. particle count:"
-		label_width="185"
+		label_width="140"
 		layout="topleft"
-		left="200"
+		left="216"
 		max_val="8192"
 		name="MaxParticleCount"
 		top_pad="7"
-		width="303" />
-    <slider
-    control_name="RenderAvatarMaxVisible"
-    decimal_digits="0"
-    follows="left|top"
-    height="16"
-    increment="1"
-    initial_value="12"
-    label="Max. # of non-impostor avatars:"
-    label_width="185"
-    layout="topleft"
-    left_delta="0"
-    max_val="65"
-    min_val="1"
-    name="MaxNumberAvatarDrawn"
-    top_pad="4"
-    width="290" />
+		width="262" />
 		<slider
 		control_name="RenderGlowResolutionPow"
 		decimal_digits="0"
@@ -391,15 +375,15 @@
 		increment="1"
 		initial_value="8"
 		label="Post process quality:"
-		label_width="185"
+		label_width="140"
 		layout="topleft"
-		left="200"
+		left_delta="0"
 		max_val="9"
 		min_val="8"
 		name="RenderPostProcess"
 		show_text="false"
 		top_pad="4"
-		width="264">
+		width="223">
 			<slider.commit_callback
 			function="Pref.UpdateSliderText"
 			parameter="PostProcessText" />
@@ -423,14 +407,14 @@
 		increment="0.125"
 		initial_value="160"
 		label="  Objects:"
-		label_width="185"
+		label_width="140"
 		layout="topleft"
 		left_delta="0"
 		max_val="2"
 		name="ObjectMeshDetail"
 		show_text="false"
 		top_pad="6"
-		width="264">
+		width="223">
 			<slider.commit_callback
 			function="Pref.UpdateSliderText"
 			parameter="ObjectMeshDetailText" />
@@ -441,13 +425,13 @@
 		height="16"
 		initial_value="160"
 		label="  Flexiprims:"
-		label_width="185"
+		label_width="140"
 		layout="topleft"
 		left_delta="0"
 		name="FlexibleMeshDetail"
 		show_text="false"
 		top_pad="4"
-		width="264">
+		width="223">
 			<slider.commit_callback
 			function="Pref.UpdateSliderText"
 			parameter="FlexibleMeshDetailText" />
@@ -459,13 +443,13 @@
         increment="0.125"
         initial_value="160"
         label="  Trees:"
-        label_width="185"
+        label_width="140"
         layout="topleft"
         left_delta="0"
         name="TreeMeshDetail"
         show_text="false"
         top_pad="4"
-        width="264">
+        width="223">
            <slider.commit_callback
             function="Pref.UpdateSliderText"
             parameter="TreeMeshDetailText" />
@@ -477,13 +461,13 @@
         increment="0.125"
         initial_value="160"
         label="  Avatars:"
-        label_width="185"
+        label_width="140"
         layout="topleft"
         left_delta="0"
         name="AvatarMeshDetail"
         show_text="false"
         top_pad="4"
-        width="264">
+        width="223">
            <slider.commit_callback
             function="Pref.UpdateSliderText"
             parameter="AvatarMeshDetailText" />
@@ -495,7 +479,7 @@
         increment="0.125"
         initial_value="160"
         label="  Terrain:"
-        label_width="185"
+        label_width="140"
         layout="topleft"
         left_delta="0"
         max_val="2"
@@ -503,7 +487,7 @@
         name="TerrainMeshDetail"
         show_text="false"
         top_pad="4"
-        width="264">
+        width="223">
            <slider.commit_callback
             function="Pref.UpdateSliderText"
             parameter="TerrainMeshDetailText" />
@@ -517,7 +501,7 @@
         increment="8"
         initial_value="160"
         label="  Sky:"
-        label_width="185"
+        label_width="140"
         layout="topleft"
         left_delta="0"
         max_val="128"
@@ -525,7 +509,7 @@
         name="SkyMeshDetail"
         show_text="false"
         top_pad="4"
-        width="264">
+        width="223">
            <slider.commit_callback
             function="Pref.UpdateSliderText"
             parameter="SkyMeshDetailText" />
@@ -536,9 +520,9 @@
         follows="left|top"
         height="12"
         layout="topleft"
-        left="469"
+        left="444"
         name="PostProcessText"
-        top="60"
+        top="305"
         width="128">
            Low
         </text>
@@ -621,9 +605,9 @@
         follows="left|top"
         height="12"
         layout="topleft"
-        left="200"
+        left_delta="-230"
         name="LightingDetailText"
-        top_pad="18"
+        top_pad="8"
         width="140">
            Lighting detail:
         </text>
@@ -632,13 +616,15 @@
         draw_border="false"
         height="38"
         layout="topleft"
+        left_delta="0"
         name="LightingDetailRadio"
         top_pad="5"
-        width="200">
+        width="321">
            <radio_item
             height="16"
             label="Sun and moon only"
             layout="topleft"
+            left="3"
             name="SunMoon"
             value="0"
             top="3"
@@ -647,6 +633,7 @@
             height="16"
             label="Nearby local lights"
             layout="topleft"
+            left_delta="0"
             name="LocalLights"
             value="1"
             top_delta="16"
@@ -658,9 +645,9 @@
         follows="left|top"
         height="12"
         layout="topleft"
-        left_pad="-30"
+        left="358"
         name="TerrainDetailText"
-        top="226"
+        top="465"
         width="155">
            Terrain detail:
         </text>
@@ -672,21 +659,23 @@
         left_delta="0"
         name="TerrainDetailRadio"
         top_pad="5"
-        width="70">
+        width="321">
            <radio_item
             height="16"
             label="Low"
             layout="topleft"
+            left="3"
             name="0"
             top="3"
-            width="50" />
+            width="315" />
            <radio_item
             height="16"
             label="High"
             layout="topleft"
+            left_delta="0"
             name="2"
             top_delta="16"
-            width="50" />
+            width="315" />
         </radio_group>
 	</panel>
 	
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
index 2c6ceeef2e3df40ce5fa80c5c2602f2b5d876e83..500e65b916c63400894585fca84267091945657b 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
@@ -374,5 +374,5 @@
    min_val="10"
    name="web_proxy_port"
    top_delta="0"
-   width="145" />
+   width="140" />
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml
index fc33836c79d8b28c64d9fc65461b453a8cf5ff67..a666608103315ba1f6f9f347f32a33f76f918f64 100644
--- a/indra/newview/skins/default/xui/en/panel_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile.xml
@@ -83,7 +83,6 @@
                allow_no_texture="true"
                default_image_name="None"
                enabled="false"
-               fallback_image="Generic_Person_Large"
                follows="top|left"
                height="124"
                layout="topleft"
@@ -131,7 +130,6 @@
                allow_no_texture="true"
                default_image_name="None"
                enabled="false"
-               fallback_image="Generic_Person_Large"
                follows="top|left"
                height="124"
                layout="topleft"
@@ -391,6 +389,14 @@
          name="edit_profile_btn"
          tool_tip="Edit your personal information"
          width="130" />
+        <button
+         follows="bottom|right"
+         height="23"
+         label="Edit Appearance"
+         left_pad="10"
+         name="edit_appearance_btn"
+         tool_tip="Create/edit your appearance: physical data, clothes and etc."
+         width="130" />
         </layout_panel>
 
 </layout_stack>
diff --git a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml
index a8cd380f2045a1c488fd47728b2d7144fc73d29e..f9c86fc75b739de40a411e9a70ccc1f32fd35523 100644
--- a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml
+++ b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
- height="157"
+ height="152"
  layout="topleft"
  left="0"
  name="LLScrollingPanelParam"
@@ -10,29 +10,25 @@
      follows="left|top"
      height="16"
      layout="topleft"
-     left="12"
+     left="4"
      name="min param text"
-     text_color="White"
-     font_shadow="hard"
-     top="120"
-     width="120" />
+     top="116"
+     width="128" />
     <text
      follows="left|top"
      height="16"
      layout="topleft"
-     left="155"
+     left_pad="6"
      name="max param text"
-     text_color="White" 
-     font_shadow="hard"
      top_delta="0"
-     width="120" />
+     width="128" />
     <text
      type="string"
      length="1"
      follows="left|top"
      height="16"
      layout="topleft"
-     left="12"
+     left="8"
      name="Loading..."
      top="11"
      width="128">
@@ -44,7 +40,7 @@
      follows="left|top"
      height="16"
      layout="topleft"
-     left="155"
+     left_pad="6"
      name="Loading...2"
      top_delta="0"
      width="128">
@@ -53,30 +49,30 @@
     <view_border 
      layout="topleft"
      follows="left|top"
-     left="7"
-     top="5"
+     left="2"
+     top="0"
      width="132"
      height="132"
      thickness="2"
-     shadow_light_color="0.3 0.3 0.3 1"
-     highlight_light_color="0.3 0.3 0.3 1"
-     highlight_dark_color="0.3 0.3 0.3 1"
-     shadow_dark_color="0.3 0.3 0.3 1"
+     shadow_light_color="LtGray_50"
+     highlight_light_color="LtGray_50"
+     highlight_dark_color="LtGray_50"
+     shadow_dark_color="LtGray_50"
      bevel_style="in"
      name="left_border"
     />
     <view_border 
      layout="topleft"
      follows="left|top"
-     left_pad="10"
+     left_pad="2"
      top_delta="0"
      width="132"
      height="132"
      thickness="2"
-     shadow_light_color="0.3 0.3 0.3 1"
-     highlight_light_color="0.3 0.3 0.3 1"
-     highlight_dark_color="0.3 0.3 0.3 1"
-     shadow_dark_color="0.3 0.3 0.3 1"
+     shadow_light_color="LtGray_50"
+     highlight_light_color="LtGray_50"
+     highlight_dark_color="LtGray_50"
+     shadow_dark_color="LtGray_50"
      bevel_style="in"
      name="right_border"
     />
@@ -88,10 +84,10 @@
      image_selected="PushButton_Selected"
      image_unselected="PushButton_Off"
      layout="topleft"
-     left="7"
+     left="2"
      name="less"
      tab_stop="false"
-     top="5"
+     top="0"
      width="132" />
     <button
      enabled="false"
@@ -101,7 +97,7 @@
      image_selected="PushButton_Selected"
      image_unselected="PushButton_Off"
      layout="topleft"
-     left_pad="10"
+     left_pad="2"
      name="more"
      tab_stop="false"
      top_delta="0"
@@ -114,11 +110,11 @@
      increment="1"
      initial_value="0"
      label="[DESC]"
-     layout="bottom|left"
+     label_width="100"
+     layout="topleft"
      left="6"
      max_val="100"
      name="param slider"
-     bottom="1"
-     width="274" 
-     slider_label.font.style="BOLD" />
+     top="134"
+     width="258" />
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml
index 43513e1ab6a5e09a7df4bbc118407e1ff8905293..c2624ce0d05338473046f3bcfc7081c978a81179 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -41,50 +41,41 @@
      name="buycurrencylabel">
         L$ [AMT]
     </panel.string>
-  <panel
-    height="18"
-    left="-315"
-    width="95"
-    top="1"
-    follows="right|top" 
-    name="balance_bg" 
-    bg_visible="true"
-    background_opaque="true" 
-    bg_opaque_image="bevel_background">
-    <text
+    <button
      auto_resize="true"
-     halign="center"
+     halign="right"
      font="SansSerifSmall"
-     follows="all"
-     height="18"
-     left="0" 
-     name="balance"
+     follows="right|top"
+     image_overlay=""
+     image_selected="spacer35.tga"
+     image_unselected="spacer35.tga"
+     image_pressed="spacer35.tga"
+     height="16"
+     right="-230"
+     label_shadow="false"
+     name="buycurrency"
      tool_tip="My Balance"
-     v_pad="4"
-     top="0"
-     wrap="false" 
-     value="L$20" 
-     width="40" />
+     top="3"
+     width="120" />
     <button
      auto_resize="true"
-     halign="center"
+     halign="right"
      font="SansSerifSmall"
-     follows="right|top|bottom"
-     image_hover_unselected="buy_over"
-     image_unselected="buy_off"
-     image_pressed="buy_press"
-     height="18"
-     label="BUY L$"
-     label_color="White"
+     follows="right|top"
+     image_selected="spacer35.tga"
+     image_unselected="spacer35.tga"
+     image_pressed="spacer35.tga"
+     height="16"
+     label="Buy L$"
+     label_color="EmphasisColor"
      left_pad="0"
-     label_shadow="true"
+     label_shadow="false"
      name="buyL"
-     pad_right="0"
+     pad_right="20"
      pad_bottom="2"
      tool_tip="Click to buy more L$"
-     top="0"
+     top="2"
      width="55" />
-  </panel>
     <text
      type="string"
      font="SansSerifSmall"
@@ -97,7 +88,7 @@
      left_pad="0"
      name="TimeText"
      tool_tip="Current time (Pacific)"
-     width="145">
+     width="100">
         24:00 AM PST
     </text>
     <button
@@ -108,7 +99,7 @@
      image_pressed="Pause_Press"
      image_pressed_selected="Play_Press"
      is_toggle="true"
-     left_pad="15"
+     left_pad="20"
      top="1"
      name="media_toggle_btn"
      tool_tip="Start/Stop All Media (Music, Video, Web pages)"
@@ -121,12 +112,12 @@
      image_pressed="Audio_Press"
      image_unselected="Audio_Off"
      is_toggle="true"
-     left_pad="5"
+     left_pad="10"
      top="2"
      name="volume_btn"
      tool_tip="Global Volume Control"
      width="16" />
-    <text
+  <!--  <text
      follows="right|top"
      halign="center"
      height="12"
@@ -134,5 +125,5 @@
      left_delta="0"
      name="stat_btn"
      top_delta="0"
-     width="20"/>
+     width="20"/>-->
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history.xml b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
index b48c5d1f8ad43084a6c7ef483d0c0dd66ee7a070..21addb8e6fe9f80fed2e17ea768261aefe43aba4 100644
--- a/indra/newview/skins/default/xui/en/panel_teleport_history.xml
+++ b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
@@ -11,15 +11,9 @@
      left="3"
      top="0"
      name="history_accordion"
-     background_visible="true"
-     bg_alpha_color="DkGray2"
+   background_visible="true"
+   bg_alpha_color="DkGray2"
      width="307">
-        <no_matched_tabs_text
-         name="no_matched_teleports_msg"
-         value="Didn't find what you're looking for? Try [secondlife:///app/search/places/[SEARCH_TERM] Search]." />
-        <no_visible_tabs_text
-         name="no_teleports_msg"
-         value="Teleport history is empty. Try [secondlife:///app/search/places/ Search]." />
 	    <accordion_tab
          layout="topleft"
          name="today"
diff --git a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
index 02ab0ffee5d7533a438b842023e9fb18b2ecc248..c5efa2e22188aa8f64ffbee7962a7dfdfe72905a 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
 background_visible="true"
-default_tab_group="1"
 follows="all"
 height="570"
 label="Outfits"
@@ -15,97 +14,63 @@ width="333">
    <string
    name="No Outfit"
    value="No Outfit" />
-   <string
-   name="Unsaved Changes"
-   value="Unsaved changes" />
-   <string
-   name="Now Wearing"
-   value="Now wearing..." />
-   <string
-   name="Changing outfits"
-   value="Changing outfits" />
    <panel
-   background_opaque="true"
-   background_visible="true"
-   bg_opaque_color="DkGray2"
-   left="10"
-   top="5"
-   follows="left|top|right"
+   left="0"
+   top="0"
+   follows="all"
    layout="topleft"
-   width="303"
+   width="330"
    height="33"
    name="panel_currentlook"
    >
       <button
       follows="left|top"
-      left="205" top="7" width="20" height="20"
-      label="E"
+      top="0"  width="1" height="1"
       layout="topleft"
-      name="editappearance_btn"
-      visible="false" />
+      left="0"
+      name="editappearance_btn" />
       <button
       follows="left|top"
-      left="235" top="7" width="20" height="20"
-      label="O"
+      top="0"  width="1" height="1"
       layout="topleft"
-      name="openoutfit_btn"
-      visible="false" />
+      left="0"
+      name="openoutfit_btn" />
       <icon
       follows="top|left"
-      height="31"
-      image_name="Shirt_Large"
+      height="24"
+      image_name="TabIcon_Appearance_Off"
       name="outfit_icon"
       mouse_opaque="false"
       visible="true"
-      left="1"
+      left="9"
       top="0"
-      width="31" />
-      <text
-      font="SansSerifSmall"
-      text_color="EmphasisColor"
-      width="300"
-      height="10"
-      follows="top|left"
-      layout="topleft"
-      left="35"
-      top="3"
-      mouse_opaque="false"
-      name="currentlook_status" >
-      (Status)
-      </text>
+      width="24" />
       <text
-      font="SansSerifLargeBold"
+      font="SansSerifHugeBold"
       height="20"
-      left="35"
-      text_color="White"
-      top="15"
+      left_pad="5"
+      text_color="LtGray"
+      top="0"
       use_ellipses="true"
-      width="230"
+      width="305"
       follows="top|left"
-      word_wrap="false"
+      word_wrap="true"
       mouse_opaque="false"
       name="currentlook_name">
       MyOutfit With a really Long Name like MOOSE
       </text>
-      <button
-      follows="left|top"
-      height="28"
-      image_overlay="Edit_Wrench"
-      label=""
-      layout="topleft"
-      left="265"
-      name="edit_outfit_btn"
-      tool_tip="Edit this outfit"
-      top="3"
-      width="28" />
-      <loading_indicator
-      follows="left|top"
-      height="24"
+      <text
+      font="SansSerifSmall"
+      text_color="White_50"
+      width="300"
+      height="1"
+      follows="top|left"
       layout="topleft"
-      left="268"
-      name="wearables_loading_indicator"
-      top="6"
-      width="24" />
+      top_pad="5"
+      mouse_opaque="false"
+      name="currentlook_title" >
+      (unsaved)
+       </text>
    </panel>
    <filter_editor
    height="23"
@@ -115,19 +80,16 @@ width="333">
    label="Filter Outfits"
    max_length="300"
    name="Filter"
-   search_button_visible="true"
    top_pad="10"
    width="303" />
    <panel
    class="panel_outfits_inventory"
    filename="panel_outfits_inventory.xml"
    name="panel_outfits_inventory"
-   height="493"
+   height="505"
    min_height="410"
    width="320"
-   visible="false"
    left="0"
-   tab_group="1"
    top_pad="6"
    follows="all" />
   <!--   <button
@@ -142,13 +104,13 @@ width="333">
    <panel
    class="panel_outfit_edit"
    filename="panel_outfit_edit.xml"
-   height="565"
+   height="550"
    follows="all"
    layout="topleft"
    left="5"
    min_height="410"
    name="panel_outfit_edit"
-   top="2"
+   top="5"
    visible="false" 
    width="320"/>
    <panel
diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
index 49b252174cfb7711331a963392112b2a438fb57e..b840fdd31b1afaf0a9bff4371885cb8d04f85983 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
@@ -1,10 +1,12 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
+	 auto_tile="true"
 	 height="570"
 	 layout="topleft"
 	 name="item properties"
 	 help_topic="item_properties"
-	 title="Item Profile"
+	 save_rect="true"
+	 title="Object Profile"
 	 width="333">
 	<panel.string
 		 name="unknown">
@@ -26,14 +28,6 @@
     	 name="acquiredDate">
         [wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
-	<panel.string
-		 name="origin_inventory">
-        (Inventory)
-	</panel.string>
-	<panel.string
-		 name="origin_inworld">
-        (Inworld)
-	</panel.string>
 	<icon
      	 follows="top|right"
      	 height="18"
@@ -46,45 +40,42 @@
 	     width="18" />
     <button
      follows="top|right"
-     height="24"
-     image_hover_unselected="BackButton_Over"
-     image_pressed="BackButton_Press"
-     image_unselected="BackButton_Off"
+     height="23"
+     image_overlay="BackArrow_Off"
      layout="topleft"
-     left="12"
+     left="14"
      name="back_btn"
      tab_stop="false"
      top="2"
-     width="30" />
+     width="23" />
     <text
      follows="top|left|right"
      font="SansSerifHugeBold"
      height="26"
      layout="topleft"
-     left_pad="3"
+     left_pad="10"
      name="title"
      text_color="LtGray"
-     top="2"
+     top="0"
      use_ellipses="true"
-     value="Item Profile"
+     value="Object Profile"
      width="275" />
     	    <text
      follows="top|left"
      height="13"
      layout="topleft"
      left="45"
-     name="origin"
+     name="where"
      text_color="LtGray_50"
      value="(Inventory)"
      width="150" />
 	<panel
          follows="all"
          height="493"
-         help_topic=""
          label=""
          layout="topleft"
          left="9"
-         name="item_profile"
+         help_topic=""
          top="45"
          width="313"
    background_visible="true"
@@ -166,49 +157,51 @@
 		     name="LabelCreatorName"
 		     top_delta="6"
 		     width="140">
-      </text>
-      <button
-      follows="top|right"
-      height="16"
-    image_selected="Inspector_I"
-    image_unselected="Inspector_I"
-      layout="topleft"
-      right="-5"
-      name="BtnCreator"
-      top_delta="-6"
-      width="16" />
-      <text
-      type="string"
-      length="1"
-      follows="left|top"
-      height="23"
-      layout="topleft"
-        left="5"
-      name="LabelOwnerTitle"
-        top_pad="10"
-      width="78">
-        Owner:
-      </text>
-      <avatar_icon
-        follows="top|left"
-        height="20"
-        default_icon_name="Generic_Person"
-        layout="topleft"
-        left_pad="0"
-        top_delta="-6"
-        mouse_opaque="true"
-        width="20" />
-      <text
-      type="string"
-        follows="left|right|top"
-        font="SansSerifSmall"
-        height="15"
-        layout="topleft"
-        left_pad="5"
-      name="LabelOwnerName"
-      top_delta="6"
-      width="140">
-      </text>
+	        Nicole Linden
+	     </text>
+	     <button
+			 follows="top|right"
+			 height="16"
+     image_selected="Inspector_I"
+     image_unselected="Inspector_I"
+			 layout="topleft"
+			 right="-5"
+			 name="BtnCreator"
+			 top_delta="-6"
+			 width="16" />
+	     <text
+			 type="string"
+			 length="1"
+			 follows="left|top"
+			 height="23"
+			 layout="topleft"
+			   left="5"
+			 name="LabelOwnerTitle"
+			   top_pad="10"
+			 width="78">
+			    Owner:
+	     </text>
+	     <avatar_icon
+			   follows="top|left"
+			   height="20"
+			   default_icon_name="Generic_Person"
+			   layout="topleft"
+			   left_pad="0"
+			   top_delta="-6"
+			   mouse_opaque="true"
+			   width="20" />
+	     <text
+			 type="string"
+			   follows="left|right|top"
+			   font="SansSerifSmall"
+			   height="15"
+			   layout="topleft"
+			   left_pad="5"
+			 name="LabelOwnerName"
+			 top_delta="6"
+			 width="140">
+			    Thrax Linden
+	     </text>
 	     <button
 			 follows="top|right"
 			 height="16"
@@ -241,6 +234,7 @@ top_pad="10"
 			 name="LabelAcquiredDate"
 			 top_delta="0"
 			 width="222">
+			Wed May 24 12:50:46 2006
       </text>
 	 <panel
          border="false"
@@ -399,7 +393,7 @@ top_pad="10"
 			    label_width="75"
 			    left="120"
 			    width="170"
-			    min_val="0"
+			    min_val="1"
 			    height="23"
 			    max_val="999999999"
 			    top_pad="10"/>
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 048de700453757122b2c52a39dd3e780a62b8896..0c73b8d7692eef339fb731053adee4e7e10e170c 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -46,13 +46,6 @@
 	<string name="LoginWaitingForRegionHandshake">Waiting for region handshake...</string>
 	<string name="LoginConnectingToRegion">Connecting to region...</string>
 	<string name="LoginDownloadingClothing">Downloading clothing...</string>
-        <string name="InvalidCertificate">The server returned an invalid or corrupt certificate. Please contact the Grid administrator.</string>
-        <string name="CertInvalidHostname">An invalid hostname was used to access the server, please check your SLURL or Grid hostname.</string>
-        <string name="CertExpired">The certificate returned by the Grid appears to be expired.  Please check your system clock, or contact your Grid administrator.</string>
-        <string name="CertKeyUsage">The certificate returned by the server could not be used for SSL.  Please contact your Grid administrator.</string>
-        <string name="CertBasicConstraints">Too many certificates were in the servers Certificate chain.  Please contact your Grid administrator.</string>
-        <string name="CertInvalidSignature">The certificate signature returned by the Grid server could not be verified.  Please contact your Grid administrator.</string>
-
 	<string name="LoginFailedNoNetwork">Network Error: Could not establish connection, please check your network connection.</string>
 	<string name="LoginFailed">Login failed.</string>
 	<string name="Quit">Quit</string>
@@ -67,7 +60,7 @@
 	<string name="SentToInvalidRegion">You were sent to an invalid region.</string>
 	<string name="TestingDisconnect">Testing viewer disconnect</string>
 
-	<!-- Tooltip -->
+	<!-- Tooltip, lltooltipview.cpp -->
 	<string name="TooltipPerson">Person</string><!-- Object under mouse pointer is an avatar -->
 	<string name="TooltipNoName">(no name)</string> <!-- No name on an object -->
 	<string name="TooltipOwner">Owner:</string> <!-- Owner name follows -->
@@ -83,7 +76,6 @@
 	<string name="TooltipFlagNoScripts">No Scripts</string>
 	<string name="TooltipLand">Land:</string>
 	<string name="TooltipMustSingleDrop">Only a single item can be dragged here</string>
-	<string name="TooltipPrice" value="L$[AMOUNT]: "/>
 
 	<!-- tooltips for Urls -->
 	<string name="TooltipHttpUrl">Click to view this web page</string>
@@ -104,6 +96,8 @@
 	<string name="TooltipMapUrl">Click to view this location on a map</string>
 	<string name="TooltipSLAPP">Click to run the secondlife:// command</string>
 	<string name="CurrentURL" value=" CurrentURL: [CurrentURL]" />	
+  <string name="TooltipPrice" value=" L$[PRICE]-" />
+  
 
 	<!-- text for SLURL labels -->
 	<string name="SLurlLabelTeleport">Teleport to</string>
@@ -120,7 +114,7 @@
 	<!-- ButtonToolTips, llfloater.cpp -->
 	<string name="BUTTON_CLOSE_DARWIN">Close (&#8984;W)</string>
 	<string name="BUTTON_CLOSE_WIN">Close (Ctrl+W)</string>
-	<string name="BUTTON_CLOSE_CHROME">Close</string>
+	<string name="BUTTON_CLOSE_CHROME">Close</string>>
 	<string name="BUTTON_RESTORE">Restore</string>
 	<string name="BUTTON_MINIMIZE">Minimize</string>
 	<string name="BUTTON_TEAR_OFF">Tear Off</string>
@@ -135,8 +129,7 @@
 	<string name="RetrievingData">Retrieving...</string>
 
 	<string name="ReleaseNotes">Release Notes</string>
-	<!-- Always mark translate="false" for strings that are nothing but URLs, as they don't need translation. -->
-	<string name="RELEASE_NOTES_BASE_URL" translate="false">http://wiki.secondlife.com/wiki/Release_Notes/</string>
+	<string name="RELEASE_NOTES_BASE_URL">http://secondlife.com/app/releasenotes/</string>
 
 	<!-- Indicates something is being loaded. Maybe should be merged with RetrievingData -->
 	<string name="LoadingData">Loading...</string>
@@ -155,8 +148,6 @@
 	<!-- Group name: text shown for LLUUID::null -->
 	<string name="GroupNameNone">(none)</string>
 
-	<string name="AvalineCaller">Avaline Caller [ORDER]</string>
-
 	<!-- Asset errors. Used in llassetstorage.cpp, translation from error code to error message. -->
 	<string name="AssetErrorNone">No error</string>
 	<string name="AssetErrorRequestFailed">Asset request: failed</string>
@@ -278,7 +269,6 @@
 	<!-- world map -->
 	<string name="texture_loading">Loading...</string>
 	<string name="worldmap_offline">Offline</string>
-	<string name="worldmap_item_tooltip_format">[AREA] m² L$[PRICE]</string>
 	<string name="worldmap_results_none_found">None found.</string>
 
 	<!-- animations uploading status codes -->
@@ -319,10 +309,6 @@
 	<!-- For use when we do not have land type back from the server -->
 	<string name="land_type_unknown">(unknown)</string>
 
-	<!-- For land type back from the simulator -->
-	<string name="Estate / Full Region">Estate / Full Region</string>
-	<string name="Mainland / Full Region">Mainland / Full Region</string>
-
 	<!-- File load/save dialogs -->
 	<string name="all_files">All Files</string>
 	<string name="sound_files">Sounds</string>
@@ -1813,40 +1799,7 @@ Clears (deletes) the media and all params from the given face.
 	<string name="skirt">Skirt</string>
 	<string name="alpha">Alpha</string>
 	<string name="tattoo">Tattoo</string>
-  <string name="invalid">invalid</string>
-  <string name="none">none</string>
-  
-  <!-- Not Worn Wearable Types -->
-	<string name="shirt_not_worn">Shirt not worn</string>
-	<string name="pants_not_worn">Pants not worn</string>
-	<string name="shoes_not_worn">Shoes not worn</string>
-	<string name="socks_not_worn">Socks not worn</string>
-	<string name="jacket_not_worn">Jacket not worn</string>
-	<string name="gloves_not_worn">Gloves not worn</string>
-	<string name="undershirt_not_worn">Undershirt not worn</string>
-	<string name="underpants_not_worn">Underpants not worn</string>
-	<string name="skirt_not_worn">Skirt not worn</string>
-	<string name="alpha_not_worn">Alpha not worn</string>
-	<string name="tattoo_not_worn">Tattoo not worn</string>
-	<string name="invalid_not_worn">invalid</string>
-
-	<!-- Create new wearable of the specified type -->
-	<string name="create_new_shape">Create new shape</string>
-	<string name="create_new_skin">Create new skin</string>
-	<string name="create_new_hair">Create new hair</string>
-	<string name="create_new_eyes">Create new eyes</string>
-	<string name="create_new_shirt">Create new shirt</string>
-	<string name="create_new_pants">Create new pants</string>
-	<string name="create_new_shoes">Create new shoes</string>
-	<string name="create_new_socks">Create new socks</string>
-	<string name="create_new_jacket">Create new jacket</string>
-	<string name="create_new_gloves">Create new gloves</string>
-	<string name="create_new_undershirt">Create new undershirt</string>
-	<string name="create_new_underpants">Create new underpants</string>
-	<string name="create_new_skirt">Create new skirt</string>
-	<string name="create_new_alpha">Create new alpha</string>
-	<string name="create_new_tattoo">Create new tattoo</string>
-	<string name="create_new_invalid">invalid</string>
+	<string name="invalid">invalid</string>
 
   <!-- Wearable List-->
   <string name="NewWearable">New [WEARABLE_ITEM]</string>
@@ -1887,8 +1840,7 @@ Clears (deletes) the media and all params from the given face.
 	<string name="LeaveMouselook">Press ESC to return to World View</string>
 
 	<!-- inventory -->
-	<string name="InventoryNoMatchingItems">Didn't find what you're looking for? Try [secondlife:///app/search/all/[SEARCH_TERM] Search].</string>
-	<string name="PlacesNoMatchingItems">Didn't find what you're looking for? Try [secondlife:///app/search/places/[SEARCH_TERM] Search].</string>
+	<string name="InventoryNoMatchingItems">No matching items found in inventory.  Try [secondlife:///app/search/groups "Search"].</string>
 	<string name="FavoritesNoMatchingItems">Drag a landmark here to add it to your favorites.</string>
 	<string name="InventoryNoTexture">You do not have a copy of this texture in your inventory</string>
     <!-- use value="" because they have preceding spaces -->
@@ -1914,10 +1866,8 @@ Clears (deletes) the media and all params from the given face.
 	<string name="AnimFlagStop"  value=" Stop Animation :    " />
 	<string name="AnimFlagStart" value=" Start Animation :   " />
 	<string name="Wave"          value=" Wave " />
-	<string name="GestureActionNone" value="None" />
 	<string name="HelloAvatar"   value=" Hello, avatar! " />
 	<string name="ViewAllGestures"  value="  View All &gt;&gt;" />
-	<string name="GetMoreGestures"  value="  Get More &gt;&gt;" />
 
 	<!-- inventory filter -->
     <!-- use value="" because they have preceding spaces -->
@@ -1957,12 +1907,8 @@ Clears (deletes) the media and all params from the given face.
 	<string name="InvFolder Uncompressed Sounds">Uncompressed Sounds</string>
 	<string name="InvFolder Animations">Animations</string>
 	<string name="InvFolder Gestures">Gestures</string>
-	<string name="InvFolder Favorite">Favorites</string>
-  <!-- historically default name of the Favorites folder can start from either "f" or "F" letter.
-  We should localize both of them with the same value -->
 	<string name="InvFolder favorite">Favorites</string>
 	<string name="InvFolder Current Outfit">Current Outfit</string>
-	<string name="InvFolder Initial Outfits">Initial Outfits</string>
 	<string name="InvFolder My Outfits">My Outfits</string>
 	<string name="InvFolder Accessories">Accessories</string>
 
@@ -2103,7 +2049,6 @@ Clears (deletes) the media and all params from the given face.
 	<string name="SummaryForTheWeek"    value="Summary for this week, beginning on " />
 	<string name="NextStipendDay"       value="The next stipend day is " />
 	<string name="GroupIndividualShare" value="                      Group       Individual Share" />
-	<string name="GroupColumn"          value="                      Group" />
 	<string name="Balance">Balance</string>
 	<string name="Credits">Credits</string>
 	<string name="Debits">Debits</string>
@@ -2182,7 +2127,6 @@ Clears (deletes) the media and all params from the given face.
 	<string name="ATTACH_HUD_BOTTOM_LEFT">HUD Bottom Left</string>
 	<string name="ATTACH_HUD_BOTTOM">HUD Bottom</string>
 	<string name="ATTACH_HUD_BOTTOM_RIGHT">HUD Bottom Right</string>
-	<string name="Bad attachment point">Invalid Attachment Point</string>
 			
 	<!-- script editor -->
 	<string name="CursorPos">Line [LINE], Column [COLUMN]</string>
@@ -2195,23 +2139,22 @@ Clears (deletes) the media and all params from the given face.
 	<string name="PanelDirEventsDateText">[mthnum,datetime,slt]/[day,datetime,slt]</string>
 
 	<!-- panel contents -->
+	<string name="PanelContentsNewScript">New Script</string>
 	<string name="PanelContentsTooltip">Content of object</string>
-	<string name="PanelContentsNewScript">New Script</string>	
 
   <!-- panel preferences general -->
   <string name="BusyModeResponseDefault">The Resident you messaged is in &apos;busy mode&apos; which means they have requested not to be disturbed.  Your message will still be shown in their IM panel for later viewing.</string>
 
 	<!-- Mute -->
-	<string name="MuteByName">(By name)</string>
+	<string name="MuteByName">(by name)</string>
 	<string name="MuteAgent">(Resident)</string>
-	<string name="MuteObject">(Object)</string>
-	<string name="MuteGroup">(Group)</string>
-	<string name="MuteExternal">(External)</string>
+	<string name="MuteObject">(object)</string>
+	<string name="MuteGroup">(group)</string>
 
 	<!-- Region/Estate Covenant -->
 	<string name="RegionNoCovenant">There is no Covenant provided for this Estate.</string>
 	<string name="RegionNoCovenantOtherOwner">There is no Covenant provided for this Estate. The land on this estate is being sold by the Estate owner, not Linden Lab.  Please contact the Estate Owner for sales details.</string>
-	<string name="covenant_last_modified" value="Last Modified: " /> <!-- use value="" to keep the trailing space -->
+	<string name="covenant_last_modified">Last Modified:</string>
 	<string name="none_text"  value=" (none) " />
 	<string name="never_text" value=" (never) " />
 
@@ -2952,9 +2895,6 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
   <string name="LocationCtrlBuildTooltip">Building/dropping objects not allowed</string>
   <string name="LocationCtrlScriptsTooltip">Scripts not allowed</string>
   <string name="LocationCtrlDamageTooltip">Health</string>
-  <string name="LocationCtrlAdultIconTooltip">Adult Region</string>
-  <string name="LocationCtrlModerateIconTooltip">Moderate Region</string>
-  <string name="LocationCtrlGeneralIconTooltip">General Region</string>
 
   <!-- Strings used by the (currently Linux) auto-updater app -->
 	<string name="UpdaterWindowTitle">
@@ -2988,10 +2928,6 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	  Failed to start viewer
 	</string>
 
-	<!-- System Messages -->
-	<string name="ItemsComingInTooFastFrom">[APP_NAME]: Items coming in too fast from [FROM_NAME], automatic preview disabled for [TIME] seconds</string>
-	<string name="ItemsComingInTooFast">[APP_NAME]: Items coming in too fast, automatic preview disabled for [TIME] seconds</string>
-
 	<!-- IM system messages -->
 	<string name="IM_logging_string">-- Instant message logging enabled --</string>
 	<string name="IM_typing_start_string">[NAME] is typing...</string>
@@ -3004,10 +2940,8 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="IM_moderator_label">(Moderator)</string>
 
 	<!-- voice calls -->
-	<string name="answered_call">Your call has been answered</string>
-	<string name="you_started_call">You started a voice call</string>
-	<string name="you_joined_call">You joined the voice call</string>
-	<string name="name_started_call">[NAME] started a voice call</string>
+	<string name="started_call">Started a voice call</string>
+	<string name="joined_call">Joined the voice call</string>
 
   <string name="ringing-im">
     Joining voice call...
@@ -3111,20 +3045,17 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
   </string>
   <string name="unread_chat_single">
     [SOURCES] has said something new
-  </string>
+  </string>"
   <string name="unread_chat_multiple">
     [SOURCES] have said something new
-  </string>
+  </string>"
 	<string name="session_initialization_timed_out_error">
 		The session initialization is timed out
 	</string>
   
-  <string name="voice_morphing_url">http://secondlife.com/landing/voicemorphing</string>
-
   <!-- Financial operations strings -->
   <string name="paid_you_ldollars">[NAME] paid you L$[AMOUNT]</string>
   <string name="you_paid_ldollars">You paid [NAME] L$[AMOUNT] [REASON].</string>
-  <string name="you_paid_ldollars_no_info">You paid L$[AMOUNT].</string>
   <string name="you_paid_ldollars_no_reason">You paid [NAME] L$[AMOUNT].</string>
   <string name="you_paid_ldollars_no_name">You paid L$[AMOUNT] [REASON].</string>
   <string name="for a parcel of land">for a parcel of land</string>
@@ -3143,7 +3074,6 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
   <string name="group_role_everyone">Everyone</string>
   <string name="group_role_officers">Officers</string>
   <string name="group_role_owners">Owners</string>
-  <string name="group_member_status_online">Online</string>
 
   <string name="uploading_abuse_report">Uploading...
   
@@ -3166,93 +3096,7 @@ Abuse Report</string>
   <string name="New Alpha">New Alpha</string>
   <string name="New Tattoo">New Tattoo</string>
   <string name="Invalid Wearable">Invalid Wearable</string>
-  <string name="New Gesture">New Gesture</string>
   <string name="New Script">New Script</string>
-  <string name="New Note">New Note</string>
   <string name="New Folder">New Folder</string>
   <string name="Contents">Contents</string>
-  <string name="Gesture">Gesture</string>
-  <string name="Male Gestures">Male Gestures</string>
-  <string name="Female Gestures">Female Gestures</string>
-  <string name="Other Gestures">Other Gestures</string>
-  <string name="Speech Gestures">Speech Gestures</string>
-  <string name="Common Gestures">Common Gestures</string>
-  <!-- gestures -->
-  <string name="Male - Excuse me">Male - Excuse me</string>
-  <string name="Male - Get lost">Male - Get lost</string>
-  <string name="Male - Blow kiss">Male - Blow kiss</string>
-  <string name="Male - Boo">Male - Boo</string>
-  <string name="Male - Bored">Male - Bored</string>
-  <string name="Male - Hey">Male - Hey</string>
-  <string name="Male - Laugh">Male - Laugh</string>
-  <string name="Male - Repulsed">Male - Repulsed</string>
-  <string name="Male - Shrug">Male - Shrug</string>
-  <string name="Male - Stick tougue out">Male - Stick tougue out</string>
-  <string name="Male - Wow">Male - Wow</string>
-
-  <string name="Female - Chuckle">Female - Chuckle</string>
-  <string name="Female - Cry">Female - Cry</string>
-  <string name="Female - Embarrassed">Female - Embarrassed</string>
-  <string name="Female - Excuse me">Female - Excuse me</string>
-  <string name="Female - Get lost">Female - Get lost</string>
-  <string name="Female - Blow kiss">Female - Blow kiss</string>
-  <string name="Female - Boo">Female - Boo</string>
-  <string name="Female - Bored">Female - Bored</string>
-  <string name="Female - Hey">Female - Hey</string>
-  <string name="Female - Hey baby">Female - Hey baby</string>
-  <string name="Female - Laugh">Female - Laugh</string>
-  <string name="Female - Looking good">Female - Looking good</string>
-  <string name="Female - Over here">Female - Over here</string>
-  <string name="Female - Please">Female - Please</string>
-  <string name="Female - Repulsed">Female - Repulsed</string>
-  <string name="Female - Shrug">Female - Shrug</string>
-  <string name="Female - Stick tougue out">Female - Stick tougue out</string>
-  <string name="Female - Wow">Female - Wow</string>
-
-  <!-- birth date format shared by avatar inspector and profile panels -->
-  <string name="AvatarBirthDateFormat">[mthnum,datetime,slt]/[day,datetime,slt]/[year,datetime,slt]</string>
-  
-  <string name="DefaultMimeType">none/none</string>
-  <string name="texture_load_dimensions_error">Can't load images larger than [WIDTH]*[HEIGHT]</string>
-
-  <!-- language specific white-space characters, delimiters, spacers, item separation symbols -->
-  <string name="sentences_separator" value=" "></string>
-  <string name="words_separator" value=", "/>
-  
-  <string name="server_is_down">
-	Despite our best efforts, something unexpected has gone wrong.
-
-	Please check status.secondlifegrid.net to see if there is a known problem with the service.  
-        If you continue to experience problems, please check your network and firewall setup.
-  </string>
-
-  <!-- overriding datetime formating. 
-	didn't translate if this is not needed for current localization 
-  -->
-  <string name="dateTimeWeekdaysNames">Sunday:Monday:Tuesday:Wednesday:Thursday:Friday:Saturday</string>
-  <string name="dateTimeWeekdaysShortNames">Sun:Mon:Tue:Wed:Thu:Fri:Sat</string>
-  <string name="dateTimeMonthNames">January:February:March:April:May:June:July:August:September:October:November:December</string>
-  <string name="dateTimeMonthShortNames">Jan:Feb:Mar:Apr:May:Jun:Jul:Aug:Sep:Oct:Nov:Dec</string>
-  <string name="dateTimeDayFormat">[MDAY]</string>
-  <string name="dateTimeAM">AM</string>
-  <string name="dateTimePM">PM</string>
-
-  <!--  currency formatting -->
-  <string name="LocalEstimateUSD">US$ [AMOUNT]</string>
-
-  <!-- Group Profile roles and powers -->
-  <string name="Membership">Membership</string>
-  <string name="Roles">Roles</string>
-  <string name="Group Identity">Group Identity</string>
-  <string name="Parcel Management">Parcel Management</string>
-  <string name="Parcel Identity">Parcel Identity</string>
-  <string name="Parcel Settings">Parcel Settings</string>
-  <string name="Parcel Powers">Parcel Powers</string>
-  <string name="Parcel Access">Parcel Access</string>
-  <string name="Parcel Content">Parcel Content</string>
-  <string name="Object Management">Object Management</string>
-  <string name="Accounting">Accounting</string>
-  <string name="Notices">Notices</string>
-  <string name="Chat">Chat</string>
-
-  </strings>
+</strings>
diff --git a/indra/newview/skins/default/xui/en/widgets/expandable_text.xml b/indra/newview/skins/default/xui/en/widgets/expandable_text.xml
index 216c4dea95cf0abad0b35bbdb6050c447d4af267..6190ea787221c236b9c258ee1a901bb6246dfc8b 100644
--- a/indra/newview/skins/default/xui/en/widgets/expandable_text.xml
+++ b/indra/newview/skins/default/xui/en/widgets/expandable_text.xml
@@ -11,7 +11,6 @@
   read_only="true"
   use_ellipses="true"
   word_wrap="true"
-  show_context_menu="true"
   tab_stop="true"
   v_pad="3"
   h_pad="4" >
diff --git a/indra/newview/skins/default/xui/en/widgets/text.xml b/indra/newview/skins/default/xui/en/widgets/text.xml
index 3006df22b878e413c5c0a0fbce926fd92ddaf610..998ec5b170c8a7ffe267618317206e3e775bb7c3 100644
--- a/indra/newview/skins/default/xui/en/widgets/text.xml
+++ b/indra/newview/skins/default/xui/en/widgets/text.xml
@@ -6,6 +6,7 @@
       font_shadow="none" 
       tab_stop="false" 
       halign="left" 
+      hover_color="LabelSelectedColor" 
       h_pad="0" 
       allow_scroll="false"
       text_readonly_color="LabelDisabledColor"
@@ -13,6 +14,7 @@
       use_ellipses="false"
       bg_visible="false" 
       border_visible="false" 
+      hover="false" 
       sound_flags="0"
       text_color="LabelTextColor"
       v_pad="0"
diff --git a/indra/newview/skins/default/xui/es/floater_customize.xml b/indra/newview/skins/default/xui/es/floater_customize.xml
index 77b670d5f0c98b719eed42ad1799b513a47f94d1..b7058d431434aefdd03d1dd759eea45a5068d52a 100644
--- a/indra/newview/skins/default/xui/es/floater_customize.xml
+++ b/indra/newview/skins/default/xui/es/floater_customize.xml
@@ -81,7 +81,7 @@
 			<texture_picker label="Tatuaje: inferior" name="Lower Tattoos" tool_tip="Pulse para elegir una imagen" width="90"/>
 			<button label="Crear una piel nueva" label_selected="Crear una piel nueva" name="Create New"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<panel label="Pelo" name="Hair">
@@ -116,7 +116,7 @@
 			<texture_picker label="Textura" name="Texture" tool_tip="Pulse para elegir una imagen"/>
 			<button label="Crear un pelo nuevo" label_selected="Crear un pelo nuevo" name="Create New"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<panel label="Ojos" name="Eyes">
@@ -147,7 +147,7 @@
 			<texture_picker label="Iris" name="Iris" tool_tip="Pulse para elegir una imagen"/>
 			<button label="Crear unos ojos nuevos" label_selected="Crear unos ojos nuevos" name="Create New"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<text label="Ropa" name="clothes_placeholder">
@@ -159,7 +159,7 @@
 			<button label="Quitarla" label_selected="Quitarla" name="Take Off"/>
 			<button label="Crear una falda nueva" label_selected="Crear una falda nueva" name="Create New"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 			<text name="title">
 				[DESC]
@@ -192,7 +192,7 @@
 			<button label="Quitarlos" label_selected="Quitarlos" name="Take Off"/>
 			<button label="Crear unos pantalones nuevos" label_selected="Crear unos pantalones nuevos" name="Create New" width="185"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 			<text name="title">
 				[DESC]
@@ -249,7 +249,7 @@
 			<color_swatch label="Color/Tinte" name="Color/Tint" tool_tip="Pulsa para abrir el selector de color"/>
 			<button label="Quitarlos" label_selected="Quitarlos" name="Take Off"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<panel label="Calcetines" name="Socks">
@@ -282,7 +282,7 @@
 			<color_swatch label="Color/Tinte" name="Color/Tint" tool_tip="Pulsa para abrir el selector de color"/>
 			<button label="Quitarlos" label_selected="Quitarlos" name="Take Off"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<panel label="Chaqueta" name="Jacket">
@@ -316,7 +316,7 @@
 			<color_swatch label="Color/Tinte" name="Color/Tint" tool_tip="Pulsa para abrir el selector de color"/>
 			<button label="Quitarla" label_selected="Quitarla" name="Take Off"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<panel label="Guantes" name="Gloves">
@@ -349,7 +349,7 @@
 			<color_swatch label="Color/Tinte" name="Color/Tint" tool_tip="Pulsa para abrir el selector de color"/>
 			<button label="Quitarlos" label_selected="Quitarlos" name="Take Off"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<panel label="Camiseta" name="Undershirt">
@@ -382,7 +382,7 @@
 			<color_swatch label="Color/Tinte" name="Color/Tint" tool_tip="Pulsa para abrir el selector de color"/>
 			<button label="Quitarla" label_selected="Quitarla" name="Take Off"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<panel label="Ropa interior" name="Underpants">
@@ -415,7 +415,7 @@
 			<color_swatch label="Color/Tinte" name="Color/Tint" tool_tip="Pulsa para abrir el selector de color"/>
 			<button label="Quitarla" label_selected="Quitarla" name="Take Off"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<panel label="Falda" name="Skirt">
@@ -448,7 +448,7 @@
 			<color_swatch label="Color/Tinte" name="Color/Tint" tool_tip="Pulsa para abrir el selector de color"/>
 			<button label="Quitarla" label_selected="Quitarla" name="Take Off"/>
 			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
+			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 		</panel>
 		<panel label="Tatuaje" name="Tattoo">
diff --git a/indra/newview/skins/default/xui/es/floater_joystick.xml b/indra/newview/skins/default/xui/es/floater_joystick.xml
index 2c1804bd90eef57c6f926dd6865eac052a6e26a2..dbd2e4f04eda1c3c461d1b6a69cb2a32669013d6 100644
--- a/indra/newview/skins/default/xui/es/floater_joystick.xml
+++ b/indra/newview/skins/default/xui/es/floater_joystick.xml
@@ -16,7 +16,7 @@
 		Modos de control:
 	</text>
 	<check_box label="Avatar" name="JoystickAvatarEnabled"/>
-	<check_box label="Construir" name="JoystickBuildEnabled"/>
+	<check_box label="Construir" left="192" name="JoystickBuildEnabled"/>
 	<check_box label="Flycam" name="JoystickFlycamEnabled"/>
 	<text name="XScale">
 		Escala: X
@@ -27,7 +27,7 @@
 	<text name="ZScale">
 		Escala: Z
 	</text>
-	<text name="PitchScale">
+	<text left="3" name="PitchScale" width="115">
 		Escala: arriba/abajo
 	</text>
 	<text name="YawScale">
@@ -45,10 +45,10 @@
 	<text name="ZDeadZone">
 		Zona muerta Z
 	</text>
-	<text name="PitchDeadZone">
+	<text left="3" name="PitchDeadZone" width="115">
 		Zona muerta arri./aba.
 	</text>
-	<text name="YawDeadZone">
+	<text left="3" name="YawDeadZone" width="115">
 		Zona muerta izq./der.
 	</text>
 	<text name="RollDeadZone">
@@ -63,7 +63,7 @@
 	<text name="ZoomDeadZone">
 		Zona muerta zoom
 	</text>
-	<button font="SansSerifSmall" label="Por defecto del SpaceNavigator" name="SpaceNavigatorDefaults"/>
+	<button font="SansSerifSmall" label="Por defecto del SpaceNavigator" left="330" name="SpaceNavigatorDefaults" width="210"/>
 	<button label="OK" label_selected="OK" left="330" name="ok_btn"/>
 	<button label="Cancelar" label_selected="Cancelar" left_delta="120" name="cancel_btn"/>
 	<stat_view label="Monitor del joystick" name="axis_view">
diff --git a/indra/newview/skins/default/xui/es/floater_tools.xml b/indra/newview/skins/default/xui/es/floater_tools.xml
index 9637544f4e01bdc96426424b849b9edd0ea9dc02..a3851ea2b010ee4b2578ad1cf6ca74147dbdca31 100644
--- a/indra/newview/skins/default/xui/es/floater_tools.xml
+++ b/indra/newview/skins/default/xui/es/floater_tools.xml
@@ -67,10 +67,7 @@
 	<text name="RenderingCost" tool_tip="Muestra cuánto se calcula que cuesta renderizar este objeto">
 		þ: [COUNT]
 	</text>
-	<check_box label="" name="checkbox uniform"/>
-	<text label="Estirar ambos lados" name="checkbox uniform label">
-		Estirar ambos lados
-	</text>
+	<check_box label="Estirar ambos lados" name="checkbox uniform"/>
 	<check_box initial_value="true" label="Estirar las texturas" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Usar la cuadrícula" name="checkbox snap to grid"/>
 	<combo_box name="combobox grid mode" tool_tip="Elige qué cuadricula usar para posicionar el objeto" width="82">
@@ -185,7 +182,7 @@
 			<button label="Configurar..." label_selected="Configurar..." name="button set group" tool_tip="Elige un grupo con el que compartir los permisos de este objeto"/>
 			<name_box initial_value="Cargando..." name="Group Name Proxy"/>
 			<button label="Transferir" label_selected="Transferir" name="button deed" tool_tip="La transferencia entrega este objeto con los permisos del próximo propietario. Los objetos compartidos por el grupo pueden ser transferidos por un oficial del grupo."/>
-			<check_box label="Compartir" name="checkbox share with group" tool_tip="Permite que todos los miembros del grupo compartan tus permisos de modificación en este objeto. Debes transferirlo para activar las restricciones según los roles."/>
+			<check_box label="Comprtir" name="checkbox share with group" tool_tip="Permite que todos los miembros del grupo compartan tus permisos de modificación en este objeto. Debes transferirlo para activar las restricciones según los roles."/>
 			<text name="label click action" width="180">
 				Al tocarlo:
 			</text>
@@ -397,7 +394,8 @@
 			<text name="glow label">
 				Resplandor
 			</text>
-			<check_box bottom_delta="-21" label="Brillo al  máximo" name="checkbox fullbright"/>
+			<check_box bottom_delta="-21" label="Brillo al 
+máximo" name="checkbox fullbright"/>
 			<text name="tex gen">
 				Detallado
 			</text>
@@ -478,7 +476,14 @@
 			Área: [AREA] m²
 		</text>
 		<button label="Acerca del terreno" label_selected="Acerca del terreno" name="button about land"/>
-		<check_box label="Mostrar los propietarios" name="checkbox show owners" tool_tip="El color de las parcelas es según su propietario:   Verde = Su terreno  Agua = Terreno de sus grupos  Rojo = Propiedad de otros  Amarillo = En venta  Morado = Para subasta  Gris = Público"/>
+		<check_box label="Mostrar los propietarios" name="checkbox show owners" tool_tip="El color de las parcelas es según su propietario: 
+
+Verde = Su terreno 
+Agua = Terreno de sus grupos 
+Rojo = Propiedad de otros 
+Amarillo = En venta 
+Morado = Para subasta 
+Gris = Público"/>
 		<text name="label_parcel_modify">
 			Modificar la parcela
 		</text>
diff --git a/indra/newview/skins/default/xui/es/language_settings.xml b/indra/newview/skins/default/xui/es/language_settings.xml
index f172994077b9843c9f5fecd4e0fda061abe06596..1ade4ba300e3d244793c64bd0c57c0489d11d026 100644
--- a/indra/newview/skins/default/xui/es/language_settings.xml
+++ b/indra/newview/skins/default/xui/es/language_settings.xml
@@ -17,7 +17,6 @@
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
diff --git a/indra/newview/skins/default/xui/es/menu_viewer.xml b/indra/newview/skins/default/xui/es/menu_viewer.xml
index 66c0bf93116ed1d9bfc035aaa5c748d857176f50..93964a2f4fa0bdc3d15dd00b72b82cbefd9edf6c 100644
--- a/indra/newview/skins/default/xui/es/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/es/menu_viewer.xml
@@ -7,11 +7,10 @@
 		</menu_item_call>
 		<menu_item_call label="Comprar L$" name="Buy and Sell L$"/>
 		<menu_item_call label="Mi perfil" name="Profile"/>
-		<menu_item_call label="Cambiar vestuario" name="ChangeOutfit"/>
+		<menu_item_call label="Mi apariencia" name="Appearance"/>
 		<menu_item_check label="Mi Inventario" name="Inventory"/>
 		<menu_item_check label="Mi Inventario" name="ShowSidetrayInventory"/>
 		<menu_item_check label="Mis gestos" name="Gestures"/>
-		<menu_item_check label="Mi voz" name="ShowVoice"/>
 		<menu label="Mi estado" name="Status">
 			<menu_item_call label="Ausente" name="Set Away"/>
 			<menu_item_call label="Ocupado" name="Set Busy"/>
@@ -20,7 +19,7 @@
 		<menu_item_call label="Dejar el estatus de Administrador" name="Leave Admin Options"/>
 		<menu_item_call label="Salir de [APP_NAME]" name="Quit"/>
 	</menu>
-	<menu label="Comunicarme" name="Communicate">
+	<menu label="Comunicarse" name="Communicate">
 		<menu_item_call label="Mis amigos" name="My Friends"/>
 		<menu_item_call label="Mis grupos" name="My Groups"/>
 		<menu_item_check label="Chat" name="Nearby Chat"/>
@@ -32,7 +31,6 @@
 		<menu_item_call label="Foto" name="Take Snapshot"/>
 		<menu_item_call label="Crear un hito de este sitio" name="Create Landmark Here"/>
 		<menu label="Perfil del lugar" name="Land">
-			<menu_item_call label="Perfil del lugar" name="Place Profile"/>
 			<menu_item_call label="Acerca del terreno" name="About Land"/>
 			<menu_item_call label="Región/Estado" name="Region/Estate"/>
 		</menu>
@@ -68,15 +66,20 @@
 			<menu_item_call label="Herramienta Crear" name="Create"/>
 			<menu_item_call label="Herramienta Terreno" name="Land"/>
 		</menu>
+		<menu label="Editar" name="Edit">
+			<menu_item_call label="Deshacer" name="Undo"/>
+			<menu_item_call label="Rehacer" name="Redo"/>
+			<menu_item_call label="Cortar" name="Cut"/>
+			<menu_item_call label="Copiar" name="Copy"/>
+			<menu_item_call label="Pegar" name="Paste"/>
+			<menu_item_call label="Eliminar" name="Delete"/>
+			<menu_item_call label="Duplicar" name="Duplicate"/>
+			<menu_item_call label="Seleccionar todo" name="Select All"/>
+			<menu_item_call label="Deseleccionar" name="Deselect"/>
+		</menu>
 		<menu_item_call label="Enlazar" name="Link"/>
 		<menu_item_call label="Desenlazar" name="Unlink"/>
 		<menu_item_check label="Editar las partes enlazadas" name="Edit Linked Parts"/>
-		<menu label="Seleccionar las partes enlazadas" name="Select Linked Parts">
-			<menu_item_call label="Seleccionar la parte siguiente" name="Select Next Part"/>
-			<menu_item_call label="Seleccionar la parte previa" name="Select Previous Part"/>
-			<menu_item_call label="Incluir la parte siguiente" name="Include Next Part"/>
-			<menu_item_call label="Incluir la parte previa" name="Include Previous Part"/>
-		</menu>
 		<menu_item_call label="Visión en lo seleccionado" name="Focus on Selection"/>
 		<menu_item_call label="Zoom en lo seleccionado" name="Zoom to Selection"/>
 		<menu label="Objeto" name="Object">
@@ -107,21 +110,19 @@
 			<menu_item_call label="Usar lo seleccionado como cuadrícula" name="Use Selection for Grid"/>
 			<menu_item_call label="Opciones de la cuadrícula" name="Grid Options"/>
 		</menu>
-		<menu label="Subir" name="Upload">
-			<menu_item_call label="Imagen ([COST] L$)..." name="Upload Image"/>
-			<menu_item_call label="Sonido ([COST] L$)..." name="Upload Sound"/>
-			<menu_item_call label="Animación ([COST] L$)..." name="Upload Animation"/>
-			<menu_item_call label="Masivo ([COST] L$ por archivo)..." name="Bulk Upload"/>
+		<menu label="Seleccionar las partes enlazadas" name="Select Linked Parts">
+			<menu_item_call label="Seleccionar la parte siguiente" name="Select Next Part"/>
+			<menu_item_call label="Seleccionar la parte previa" name="Select Previous Part"/>
+			<menu_item_call label="Incluir la parte siguiente" name="Include Next Part"/>
+			<menu_item_call label="Incluir la parte previa" name="Include Previous Part"/>
 		</menu>
 	</menu>
 	<menu label="Ayuda" name="Help">
 		<menu_item_call label="Ayuda de [SECOND_LIFE]" name="Second Life Help"/>
 		<menu_item_call label="Denunciar una infracción" name="Report Abuse"/>
 		<menu_item_call label="Informar de un fallo" name="Report Bug"/>
-		<menu_item_call label="Acerca de [APP_NAME]" name="About Second Life"/>
 	</menu>
 	<menu label="Avanzado" name="Advanced">
-		<menu_item_check label="Mostrar el menú Avanzado" name="Show Advanced Menu"/>
 		<menu_item_call label="Parar mis animaciones" name="Stop Animating My Avatar"/>
 		<menu_item_call label="Recargar las texturas" name="Rebake Texture"/>
 		<menu_item_call label="Interfaz en el tamaño predeterminado" name="Set UI Size to Default"/>
@@ -143,6 +144,7 @@
 			<menu_item_check label="Realzar las transparencias" name="Highlight Transparent"/>
 			<menu_item_check label="Mostrar los HUD anexados" name="Show HUD Attachments"/>
 			<menu_item_check label="Mostrar el Punto de Mira en la vista subjetiva" name="ShowCrosshairs"/>
+			<menu_item_check label="Mostrar información complementaria del terreno" name="Land Tips"/>
 		</menu>
 		<menu label="Objetos representados" name="Rendering Types">
 			<menu_item_check label="Simple" name="Simple"/>
@@ -169,7 +171,6 @@
 			<menu_item_check label="Objetos flexibles" name="Flexible Objects"/>
 		</menu>
 		<menu_item_check label="Ejecutar múltiples temas" name="Run Multiple Threads"/>
-		<menu_item_check label="Usar Plugin Read Thread" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Vaciar la caché de grupo" name="ClearGroupCache"/>
 		<menu_item_check label="Vista subjetiva suavizada" name="Mouse Smoothing"/>
 		<menu label="Atajos de teclado" name="Shortcuts">
@@ -177,7 +178,6 @@
 			<menu_item_check label="Buscar" name="Search"/>
 			<menu_item_call label="Recuperar las teclas" name="Release Keys"/>
 			<menu_item_call label="Interfaz en el tamaño predeterminado" name="Set UI Size to Default"/>
-			<menu_item_check label="Mostrar el menú Avanzado - acceso directo antiguo" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_check label="Correr siempre" name="Always Run"/>
 			<menu_item_check label="Volar" name="Fly"/>
 			<menu_item_call label="Cerrar la ventana" name="Close Window"/>
@@ -197,9 +197,10 @@
 			<menu_item_call label="Acercar el zoom" name="Zoom In"/>
 			<menu_item_call label="Zoom por defecto" name="Zoom Default"/>
 			<menu_item_call label="Alejar el zoom" name="Zoom Out"/>
+			<menu_item_call label="Pantalla completa" name="Toggle Fullscreen"/>
 		</menu>
 		<menu_item_call label="Mostrar las configuraciones del depurador" name="Debug Settings"/>
-		<menu_item_check label="Mostrar el menú &apos;Develop&apos;" name="Debug Mode"/>
+		<menu_item_check label="Mostrar el menú 'Develop'" name="Debug Mode"/>
 	</menu>
 	<menu label="Develop" name="Develop">
 		<menu label="Consoles" name="Consoles">
diff --git a/indra/newview/skins/default/xui/es/notifications.xml b/indra/newview/skins/default/xui/es/notifications.xml
index e9eda790dd9dda9e1c8c645b6b9fd92f8359a917..df18b8883266c4d67ddbe269efee47897671fdfd 100644
--- a/indra/newview/skins/default/xui/es/notifications.xml
+++ b/indra/newview/skins/default/xui/es/notifications.xml
@@ -74,7 +74,7 @@ Detalles del error: la notificación de nombre &apos;[_NAME]&apos; no se ha enco
 	<notification name="LoginFailedNoNetwork">
 		No se puede conectar con [SECOND_LIFE_GRID].
 &apos;[DIAGNOSTIC]&apos;
-Asegúrate de que tu conexión a Internet está funcionando adecuadamente.
+Asegúrate de que tu conexión a internet está funcionando adecuadamente.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="MessageTemplateNotFound">
@@ -86,19 +86,19 @@ Asegúrate de que tu conexión a Internet está funcionando adecuadamente.
 		<usetemplate canceltext="Cancelar" name="yesnocancelbuttons" notext="No guardarlos" yestext="Guardarlos"/>
 	</notification>
 	<notification name="CompileQueueSaveText">
-		Hubo un problema al subir el texto de un script por la siguiente razón: [REASON]. Por favor, inténtalo más tarde.
+		Hubo un problema al subir el texto de un script por la siguiente razón: [REASON]. Por favor, inténtelo más tarde.
 	</notification>
 	<notification name="CompileQueueSaveBytecode">
-		Hubo un problema al subir el script compilado por la siguiente razón: [REASON]. Por favor, inténtalo más tarde.
+		Hubo un problema al subir el script compilado por la siguiente razón: [REASON]. Por favor, inténtelo más tarde.
 	</notification>
 	<notification name="WriteAnimationFail">
-		Hubo un problema al escribir los datos de la animación. Por favor, inténtalo más tarde.
+		Hubo un problema al escribir los datos de la animación. Por favor, inténtelo más tarde.
 	</notification>
 	<notification name="UploadAuctionSnapshotFail">
 		Hubo un problema al subir la foto de la subasta por la siguiente razón: [REASON]
 	</notification>
 	<notification name="UnableToViewContentsMoreThanOne">
-		No se puede ver a la vez los contenidos de más de un ítem. Por favor, elige un solo objeto y vuelve a intentarlo.
+		No se puede ver a la vez los contenidos de más de un ítem. Por favor, elija un solo objeto y vuelva a intentarlo.
 	</notification>
 	<notification name="SaveClothingBodyChanges">
 		¿Guardar todos los cambios en la ropa y partes del cuerpo?
@@ -119,11 +119,11 @@ Asegúrate de que tu conexión a Internet está funcionando adecuadamente.
 		<usetemplate name="okcancelbuttons" notext="No" yestext="Sí"/>
 	</notification>
 	<notification name="RevokeModifyRights">
-		¿Quieres revocar los derechos de modificación a [FIRST_NAME] [LAST_NAME]?
+		¿Quiere revocar los derechos de modificación a [FIRST_NAME] [LAST_NAME]?
 		<usetemplate name="okcancelbuttons" notext="No" yestext="Sí"/>
 	</notification>
 	<notification name="RevokeModifyRightsMultiple">
-		¿Quieres revocar los derechos de modificación a los residentes seleccionados?
+		¿Quiere revocar los derechos de modificación a los residentes seleccionados?
 		<usetemplate name="okcancelbuttons" notext="No" yestext="Sí"/>
 	</notification>
 	<notification name="UnableToCreateGroup">
@@ -188,7 +188,7 @@ Por favor, invita a miembros en las próximas 48 horas.
 		<usetemplate canceltext="Cancelar" name="okcancelbuttons" notext="Cancelar" yestext="Crear un grupo por 100 L$"/>
 	</notification>
 	<notification name="LandBuyPass">
-		Por [COST] L$ puedes entrar a este terreno (&apos;[PARCEL_NAME]&apos;) durante [TIME] horas. ¿Comprar un pase?
+		Por [COST] L$ puede entrar a este terreno (&apos;[PARCEL_NAME]&apos;) durante [TIME] horas. ¿Comprar un pase?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
 	<notification name="SalePriceRestriction">
@@ -208,7 +208,7 @@ El precio de venta será de [SALE_PRICE] L$ y se autoriza la compra a [NAME].
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
 	<notification name="ReturnObjectsDeededToGroup">
-		¿Estás seguro de que quieres devolver todos los objetos de esta parcela que estén compartidos con el grupo &apos;[NAME]&apos; al inventario de su propietario anterior?
+		¿Estás seguros de que quieres devolver todos los objetos de esta parcela que estén compartidos con el grupo &apos;[NAME]&apos; al inventario de su propietario anterior?
 
 *ATENCIÓN* ¡Esto borrará los objetos no transferibles que se hayan cedido al grupo!
 
@@ -304,7 +304,7 @@ debes estar dentro de ella.
 La carpeta del vestuario contiene partes del cuerpo, u objetos a anexar o que no son ropa.
 	</notification>
 	<notification name="CannotWearTrash">
-		No puedes vestirte ropas o partes del cuerpo que estén en la Papelera
+		No puede vestirte ropas o partes del cuerpo que estén en la Papelera
 	</notification>
 	<notification name="MaxAttachmentsOnOutfit">
 		No se puede anexar el objeto.
@@ -323,9 +323,6 @@ Necesitas una cuenta para entrar en [SECOND_LIFE]. ¿Quieres crear una ahora?
 		</url>
 		<usetemplate name="okcancelbuttons" notext="Volver a intentarlo" yestext="Crear una cuenta nueva"/>
 	</notification>
-	<notification name="InvalidCredentialFormat">
-		Escribe el nombre y apellido de tu avatar en el campo Nombre de usuario e inicia sesión otra vez.
-	</notification>
 	<notification name="AddClassified">
 		Los anuncios clasificados aparecen durante una semana en la sección &apos;Clasificados&apos; de la búsqueda y en [http://secondlife.com/community/classifieds secondlife.com].
 Rellena tu anuncio y pulsa &apos;Publicar...&apos; para añadirlo al directorio.
@@ -352,11 +349,7 @@ No se reembolsan las cuotas pagadas.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="DeleteAvatarPick">
-		¿Borrar el destacado &lt;nolink&gt;[PICK]&lt;/nolink&gt;?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
-	</notification>
-	<notification name="DeleteOutfits">
-		¿Eliminar el vestuario seleccionado?
+		¿Borrar el destacado [PICK]?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
 	<notification name="PromptGoToEventsPage">
@@ -433,7 +426,7 @@ El objeto debe de haber sido borrado o estar fuera de rango (&apos;out of range&
 		Al guardar un script compilado, hubo un problema por: [REASON]. Por favor, vuelve a intentar guardarlo más tarde..
 	</notification>
 	<notification name="StartRegionEmpty">
-		Perdón, no está definida tu Posición inicial.
+		Perdon, no está definida tu Posición inicial.
 Por favor, escribe el nombre de la región en el cajetín de Posición inicial, o elige para esa posición Mi Base o Mi última posición.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
@@ -474,8 +467,9 @@ La calidad gráfica puede ajustarse en Preferencias &gt; Gráficos.
 		En la región [REGION] no se permite modificar el terreno.
 	</notification>
 	<notification name="CannotCopyWarning">
-		No tienes permiso para copiar los elementos siguientes:
-[ITEMS] y, si los das, los perderás del inventario. ¿Seguro que quieres ofrecerlos?
+		No tienes permiso para copiar este ítem.
+Si lo das, lo perderás de tu inventario.
+¿Realmente quieres darlo?
 		<usetemplate name="okcancelbuttons" notext="No" yestext="Sí"/>
 	</notification>
 	<notification name="CannotGiveItem">
@@ -617,10 +611,6 @@ Podría ser [VALIDS]
 	<notification name="CannotEncodeFile">
 		No se puede codificar el archivo: [FILE]
 	</notification>
-	<notification name="CorruptedProtectedDataStore">
-		No se pueden rellenar el nombre de usuario y la contraseña.  Esto puede deberse a un cambio de configuración de la red.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
 	<notification name="CorruptResourceFile">
 		Archivo con los recursos corruptos: [FILE]
 	</notification>
@@ -649,22 +639,22 @@ Por favor, inténtalo más tarde.
 	</notification>
 	<notification name="CannotRecompileSelectObjectsNoScripts">
 		No se pudo &apos;recompilar&apos;.
-Selecciona un objeto con script.
+Seleccione un objeto con script.
 	</notification>
 	<notification name="CannotRecompileSelectObjectsNoPermission">
 		No se pudo &apos;recompilar&apos;.
 
-Selecciona objetos con scripts en los que tengas permiso para modificarlos.
+Seleccione objetos con scripts en los que usted tenga permiso para modificarlos.
 	</notification>
 	<notification name="CannotResetSelectObjectsNoScripts">
 		No se pudo &apos;reiniciar&apos;.
 
-Selecciona objetos con scripts.
+Seleccione objetos con scripts.
 	</notification>
 	<notification name="CannotResetSelectObjectsNoPermission">
 		No se pudo &apos;reiniciar&apos;.
 
-Selecciona objetos con scripts en los que tengas permiso para modificarlos.
+Seleccione objetos con scripts en los que usted tenga permiso para modificarlos.
 	</notification>
 	<notification name="CannotOpenScriptObjectNoMod">
 		Imposible abrir el script del objeto sin modificar los permisos.
@@ -672,7 +662,7 @@ Selecciona objetos con scripts en los que tengas permiso para modificarlos.
 	<notification name="CannotSetRunningSelectObjectsNoScripts">
 		No se puede configurar ningún script como &apos;ejecutándose&apos;.
 
-Selecciona objetos con scripts.
+Seleccione objetos con scripts.
 	</notification>
 	<notification name="CannotSetRunningNotSelectObjectsNoScripts">
 		No se puede configurar ningún script como &apos;no ejecutándose&apos;.
@@ -780,7 +770,7 @@ no se ha seleccionado una parcela.
 	</notification>
 	<notification name="CannotDeedLandNoGroup">
 		No se ha podido transferir el terreno:
-no has seleccionado un grupo.
+no ha seleccionado un grupo.
 	</notification>
 	<notification name="CannotDeedLandNoRegion">
 		No se ha podido transferir el terreno:
@@ -810,7 +800,7 @@ Vuelve a intentarlo en unos segundos.
 	</notification>
 	<notification name="CannotReleaseLandSelected">
 		No se ha podido abandonar el terreno:
-no eres propietario de todas las parcelas seleccionadas.
+no es propietario de todas las parcelas seleccionadas.
 
 Por favor, selecciona una sola parcela.
 	</notification>
@@ -913,7 +903,7 @@ Deberás reconfigurar el nombre y las opciones de la nueva parcela.
 Generalmente, esto es un fallo pasajero. Por favor, personaliza y guarda el ítem de aquí a unos minutos.
 	</notification>
 	<notification name="YouHaveBeenLoggedOut">
-		Vaya, se ha cerrado tu sesión en [SECOND_LIFE].
+		Vaya, se ha cerrado tu sesión en [SECOND_LIFE]
             [MESSAGE]
 		<usetemplate name="okcancelbuttons" notext="Salir" yestext="Ver MI y Chat"/>
 	</notification>
@@ -939,36 +929,6 @@ no tienes el permiso de comprar terreno para el grupo que tienes activado actual
 			<button name="Cancel" text="Cancelar"/>
 		</form>
 	</notification>
-	<notification label="Guardar el vestuario" name="SaveOutfitAs">
-		Guardar como un nuevo vestuario lo que estoy llevando:
-		<form name="form">
-			<input name="message">
-				[DESC] (nuevo)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Cancelar"/>
-		</form>
-	</notification>
-	<notification label="Guardar artículo" name="SaveWearableAs">
-		Guardar el ítem en mi inventario como:
-		<form name="form">
-			<input name="message">
-				[DESC] (nuevo)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Cancelar"/>
-		</form>
-	</notification>
-	<notification label="Renombrar el vestuario" name="RenameOutfit">
-		Nombre del nuevo vestuario:
-		<form name="form">
-			<input name="new_name">
-				[NAME]
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Cancelar"/>
-		</form>
-	</notification>
 	<notification name="RemoveFromFriends">
 		¿Quieres quitar a [FIRST_NAME] [LAST_NAME] de tu lista de amigos?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
@@ -1003,12 +963,6 @@ en TODO EL TERRENO de este sim?
 
 Por favor, elige un pago mayor.
 	</notification>
-	<notification name="ConfirmItemDeleteHasLinks">
-		Por lo menos uno  de los elementos seleccionados contiene vínculos que le señalan. Si eliminas este elemento, los vínculos dejarán de funcionar permanentemente. Lo más recomendable es eliminar primero los vínculos.
-
-¿Estás seguro de que quieres eliminar los elementos?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
-	</notification>
 	<notification name="ConfirmObjectDeleteLock">
 		Al menos uno de los ítems que has seleccionado está bloqueado.
 
@@ -1139,9 +1093,9 @@ Si es la primera vez que usas [SECOND_LIFE], debes crear una cuenta antes de pod
 		<usetemplate name="okcancelbuttons" notext="Continuar" yestext="Cuenta nueva..."/>
 	</notification>
 	<notification name="LoginPacketNeverReceived">
-		Tenemos problemas de conexión. Puede deberse a un problema de tu conexión a Internet o de [SECOND_LIFE_GRID].
+		Tenemos problemas de conexión. Puede deberse a un problema de tu conexión a internet o de [SECOND_LIFE_GRID].
 
-Puedes revisar tu conexión a Internet y volver a intentarlo en unos minutos, pulsar Ayuda para conectarte a [SUPPORT_SITE], o pulsar Teleporte para intentar teleportarte a tu Base.
+Puedes revisar tu conexión a internet y volver a intentarlo en unos minutos, pulsar Ayuda para conectarte a [SUPPORT_SITE], o pulsar Teleporte para intentar teleportarte a tu Base.
 		<url name="url">
 			http://es.secondlife.com/support/
 		</url>
@@ -1160,42 +1114,6 @@ Por favor, elige el avatar masculino o femenino.
 Puedes cambiar más adelante tu elección.
 		<usetemplate name="okcancelbuttons" notext="Mujer" yestext="Varón"/>
 	</notification>
-	<notification name="CantTeleportToGrid">
-		No se puede hacer el teleporte a [SLURL] porque se encuentra en una cuadrícula ([GRID]) diferente de la actual ([CURRENT_GRID]). Cierra el visor y vuelve a intentarlo.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="GeneralCertificateError">
-		No se puede establecer la conexión con el servidor.
-[REASON]
-
-Nombre del asunto: [SUBJECT_NAME_STRING]
-Nombre del emisor: [ISSUER_NAME_STRING]
-Válido desde: [VALID_FROM]
-Válido hasta: [VALID_TO]
-Huella digital MD5: [SHA1_DIGEST]
-Huella digital SHA1: [MD5_DIGEST]
-Uso de la clave: [KEYUSAGE]
-Uso de clave extendida: [EXTENDEDKEYUSAGE]
-Identificador de clave de asunto: [SUBJECTKEYIDENTIFIER]
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="TrustCertificateError">
-		La autoridad de certificación de este servidor se desconoce.
-
-Información del certificado:
-Nombre del asunto: [SUBJECT_NAME_STRING]
-Nombre del emisor: [ISSUER_NAME_STRING]
-Válido desde: [VALID_FROM]
-Válido hasta: [VALID_TO]
-Huella digital MD5: [SHA1_DIGEST]
-Huella digital SHA1: [MD5_DIGEST]
-Uso de la clave: [KEYUSAGE]
-Uso de clave extendida: [EXTENDEDKEYUSAGE]
-Identificador de clave de asunto: [SUBJECTKEYIDENTIFIER]
-
-¿Deseas confiar en esta autoridad?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Confiar"/>
-	</notification>
 	<notification name="NotEnoughCurrency">
 		[NAME] cuesta [PRICE] L$. No tienes suficientes L$ para hacer eso.
 	</notification>
@@ -1503,10 +1421,6 @@ Se ocultará el chat y los mensajes instantáneos (éstos recibirán tu Respuest
 		¿Teleportarte a [CLASSIFIED]?
 		<usetemplate ignoretext="Confirmar el teleporte a una localización de los Clasificados" name="okcancelignore" notext="Cancelar" yestext="Teleportar"/>
 	</notification>
-	<notification name="TeleportToHistoryEntry">
-		¿Teleportarse a [HISTORY_ENTRY]?
-		<usetemplate ignoretext="Confirmar que quiero teleportarme a una localización del historial" name="okcancelignore" notext="Cancelar" yestext="Teleportar"/>
-	</notification>
 	<notification label="Mensaje a todo el estado" name="MessageEstate">
 		Escribe un anuncio breve que se enviará a todo el que esté en tu estado.
 		<form name="form">
@@ -1591,16 +1505,13 @@ Por favor, comprueba que tienes instalado el último visor, y dirígete a la Bas
 	<notification name="RegionEntryAccessBlocked_Change">
 		No estás autorizado en esta región por tus preferencias sobre el nivel de calificación.
 
-Para entrar en la región que deseas, cambia tu preferencia de nivel de calificación. Esto te permitirá buscar contenidos [REGIONMATURITY] y tener acceso a ellos. Para deshacer los cambios, elige Yo &gt; Preferencias &gt; General.
+Puedes pulsar &apos;Cambiar las Preferencias&apos; para incrementar las preferencias del nivel de calificación y, así, poder entrar. En adelante, podrás buscar y acceder a contenido [REGIONMATURITY]. Si más adelante quieres deshacer este cambio, ve a Yo &gt; Preferencias &gt; General.
 		<form name="form">
 			<button name="OK" text="Cambiar las preferencias"/>
 			<button default="true" name="Cancel" text="Cerrar"/>
 			<ignore name="ignore" text="Mis preferencias sobre nivel de calificación me impiden entrar a esta región"/>
 		</form>
 	</notification>
-	<notification name="PreferredMaturityChanged">
-		Tu preferencia de nivel de calificación actual es [RATING].
-	</notification>
 	<notification name="LandClaimAccessBlocked">
 		No puedes reclamar este terreno por su nivel de calificación. Puede deberse a que no hay información validada de tu edad.
 
@@ -2015,9 +1926,6 @@ Publícala en una página web para que otros puedan acceder fácilmente a esta p
 	<notification name="SystemMessageTip">
 		[MESSAGE]
 	</notification>
-	<notification name="IMSystemMessageTip">
-		[MESSAGE]
-	</notification>
 	<notification name="Cancelled">
 		Cancelado
 	</notification>
@@ -2348,6 +2256,15 @@ Por favor, vuelve a intentarlo en unos momentos.
 	</notification>
 	<notification name="ObjectGiveItem">
 		Un objeto de nombre [OBJECTFROMNAME], propiedad de [NAME_SLURL], te ha dado este [OBJECTTYPE]:
+[ITEM_SLURL]
+		<form name="form">
+			<button name="Keep" text="Guardar"/>
+			<button name="Discard" text="Descartar"/>
+			<button name="Mute" text="Ignorar"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItemUnknownUser">
+		Un objeto de nombre [OBJECTFROMNAME] propiedad de (un Residente desconocido) te ha dado este [OBJECTTYPE]:
 [ITEM_SLURL]
 		<form name="form">
 			<button name="Keep" text="Guardar"/>
@@ -2378,9 +2295,9 @@ Por favor, vuelve a intentarlo en unos momentos.
 		</form>
 	</notification>
 	<notification name="TeleportOffered">
-		[NAME_SLURL] te ha ofrecido teleportarte a su posición:
+		[NAME] te ofrece teleportarte a su localización:
 
-[MESSAGE] - [MATURITY_STR] &lt;icon&gt;[MATURITY_ICON]&lt;/icon&gt;
+[MESSAGE]
 		<form name="form">
 			<button name="Teleport" text="Teleportar"/>
 			<button name="Cancel" text="Cancelar"/>
@@ -2398,11 +2315,11 @@ Por favor, vuelve a intentarlo en unos momentos.
 		</form>
 	</notification>
 	<notification name="OfferFriendship">
-		[NAME_SLURL] te está ofreciendo su amistad.
+		[NAME] te está ofreciendo amistad.
 
 [MESSAGE]
 
-(Por defecto, podrás ver si el otro está conectado)
+(Por defecto, podrás ver si están conectados los demás).
 		<form name="form">
 			<button name="Accept" text="Aceptar"/>
 			<button name="Decline" text="Rehusar"/>
@@ -2595,21 +2512,6 @@ Pulsa Aceptar o Rehusar para coger o no la llamada. Pulsa Ignorar para ignorar a
 	<notification name="VoiceLoginRetry">
 		Estamos creando un canal de voz para ti. Se puede tardar hasta un minuto.
 	</notification>
-	<notification name="VoiceEffectsExpired">
-		Una o más de las transformaciones de voz a las que estás suscrito han caducado.
-[Pulsa aquí [URL]] para renovar la suscripción.
-	</notification>
-	<notification name="VoiceEffectsExpiredInUse">
-		La transformación de voz activa ha caducado y se ha aplicado tu configuración de voz normal.
-[Pulsa aquí [URL]] para renovar la suscripción.
-	</notification>
-	<notification name="VoiceEffectsWillExpire">
-		Una o más de tus transformaciones de voz caducarán en menos de [INTERVAL] días.
-[Pulsa aquí [URL]] para renovar la suscripción.
-	</notification>
-	<notification name="VoiceEffectsNew">
-		Están disponibles nuevas transformaciones de voz.
-	</notification>
 	<notification name="Cannot enter parcel: not a group member">
 		Sólo los miembros de un grupo determinado pueden visitar esta zona.
 	</notification>
@@ -2675,95 +2577,6 @@ Por tu seguridad, serán bloqueadas durante unos segundos.
 		El botón elegido no se puede mostrar correctamente.
 Se mostrará cuando haya suficiente espacio.
 	</notification>
-	<notification name="ShareNotification">
-		Selecciona los residentes con quienes deseas compartir.
-	</notification>
-	<notification name="ShareItemsConfirmation">
-		¿Estás seguro de que quieres compartir los elementos siguientes?
-
-[ITEMS]
-
-Con los siguientes residentes:
-
-[RESIDENTS]
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
-	</notification>
-	<notification name="ItemsShared">
-		Los elementos se han compartido correctamente.
-	</notification>
-	<notification name="DeedToGroupFail">
-		Error de transferencia a grupo.
-	</notification>
-	<notification name="AvatarRezNotification">
-		( [EXISTENCE] segundos vivo)
-El avatar &apos;[NAME]&apos; tardó [TIME] segundos en dejar de aparecer como nube.
-	</notification>
-	<notification name="AvatarRezSelfBakedDoneNotification">
-		( [EXISTENCE] segundos vivo)
-Has terminado de texturizar tu vestuario en [TIME] segundos.
-	</notification>
-	<notification name="AvatarRezSelfBakedUpdateNotification">
-		( [EXISTENCE] segundos vivo)
-Has enviado una actualización de tu apariencia después de [TIME] segundos.
-[STATUS]
-	</notification>
-	<notification name="AvatarRezCloudNotification">
-		( [EXISTENCE] segundos vivo)
-El avatar &apos;[NAME]&apos; se convirtió en nube.
-	</notification>
-	<notification name="AvatarRezArrivedNotification">
-		( [EXISTENCE] segundos vivo)
-Apareció el avatar &apos;[NAME]&apos;.
-	</notification>
-	<notification name="AvatarRezLeftCloudNotification">
-		( [EXISTENCE] segundos vivo)
-El avatar &apos;[NAME]&apos; salió al cabo de [TIME] segundos como nube.
-	</notification>
-	<notification name="AvatarRezEnteredAppearanceNotification">
-		( [EXISTENCE] segundos vivo)
-El avatar &apos;[NAME]&apos; ya está en modo de edición de apariencia.
-	</notification>
-	<notification name="AvatarRezLeftAppearanceNotification">
-		( [EXISTENCE] segundos vivo)
-El avatar &apos;[NAME]&apos; desactivó el modo de apariencia.
-	</notification>
-	<notification name="NoConnect">
-		Tenemos problemas de conexión con [PROTOCOL] [HOSTID].
-Comprueba la configuración de la red y del servidor de seguridad.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="NoVoiceConnect">
-		Tenemos problemas de conexión con tu servidor de voz:
-
-[HOSTID]
-
-No podrás establecer comunicaciones de voz.
-Comprueba la configuración de la red y del servidor de seguridad.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="AvatarRezLeftNotification">
-		( [EXISTENCE] segundos vivo)
-El avatar &apos;[NAME]&apos; ya estaba totalmente cargado al salir.
-	</notification>
-	<notification name="AvatarRezSelfBakeNotification">
-		( [EXISTENCE] segundos con vida )
-Has [ACTION] una textura obtenida mediante bake de [RESOLUTION] para &apos;[BODYREGION]&apos; después de [TIME] segundos.
-	</notification>
-	<notification name="ConfirmLeaveCall">
-		¿Estás seguro de que deseas salir de esta multiconferencia?
-		<usetemplate ignoretext="Confirma antes de salir de la llamada" name="okcancelignore" notext="No" yestext="Sí"/>
-	</notification>
-	<notification name="ConfirmMuteAll">
-		Has seleccionado silenciar a todos los participantes en una multiconferencia.
-Si lo haces, todos los residentes que se unan posteriormente a la llamada también serán silenciados, incluso cuando abandones la conferencia.
-
-¿Deseas silenciar a todos?
-		<usetemplate ignoretext="Confirma que deseas silenciar a todos los participantes en una multiconferencia." name="okcancelignore" notext="Cancelar" yestext="OK"/>
-	</notification>
 	<global name="UnsupportedCPU">
 		- La velocidad de tu CPU no cumple los requerimientos mínimos.
 	</global>
@@ -2788,7 +2601,4 @@ Si los problemas persisten, por favor, acude a [SUPPORT_SITE].
 		Si posees un terreno, puedes hacerlo tu Base.
 También puedes buscar en el Mapa lugares marcados como &quot;Puntos de Información&quot;.
 	</global>
-	<global name="You died and have been teleported to your home location">
-		Has muerto y te has teleportado a tu Base.
-	</global>
 </notifications>
diff --git a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
index fc8c9087889b9eccb63dae97221d8cc1b0406c07..46d8984889e7aa55deb6dff9ab1aaa97abfb118c 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
@@ -45,9 +45,8 @@
 	</text>
 	<check_box initial_value="true" label="Ejecutar la animación de escribir al hacerlo en el chat" name="play_typing_animation"/>
 	<check_box label="Cuando estoy desconectado, enviarme los MI al correo-e" name="send_im_to_email"/>
-	<check_box label="Permitir el historial de MI y chat en texto sin formato" name="plain_text_chat_history"/>
 	<text name="show_ims_in_label">
-		Mostrar los MI en:
+		Mostrar los MI en: 
 	</text>
 	<text name="requires_restart_label">
 		(requiere reiniciar)
diff --git a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml
index b3acc830789adc16642aa56254fa6197368b664f..4eaff8535e78a5abf9a2658fce9a3ac927364256 100644
--- a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml
@@ -22,10 +22,10 @@ le Lindex...
 	<text name="currency_action">
 		Je veux acheter
 	</text>
-	<text name="currency_label" left="308">
+	<text name="currency_label">
 		L$
 	</text>
-	<line_editor label="L$" name="currency_amt" width="65" left_pad="-85">
+	<line_editor label="L$" name="currency_amt" width="65">
 		1234
 	</line_editor>
 	<text name="buying_label">
diff --git a/indra/newview/skins/default/xui/fr/floater_color_picker.xml b/indra/newview/skins/default/xui/fr/floater_color_picker.xml
index c54e3e9ce0ccb5cd859e5b931c8f253afd1d91ec..7ead543c78968695aaef0b3dade93e791c64a49e 100644
--- a/indra/newview/skins/default/xui/fr/floater_color_picker.xml
+++ b/indra/newview/skins/default/xui/fr/floater_color_picker.xml
@@ -25,7 +25,7 @@
 	<text left="8" name="Current color:">
 		Couleur actuelle :
 	</text>
-	<text name="(Drag below to save.)">
-		Enr. : faire glisser dessous
+	<text left="8" name="(Drag below to save.)" width="220">
+		Enreg. : faire glisser dessous
 	</text>
 </floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_customize.xml b/indra/newview/skins/default/xui/fr/floater_customize.xml
index ff407b25c1657e0e62bb952892540104b05c04d6..d5ee070dcd32e23e4d5fdffb412cf98c66286dda 100644
--- a/indra/newview/skins/default/xui/fr/floater_customize.xml
+++ b/indra/newview/skins/default/xui/fr/floater_customize.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="floater customize" title="APPARENCE">
-	<tab_container name="customize tab container" tab_min_width="150">
+<floater name="floater customize" title="APPARENCE" width="548">
+	<tab_container name="customize tab container" tab_min_width="150" width="546">
 		<text label="Parties du corps" name="body_parts_placeholder">
 			Parties du corps
 		</text>
 		<panel label="Silhouette" left="154" name="Shape" width="389">
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 			<button label="Corps" label_selected="Corps" name="Body"/>
 			<button label="Tête" label_selected="Tête" name="Head"/>
 			<button label="Yeux" label_selected="Yeux" name="Eyes"/>
@@ -44,8 +44,8 @@
 				Silhouette :
 			</text>
 			<button label="Créer une silhouette" label_selected="Créer une silhouette" name="Create New"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
 		</panel>
 		<panel label="Peau" name="Skin">
 			<button label="Couleur" label_selected="Couleur" name="Skin Color" width="84"/>
@@ -80,9 +80,9 @@
 			<texture_picker label="Tatouages haut" name="Upper Tattoos" tool_tip="Cliquez pour sélectionner une image" width="78"/>
 			<texture_picker label="Tatouages bas" name="Lower Tattoos" tool_tip="Cliquez pour sélectionner une image" width="78"/>
 			<button label="Créer une peau" label_selected="Créer une peau" name="Create New"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<panel label="Cheveux" name="Hair">
 			<button label="Couleur" label_selected="Couleur" name="Color"/>
@@ -115,9 +115,9 @@
 			</text>
 			<texture_picker label="Texture" name="Texture" tool_tip="Cliquez pour sélectionner une image"/>
 			<button label="Créer des cheveux" label_selected="Créer des cheveux" name="Create New"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<panel label="Yeux" name="Eyes">
 			<text name="title">
@@ -146,9 +146,9 @@
 			</text>
 			<texture_picker label="Iris" name="Iris" tool_tip="Cliquez pour sélectionner une image"/>
 			<button label="Créer des yeux" label_selected="Créer des yeux" name="Create New"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<text label="Habits" name="clothes_placeholder">
 			Habits
@@ -158,9 +158,9 @@
 			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Créer une chemise" label_selected="Créer une chemise" name="Create New"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 			<text name="title">
 				[DESC]
 			</text>
@@ -191,9 +191,9 @@
 			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Créer un pantalon" label_selected="Créer un pantalon" name="Create New"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 			<text name="title">
 				[DESC]
 			</text>
@@ -248,9 +248,9 @@
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
 			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<panel label="Chaussettes" name="Socks">
 			<text name="title">
@@ -281,9 +281,9 @@
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
 			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<panel label="Veste" name="Jacket">
 			<text name="title">
@@ -315,9 +315,9 @@
 			<texture_picker label="Tissu (dessous)" name="Lower Fabric" tool_tip="Cliquez pour sélectionner une image" width="81"/>
 			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="81"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<panel label="Gants" name="Gloves">
 			<text name="title">
@@ -348,9 +348,9 @@
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
 			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<panel label="Débardeur" name="Undershirt">
 			<text name="title">
@@ -375,15 +375,15 @@
 			<text name="no modify instructions">
 				Vous n&apos;avez pas la permission de modifier cet objet.
 			</text>
-			<text name="Item Action Label">
+			<text bottom="-470" name="Item Action Label" right="92">
 				Débardeur :
 			</text>
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
 			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<panel label="Caleçon" name="Underpants">
 			<text name="title">
@@ -408,15 +408,15 @@
 			<text name="no modify instructions">
 				Vous n&apos;avez pas la permission de modifier cet objet.
 			</text>
-			<text name="Item Action Label">
+			<text bottom="-470" name="Item Action Label" right="92">
 				Caleçon :
 			</text>
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
 			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<panel label="Jupe" name="Skirt">
 			<text name="title">
@@ -447,9 +447,9 @@
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
 			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
-			<button label="Enregistrer" label_selected="Enregistrer" name="Save"/>
-			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." name="Save As"/>
-			<button label="Rétablir" label_selected="Rétablir" name="Revert"/>
+			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
+			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
+			<button label="Rétablir" label_selected="Rétablir" left="305" name="Revert" width="82"/>
 		</panel>
 		<panel label="Tatouage" name="Tattoo">
 			<text name="title">
@@ -523,7 +523,7 @@
 		</panel>
 	</tab_container>
 	<scroll_container left="251" name="panel_container"/>
-	<button label="Infos scripts" label_selected="Infos scripts" name="script_info" tool_tip="Afficher les scripts attachés à votre avatar"/>
+	<button label="Infos sur les scripts" label_selected="Infos sur les scripts" name="script_info" tool_tip="Afficher les scripts attachés à votre avatar"/>
 	<button label="Créer tenue" label_selected="Créer une tenue..." name="make_outfit_btn"/>
 	<button label="Annuler" label_selected="Annuler" name="Cancel"/>
 	<button label="OK" label_selected="OK" name="Ok"/>
diff --git a/indra/newview/skins/default/xui/fr/floater_day_cycle_options.xml b/indra/newview/skins/default/xui/fr/floater_day_cycle_options.xml
index 0ce17b9dc6fbd520c33c86c864832c65ef1805e5..a381f64cd92ae30541b65046d6b79dd63d015097 100644
--- a/indra/newview/skins/default/xui/fr/floater_day_cycle_options.xml
+++ b/indra/newview/skins/default/xui/fr/floater_day_cycle_options.xml
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater name="Day Cycle Floater" title="EDITEUR DU CYCLE DU JOUR">
 	<tab_container name="Day Cycle Tabs">
 		<panel label="Cycle du jour" name="Day Cycle">
-			<button label="?" name="WLDayCycleHelp"/>
+			<button label="?" name="WLDayCycleHelp" />
 			<text name="WL12am">
 				Min.
 			</text>
@@ -57,38 +57,41 @@
 			<text name="WL12amHash2">
 				|
 			</text>
-			<button label="Ajouter clé" label_selected="Ajouter clé" name="WLAddKey"/>
-			<button label="Supprimer clé" label_selected="Supprimer clé" name="WLDeleteKey"/>
-			<text name="WLCurKeyFrameText">
+			<button label="Ajouter clé" label_selected="Ajouter clé" name="WLAddKey" width="89" bottom="-45" />
+			<button label="Supprimer clé" label_selected="Supprimer clé" name="WLDeleteKey" width="89" bottom="-70" />
+			<text name="WLCurKeyFrameText" width="170">
 				Réglages des images-clés :
 			</text>
-			<text name="WLCurKeyTimeText">
+			<text name="WLCurKeyTimeText" width="170">
 				Heure de la clé :
 			</text>
-			<spinner label="Heure" name="WLCurKeyHour"/>
-			<spinner label="Min" name="WLCurKeyMin"/>
+			<spinner label="Heure" name="WLCurKeyHour" label_width="80" width="74"/>
+			<spinner label="Min" name="WLCurKeyMin" label_width="80"/>
 			<text name="WLCurKeyTimeText2">
 				Préréglages clés :
 			</text>
-			<combo_box label="Préréglage" name="WLKeyPresets"/>
+			<combo_box label="Préréglage" name="WLKeyPresets" />
 			<text name="DayCycleText">
 				Snap :
 			</text>
-			<combo_box label="5 min" name="WLSnapOptions"/>
+			<combo_box label="5 min" name="WLSnapOptions" />
 			<text name="DayCycleText2">
 				Durée du cycle :
 			</text>
-			<spinner label="Heure" name="WLLengthOfDayHour"/>
-			<spinner label="Min" name="WLLengthOfDayMin"/>
-			<spinner label="Sec" name="WLLengthOfDaySec"/>
-			<text name="DayCycleText3">
-				Aperçu :
-			</text>
-			<button label="Lire" label_selected="Lire" name="WLAnimSky"/>
-			<button label="Arrêter" label_selected="Stop" name="WLStopAnimSky"/>
-			<button label="Utiliser heure domaine" label_selected="Aller heure domaine" name="WLUseLindenTime"/>
-			<button label="Enregistrer jour test" label_selected="Enregistrer jour test" name="WLSaveDayCycle"/>
-			<button label="Charger jour test" label_selected="Charger jour test" name="WLLoadDayCycle"/>
+			<spinner label="Heure" name="WLLengthOfDayHour" label_width="80" width="74" />
+			<spinner label="Min" name="WLLengthOfDayMin" />
+			<spinner label="S" name="WLLengthOfDaySec" label_width="10" width="50" left_delta="95"/>
+			<text name="DayCycleText3" left="280" width="200">
+				Prévisualiser :
+			</text>
+			<button label="Lire" label_selected="Lire" name="WLAnimSky" left_delta="90"/>
+			<button label="Stop !" label_selected="Stop" name="WLStopAnimSky" />
+			<button label="Utiliser heure domaine" label_selected="Aller heure domaine"
+			     name="WLUseLindenTime" />
+			<button label="Enregistrer jour test" label_selected="Enregistrer jour test"
+			     name="WLSaveDayCycle" />
+			<button label="Charger jour test" label_selected="Charger jour test"
+			     name="WLLoadDayCycle" />
 		</panel>
 	</tab_container>
 </floater>
diff --git a/indra/newview/skins/default/xui/fr/floater_tools.xml b/indra/newview/skins/default/xui/fr/floater_tools.xml
index 92f02ad1faebbfe7e48d4f092a7b10af0ccf53e9..16d276f8c2cdec36aab9dc9b326915e11dfae8a4 100644
--- a/indra/newview/skins/default/xui/fr/floater_tools.xml
+++ b/indra/newview/skins/default/xui/fr/floater_tools.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="toolbox floater" short_title="OUTILS POUR LA CONSTRUCTION" title="">
 	<floater.string name="status_rotate">
-		Pour faire tourner l&apos;objet, faites glisser les bandes de couleur.
+		Pour faire tourner l&apos;objet, faîtes glisser les bandes de couleur.
 	</floater.string>
 	<floater.string name="status_scale">
 		Pour étirer le côté sélectionné, cliquez et faites glisser.
@@ -37,7 +37,7 @@
 		Référence
 	</floater.string>
 	<floater.string name="grid_attachment_text">
-		Pièce jointe
+		Pièce-jointe
 	</floater.string>
 	<button label="" label_selected="" name="button focus" tool_tip="Mise au point"/>
 	<button label="" label_selected="" name="button move" tool_tip="Déplacer"/>
@@ -54,7 +54,7 @@
 	</radio_group>
 	<radio_group name="move_radio_group">
 		<radio_item label="Déplacer" name="radio move"/>
-		<radio_item label="Soulever (Ctrl)" name="radio lift"/>
+		<radio_item label="Orbite (Ctrl)" name="radio lift"/>
 		<radio_item label="Faire tourner (Ctrl+Maj)" name="radio spin"/>
 	</radio_group>
 	<radio_group name="edit_radio_group">
@@ -67,10 +67,7 @@
 	<text name="RenderingCost" tool_tip="Affiche le coût du rendu calculé pour cet objet">
 		þ : [COUNT]
 	</text>
-	<check_box label="" name="checkbox uniform"/>
-	<text label="Étirer les deux côtés" name="checkbox uniform label">
-		Étirer les deux côtés
-	</text>
+	<check_box label="Étirer les deux côtés" name="checkbox uniform"/>
 	<check_box initial_value="true" label="Étirer les textures" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Fixer sur la grille" name="checkbox snap to grid"/>
 	<combo_box name="combobox grid mode" tool_tip="Choisissez le type d&apos;axe de grille pour le positionnement de l&apos;objet">
@@ -190,7 +187,7 @@
 				Cliquer pour :
 			</text>
 			<combo_box name="clickaction" width="178">
-				<combo_box.item label="Toucher (par défaut)" name="Touch/grab(default)"/>
+				<combo_box.item label="Toucher (défaut)" name="Touch/grab(default)"/>
 				<combo_box.item label="S&apos;asseoir sur l&apos;objet" name="Sitonobject"/>
 				<combo_box.item label="Acheter l&apos;objet" name="Buyobject"/>
 				<combo_box.item label="Payer l&apos;objet" name="Payobject"/>
@@ -402,8 +399,8 @@
 				Application
 			</text>
 			<combo_box name="combobox texgen">
-				<combo_box.item label="Par défaut" name="Default"/>
-				<combo_box.item label="Plan" name="Planar"/>
+				<combo_box.item label="Défaut" name="Default"/>
+				<combo_box.item label="Planar" name="Planar"/>
 			</combo_box>
 			<text name="label shininess">
 				Brillance
@@ -444,7 +441,7 @@
 			<check_box label="Inverser" name="checkbox flip s"/>
 			<spinner label="Vertical (V)" name="TexScaleV"/>
 			<check_box label="Inverser" name="checkbox flip t"/>
-			<spinner label="RotationËš" name="TexRot"/>
+			<spinner label="RotationËš" name="TexRot" />
 			<spinner label="Répétitions / Mètre" name="rptctrl"/>
 			<button label="Appliquer" label_selected="Appliquer" name="button apply"/>
 			<text name="tex offset">
diff --git a/indra/newview/skins/default/xui/fr/language_settings.xml b/indra/newview/skins/default/xui/fr/language_settings.xml
index bd272e1f284b76a3ad20dfbcee5b7d4c332dd462..117ae16ee84cafd8572c40dda57849deee2267a2 100644
--- a/indra/newview/skins/default/xui/fr/language_settings.xml
+++ b/indra/newview/skins/default/xui/fr/language_settings.xml
@@ -17,7 +17,6 @@
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
diff --git a/indra/newview/skins/default/xui/fr/menu_viewer.xml b/indra/newview/skins/default/xui/fr/menu_viewer.xml
index cd0e41e49646119ae9c5072d8697665a755f862d..b8a3b6510125a34083acac4e6805aad14e3f26ba 100644
--- a/indra/newview/skins/default/xui/fr/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/fr/menu_viewer.xml
@@ -7,11 +7,10 @@
 		</menu_item_call>
 		<menu_item_call label="Acheter des L$" name="Buy and Sell L$"/>
 		<menu_item_call label="Mon profil" name="Profile"/>
-		<menu_item_call label="Changer de tenue" name="ChangeOutfit"/>
+		<menu_item_call label="Mon apparence" name="Appearance"/>
 		<menu_item_check label="Mon inventaire" name="Inventory"/>
 		<menu_item_check label="Mon inventaire" name="ShowSidetrayInventory"/>
 		<menu_item_check label="Mes gestes" name="Gestures"/>
-		<menu_item_check label="Ma voix" name="ShowVoice"/>
 		<menu label="Mon statut" name="Status">
 			<menu_item_call label="Absent" name="Set Away"/>
 			<menu_item_call label="Occupé" name="Set Busy"/>
@@ -32,7 +31,6 @@
 		<menu_item_call label="Photo" name="Take Snapshot"/>
 		<menu_item_call label="Créer un repère pour ce lieu" name="Create Landmark Here"/>
 		<menu label="Profil du lieu" name="Land">
-			<menu_item_call label="Profil du lieu" name="Place Profile"/>
 			<menu_item_call label="À propos du terrain" name="About Land"/>
 			<menu_item_call label="Région/Domaine" name="Region/Estate"/>
 		</menu>
@@ -61,22 +59,27 @@
 	</menu>
 	<menu label="Construire" name="BuildTools">
 		<menu_item_check label="Construire" name="Show Build Tools"/>
-		<menu label="Sélectionner un outil de construction" name="Select Tool">
-			<menu_item_call label="Outil de mise au point" name="Focus"/>
+		<menu label="Sélectionner l&apos;outil de construction" name="Select Tool">
+			<menu_item_call label="Outil de zoom" name="Focus"/>
 			<menu_item_call label="Outil de déplacement" name="Move"/>
 			<menu_item_call label="Outil de modification" name="Edit"/>
 			<menu_item_call label="Outil de création" name="Create"/>
 			<menu_item_call label="Outil Terrain" name="Land"/>
 		</menu>
+		<menu label="Édition" name="Edit">
+			<menu_item_call label="Annuler" name="Undo"/>
+			<menu_item_call label="Refaire" name="Redo"/>
+			<menu_item_call label="Couper" name="Cut"/>
+			<menu_item_call label="Copier" name="Copy"/>
+			<menu_item_call label="Coller" name="Paste"/>
+			<menu_item_call label="Supprimer" name="Delete"/>
+			<menu_item_call label="Dupliquer" name="Duplicate"/>
+			<menu_item_call label="Tout sélectionner" name="Select All"/>
+			<menu_item_call label="Désélectionner" name="Deselect"/>
+		</menu>
 		<menu_item_call label="Lien" name="Link"/>
 		<menu_item_call label="Annuler le lien" name="Unlink"/>
 		<menu_item_check label="Modifier les parties liées" name="Edit Linked Parts"/>
-		<menu label="Sélectionner les parties liées" name="Select Linked Parts">
-			<menu_item_call label="Sélectionner la partie suivante" name="Select Next Part"/>
-			<menu_item_call label="Sélectionner la partie précédente" name="Select Previous Part"/>
-			<menu_item_call label="Inclure la partie suivante" name="Include Next Part"/>
-			<menu_item_call label="Inclure la partie précédente" name="Include Previous Part"/>
-		</menu>
 		<menu_item_call label="Point central sur la sélection" name="Focus on Selection"/>
 		<menu_item_call label="Zoomer sur la sélection" name="Zoom to Selection"/>
 		<menu label="Objet" name="Object">
@@ -107,11 +110,11 @@
 			<menu_item_call label="Utiliser la sélection pour la grille" name="Use Selection for Grid"/>
 			<menu_item_call label="Options de la grille" name="Grid Options"/>
 		</menu>
-		<menu label="Charger" name="Upload">
-			<menu_item_call label="Image ([COST] L$)..." name="Upload Image"/>
-			<menu_item_call label="Son ([COST] L$)..." name="Upload Sound"/>
-			<menu_item_call label="Animation ([COST] L$)..." name="Upload Animation"/>
-			<menu_item_call label="Lot ([COST] L$ par fichier)..." name="Bulk Upload"/>
+		<menu label="Sélectionner les parties liées" name="Select Linked Parts">
+			<menu_item_call label="Sélectionner la partie suivante" name="Select Next Part"/>
+			<menu_item_call label="Sélectionner la partie précédente" name="Select Previous Part"/>
+			<menu_item_call label="Inclure la partie suivante" name="Include Next Part"/>
+			<menu_item_call label="Inclure la partie précédente" name="Include Previous Part"/>
 		</menu>
 	</menu>
 	<menu label="Aide" name="Help">
@@ -121,7 +124,6 @@
 		<menu_item_call label="À propos de [APP_NAME]" name="About Second Life"/>
 	</menu>
 	<menu label="Avancé" name="Advanced">
-		<menu_item_check label="Afficher le menu Avancé" name="Show Advanced Menu"/>
 		<menu_item_call label="Arrêter mon animation" name="Stop Animating My Avatar"/>
 		<menu_item_call label="Refixer les textures" name="Rebake Texture"/>
 		<menu_item_call label="Taille de l&apos;interface par défaut" name="Set UI Size to Default"/>
@@ -143,6 +145,7 @@
 			<menu_item_check label="Mettre la transparence en surbrillance" name="Highlight Transparent"/>
 			<menu_item_check label="Afficher les éléments HUD" name="Show HUD Attachments"/>
 			<menu_item_check label="Afficher le réticule de la vue subjective" name="ShowCrosshairs"/>
+			<menu_item_check label="Afficher les info-bulles de terrain" name="Land Tips"/>
 		</menu>
 		<menu label="Types de rendu" name="Rendering Types">
 			<menu_item_check label="Simple" name="Simple"/>
@@ -169,7 +172,6 @@
 			<menu_item_check label="Objets flexibles" name="Flexible Objects"/>
 		</menu>
 		<menu_item_check label="Exécuter plusieurs threads" name="Run Multiple Threads"/>
-		<menu_item_check label="Utiliser le thread de lecture de plug-in" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Effacer le cache du groupe" name="ClearGroupCache"/>
 		<menu_item_check label="Effet de lissage de la souris" name="Mouse Smoothing"/>
 		<menu label="Raccourcis" name="Shortcuts">
@@ -177,7 +179,6 @@
 			<menu_item_check label="Rechercher" name="Search"/>
 			<menu_item_call label="Relâcher les touches" name="Release Keys"/>
 			<menu_item_call label="Taille de l&apos;interface par défaut" name="Set UI Size to Default"/>
-			<menu_item_check label="Afficher le menu Avancé - raccourci existant" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_check label="Toujours courir" name="Always Run"/>
 			<menu_item_check label="Voler" name="Fly"/>
 			<menu_item_call label="Fermer la fenêtre" name="Close Window"/>
@@ -187,8 +188,8 @@
 			<menu_item_check label="Joystick Flycam" name="Joystick Flycam"/>
 			<menu_item_call label="Réinitialiser la vue" name="Reset View"/>
 			<menu_item_call label="Regarder la dernière conversation" name="Look at Last Chatter"/>
-			<menu label="Sélectionner un outil de construction" name="Select Tool">
-				<menu_item_call label="Outil de mise au point" name="Focus"/>
+			<menu label="Sélectionner l&apos;outil de construction" name="Select Tool">
+				<menu_item_call label="Outil de zoom" name="Focus"/>
 				<menu_item_call label="Outil de déplacement" name="Move"/>
 				<menu_item_call label="Outil de modification" name="Edit"/>
 				<menu_item_call label="Outil de création" name="Create"/>
@@ -197,6 +198,7 @@
 			<menu_item_call label="Zoomer en avant" name="Zoom In"/>
 			<menu_item_call label="Zoom par défaut" name="Zoom Default"/>
 			<menu_item_call label="Zoomer en arrière" name="Zoom Out"/>
+			<menu_item_call label="Activer/Quitter le plein écran" name="Toggle Fullscreen"/>
 		</menu>
 		<menu_item_call label="Afficher les paramètres de débogage" name="Debug Settings"/>
 		<menu_item_check label="Afficher le menu Développeurs" name="Debug Mode"/>
diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml
index c1321b71ea84c792a1850d3d6e812b3122688c8a..38c6b57f5c031d52d686993216ef98d27b88b9b2 100644
--- a/indra/newview/skins/default/xui/fr/notifications.xml
+++ b/indra/newview/skins/default/xui/fr/notifications.xml
@@ -168,7 +168,7 @@ Ajouter ce pouvoir à « [ROLE_NAME] » ?
 	<notification name="AttachmentDrop">
 		Vous êtes sur le point d&apos;abandonner l&apos;élément joint.
 Voulez-vous vraiment continuer ?
-		<usetemplate ignoretext="Confirmer avant d&apos;abandonner les éléments joints" name="okcancelignore" notext="Non" yestext="Oui"/>
+		<usetemplate ignoretext="Confirmez avant d&apos;abandonner les éléments joints." name="okcancelignore" notext="Non" yestext="Oui"/>
 	</notification>
 	<notification name="JoinGroupCanAfford">
 		Rejoindre ce groupe coûte [COST] L$.
@@ -283,7 +283,7 @@ Pour ne placer le média que sur une seule face, choisissez Sélectionner une fa
 		Veuillez saisir votre adresse e-mail.
 	</notification>
 	<notification name="PromptMissingSubjMsg">
-		Envoyer la photo avec l&apos;objet ou le message par défaut ?
+		Envoyer la photo avec le sujet ou le message par défaut ?
 		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification name="ErrorProcessingSnapshot">
@@ -325,9 +325,6 @@ Pour entrer dans [SECOND_LIFE], vous devez avoir un compte. Voulez-vous en crée
 		</url>
 		<usetemplate name="okcancelbuttons" notext="Réessayer" yestext="Créer un compte"/>
 	</notification>
-	<notification name="InvalidCredentialFormat">
-		Saisissez à la fois le prénom et le nom de votre avatar dans le champ Nom d&apos;utilisateur, puis connectez-vous.
-	</notification>
 	<notification name="AddClassified">
 		Les petites annonces sont publiées à l&apos;onglet Petites annonces de la section Recherche et sur [http://secondlife.com/community/classifieds secondlife.com] pendant une semaine.
 Rédigez votre annonce, puis cliquez sur Publier pour l&apos;ajouter à la liste des annonces.
@@ -354,11 +351,7 @@ Voulez-vous vraiment continuer ?
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="DeleteAvatarPick">
-		Supprimer la sélection &lt;nolink&gt;[PICK]&lt;/nolink&gt; ?
-		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
-	</notification>
-	<notification name="DeleteOutfits">
-		Supprimer la ou les tenues sélectionnées ?
+		Supprimer le favori [PICK] ?
 		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification name="PromptGoToEventsPage">
@@ -478,9 +471,7 @@ La qualité des graphiques peut être augmentée à la section Préférences &gt
 		Le terraformage est interdit dans la région [REGION].
 	</notification>
 	<notification name="CannotCopyWarning">
-		Vous n&apos;êtes pas autorisé à copier les articles suivants :
-[ITEMS].
-Ceux-ci disparaîtront donc de votre inventaire si vous les donnez. Voulez-vous vraiment offrir ces articles ?
+		Vous n&apos;êtes pas autorisé à copier cet objet et il disparaîtra de votre inventaire si vous le donnez. Souhaitez-vous vraiment offrir cet objet ?
 		<usetemplate name="okcancelbuttons" notext="Non" yestext="Oui"/>
 	</notification>
 	<notification name="CannotGiveItem">
@@ -617,10 +608,6 @@ Assurez-vous que le fichier a l&apos;extension correcte.
 	<notification name="CannotEncodeFile">
 		Impossible d&apos;encoder le fichier : [FILE]
 	</notification>
-	<notification name="CorruptedProtectedDataStore">
-		Impossible de renseigner votre nom d&apos;utilisateur et mot de passe.  Cette situation peut se produire lorsque vous changez la configuration du réseau.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
 	<notification name="CorruptResourceFile">
 		Fichier ressource corrompu : [FILE]
 	</notification>
@@ -938,36 +925,6 @@ Proposer à [NAME] de devenir votre ami(e) ?
 			<button name="Cancel" text="Annuler"/>
 		</form>
 	</notification>
-	<notification label="Enregistrer la tenue" name="SaveOutfitAs">
-		Enregistrer ce que je porte comme nouvelle tenue :
-		<form name="form">
-			<input name="message">
-				[DESC] (nouv.)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Annuler"/>
-		</form>
-	</notification>
-	<notification label="Enregistrer l&apos;article à porter" name="SaveWearableAs">
-		Enregistrer l&apos;article dans mon inventaire comme :
-		<form name="form">
-			<input name="message">
-				[DESC] (nouv.)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Annuler"/>
-		</form>
-	</notification>
-	<notification label="Renommer la tenue" name="RenameOutfit">
-		Nouveau nom de la tenue :
-		<form name="form">
-			<input name="new_name">
-				[NAME]
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Annuler"/>
-		</form>
-	</notification>
 	<notification name="RemoveFromFriends">
 		Voulez-vous supprimer [FIRST_NAME] [LAST_NAME] de votre liste d&apos;amis ?
 		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
@@ -996,12 +953,6 @@ Proposer à [NAME] de devenir votre ami(e) ?
 
 Veuillez saisir un montant plus élevé.
 	</notification>
-	<notification name="ConfirmItemDeleteHasLinks">
-		Des articles liés pointent vers au moins un article sélectionné. Les liens arrêteront définitivement de fonctionner si vous supprimez cet article. Il est vivement conseillé de supprimer d&apos;abord ces liens.
-
-Voulez-vous vraiment supprimer ces articles ?
-		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
-	</notification>
 	<notification name="ConfirmObjectDeleteLock">
 		Au moins un des objets que vous avez sélectionnés est verrouillé.
 
@@ -1150,42 +1101,6 @@ Choisissez un avatar homme ou femme.
 Vous pourrez revenir sur votre décision plus tard.
 		<usetemplate name="okcancelbuttons" notext="Femme" yestext="Homme"/>
 	</notification>
-	<notification name="CantTeleportToGrid">
-		Téléportation vers [SLURL] impossible car cet endroit existe sur une grille ([GRID]) différente de la grille actuelle ([CURRENT_GRID]). Veuillez fermer votre client et réessayer.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="GeneralCertificateError">
-		Connexion au serveur impossible.
-[REASON]
-
-Nom du sujet : [SUBJECT_NAME_STRING]
-Émetteur : [ISSUER_NAME_STRING]
-Début de validité : [VALID_FROM]
-Fin de validité : [VALID_TO]
-Empreinte MD5 : [SHA1_DIGEST]
-Empreinte SHA1 : [MD5_DIGEST]
-Utilisation de la clé : [KEYUSAGE]
-Utilisation étendue de la clé : [EXTENDEDKEYUSAGE]
-Identifiant de la clé du sujet : [SUBJECTKEYIDENTIFIER]
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="TrustCertificateError">
-		Autorité de certification de ce serveur inconnue.
-
-Informations sur le certificat :
-Nom du sujet : [SUBJECT_NAME_STRING]
-Émetteur : [ISSUER_NAME_STRING]
-Début de validité : [VALID_FROM]
-Fin de validité : [VALID_TO]
-Empreinte MD5 : [SHA1_DIGEST]
-Empreinte SHA1 : [MD5_DIGEST]
-Utilisation de la clé : [KEYUSAGE]
-Utilisation étendue de la clé : [EXTENDEDKEYUSAGE]
-Identifiant de la clé du sujet : [SUBJECTKEYIDENTIFIER]
-
-Approuver cette autorité ?
-		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="Approuver"/>
-	</notification>
 	<notification name="NotEnoughCurrency">
 		[NAME] [PRICE] L$ Vous n&apos;avez pas suffisamment de L$ pour faire cela.
 	</notification>
@@ -1350,7 +1265,7 @@ Télécharger vers le dossier Applications ?
 	</notification>
 	<notification name="WebLaunchQAWiki">
 		Consultez le Wiki sur l&apos;Assurance Qualité de [SECOND_LIFE].
-		<usetemplate ignoretext="Lancer mon navigateur web pour consulter la page Wiki sur l&apos;Assurance Qualité" name="okcancelignore" notext="Annuler" yestext="OK"/>
+		<usetemplate ignoretext="Lancer mon navigateur web pour consulter la page Wiki sur l&apos;Assurance Qualité." name="okcancelignore" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification name="WebLaunchPublicIssue">
 		Pour signaler des bugs et autres problèmes, utilisez le JIRA de [SECOND_LIFE].
@@ -1492,10 +1407,6 @@ Les chats et les messages instantanés ne s&apos;afficheront pas. Les messages i
 		Vous téléporter vers [CLASSIFIED] ?
 		<usetemplate ignoretext="Confirmer que je veux me téléporter à un endroit dans les Petites annonces" name="okcancelignore" notext="Annuler" yestext="Téléporter"/>
 	</notification>
-	<notification name="TeleportToHistoryEntry">
-		Vous téléporter vers [HISTORY_ENTRY] ?
-		<usetemplate ignoretext="Confirmer que je veux me téléporter à un endroit de l&apos;historique" name="okcancelignore" notext="Annuler" yestext="Téléporter"/>
-	</notification>
 	<notification label="Envoyer un message à tout le monde dans votre domaine" name="MessageEstate">
 		Saisissez un message court qui sera envoyé à tous les résidents se trouvant actuellement sur votre domaine.
 		<form name="form">
@@ -1578,18 +1489,15 @@ Souhaitez-vous en savoir plus sur les différentes catégories d&apos;accès ?
 		Votre catégorie d&apos;accès ne vous permet pas de pénétrer dans cette région.
 	</notification>
 	<notification name="RegionEntryAccessBlocked_Change">
-		La catégorie de contenu définie dans vos préférences ne vous permet pas de pénétrer dans cette région.
+		Votre catégorie d&apos;accès ne vous permet pas de pénétrer dans cette région.
 
-Pour cela, vous devez modifier votre paramètre de catégorie de contenu. Vous pourrez alors rechercher du contenu [REGIONMATURITY] et y accéder. Pour annuler vos modifications, accédez à Moi &gt; Préférences &gt; Général.
+En cliquant sur Modifier les préférences, vous pourrez changer votre catégorie d&apos;accès et pénétrer dans la région. À partir de maintenant, vous pouvez rechercher et accéder au contenu [REGIONMATURITY]. Vous pouvez modifier ce paramètre à partir du menu Moi &gt; Préférences &gt; Général.
 		<form name="form">
 			<button name="OK" text="Modifier les préférences"/>
 			<button default="true" name="Cancel" text="Fermer"/>
 			<ignore name="ignore" text="La catégorie de contenu que j&apos;ai choisie m&apos;empêche de pénétrer dans une région"/>
 		</form>
 	</notification>
-	<notification name="PreferredMaturityChanged">
-		Votre préférence de catégorie de contenu est désormais [RATING].
-	</notification>
 	<notification name="LandClaimAccessBlocked">
 		Votre catégorie d&apos;accès ne vous permet pas de réclamer cette région. Cela vient peut-être du fait qu&apos;il manquait des informations pour valider votre âge.
 
@@ -1683,7 +1591,7 @@ Publier cette petite annonce maintenant pour [AMOUNT] L$ ?
 		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification label="Envoyer un message à la région" name="MessageRegion">
-		Saisissez un message qui sera envoyé à tous les résidents présents dans cette région.
+		Saisissez une message qui sera envoyé à tous les résidents présents dans cette région.
 		<form name="form">
 			<input name="message"/>
 			<button name="OK" text="OK"/>
@@ -1856,7 +1764,7 @@ Linden Lab
 		Les composantes requises suivantes ne se trouvent pas dans [FLOATER]:
 [COMPONENTS]
 	</notification>
-	<notification label="Remplacer la pièce jointe existante" name="ReplaceAttachment">
+	<notification label="Remplacer la pièce-jointe existante" name="ReplaceAttachment">
 		Vous avez déjà un objet sur cette partie du corps.
 Voulez-vous le remplacer par l&apos;objet sélectionné ?
 		<form name="form">
@@ -2005,9 +1913,6 @@ Liez-la à partir d&apos;une page web pour permettre aux autres résidents d&apo
 	<notification name="SystemMessageTip">
 		[MESSAGE]
 	</notification>
-	<notification name="IMSystemMessageTip">
-		[MESSAGE]
-	</notification>
 	<notification name="Cancelled">
 		Annulé
 	</notification>
@@ -2342,6 +2247,15 @@ Veuillez réessayer dans quelques minutes.
 	</notification>
 	<notification name="ObjectGiveItem">
 		Un objet appelé [OBJECTFROMNAME] appartenant à [NAME_SLURL] vous a donné un [OBJECTTYPE] :
+[ITEM_SLURL]
+		<form name="form">
+			<button name="Keep" text="Garder"/>
+			<button name="Discard" text="Jeter"/>
+			<button name="Mute" text="Ignorer"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItemUnknownUser">
+		Un objet appelé [OBJECTFROMNAME] appartenant à (un résident inconnu) vous a donné un [OBJECTTYPE] :
 [ITEM_SLURL]
 		<form name="form">
 			<button name="Keep" text="Garder"/>
@@ -2372,9 +2286,9 @@ Veuillez réessayer dans quelques minutes.
 		</form>
 	</notification>
 	<notification name="TeleportOffered">
-		[NAME_SLURL] propose de vous téléporter à son emplacement :
+		[NAME] vous propose d&apos;être téléporté jusqu&apos;à son emplacement :
 
-[MESSAGE] - [MATURITY_STR] &lt;icon&gt;[MATURITY_ICON]&lt;/icon&gt;
+[MESSAGE]
 		<form name="form">
 			<button name="Teleport" text="Téléporter"/>
 			<button name="Cancel" text="Annuler"/>
@@ -2392,11 +2306,11 @@ Veuillez réessayer dans quelques minutes.
 		</form>
 	</notification>
 	<notification name="OfferFriendship">
-		[NAME_SLURL] vous demande de devenir son ami(e).
+		[NAME] vous demande de devenir son ami(e).
 
 [MESSAGE]
 
-(Par défaut, chacun pourra voir si l&apos;autre est connecté.)
+(Par défaut, vous pourrez voir lorsque vous êtes tous deux connectés.)
 		<form name="form">
 			<button name="Accept" text="Accepter"/>
 			<button name="Decline" text="Refuser"/>
@@ -2500,6 +2414,14 @@ Accepter cette requête ?
 			<button name="Ignore" text="Ignorer"/>
 		</form>
 	</notification>
+	<notification name="ScriptToast">
+		Le/La [TITLE] de [FIRST] [LAST] demande la participation du résident.
+		<form name="form">
+			<button name="Open" text="Ouvrir la boîte de dialogue"/>
+			<button name="Ignore" text="Ignorer"/>
+			<button name="Block" text="Ignorer"/>
+		</form>
+	</notification>
 	<notification name="BuyLindenDollarSuccess">
 		Nous vous remercions de votre paiement.
 
@@ -2590,21 +2512,6 @@ Pour y participer, cliquez sur Accepter. Sinon, cliquez sur Refuser. Pour ignore
 	<notification name="VoiceLoginRetry">
 		Nous sommes en train de créer un canal vocal pour vous. Veuillez patienter quelques instants.
 	</notification>
-	<notification name="VoiceEffectsExpired">
-		Au moins l&apos;un des effets de voix auxquels vous êtes abonné a expiré.
-[[URL] Cliquez ici] pour renouveler votre abonnement.
-	</notification>
-	<notification name="VoiceEffectsExpiredInUse">
-		L&apos;effet de voix actif a expiré. Vos paramètres de voix normaux ont été rétablis.
-[[URL] Cliquez ici] pour renouveler votre abonnement.
-	</notification>
-	<notification name="VoiceEffectsWillExpire">
-		Au moins l&apos;un de vos effets de voix expirera dans moins de [INTERVAL] jours.
-[[URL] Cliquez ici] pour renouveler votre abonnement.
-	</notification>
-	<notification name="VoiceEffectsNew">
-		De nouveaux effets de voix sont disponibles !
-	</notification>
 	<notification name="Cannot enter parcel: not a group member">
 		Seuls les membres d&apos;un certain groupe peuvent visiter cette zone.
 	</notification>
@@ -2641,7 +2548,7 @@ Elles vont être bloquées pendant quelques secondes pour votre sécurité.
 	</notification>
 	<notification name="ConfirmCloseAll">
 		Êtes-vous certain de vouloir fermer tous les IM ?
-		<usetemplate ignoretext="Confirmer avant de fermer tous les IM" name="okcancelignore" notext="Annuler" yestext="OK"/>
+		<usetemplate ignoretext="Confirmer avant de fermer tous les IM." name="okcancelignore" notext="Annuler" yestext="OK"/>
 	</notification>
 	<notification name="AttachmentSaved">
 		L&apos;élément joint a été sauvegardé.
@@ -2670,96 +2577,6 @@ Elles vont être bloquées pendant quelques secondes pour votre sécurité.
 		Le bouton sélectionné ne peut pas être affiché actuellement.
 Le bouton sera affiché quand il y aura suffisamment de place.
 	</notification>
-	<notification name="ShareNotification">
-		Sélectionnez les résidents avec lesquels partager l&apos;élément.
-	</notification>
-	<notification name="ShareItemsConfirmation">
-		Voulez-vous vraiment partager les articles suivants :
-
-[ITEMS]
-
-avec les résidents suivants :
-
-[RESIDENTS] ?
-		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="Ok"/>
-	</notification>
-	<notification name="ItemsShared">
-		Articles partagés.
-	</notification>
-	<notification name="DeedToGroupFail">
-		Échec de cession au groupe.
-	</notification>
-	<notification name="AvatarRezNotification">
-		([EXISTENCE] secondes d&apos;existence)
-Nuage de l&apos;avatar [NAME] disparu au bout de [TIME] secondes.
-	</notification>
-	<notification name="AvatarRezSelfBakedDoneNotification">
-		([EXISTENCE] secondes d&apos;existence)
-Tenue figée au bout de [TIME] secondes.
-	</notification>
-	<notification name="AvatarRezSelfBakedUpdateNotification">
-		([EXISTENCE] secondes d&apos;existence)
-Mise à jour de votre apparence transmise au bout de [TIME] secondes.
-[STATUS]
-	</notification>
-	<notification name="AvatarRezCloudNotification">
-		([EXISTENCE] secondes d&apos;existence)
-Transformation de l&apos;avatar [NAME] en nuage.
-	</notification>
-	<notification name="AvatarRezArrivedNotification">
-		([EXISTENCE] secondes d&apos;existence)
-L&apos;avatar [NAME] est apparu.
-	</notification>
-	<notification name="AvatarRezLeftCloudNotification">
-		([EXISTENCE] secondes d&apos;existence)
-Départ de l&apos;avatar [NAME] après [TIME] secondes sous forme de nuage.
-	</notification>
-	<notification name="AvatarRezEnteredAppearanceNotification">
-		([EXISTENCE] secondes d&apos;existence)
-L&apos;avatar [NAME] est entré en mode Apparence.
-	</notification>
-	<notification name="AvatarRezLeftAppearanceNotification">
-		([EXISTENCE] secondes d&apos;existence)
-L&apos;avatar [NAME] a quitté le mode Apparence.
-	</notification>
-	<notification name="NoConnect">
-		Problèmes de connexion via [PROTOCOL] [HOSTID].
-Veuillez vérifier la configuration de votre réseau et de votre pare-feu.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="NoVoiceConnect">
-		Problèmes de connexion à votre serveur vocal :
-
-[HOSTID]
-
-Aucune communication vocale n&apos;est disponible.
-Veuillez vérifier la configuration de votre réseau et de votre pare-feu.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="AvatarRezLeftNotification">
-		([EXISTENCE] secondes d&apos;existence)
-Départ de l&apos;avatar [NAME] entièrement chargé.
-	</notification>
-	<notification name="AvatarRezSelfBakeNotification">
-		([EXISTENCE] secondes d&apos;existence)
-Vous avez [ACTION] une texture figée de [RESOLUTION] pour [BODYREGION] au bout de [TIME] secondes.
-	</notification>
-	<notification name="ConfirmLeaveCall">
-		Voulez-vous vraiment quitter cet appel ?
-		<usetemplate ignoretext="Confirmer avant de quitter l&apos;appel" name="okcancelignore" notext="Non" yestext="Oui"/>
-	</notification>
-	<notification name="ConfirmMuteAll">
-		Vous avez choisi d&apos;ignorer l&apos;ensemble des participants de l&apos;appel du groupe.
-Les résidents rejoignant l&apos;appel ultérieurement seront également
-ignorés, même si vous quittez l&apos;appel.
-
-Ignorer les autres ?
-		<usetemplate ignoretext="Confirmer avant d&apos;ignorer les autres lors d&apos;un appel de groupe" name="okcancelignore" notext="Annuler" yestext="Ok"/>
-	</notification>
 	<global name="UnsupportedCPU">
 		- Votre processeur ne remplit pas les conditions minimum requises.
 	</global>
@@ -2784,7 +2601,4 @@ Si vous avez toujours des problèmes, veuillez consulter la page [SUPPORT_SITE].
 		Si vous possédez un terrain, vous pouvez le définir comme domicile.
 Sinon, consultez la carte et trouvez les &quot; infohubs &quot;.
 	</global>
-	<global name="You died and have been teleported to your home location">
-		Vous êtes mort et avez été téléporté à votre domicile.
-	</global>
 </notifications>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_gloves.xml b/indra/newview/skins/default/xui/fr/panel_edit_gloves.xml
index 7f02222bef2412ebfce4f1b3e4a613f47de2fe94..b1a437497df10256175b3f80f4f935bdb831d6a3 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_gloves.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_gloves.xml
@@ -2,11 +2,9 @@
 <panel name="edit_gloves_panel">
 	<panel name="avatar_gloves_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="80"/>
-	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="gloves_main_tab" title="Gants"/>
-		</accordion>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="gloves_main_tab" title="Gants"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_jacket.xml b/indra/newview/skins/default/xui/fr/panel_edit_jacket.xml
index 0a87471db882dd8946f4e8ae543a138e1cdacd90..b757f60b18ecc8292062821a4c5073b17b9bb4c9 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_jacket.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_jacket.xml
@@ -3,11 +3,9 @@
 	<panel name="avatar_jacket_color_panel">
 		<texture_picker label="Tissu (haut)" name="Upper Fabric" tool_tip="Cliquez pour sélectionner une image"/>
 		<texture_picker label="Tissu (bas)" name="Lower Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="80"/>
-	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="jacket_main_tab" title="Veste"/>
-		</accordion>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="jacket_main_tab" title="Veste"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_pants.xml b/indra/newview/skins/default/xui/fr/panel_edit_pants.xml
index b9f81278e22e6f57743ce4d0cfbbee1adb06a817..0cebe1e76a5091d2b958ce376573024dda59c121 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_pants.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_pants.xml
@@ -2,11 +2,9 @@
 <panel name="edit_pants_panel">
 	<panel name="avatar_pants_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="80"/>
-	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="pants_main_tab" title="Pantalon"/>
-		</accordion>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="pants_main_tab" title="Pantalon"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_shirt.xml b/indra/newview/skins/default/xui/fr/panel_edit_shirt.xml
index e4e66db2edd103308308e2789b52dfde48098ef2..d6035415d8cb246eadb5512badbaeccf3144f470 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_shirt.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_shirt.xml
@@ -2,11 +2,9 @@
 <panel name="edit_shirt_panel">
 	<panel name="avatar_shirt_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="80"/>
-	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="shirt_main_tab" title="Chemise"/>
-		</accordion>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="shirt_main_tab" title="Chemise"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_shoes.xml b/indra/newview/skins/default/xui/fr/panel_edit_shoes.xml
index 6fca0fe1217a1992a5de3498d2c9b54d05c68c6b..ef6d72629c4e2d547bb6e9d6469ff67d5c928197 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_shoes.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_shoes.xml
@@ -2,11 +2,9 @@
 <panel name="edit_shoes_panel">
 	<panel name="avatar_shoes_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="80"/>
-	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="shoes_main_tab" title="Chaussures"/>
-		</accordion>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="shoes_main_tab" title="Chaussures"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_skirt.xml b/indra/newview/skins/default/xui/fr/panel_edit_skirt.xml
index 65fed2fbf49a46c1150aa151394cab0686e61a1c..1250c7819d5071cf5ede7c6b5f1a59d0497aa3f6 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_skirt.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_skirt.xml
@@ -2,11 +2,9 @@
 <panel name="edit_skirt_panel">
 	<panel name="avatar_skirt_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="80"/>
-	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="skirt_main_tab" title="Jupe"/>
-		</accordion>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="skirt_main_tab" title="Jupe"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_socks.xml b/indra/newview/skins/default/xui/fr/panel_edit_socks.xml
index b9e9a07b8ce6543e11e2f4609f1d8555a98928d8..bcd69b7dc5b801d97c779c6695f3d0985821f25b 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_socks.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_socks.xml
@@ -2,11 +2,9 @@
 <panel name="edit_socks_panel">
 	<panel name="avatar_socks_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="80"/>
-	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="socks_main_tab" title="Chaussettes"/>
-		</accordion>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="socks_main_tab" title="Chaussettes"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_underpants.xml b/indra/newview/skins/default/xui/fr/panel_edit_underpants.xml
index 7eddbd93f6a001f929ea49e830bdee2a8fb5e72d..dd2670bd7569430c74b22830cb3559e0af546032 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_underpants.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_underpants.xml
@@ -2,11 +2,9 @@
 <panel name="edit_underpants_panel">
 	<panel name="avatar_underpants_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="80"/>
-	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="underpants_main_tab" title="Caleçon"/>
-		</accordion>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="underpants_main_tab" title="Caleçon"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_undershirt.xml b/indra/newview/skins/default/xui/fr/panel_edit_undershirt.xml
index e6bac22c231bff19e7fec9fd4fd0bcd7dc5aebe0..93a08f11891bb198982e60565f038a29745777f7 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_undershirt.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_undershirt.xml
@@ -2,11 +2,9 @@
 <panel name="edit_undershirt_panel">
 	<panel name="avatar_undershirt_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="80"/>
-	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="undershirt_main_tab" title="Débardeur"/>
-		</accordion>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="undershirt_main_tab" title="Débardeur"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_media_settings_permissions.xml b/indra/newview/skins/default/xui/fr/panel_media_settings_permissions.xml
index 8f1b436ba1b1516d00bdc170947b51af0ca2e2ba..f456ee1c835559728703b17d60084a936fb9c41a 100644
--- a/indra/newview/skins/default/xui/fr/panel_media_settings_permissions.xml
+++ b/indra/newview/skins/default/xui/fr/panel_media_settings_permissions.xml
@@ -11,19 +11,10 @@
 			Mini
 		</combo_item>
 	</combo_box>
-	<text name="owner_label">
-		Propriétaire
-	</text>
 	<check_box initial_value="false" label="Activer la navigation et l&apos;interactivité" name="perms_owner_interact"/>
 	<check_box initial_value="false" label="Afficher la barre de contrôles" name="perms_owner_control"/>
-	<text name="group_label">
-		Groupe :
-	</text>
 	<check_box initial_value="false" label="Activer la navigation et l&apos;interactivité" name="perms_group_interact"/>
 	<check_box initial_value="false" label="Afficher la barre de contrôles" name="perms_group_control"/>
-	<text name="anyone_label">
-		Tout le monde
-	</text>
 	<check_box initial_value="false" label="Activer la navigation et l&apos;interactivité" name="perms_anyone_interact"/>
 	<check_box initial_value="false" label="Afficher la barre de contrôles" name="perms_anyone_control"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/panel_nearby_media.xml b/indra/newview/skins/default/xui/fr/panel_nearby_media.xml
index 66bfd01a2aa5fc6064e954caa459de2c097aa59f..ef5a42555e2987595364e5ceef32effa611f7734 100644
--- a/indra/newview/skins/default/xui/fr/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/fr/panel_nearby_media.xml
@@ -1,8 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_media">
-	<string name="media_item_count_format">
-		(%ld articles de média)
-	</string>
 	<string name="empty_item_text">
 		&lt;vide&gt;
 	</string>
@@ -19,14 +16,13 @@
 		<button label="Arrêter" name="all_nearby_media_disable_btn" tool_tip="Désactiver tous les médias près de vous"/>
 		<button label="Lire" name="all_nearby_media_enable_btn" tool_tip="Activer tous les médias près de vous"/>
 		<button name="open_prefs_btn" tool_tip="Ouvrir les préférences de média"/>
-		<button label="Plus &gt;&gt;" label_selected="Moins &lt;&lt;" name="more_btn" tool_tip="Options avancées"/>
-		<button label="Plus &gt;&gt;" label_selected="Moins &lt;&lt;" name="less_btn" tool_tip="Options avancées"/>
+		<button label="Plus &gt;&gt;" label_selected="Moins &lt;&lt;" name="more_less_btn" tool_tip="Options avancées"/>
 	</panel>
 	<panel name="nearby_media_panel">
-		<text name="nearby_media_title">
+		<text name="nearby_media">
 			Médias proches
 		</text>
-		<text name="show_text">
+		<text name="show">
 			Voir :
 		</text>
 		<combo_box name="show_combo">
@@ -51,7 +47,7 @@
 					<button name="play_btn" tool_tip="Lire le média sélectionné"/>
 				</layout_panel>
 				<layout_panel name="pause">
-					<button name="pause_btn" tool_tip="Pause du média sélectionné"/>
+					<button name="pause_btn" tool_tip="Suspendre la lecture du média sélectionné"/>
 				</layout_panel>
 				<layout_panel name="volume_slider_ctrl">
 					<slider_bar initial_value="0.5" name="volume_slider" tool_tip="Volume audio du média sélectionné"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_places.xml b/indra/newview/skins/default/xui/fr/panel_places.xml
index 52a69db23cb2ca1778b99097334a948aeb1a0ede..92b0a6c1dbb9bf28b996984845acedc3781cc62a 100644
--- a/indra/newview/skins/default/xui/fr/panel_places.xml
+++ b/indra/newview/skins/default/xui/fr/panel_places.xml
@@ -5,12 +5,11 @@
 	<filter_editor label="Filtrer les endroits" name="Filter"/>
 	<panel name="button_panel">
 		<button label="Téléporter" name="teleport_btn" tool_tip="Me téléporter jusqu&apos;à la zone sélectionnée"/>
-		<button label="Carte" name="map_btn" tool_tip="Afficher la zone correspondante sur la carte du monde"/>
-		<button label="Modifier" name="edit_btn" tool_tip="Modifier les informations du repère"/>
+		<button label="Carte" name="map_btn"/>
+		<button label="Éditer" name="edit_btn" tool_tip="Modifier les informations du repère"/>
 		<button label="â–¼" name="overflow_btn" tool_tip="Afficher d&apos;autres options"/>
 		<button label="Enregistrer" name="save_btn"/>
 		<button label="Annuler" name="cancel_btn"/>
 		<button label="Fermer" name="close_btn"/>
-		<button label="Profil" name="profile_btn" tool_tip="Afficher le profil de l&apos;endroit"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml
index 1204d3325aa33715a8f8582f7dec9548a6fb65f1..0ea11bb80f355233493eb680f86455b5cbe16c4c 100644
--- a/indra/newview/skins/default/xui/fr/strings.xml
+++ b/indra/newview/skins/default/xui/fr/strings.xml
@@ -32,7 +32,7 @@
 		Initialisation du cache des textures...
 	</string>
 	<string name="StartupInitializingVFS">
-		Initialisation VFS...
+		Initialisation VFS…
 	</string>
 	<string name="ProgressRestoring">
 		Restauration...
@@ -100,24 +100,6 @@
 	<string name="LoginDownloadingClothing">
 		Habits en cours de téléchargement...
 	</string>
-	<string name="InvalidCertificate">
-		Certificat non valide ou corrompu renvoyé par le serveur. Contactez l&apos;administrateur de la grille.
-	</string>
-	<string name="CertInvalidHostname">
-		Nom d&apos;hôte non valide utilisé pour accéder au serveur. Vérifiez votre nom d&apos;hôte de grille ou SLURL.
-	</string>
-	<string name="CertExpired">
-		Il semble que le certificat renvoyé par la grille ait expiré.  Vérifiez votre horloge système ou contactez l&apos;administrateur de la grille.
-	</string>
-	<string name="CertKeyUsage">
-		Impossible d&apos;utiliser le certificat renvoyé par le serveur pour SSL. Contactez l&apos;administrateur de la grille.
-	</string>
-	<string name="CertBasicConstraints">
-		Certificats trop nombreux dans la chaîne des certificats du serveur. Contactez l&apos;administrateur de la grille.
-	</string>
-	<string name="CertInvalidSignature">
-		Impossible de vérifier la signature de certificat renvoyée par le serveur de la grille.  Contactez l&apos;administrateur de la grille.
-	</string>
 	<string name="LoginFailedNoNetwork">
 		Erreur réseau : impossible d&apos;établir la connexion. Veuillez vérifier votre connexion réseau.
 	</string>
@@ -196,7 +178,6 @@
 	<string name="TooltipMustSingleDrop">
 		Impossible de faire glisser plus d&apos;un objet ici
 	</string>
-	<string name="TooltipPrice" value="[AMOUNT] L$ :"/>
 	<string name="TooltipHttpUrl">
 		Cliquez pour afficher cette page web
 	</string>
@@ -249,6 +230,7 @@
 		Cliquez pour exécuter la commande secondlife:// command
 	</string>
 	<string name="CurrentURL" value=" URL actuelle : [CurrentURL]"/>
+	<string name="TooltipPrice" value="[PRICE] L$-"/>
 	<string name="SLurlLabelTeleport">
 		Me téléporter vers
 	</string>
@@ -279,9 +261,6 @@
 	<string name="BUTTON_CLOSE_WIN">
 		Fermer (Ctrl+W)
 	</string>
-	<string name="BUTTON_CLOSE_CHROME">
-		Fermer
-	</string>
 	<string name="BUTTON_RESTORE">
 		Restaurer
 	</string>
@@ -309,9 +288,6 @@
 	<string name="ReleaseNotes">
 		Notes de version
 	</string>
-	<string name="RELEASE_NOTES_BASE_URL">
-		http://wiki.secondlife.com/wiki/Release_Notes/
-	</string>
 	<string name="LoadingData">
 		Chargement...
 	</string>
@@ -327,9 +303,6 @@
 	<string name="GroupNameNone">
 		(aucun)
 	</string>
-	<string name="AvalineCaller">
-		Appelant Avaline [ORDER]
-	</string>
 	<string name="AssetErrorNone">
 		Aucune erreur
 	</string>
@@ -415,7 +388,7 @@
 		image targa
 	</string>
 	<string name="trash">
-		Corbeille
+		Poubelle
 	</string>
 	<string name="jpeg image">
 		image jpeg
@@ -541,7 +514,7 @@
 		Va te faire voir !
 	</string>
 	<string name="anim_express_kiss">
-		Envoyer un baiser
+		Baiser
 	</string>
 	<string name="anim_laugh_short">
 		Rire
@@ -663,9 +636,6 @@
 	<string name="worldmap_offline">
 		Hors ligne
 	</string>
-	<string name="worldmap_item_tooltip_format">
-		[AREA] m² [PRICE] L$
-	</string>
 	<string name="worldmap_results_none_found">
 		Aucun résultat.
 	</string>
@@ -759,12 +729,6 @@
 	<string name="land_type_unknown">
 		(inconnu)
 	</string>
-	<string name="Estate / Full Region">
-		Domaine / Région entière
-	</string>
-	<string name="Mainland / Full Region">
-		Continent / Région entière
-	</string>
 	<string name="all_files">
 		Tous fichiers
 	</string>
@@ -870,93 +834,6 @@
 	<string name="invalid">
 		non valide
 	</string>
-	<string name="none">
-		aucun
-	</string>
-	<string name="shirt_not_worn">
-		Chemise non portée
-	</string>
-	<string name="pants_not_worn">
-		Pantalon non porté
-	</string>
-	<string name="shoes_not_worn">
-		Chaussures non portées
-	</string>
-	<string name="socks_not_worn">
-		Chaussettes non portées
-	</string>
-	<string name="jacket_not_worn">
-		Veste non portée
-	</string>
-	<string name="gloves_not_worn">
-		Gants non portés
-	</string>
-	<string name="undershirt_not_worn">
-		Débardeur non porté
-	</string>
-	<string name="underpants_not_worn">
-		Caleçon non porté
-	</string>
-	<string name="skirt_not_worn">
-		Jupe non portée
-	</string>
-	<string name="alpha_not_worn">
-		Alpha non porté
-	</string>
-	<string name="tattoo_not_worn">
-		Tatouage non porté
-	</string>
-	<string name="invalid_not_worn">
-		non valide
-	</string>
-	<string name="create_new_shape">
-		Créer une nouvelle silhouette
-	</string>
-	<string name="create_new_skin">
-		Créer une nouvelle peau
-	</string>
-	<string name="create_new_hair">
-		Créer de nouveaux cheveux
-	</string>
-	<string name="create_new_eyes">
-		Créer de nouveaux yeux
-	</string>
-	<string name="create_new_shirt">
-		Créer une nouvelle chemise
-	</string>
-	<string name="create_new_pants">
-		Créer un nouveau pantalon
-	</string>
-	<string name="create_new_shoes">
-		Créer de nouvelles chaussures
-	</string>
-	<string name="create_new_socks">
-		Créer de nouvelles chaussettes
-	</string>
-	<string name="create_new_jacket">
-		Créer une nouvelle veste
-	</string>
-	<string name="create_new_gloves">
-		Créer de nouveaux gants
-	</string>
-	<string name="create_new_undershirt">
-		Créer un nouveau débardeur
-	</string>
-	<string name="create_new_underpants">
-		Créer un nouveau caleçon
-	</string>
-	<string name="create_new_skirt">
-		Créer une nouvelle jupe
-	</string>
-	<string name="create_new_alpha">
-		Créer un nouvel alpha
-	</string>
-	<string name="create_new_tattoo">
-		Créer un nouveau tatouage
-	</string>
-	<string name="create_new_invalid">
-		non valide
-	</string>
 	<string name="NewWearable">
 		Nouv. [WEARABLE_ITEM]
 	</string>
@@ -982,7 +859,7 @@
 		Consultez les notices précédentes ou choisissez de ne plus recevoir ces messages ici.
 	</string>
 	<string name="GroupNotifyOpenAttachment">
-		Ouvrir pièce jointe
+		Ouvrir la pièce jointe
 	</string>
 	<string name="GroupNotifySaveAttachment">
 		Enregistrer la pièce jointe
@@ -1027,10 +904,7 @@
 		Appuyez sur ESC pour quitter la vue subjective
 	</string>
 	<string name="InventoryNoMatchingItems">
-		Vous n&apos;avez pas trouvé ce que vous cherchiez ? Essayez [secondlife:///app/search/all/Rechercher [SEARCH_TERM]].
-	</string>
-	<string name="PlacesNoMatchingItems">
-		Vous n&apos;avez pas trouvé ce que vous cherchiez ? Essayez [secondlife:///app/search/places/Rechercher [SEARCH_TERM]].
+		Objet inexistant dans l&apos;inventaire. Voir [secondlife:///app/search/groups &quot;Rechercher&quot;].
 	</string>
 	<string name="FavoritesNoMatchingItems">
 		Faites glisser un repère ici pour l&apos;ajouter à vos Favoris.
@@ -1064,10 +938,8 @@
 	<string name="AnimFlagStop" value=" Arrêter l&apos;animation :"/>
 	<string name="AnimFlagStart" value=" Démarrer l&apos;animation :"/>
 	<string name="Wave" value=" Faire signe"/>
-	<string name="GestureActionNone" value="Aucune"/>
 	<string name="HelloAvatar" value=" Bonjour, avatar !"/>
 	<string name="ViewAllGestures" value="  Tout afficher &gt;&gt;"/>
-	<string name="GetMoreGestures" value="Plus &gt;&gt;"/>
 	<string name="Animations" value=" Animations,"/>
 	<string name="Calling Cards" value=" Cartes de visite,"/>
 	<string name="Clothing" value=" Habits,"/>
@@ -1127,7 +999,7 @@
 		Parties du corps
 	</string>
 	<string name="InvFolder Trash">
-		Corbeille
+		Poubelle
 	</string>
 	<string name="InvFolder Photo Album">
 		Albums photo
@@ -1144,15 +1016,12 @@
 	<string name="InvFolder Gestures">
 		Gestes
 	</string>
-	<string name="InvFolder Favorite">
+	<string name="InvFolder favorite">
 		Favoris
 	</string>
 	<string name="InvFolder Current Outfit">
 		Tenue actuelle
 	</string>
-	<string name="InvFolder Initial Outfits">
-		Tenues initiales
-	</string>
 	<string name="InvFolder My Outfits">
 		Mes tenues
 	</string>
@@ -1472,12 +1341,11 @@
 	<string name="SummaryForTheWeek" value="Récapitulatif de la semaine, début le "/>
 	<string name="NextStipendDay" value="Prochaine prime le "/>
 	<string name="GroupIndividualShare" value="                      Groupe    Part individuelle"/>
-	<string name="GroupColumn" value="Groupe"/>
 	<string name="Balance">
 		Solde
 	</string>
 	<string name="Credits">
-		Crédits
+		Remerciements
 	</string>
 	<string name="Debits">
 		Débits
@@ -1668,9 +1536,6 @@
 	<string name="ATTACH_HUD_BOTTOM_RIGHT">
 		HUD en bas à droite
 	</string>
-	<string name="Bad attachment point">
-		Point d&apos;attache non valide
-	</string>
 	<string name="CursorPos">
 		Ligne [LINE], colonne [COLUMN]
 	</string>
@@ -1683,21 +1548,15 @@
 	<string name="PanelDirEventsDateText">
 		[mthnum,datetime,slt]/[day,datetime,slt]
 	</string>
-	<string name="PanelContentsTooltip">
-		Contenu de l&apos;objet
-	</string>
 	<string name="PanelContentsNewScript">
 		Nouveau script
 	</string>
+	<string name="PanelContentsTooltip">
+		Contenu de l&apos;objet
+	</string>
 	<string name="BusyModeResponseDefault">
 		Le résident auquel vous avez envoyé un message est en mode Occupé, ce qui signifie qu&apos;il a demandé à ne pas être dérangé.  Votre message restera affiché dans son panneau IM afin qu&apos;il puisse le lire ultérieurement.
 	</string>
-	<string name="NoOutfits">
-		Aucune tenue n&apos;est actuellement en votre possession. Essayez [secondlife:///app/search/all Rechercher].
-	</string>
-	<string name="NoOutfitsTabsMatched">
-		Vous n&apos;avez pas trouvé ce que vous cherchiez ? Essayez [secondlife:///app/search/all/Rechercher [SEARCH_TERM]].
-	</string>
 	<string name="MuteByName">
 		(par nom)
 	</string>
@@ -1710,16 +1569,15 @@
 	<string name="MuteGroup">
 		(groupe)
 	</string>
-	<string name="MuteExternal">
-		(externe)
-	</string>
 	<string name="RegionNoCovenant">
 		Il n&apos;y a aucun règlement pour ce domaine.
 	</string>
 	<string name="RegionNoCovenantOtherOwner">
 		Il n&apos;y a aucun règlement pour ce domaine. Le terrain sur ce domaine est vendu par le propriétaire, non par Linden Lab.  Pour en savoir plus, veuillez contacter le propriétaire.
 	</string>
-	<string name="covenant_last_modified" value="Dernière modification :"/>
+	<string name="covenant_last_modified">
+		Dernière modification :
+	</string>
 	<string name="none_text" value=" (aucun)"/>
 	<string name="never_text" value=" (jamais)"/>
 	<string name="GroupOwned">
@@ -1798,7 +1656,7 @@
 		Solde
 	</string>
 	<string name="GroupMoneyCredits">
-		Crédits
+		Remerciements
 	</string>
 	<string name="GroupMoneyDebits">
 		Débits
@@ -2227,7 +2085,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Large
 	</string>
 	<string name="Brow Size">
-		Taille du front
+		Taille
 	</string>
 	<string name="Bug Eyes">
 		Yeux globuleux
@@ -2377,7 +2235,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Extrémités
 	</string>
 	<string name="Egg Head">
-		Proéminence
+		Forme de la tête
 	</string>
 	<string name="Eye Bags">
 		Cernes
@@ -2503,7 +2361,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Gants avec doigts
 	</string>
 	<string name="Glove Length">
-		Longueur
+		Longueur des gants
 	</string>
 	<string name="Hair">
 		Cheveux
@@ -2617,7 +2475,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Angle mâchoire
 	</string>
 	<string name="Jaw Jut">
-		Saillie mâchoire
+		Saillie de la mâchoire
 	</string>
 	<string name="Jaw Shape">
 		Mâchoire
@@ -2701,7 +2559,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Fente labiale
 	</string>
 	<string name="Lip Cleft Depth">
-		Prof. fente labiale
+		Fente labiale
 	</string>
 	<string name="Lip Fullness">
 		Volume des lèvres
@@ -2785,7 +2643,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Abaisser
 	</string>
 	<string name="Lower Bridge">
-		Arête inférieure
+		Arête plus basse
 	</string>
 	<string name="Lower Cheeks">
 		Joue inférieure
@@ -2959,19 +2817,19 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Épaisseur du nez
 	</string>
 	<string name="Nose Tip Angle">
-		Angle bout du nez
+		Bout du nez
 	</string>
 	<string name="Nose Tip Shape">
-		Forme bout du nez
+		Bout du nez
 	</string>
 	<string name="Nose Width">
 		Largeur du nez
 	</string>
 	<string name="Nostril Division">
-		Division narines
+		Division des narines
 	</string>
 	<string name="Nostril Width">
-		Largeur narines
+		Largeur des narines
 	</string>
 	<string name="Opaque">
 		Opaque
@@ -3061,10 +2919,10 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Plus rose
 	</string>
 	<string name="Platform Height">
-		Platef. (hauteur)
+		Plateforme (hauteur)
 	</string>
 	<string name="Platform Width">
-		Platef. (largeur)
+		Plateforme (largeur)
 	</string>
 	<string name="Pointy">
 		Pointue
@@ -3088,7 +2946,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Plus
 	</string>
 	<string name="Puffy Eyelids">
-		Paup. gonflées
+		Cernes
 	</string>
 	<string name="Rainbow Color">
 		Couleur arc en ciel
@@ -3154,7 +3012,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Vers la gauche
 	</string>
 	<string name="Shift Mouth">
-		Déplacement
+		Déplacer la bouche
 	</string>
 	<string name="Shift Right">
 		Vers la droite
@@ -3352,7 +3210,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Forme de l&apos;orteil
 	</string>
 	<string name="Toe Thickness">
-		Épaisseur orteil
+		Épaisseur de l&apos;orteil
 	</string>
 	<string name="Torso Length">
 		Longueur du torse
@@ -3379,7 +3237,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		Arête supérieure
 	</string>
 	<string name="Upper Cheeks">
-		Joue supérieure
+		Pommette
 	</string>
 	<string name="Upper Chin Cleft">
 		Menton supérieur
@@ -3453,15 +3311,6 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 	<string name="LocationCtrlDamageTooltip">
 		Santé
 	</string>
-	<string name="LocationCtrlAdultIconTooltip">
-		Région de type Adulte
-	</string>
-	<string name="LocationCtrlModerateIconTooltip">
-		Région de type Modéré
-	</string>
-	<string name="LocationCtrlGeneralIconTooltip">
-		Région de type Général
-	</string>
 	<string name="UpdaterWindowTitle">
 		[APP_NAME] - Mise à jour
 	</string>
@@ -3492,12 +3341,6 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 	<string name="UpdaterFailStartTitle">
 		Impossible de lancer le client
 	</string>
-	<string name="ItemsComingInTooFastFrom">
-		[APP_NAME] : transfert trop rapide des articles de [FROM_NAME] ; aperçu automatique désactivé pendant [TIME] secondes
-	</string>
-	<string name="ItemsComingInTooFast">
-		[APP_NAME] : transfert trop rapide des articles ; aperçu automatique désactivé pendant [TIME] secondes
-	</string>
 	<string name="IM_logging_string">
 		-- Archivage des IM activé --
 	</string>
@@ -3525,17 +3368,11 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 	<string name="IM_moderator_label">
 		(Modérateur)
 	</string>
-	<string name="answered_call">
-		Votre appel a fait l&apos;objet d&apos;une réponse
-	</string>
-	<string name="you_started_call">
-		Vous appelez.
+	<string name="started_call">
+		A appelé quelqu&apos;un
 	</string>
-	<string name="you_joined_call">
-		Vous avez rejoint l&apos;appel
-	</string>
-	<string name="name_started_call">
-		[NAME] appelle.
+	<string name="joined_call">
+		A rejoint l&apos;appel
 	</string>
 	<string name="ringing-im">
 		En train de rejoindre l&apos;appel...
@@ -3624,21 +3461,12 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 	<string name="unread_chat_multiple">
 		[SOURCES] ont dit quelque chose de nouveau
 	</string>
-	<string name="session_initialization_timed_out_error">
-		Expiration du délai d&apos;initialisation de la session
-	</string>
-	<string name="voice_morphing_url">
-		http://secondlife.com/landing/voicemorphing
-	</string>
 	<string name="paid_you_ldollars">
 		[NAME] vous a payé [AMOUNT] L$
 	</string>
 	<string name="you_paid_ldollars">
 		Vous avez payé à [AMOUNT] L$ [REASON].
 	</string>
-	<string name="you_paid_ldollars_no_info">
-		Vous avez payé [AMOUNT] L$.
-	</string>
 	<string name="you_paid_ldollars_no_reason">
 		Vous avez payé à [NAME] [AMOUNT] L$.
 	</string>
@@ -3687,9 +3515,6 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 	<string name="group_role_owners">
 		Propriétaires
 	</string>
-	<string name="group_member_status_online">
-		En ligne
-	</string>
 	<string name="uploading_abuse_report">
 		Chargement en cours... 
 
@@ -3743,203 +3568,13 @@ de l&apos;infraction signalée
 	<string name="Invalid Wearable">
 		Objet à porter non valide
 	</string>
-	<string name="New Gesture">
-		Nouveau geste
-	</string>
 	<string name="New Script">
 		Nouveau script
 	</string>
-	<string name="New Note">
-		Nouvelle note
-	</string>
 	<string name="New Folder">
 		Nouveau dossier
 	</string>
 	<string name="Contents">
 		Contenus
 	</string>
-	<string name="Gesture">
-		Geste
-	</string>
-	<string name="Male Gestures">
-		Gestes masculins
-	</string>
-	<string name="Female Gestures">
-		Gestes féminins
-	</string>
-	<string name="Other Gestures">
-		Autres gestes
-	</string>
-	<string name="Speech Gestures">
-		Gestes liés à la parole
-	</string>
-	<string name="Common Gestures">
-		Gestes communs
-	</string>
-	<string name="Male - Excuse me">
-		Homme - Demander pardon
-	</string>
-	<string name="Male - Get lost">
-		Homme - Get lost
-	</string>
-	<string name="Male - Blow kiss">
-		Homme - Envoyer un baiser
-	</string>
-	<string name="Male - Boo">
-		Homme - Hou !
-	</string>
-	<string name="Male - Bored">
-		Homme - Ennui
-	</string>
-	<string name="Male - Hey">
-		Homme - Hé !
-	</string>
-	<string name="Male - Laugh">
-		Homme - Rire
-	</string>
-	<string name="Male - Repulsed">
-		Homme - Dégoût
-	</string>
-	<string name="Male - Shrug">
-		Homme - Hausser les épaules
-	</string>
-	<string name="Male - Stick tougue out">
-		Homme - Tirer la langue
-	</string>
-	<string name="Male - Wow">
-		Homme - Ouah !
-	</string>
-	<string name="Female - Chuckle">
-		Femme - Glousser
-	</string>
-	<string name="Female - Cry">
-		Femme - Pleurer
-	</string>
-	<string name="Female - Embarrassed">
-		Femme - Gêne
-	</string>
-	<string name="Female - Excuse me">
-		Femme - Demander pardon
-	</string>
-	<string name="Female - Get lost">
-		Femme - Get lost
-	</string>
-	<string name="Female - Blow kiss">
-		Femme - Envoyer un baiser
-	</string>
-	<string name="Female - Boo">
-		Femme - Hou !
-	</string>
-	<string name="Female - Bored">
-		Femme - Ennui
-	</string>
-	<string name="Female - Hey">
-		Femme - Hé !
-	</string>
-	<string name="Female - Hey baby">
-		Femme - Hey baby
-	</string>
-	<string name="Female - Laugh">
-		Femme - Rire
-	</string>
-	<string name="Female - Looking good">
-		Femme - Looking good
-	</string>
-	<string name="Female - Over here">
-		Femme - Over here
-	</string>
-	<string name="Female - Please">
-		Femme - Please
-	</string>
-	<string name="Female - Repulsed">
-		Femme - Dégoût
-	</string>
-	<string name="Female - Shrug">
-		Femme - Hausser les épaules
-	</string>
-	<string name="Female - Stick tougue out">
-		Femme - Tirer la langue
-	</string>
-	<string name="Female - Wow">
-		Femme - Ouah !
-	</string>
-	<string name="AvatarBirthDateFormat">
-		[day,datetime,slt]/[mthnum,datetime,slt]/[year,datetime,slt]
-	</string>
-	<string name="DefaultMimeType">
-		aucun/aucun
-	</string>
-	<string name="texture_load_dimensions_error">
-		Impossible de charger des images de taille supérieure à [WIDTH]*[HEIGHT]
-	</string>
-	<string name="words_separator" value=","/>
-	<string name="server_is_down">
-		Malgré nos efforts, une erreur inattendue s&apos;est produite.
-
-	Veuillez vous reporter à status.secondlifegrid.net afin de déterminer si un problème connu existe avec ce service.  
-        Si le problème persiste, vérifiez la configuration de votre réseau et de votre pare-feu.
-	</string>
-	<string name="dateTimeWeekdaysNames">
-		Sunday:Monday:Tuesday:Wednesday:Thursday:Friday:Saturday
-	</string>
-	<string name="dateTimeWeekdaysShortNames">
-		Sun:Mon:Tue:Wed:Thu:Fri:Sat
-	</string>
-	<string name="dateTimeMonthNames">
-		January:February:March:April:May:June:July:August:September:October:November:December
-	</string>
-	<string name="dateTimeMonthShortNames">
-		Jan:Feb:Mar:Apr:May:Jun:Jul:Aug:Sep:Oct:Nov:Dec
-	</string>
-	<string name="dateTimeDayFormat">
-		[MDAY]
-	</string>
-	<string name="dateTimeAM">
-		AM
-	</string>
-	<string name="dateTimePM">
-		PM
-	</string>
-	<string name="LocalEstimateUSD">
-		[AMOUNT] US$
-	</string>
-	<string name="Membership">
-		Inscription
-	</string>
-	<string name="Roles">
-		Rôles
-	</string>
-	<string name="Group Identity">
-		Identité du groupe
-	</string>
-	<string name="Parcel Management">
-		Gestion des parcelles
-	</string>
-	<string name="Parcel Identity">
-		Identité des parcelles
-	</string>
-	<string name="Parcel Settings">
-		Paramètres des parcelles
-	</string>
-	<string name="Parcel Powers">
-		Pouvoirs sur les parcelles
-	</string>
-	<string name="Parcel Access">
-		Accès aux parcelles
-	</string>
-	<string name="Parcel Content">
-		Contenu des parcelles
-	</string>
-	<string name="Object Management">
-		Gestion des objets
-	</string>
-	<string name="Accounting">
-		Comptabilité
-	</string>
-	<string name="Notices">
-		Notices
-	</string>
-	<string name="Chat">
-		Chat
-	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/it/floater_about_land.xml b/indra/newview/skins/default/xui/it/floater_about_land.xml
index af83a3874685b05d35e401f55c256e26c274edda..bc23c2e8ff8cb912baf860ef42d189a66b7f0cb2 100644
--- a/indra/newview/skins/default/xui/it/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/it/floater_about_land.xml
@@ -63,9 +63,6 @@
 				Nessun appezzamento selezionato.
 Vai al menu Mondo &gt; Informazioni sul terreno oppure seleziona un altro appezzamento per vederne i dettagli.
 			</panel.string>
-			<panel.string name="time_stamp_template">
-				[wkday,datetime,local] [day,datetime,local] [mth,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
-			</panel.string>
 			<text name="Name:">
 				Nome:
 			</text>
@@ -82,7 +79,7 @@ Vai al menu Mondo &gt; Informazioni sul terreno oppure seleziona un altro appezz
 				Categoria di accesso:
 			</text>
 			<text left="119" name="ContentRatingText">
-				Adulti
+				Adult
 			</text>
 			<text name="Owner:">
 				Proprietario:
@@ -142,10 +139,10 @@ Vai al menu Mondo &gt; Informazioni sul terreno oppure seleziona un altro appezz
 			<button label="Acquista il terreno..." label_selected="Acquista il terreno..." left="130" name="Buy Land..." width="125"/>
 			<button label="Informazioni script" name="Scripts..."/>
 			<button label="Acquista per il gruppo" name="Buy For Group..."/>
-			<button label="Compra Pass..." label_selected="Compra Pass..." left="130" name="Buy Pass..." tool_tip="Un pass ti da un accesso temporaneo in questo territorio." width="125"/>
+			<button label="Compra pass..." label_selected="Compra pass..." left="130" name="Buy Pass..." tool_tip="Un pass ti da un accesso temporaneo in questo territorio." width="125"/>
 			<button label="Abbandona la terra" name="Abandon Land..."/>
 			<button label="Reclama la terra" name="Reclaim Land..."/>
-			<button label="Vendita Linden" name="Linden Sale..." tool_tip="La terra deve essere di proprietà, con contenuto impostato, e non già messa all&apos;asta."/>
+			<button label="Vendita Linden" name="Linden Sale..." tool_tip="La terra deve essere posseduta, con contenuto impostato, e non già messa in asta."/>
 		</panel>
 		<panel label="REGOLAMENTO" name="land_covenant_panel">
 			<panel.string name="can_resell">
@@ -196,18 +193,18 @@ o suddivisa.
 				Categoria di accesso:
 			</text>
 			<text left="125" name="region_maturity_text">
-				Adulti
+				Adult
 			</text>
 			<text name="resellable_lbl">
 				Rivendita:
 			</text>
-			<text name="resellable_clause">
+			<text left="125" name="resellable_clause">
 				La terra in questa regione non può essere rivenduta.
 			</text>
 			<text name="changeable_lbl">
 				Suddividi:
 			</text>
-			<text name="changeable_clause">
+			<text left="125" name="changeable_clause">
 				La terra in questa regione non può essere unita/suddivisa.
 			</text>
 		</panel>
@@ -222,7 +219,7 @@ o suddivisa.
 				Fattore bonus degli oggetti della regione: [BONUS]
 			</text>
 			<text name="Simulator primitive usage:">
-				Uso delle primitive:
+				Uso dei Prim:
 			</text>
 			<text left="214" name="objects_available" width="230">
 				[COUNT] dei [MAX] ([AVAILABLE] dsponibili)
@@ -269,7 +266,7 @@ o suddivisa.
 			<text left="214" name="selected_objects_text" width="48">
 				[COUNT]
 			</text>
-			<text name="Autoreturn">
+			<text left="4" name="Autoreturn" width="412">
 				Restituzione automatica degli oggetti di altri residenti (minuti, 0 per disattivarla):
 			</text>
 			<line_editor name="clean other time" right="-20"/>
@@ -297,16 +294,16 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 				Questa opzione è disabilitata perchè tu non puoi modificare le opzioni di questo terreno.
 			</panel.string>
 			<panel.string name="mature_check_mature">
-				Contenuto Moderato
+				Contenuto Mature
 			</panel.string>
 			<panel.string name="mature_check_adult">
-				Contenuto Adulti
+				Contenuto Adult
 			</panel.string>
 			<panel.string name="mature_check_mature_tooltip">
-				Il contenuto o le informazioni del tuo terreno sono considerate di tipo Moderato.
+				Il contenuto o le informazioni del tuo terreno sono considerate Mature.
 			</panel.string>
 			<panel.string name="mature_check_adult_tooltip">
-				Il contenuto o le informazioni del tuo terreno sono considerate di tipo per Adulti.
+				Il contenuto o le informazioni del tuo terreno sono considerate Adult.
 			</panel.string>
 			<panel.string name="landing_point_none">
 				(nessuno)
@@ -320,7 +317,7 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 			<text name="allow_label">
 				Permetti ad altri residenti di:
 			</text>
-			<check_box label="Modificare il terreno" name="edit land check" tool_tip="Se spuntata, chiunque può terraformare il tuo terreno. È preferibile lasciare questa opzione non spuntata, dato che sarai comunque in grado di modificare il tuo terreno."/>
+			<check_box label="Modificare il terreno" name="edit land check" tool_tip="Se spuntato, chiunque può terraformare il tuo terreno. E&apos; preferibile lasciare questo quadrato non spuntato, dato che sarai sempre in grado di modificare il tuo terreno."/>
 			<check_box label="Permetti il volo" name="check fly" tool_tip="Se spuntato, gli altri residenti potranno volare sul tuo terreno. Se non spuntato, potranno solamente arrivare in volo o sorvolare il terreno."/>
 			<text name="allow_label2">
 				Creare oggetti:
@@ -328,7 +325,7 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 			<check_box label="Tutti i residenti" name="edit objects check"/>
 			<check_box label="Gruppo" name="edit group objects check"/>
 			<text name="allow_label3">
-				Immissione oggetti:
+				Entrata oggetti:
 			</text>
 			<check_box label="Tutti i residenti" name="all object entry check"/>
 			<check_box label="Gruppo" name="group object entry check"/>
@@ -340,16 +337,16 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 			<text name="land_options_label">
 				Opzioni per il terreno:
 			</text>
-			<check_box label="Sicuro (senza danno)" name="check safe" tool_tip="Se spuntato, imposta il terreno su &apos;sicuro&apos;, disabilitando i danni da combattimento. Se non spuntato, viene abilitato il combattimento con danni."/>
+			<check_box label="Sicuro (senza danno)" name="check safe" tool_tip="Se spuntato, imposta il terreno su &apos;sicuro&apos;, disabilitando i danni da combattimento. Se non spuntato, viene abilitato il combattimento a morte."/>
 			<check_box label="Nessuna spinta" name="PushRestrictCheck" tool_tip="Previeni i colpi. Selezionare questa opzione può essere utile per prevenire comportamenti dannosi sul tuo terreno."/>
-			<check_box label="Mostra luogo nella ricerca (30 L$/settimana)" name="ShowDirectoryCheck" tool_tip="Consenti che il lotto sia visto nei risultati di ricerca"/>
-			<combo_box name="land category with adult">
+			<check_box label="Mostra luogo nella ricerca (30 L$/settimana)" name="ShowDirectoryCheck" tool_tip="Lascia che questa terra sia vista dagli altri nei risultati di ricerca"/>
+			<combo_box left="282" name="land category with adult" width="140">
 				<combo_box.item label="Tutte le categorie" name="item0"/>
 				<combo_box.item label="Luogo dei Linden" name="item1"/>
-				<combo_box.item label="Adulti" name="item2"/>
-				<combo_box.item label="Arte e cultura" name="item3"/>
+				<combo_box.item label="Adult" name="item2"/>
+				<combo_box.item label="Arte &amp; Cultura" name="item3"/>
 				<combo_box.item label="Affari" name="item4"/>
-				<combo_box.item label="Istruzione" name="item5"/>
+				<combo_box.item label="Educazione" name="item5"/>
 				<combo_box.item label="Gioco" name="item6"/>
 				<combo_box.item label="Divertimento" name="item7"/>
 				<combo_box.item label="Accoglienza nuovi residenti" name="item8"/>
@@ -358,7 +355,7 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 				<combo_box.item label="Shopping" name="item11"/>
 				<combo_box.item label="Altro" name="item12"/>
 			</combo_box>
-			<combo_box name="land category">
+			<combo_box left="282" name="land category" width="140">
 				<combo_box.item label="Tutte le categorie" name="item0"/>
 				<combo_box.item label="Luogo dei Linden" name="item1"/>
 				<combo_box.item label="Arte &amp; Cultura" name="item3"/>
@@ -372,7 +369,7 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 				<combo_box.item label="Shopping" name="item11"/>
 				<combo_box.item label="Altro" name="item12"/>
 			</combo_box>
-			<check_box label="Contenuti di tipo Moderato" name="MatureCheck" tool_tip=" "/>
+			<check_box label="Contenuto Mature" name="MatureCheck" tool_tip=" "/>
 			<text name="Snapshot:">
 				Fotografia:
 			</text>
@@ -421,7 +418,7 @@ Texture:
 			<spinner left_delta="104" name="media_size_width" tool_tip="Aumenta larghezza per far vedere meglio i media web, lascia a 0 per impostare il default."/>
 			<spinner name="media_size_height" tool_tip="Aumenta altezza per far vedere meglio i media web, lascia a 0 per impostare il default."/>
 			<text name="pixels">
-				pixel
+				pixels
 			</text>
 			<text name="Options:">
 				Opzioni
@@ -430,17 +427,7 @@ Media:
 			<check_box label="Fai ripetere il video" left="265" name="media_loop" tool_tip="Fai ripetere il video continuamente. Quando il video è finito, reinizierà dal principio."/>
 		</panel>
 		<panel label="SUONO" name="land_audio_panel">
-			<text name="MusicURL:">
-				URL musica:
-			</text>
 			<check_box label="Nascondi URL" name="hide_music_url" tool_tip="Questa opzione consente di nascondere l&apos;url della musica a chi non è autorizzato a visionare le informazioni di questo parcel."/>
-			<text name="Sound:">
-				Audio:
-			</text>
-			<check_box label="Limita l&apos;audio per oggetti e gesture a questo lotto" name="check sound local"/>
-			<text name="Voice settings:">
-				Voce:
-			</text>
 			<check_box label="Attiva voce" name="parcel_enable_voice_channel"/>
 			<check_box label="Attiva voce (stabilito dalla proprietà)" name="parcel_enable_voice_channel_is_estate_disabled"/>
 			<check_box label="Limita il chat vocale a questo lotto" name="parcel_enable_voice_channel_local"/>
@@ -473,20 +460,7 @@ Media:
 			<spinner label="Prezzo in L$:" name="PriceSpin"/>
 			<spinner label="Ore di accesso:" name="HoursSpin"/>
 			<panel name="Allowed_layout_panel">
-				<text label="Consenti sempre" name="AllowedText">
-					Residenti consentiti
-				</text>
 				<name_list name="AccessList" tool_tip="([LISTED] in lista, [MAX] max)"/>
-				<button label="Aggiungi" name="add_allowed"/>
-				<button label="Rimuovi" label_selected="Rimuovi" name="remove_allowed"/>
-			</panel>
-			<panel name="Banned_layout_panel">
-				<text label="Espelli" name="BanCheck">
-					Residenti con divieto
-				</text>
-				<name_list name="BannedList" tool_tip="([LISTED] in lista, [MAX] max)"/>
-				<button label="Aggiungi" name="add_banned"/>
-				<button label="Rimuovi" label_selected="Rimuovi" name="remove_banned"/>
 			</panel>
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/it/floater_avatar_textures.xml b/indra/newview/skins/default/xui/it/floater_avatar_textures.xml
index b6376973cd566e82e6eaace011c0706b08cf22fa..2935f0fdb6b1a9e206db6c38c07545ddcde9a419 100644
--- a/indra/newview/skins/default/xui/it/floater_avatar_textures.xml
+++ b/indra/newview/skins/default/xui/it/floater_avatar_textures.xml
@@ -3,48 +3,41 @@
 	<floater.string name="InvalidAvatar">
 		AVATAR NON VALIDO
 	</floater.string>
+	<text name="composite_label">
+		Texture Composite
+	</text>
+	<button label="Deposito" label_selected="Deposito" name="Dump"/>
 	<scroll_container name="profile_scroll">
 		<panel name="scroll_content_panel">
-			<text name="label">
-				Baking delle
-texture
-			</text>
-			<text name="composite_label">
-				Composito
-Texture
-			</text>
-			<button label="Memorizza gli ID sulla console" label_selected="Dump" name="Dump"/>
-			<panel name="scroll_content_panel">
-				<texture_picker label="Capigliature" name="hair-baked"/>
-				<texture_picker label="Capigliature" name="hair_grain"/>
-				<texture_picker label="Alpha dei capelli" name="hair_alpha"/>
-				<texture_picker label="Testa" name="head-baked"/>
-				<texture_picker label="Makeup" name="head_bodypaint"/>
-				<texture_picker label="Alpha della testa" name="head_alpha"/>
-				<texture_picker label="Tatuaggio della testa" name="head_tattoo"/>
-				<texture_picker label="Occhi" name="eyes-baked"/>
-				<texture_picker label="Occhio" name="eyes_iris"/>
-				<texture_picker label="Alpha degli occhi" name="eyes_alpha"/>
-				<texture_picker label="Parte superiore del corpo" name="upper-baked"/>
-				<texture_picker label="Bodypaint parte superiore del corpo" name="upper_bodypaint"/>
-				<texture_picker label="Maglietta intima" name="upper_undershirt"/>
-				<texture_picker label="Guanti" name="upper_gloves"/>
-				<texture_picker label="Camicia" name="upper_shirt"/>
-				<texture_picker label="Parte superiore della giacca" name="upper_jacket"/>
-				<texture_picker label="Alpha superiore" name="upper_alpha"/>
-				<texture_picker label="Tatuaggio superiore" name="upper_tattoo"/>
-				<texture_picker label="Parte inferiore del corpo" name="lower-baked"/>
-				<texture_picker label="BodyPaint parte inferiore del corpo" name="lower_bodypaint"/>
-				<texture_picker label="Slip" name="lower_underpants"/>
-				<texture_picker label="Calzini" name="lower_socks"/>
-				<texture_picker label="Scarpe" name="lower_shoes"/>
-				<texture_picker label="Pantaloni" name="lower_pants"/>
-				<texture_picker label="Giacca" name="lower_jacket"/>
-				<texture_picker label="Alpha inferiore" name="lower_alpha"/>
-				<texture_picker label="Tattuaggio inferiore" name="lower_tattoo"/>
-				<texture_picker label="Gonna" name="skirt-baked"/>
-				<texture_picker label="Gonna" name="skirt"/>
-			</panel>
+			<texture_picker label="Capigliature" name="hair-baked"/>
+			<texture_picker label="Capigliature" name="hair_grain"/>
+			<texture_picker label="Alpha dei capelli" name="hair_alpha"/>
+			<texture_picker label="Testa" name="head-baked"/>
+			<texture_picker label="Makeup" name="head_bodypaint"/>
+			<texture_picker label="Alpha della testa" name="head_alpha"/>
+			<texture_picker label="Tatuaggio della testa" name="head_tattoo"/>
+			<texture_picker label="Occhi" name="eyes-baked"/>
+			<texture_picker label="Occhio" name="eyes_iris"/>
+			<texture_picker label="Alpha degli occhi" name="eyes_alpha"/>
+			<texture_picker label="Parte superiore del corpo" name="upper-baked"/>
+			<texture_picker label="Bodypaint parte superiore del corpo" name="upper_bodypaint"/>
+			<texture_picker label="Maglietta intima" name="upper_undershirt"/>
+			<texture_picker label="Guanti" name="upper_gloves"/>
+			<texture_picker label="Camicia" name="upper_shirt"/>
+			<texture_picker label="Parte superiore della giacca" name="upper_jacket"/>
+			<texture_picker label="Alpha superiore" name="upper_alpha"/>
+			<texture_picker label="Tatuaggio superiore" name="upper_tattoo"/>
+			<texture_picker label="Parte inferiore del corpo" name="lower-baked"/>
+			<texture_picker label="Bodypaint parte inferiore del corpo" name="lower_bodypaint"/>
+			<texture_picker label="Slip" name="lower_underpants"/>
+			<texture_picker label="Calzini" name="lower_socks"/>
+			<texture_picker label="Scarpe" name="lower_shoes"/>
+			<texture_picker label="Pantaloni" name="lower_pants"/>
+			<texture_picker label="Giacca" name="lower_jacket"/>
+			<texture_picker label="Alpha inferiore" name="lower_alpha"/>
+			<texture_picker label="Tattuaggio inferiore" name="lower_tattoo"/>
+			<texture_picker label="Gonna" name="skirt-baked"/>
+			<texture_picker label="Gonna" name="skirt"/>
 		</panel>
 	</scroll_container>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_buy_currency.xml b/indra/newview/skins/default/xui/it/floater_buy_currency.xml
index 0a499a6c44faa3046252204bf65a5b9c15b32599..1327e8b172a10dfd555ddf22279db8a75a3c92c9 100644
--- a/indra/newview/skins/default/xui/it/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/it/floater_buy_currency.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="buy currency" title="ACQUISTA L$">
 	<floater.string name="buy_currency">
-		acquistare [LINDENS] L$ per circa [LOCALAMOUNT]
+		Acquista [LINDENS] L$ per circa [LOCALAMOUNT]
 	</floater.string>
 	<text font="SansSerifLarge" left="5" name="info_need_more" right="-5">
 		Ti servono più L$
@@ -57,8 +57,8 @@
 	<text bottom_delta="16" name="purchase_warning_notenough">
 		Non stai acquistando abbastanza L$. Aumenta l&apos;importo.
 	</text>
-	<button label="Acquista" name="buy_btn"/>
-	<button label="Annulla" name="cancel_btn"/>
+	<button label="Acquista adesso" name="buy_btn"/>
+	<button label="Cancella" name="cancel_btn"/>
 	<text left="5" name="info_cannot_buy" right="-5">
 		Non in grado di acquistare
 	</text>
diff --git a/indra/newview/skins/default/xui/it/floater_buy_land.xml b/indra/newview/skins/default/xui/it/floater_buy_land.xml
index f3b30f7048760851963dda792cee77e66eefe487..2e78168209f5888383ac44403ea1886908413f65 100644
--- a/indra/newview/skins/default/xui/it/floater_buy_land.xml
+++ b/indra/newview/skins/default/xui/it/floater_buy_land.xml
@@ -124,6 +124,9 @@ consente [AMOUNT2] oggetti
 	<floater.string name="no_parcel_selected">
 		(nessun terreno selezionato)
 	</floater.string>
+	<floater.string name="icon_PG" value="Parcel_PG_Dark"/>
+	<floater.string name="icon_M" value="Parcel_M_Dark"/>
+	<floater.string name="icon_R" value="Parcel_R_Dark"/>
 	<text name="region_name_label">
 		Regione:
 	</text>
diff --git a/indra/newview/skins/default/xui/it/floater_customize.xml b/indra/newview/skins/default/xui/it/floater_customize.xml
index 63c26b4d732e4161c8644a0da42acc6d8c807026..75ddf43f651c95948d78ca652738fdea6229a0b9 100644
--- a/indra/newview/skins/default/xui/it/floater_customize.xml
+++ b/indra/newview/skins/default/xui/it/floater_customize.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="floater customize" title="ASPETTO">
-	<tab_container name="customize tab container" tab_min_width="120">
+<floater name="floater customize" title="ASPETTO" width="551">
+	<tab_container name="customize tab container" tab_min_width="120" width="549">
 		<text label="Parti del corpo" name="body_parts_placeholder">
 			Parti del corpo
 		</text>
-		<panel label="Forma del corpo" left="124" name="Shape">
-			<button label="Crea una nuova forma del corpo" label_selected="Crea una nuova forma del corpo" name="Create New" width="190"/>
+		<panel label="Forma del corpo" left="124" name="Shape" width="389">
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 			<button label="Corpo" label_selected="Corpo" name="Body"/>
 			<button label="Testa" label_selected="Testa" name="Head"/>
 			<button label="Occhi" label_selected="Occhi" name="Eyes"/>
@@ -40,12 +40,12 @@
 			<text name="no modify instructions">
 				Non hai il permesso di modificare questo indumento.
 			</text>
-			<text name="Item Action Label">
+			<text name="Item Action Label" right="89">
 				Forma del corpo:
 			</text>
-			<button label="Salva" label_selected="Salva" name="Save"/>
-			<button label="Salva come..." label_selected="Salva come..." name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert"/>
+			<button label="Crea una nuova forma del corpo" label_selected="Crea una nuova forma del corpo" name="Create New" width="190"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
+			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
 		</panel>
 		<panel label="Pelle" name="Skin">
 			<button label="Colore della pelle" label_selected="Colore della pelle" name="Skin Color" width="115"/>
@@ -80,9 +80,9 @@
 			<texture_picker label="Tatuaggi: superiori" name="Upper Tattoos" tool_tip="Clicca per scegliere un&apos;immagine" width="96"/>
 			<texture_picker label="Tatuaggi: inferiori" name="Lower Tattoos" tool_tip="Clicca per scegliere un&apos;immagine" width="96"/>
 			<button label="Crea una nuova pelle" label_selected="Crea una nuova pelle" name="Create New"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
-			<button label="Salva come..." label_selected="Salva come..." name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
+			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<panel label="Capelli" name="Hair">
 			<button label="Capelli" label_selected="Colore" name="Color"/>
@@ -115,9 +115,9 @@
 			</text>
 			<texture_picker label="Texture" name="Texture" tool_tip="Clicca per scegliere un&apos;immagine"/>
 			<button label="Crea nuovi capelli" label_selected="Crea nuovi capelli" name="Create New"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<panel label="Occhi" name="Eyes">
 			<text name="title">
@@ -146,9 +146,9 @@
 			</text>
 			<texture_picker label="Iride" name="Iris" tool_tip="Clicca per scegliere un&apos;immagine"/>
 			<button label="Crea nuovi occhi" label_selected="Crea nuovi occhi" name="Create New"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<text label="Vestiti" name="clothes_placeholder">
 			Abiti
@@ -158,9 +158,9 @@
 			<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<button label="Togli" label_selected="Togli" name="Take Off"/>
 			<button label="Crea una nuova camicia" label_selected="Crea una nuova camicia" name="Create New"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche"  name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 			<text name="title">
 				[DESC]
 			</text>
@@ -191,9 +191,9 @@
 			<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<button label="Togli" label_selected="Togli" name="Take Off"/>
 			<button label="Crea nuovi pantaloni" label_selected="Crea nuovi pantaloni" name="Create New"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 			<text name="title">
 				[DESC]
 			</text>
@@ -248,9 +248,9 @@
 			<texture_picker label="Tessuto" name="Fabric" tool_tip="Clicca per scegliere un&apos;immagine"/>
 			<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<button label="Togli" label_selected="Togli" name="Take Off"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<panel label="Calze" name="Socks">
 			<text name="title">
@@ -281,9 +281,9 @@
 			<texture_picker label="Tessuto" name="Fabric" tool_tip="Clicca per scegliere un&apos;immagine"/>
 			<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<button label="Togli" label_selected="Togli" name="Take Off"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<panel label="Giacca" name="Jacket">
 			<text name="title">
@@ -315,9 +315,9 @@
 			<texture_picker label="Tessuto: inferiore" name="Lower Fabric" tool_tip="Clicca per scegliere un&apos;immagine" width="96"/>
 			<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<button label="Togli" label_selected="Togli" name="Take Off"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<panel label="Guanti" name="Gloves">
 			<text name="title">
@@ -348,9 +348,9 @@
 			<texture_picker label="Tessuto" name="Fabric" tool_tip="Clicca per scegliere un&apos;immagine"/>
 			<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<button font="SansSerifSmall" label="Rimuovi l&apos;indumento" label_selected="Rimuovi l&apos;indumento" name="Take Off" width="115"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<panel label="Canottiera" name="Undershirt">
 			<text name="title">
@@ -381,9 +381,9 @@
 			<texture_picker label="Tessuto" name="Fabric" tool_tip="Clicca per scegliere un&apos;immagine"/>
 			<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<button font="SansSerifSmall" label="Rimuovi l&apos;indumento" label_selected="Rimuovi l&apos;indumento" name="Take Off" width="115"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<panel label="Mutande" name="Underpants">
 			<text name="title">
@@ -414,9 +414,9 @@
 			<texture_picker label="Tessuto" name="Fabric" tool_tip="Clicca per scegliere un&apos;immagine"/>
 			<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<button font="SansSerifSmall" label="Rimuovi l&apos;indumento" label_selected="Rimuovi l&apos;indumento" name="Take Off" width="115"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<panel label="Gonna" name="Skirt">
 			<text name="title">
@@ -447,9 +447,9 @@
 			<texture_picker label="Tessuto" name="Fabric" tool_tip="Clicca per scegliere un&apos;immagine"/>
 			<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<button font="SansSerifSmall" label="Rimuovi l&apos;indumento" label_selected="Rimuovi l&apos;indumento" name="Take Off" width="115"/>
-			<button label="Salva" label_selected="Salva" name="Save"/>
+			<button label="Salva" label_selected="Salva" left="95" name="Save" width="72"/>
 			<button label="Salva come..." label_selected="Salva come..." left="171" name="Save As"/>
-			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" name="Revert" width="120"/>
+			<button font="SansSerifSmall" label="Annulla le modifiche" label_selected="Annulla le modifiche" left="267" name="Revert" width="120"/>
 		</panel>
 		<panel label="Tatuaggio" name="Tattoo">
 			<text name="title">
@@ -522,7 +522,7 @@
 			<button label="Ripristina" label_selected="Ripristina" name="Revert"/>
 		</panel>
 	</tab_container>
-	<scroll_container name="panel_container"/>
+	<scroll_container left="254" name="panel_container"/>
 	<button label="Informazioni script" label_selected="Informazioni script" name="script_info" tool_tip="Mostra gli script collegati al tuo avatar"/>
 	<button label="Crea vestiario" label_selected="Crea vestiario" name="make_outfit_btn"/>
 	<button label="Annulla" label_selected="Annulla" name="Cancel"/>
diff --git a/indra/newview/skins/default/xui/it/floater_image_preview.xml b/indra/newview/skins/default/xui/it/floater_image_preview.xml
index ee7be7b155c99228231410e083f6153d43171dc1..6169c0222d4fbb1ead301c38dc51e0bc72d63663 100644
--- a/indra/newview/skins/default/xui/it/floater_image_preview.xml
+++ b/indra/newview/skins/default/xui/it/floater_image_preview.xml
@@ -11,16 +11,16 @@
 immagine come:
 	</text>
 	<combo_box label="Tipo d&apos;abito" left="120" name="clothing_type_combo" width="166">
-		<item label="Immagine" name="Image" value="Immagine"/>
-		<item label="Capigliature" name="Hair" value="Capigliature"/>
-		<item label="Testa femminile" name="FemaleHead" value="Testa femminile"/>
-		<item label="Parte superiore del corpo femminile" name="FemaleUpperBody" value="Parte superiore del corpo femminile"/>
-		<item label="Parte inferiore del corpo femminile" name="FemaleLowerBody" value="Parte inferiore del corpo femminile"/>
-		<item label="Testa maschile" name="MaleHead" value="Testa maschile"/>
-		<item label="Parte superiore del corpo maschile" name="MaleUpperBody" value="Parte superiore del corpo maschile"/>
-		<item label="Parte inferiore del corpo maschile" name="MaleLowerBody" value="Parte inferiore del corpo maschile"/>
-		<item label="Gonna" name="Skirt" value="Gonna"/>
-		<item label="Prim Sculpted" name="SculptedPrim" value="Prim Sculpted"/>
+		<combo_box.item label="Immagine" name="Image"/>
+		<combo_box.item label="Capigliature" name="Hair"/>
+		<combo_box.item label="Testa femminile" name="FemaleHead"/>
+		<combo_box.item label="Parte superiore del corpo femminile" name="FemaleUpperBody"/>
+		<combo_box.item label="Parte inferiore del corpo femminile" name="FemaleLowerBody"/>
+		<combo_box.item label="Testa maschile" name="MaleHead"/>
+		<combo_box.item label="Parte superiore del corpo maschile" name="MaleUpperBody"/>
+		<combo_box.item label="Parte inferiore del corpo maschile" name="MaleLowerBody"/>
+		<combo_box.item label="Gonna" name="Skirt"/>
+		<combo_box.item label="Prim Sculpted" name="SculptedPrim"/>
 	</combo_box>
 	<text name="bad_image_text">
 		Non è stato possibile leggere l&apos;immagine.
diff --git a/indra/newview/skins/default/xui/it/floater_incoming_call.xml b/indra/newview/skins/default/xui/it/floater_incoming_call.xml
index 4d9c1b98dd34deafa2bca8eb404ac12deca45f30..81a6ea7a60e2007d18fc2996192188c3aba94c16 100644
--- a/indra/newview/skins/default/xui/it/floater_incoming_call.xml
+++ b/indra/newview/skins/default/xui/it/floater_incoming_call.xml
@@ -16,13 +16,7 @@
 		ha aderito ad una chiamata in chat vocale in conferenza.
 	</floater.string>
 	<floater.string name="VoiceInviteGroup">
-		ha appena aderito al canale voce &apos;[GROUP]&apos;.
-	</floater.string>
-	<floater.string name="VoiceInviteQuestionGroup">
-		Vuoi abbandonare [CURRENT_CHAT] e aderire alla chiamata con &apos;[GROUP]&apos;?
-	</floater.string>
-	<floater.string name="VoiceInviteQuestionDefault">
-		Vuoi abbandonare [CURRENT_CHAT] e aderire a questa voice chat?
+		ha accettato una chiamata in Chat vocale con il gruppo [GROUP].
 	</floater.string>
 	<text name="question">
 		Vuoi abbandonare [CURRENT_CHAT] e aderire a questa voice chat?
diff --git a/indra/newview/skins/default/xui/it/floater_preview_gesture.xml b/indra/newview/skins/default/xui/it/floater_preview_gesture.xml
index 7e29db63367afed80ae0eefa64d6cd7d3a72aa6c..4e926cedc9250bd2b645fb40b5296c21488892be 100644
--- a/indra/newview/skins/default/xui/it/floater_preview_gesture.xml
+++ b/indra/newview/skins/default/xui/it/floater_preview_gesture.xml
@@ -24,30 +24,28 @@
 	<floater.string name="Title">
 		Gesture: [NAME]
 	</floater.string>
+	<text name="name_text">
+		Nome:
+	</text>
 	<text name="desc_label">
 		Descrizione:
 	</text>
 	<text name="trigger_label">
 		Parole chiave:
 	</text>
-	<text name="replace_text" tool_tip="Sostituisci le parole chiave con questi termini. Per esempio, sostituire la parola chiave &apos;salve&apos; con &apos;ciao&apos; modificherà la chat &apos;Volevo solo dire salve&apos; in &apos;Volevo solo dire ciao&apos; e avvierà la gesture!">
+	<text left="208" name="replace_text" tool_tip="Sostituisci le parole chiave con questi termini. Per esempio, sostituire la parola chiave &apos;salve&apos; con &apos;ciao&apos; modificherà la chat &apos;Volevo solo dire salve&apos; in &apos;Volevo solo dire ciao&apos; e avvierà la gesture!">
 		Sostituisci con:
 	</text>
 	<line_editor name="replace_editor" tool_tip="Sostituisci le parole chiave con questi termini. Per esempio, sostituire la parola chiave &apos;salve&apos; con &apos;ciao&apos; modificherà la chat &apos;Volevo solo dire salve&apos; in &apos;Volevo solo dire ciao&apos; e avvierà la gesture!"/>
 	<text name="key_label">
 		Scorciatoia da tastiera:
 	</text>
-	<combo_box label="Nessuno" name="modifier_combo" />
-	<combo_box label="Nessuno" name="key_combo" />
+	<combo_box label="Nessuno" left="156" name="modifier_combo" width="76"/>
+	<combo_box label="Nessuno" left_delta="80" name="key_combo" width="76"/>
 	<text name="library_label">
 		Libreria:
 	</text>
-	<scroll_list name="library_list">
-		<scroll_list.rows name="action_animation" value="Animazione"/>
-		<scroll_list.rows name="action_sound" value="Suono"/>
-		<scroll_list.rows name="action_chat" value="Chat"/>
-		<scroll_list.rows name="action_wait" value="Attendi"/>
-	</scroll_list>
+	<scroll_list name="library_list"/>
 	<button label="Aggiungi &gt;&gt;" name="add_btn"/>
 	<text name="steps_label">
 		Fasi:
@@ -55,16 +53,13 @@
 	<button label="Su" name="up_btn"/>
 	<button label="Giù" name="down_btn"/>
 	<button label="Elimina" name="delete_btn"/>
-	<text name="options_text">
-		(opzioni)
-	</text>
 	<radio_group name="animation_trigger_type">
 		<radio_item label="Attiva" name="start"/>
 		<radio_item label="Ferma" name="stop"/>
 	</radio_group>
-	<check_box label="finché le animazioni sono eseguite" name="wait_anim_check"/>
-	<check_box label="durata in secondi:" name="wait_time_check"/>
-	<line_editor name="wait_time_editor"/>
+	<check_box label="finché le animazioni sono eseguite" left="226" name="wait_anim_check"/>
+	<check_box label="tempo in secondi" name="wait_time_check"/>
+	<line_editor left_delta="114" name="wait_time_editor"/>
 	<text name="help_label">
 		Tutte le fasi avvengono contemporaneamente, a meno che non aggiungi fasi di attesa.
 	</text>
diff --git a/indra/newview/skins/default/xui/it/floater_preview_notecard.xml b/indra/newview/skins/default/xui/it/floater_preview_notecard.xml
index 7ec229f9d3088f834345abdcd74303c47080dc40..70e28dde3541c360423bca464b837d2f4667048c 100644
--- a/indra/newview/skins/default/xui/it/floater_preview_notecard.xml
+++ b/indra/newview/skins/default/xui/it/floater_preview_notecard.xml
@@ -9,6 +9,9 @@
 	<floater.string name="Title">
 		Biglietto: [NAME]
 	</floater.string>
+	<floater.string label="Salva" label_selected="Salva" name="Save">
+		Salva
+	</floater.string>
 	<text name="desc txt">
 		Descrizione:
 	</text>
@@ -16,5 +19,4 @@
 		In caricamento...
 	</text_editor>
 	<button label="Salva" label_selected="Salva" name="Save"/>
-	<button label="Elimina" label_selected="Elimina" name="Delete"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_tools.xml b/indra/newview/skins/default/xui/it/floater_tools.xml
index 68d193ff3343b2c2d818168d452158e4aa82e02e..6ad8d68df27db32729e2491958b3f502979a05a9 100644
--- a/indra/newview/skins/default/xui/it/floater_tools.xml
+++ b/indra/newview/skins/default/xui/it/floater_tools.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="toolbox floater" short_title="STRUMENTI PER COSTRUZIONE">
+<floater name="toolbox floater" short_title="STRUMENTI PER COSTRUZIONE" title="" width="288">
 	<floater.string name="status_rotate">
 		Sposta le fasce colorate per ruotare l&apos;oggetto
 	</floater.string>
@@ -39,12 +39,12 @@
 	<floater.string name="grid_attachment_text">
 		Accessorio
 	</floater.string>
-	<button label="" label_selected="" name="button focus" tool_tip="Ingrandisci"/>
-	<button label="" label_selected="" name="button move" tool_tip="Sposta"/>
+	<button label="" label_selected="" name="button focus" tool_tip="Focus"/>
+	<button label="" label_selected="" name="button move" tool_tip="Muoviti"/>
 	<button label="" label_selected="" name="button edit" tool_tip="Modifica"/>
 	<button label="" label_selected="" name="button create" tool_tip="Crea"/>
-	<button label="" label_selected="" name="button land" tool_tip="Terreno"/>
-	<text name="text status">
+	<button label="" label_selected="" name="button land" tool_tip="Terra"/>
+	<text name="text status" width="280">
 		Trascina per muovere, trascina+maiuscolo per copiare
 	</text>
 	<radio_group name="focus_radio_group">
@@ -67,13 +67,10 @@
 	<text name="RenderingCost" tool_tip="Mostra il costo di rendering calcolato per questo oggetto">
 		þ: [COUNT]
 	</text>
-	<check_box label="" name="checkbox uniform"/>
-	<text label="Allunga entrambi i lati" name="checkbox uniform label">
-		Allunga entrambi i lati
-	</text>
+	<check_box label="Ridimens. simmetricamente" name="checkbox uniform"/>
 	<check_box initial_value="true" label="Ridimensiona le texture" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Posiziona nella griglia" name="checkbox snap to grid"/>
-	<combo_box name="combobox grid mode" tool_tip="Scegli il tipo di righello per posizionare l&apos;oggetto">
+	<combo_box left_delta="48" name="combobox grid mode" tool_tip="Scegli il tipo di righello per posizionare l&apos;oggetto">
 		<combo_box.item label="Rete del mondo" name="World"/>
 		<combo_box.item label="Rete locale" name="Local"/>
 		<combo_box.item label="Griglia di riferimento" name="Reference"/>
@@ -113,18 +110,18 @@
 	<text name="Dozer Size:">
 		Grandezza
 	</text>
-	<slider_bar initial_value="2.0" name="slider brush size"/>
+	<slider_bar initial_value="2.0" left="184" name="slider brush size" width="74"/>
 	<text name="Strength:">
 		Potenza
 	</text>
-	<button label="Applica" label_selected="Applica" name="button apply to selection" tool_tip="Modifica il terreno selezionato"/>
-	<text name="obj_count">
+	<button label="Applica" label_selected="Applica" left="146" name="button apply to selection" tool_tip="Modifica il terreno selezionato"/>
+	<text left="134" name="obj_count">
 		Oggetti: [COUNT]
 	</text>
-	<text name="prim_count">
+	<text left="134" name="prim_count">
 		Prim: [COUNT]
 	</text>
-	<tab_container name="Object Info Tabs">
+	<tab_container name="Object Info Tabs" tab_max_width="150" tab_min_width="30" width="288">
 		<panel label="Generale" name="General">
 			<panel.string name="text deed continued">
 				Cessione
@@ -185,12 +182,12 @@
 			</text>
 			<button label="Imposta..." label_selected="Imposta..." name="button set group" tool_tip="Scegli un gruppo con cui condividere i diritti relativi all&apos;oggetto"/>
 			<name_box initial_value="Caricamento in corso..." name="Group Name Proxy"/>
-			<button label="Cessione" label_selected="Cessione" name="button deed" tool_tip="Con una cessione si trasferisce il bene con i diritti al proprietario successivo Gli oggetti in proprietà condivisa di gruppo possono essere ceduti soltanto da un funzionario del gruppo."/>
+			<button label="Cessione" label_selected="Cessione" left_delta="152" name="button deed" tool_tip="Con una cessione si trasferisce il bene con i diritti al proprietario successivo Gli oggetti in proprietà condivisa di gruppo possono essere ceduti soltanto da un funzionario del gruppo." width="98"/>
 			<check_box label="Condividi" name="checkbox share with group" tool_tip="Consenti a tutti i membri del gruppo selezionato di condividere i tuoi diritti di modifica di questo oggetto. Per attivare le restrizioni per ruolo devi prima effettuare la cessione."/>
-			<text name="label click action">
+			<text name="label click action" width="220">
 				Fai clic per:
 			</text>
-			<combo_box name="clickaction">
+			<combo_box name="clickaction" width="192">
 				<combo_box.item label="Tocca (predefinito)" name="Touch/grab(default)"/>
 				<combo_box.item label="Siediti sull&apos;oggetto" name="Sitonobject"/>
 				<combo_box.item label="Compra l&apos;oggetto" name="Buyobject"/>
@@ -219,8 +216,8 @@
 					Proprietario successivo:
 				</text>
 				<check_box label="Modificare" name="checkbox next owner can modify"/>
-				<check_box label="Copiare" name="checkbox next owner can copy"/>
-				<check_box label="Trasferisci" name="checkbox next owner can transfer" tool_tip="Il prossimo proprietario può regalare o rivendere questo oggetto"/>
+				<check_box label="Copiare" left_delta="80" name="checkbox next owner can copy"/>
+				<check_box label="Trasferisci" left_delta="67" name="checkbox next owner can transfer" tool_tip="Il prossimo proprietario può regalare o rivendere questo oggetto"/>
 				<text name="B:">
 					B:
 				</text>
@@ -321,7 +318,7 @@
 			</text>
 			<spinner label="X" name="Shear X"/>
 			<spinner label="Y" name="Shear Y"/>
-			<text name="advanced_cut">
+			<text name="advanced_cut" width="149">
 				Riduci un bordo (inizio/fine)
 			</text>
 			<text name="advanced_dimple">
@@ -358,29 +355,29 @@
 			</combo_box>
 		</panel>
 		<panel label="Caratteristiche" name="Features">
-			<text name="select_single">
+			<text name="select_single" width="280">
 				Seleziona solo un prim per modificarne le caratteristiche.
 			</text>
 			<text name="edit_object">
 				Modifica le caratteristiche dell&apos;oggetto:
 			</text>
 			<check_box label="Flessibilità" name="Flexible1D Checkbox Ctrl" tool_tip="Consenti all&apos;oggetto di flettersi lungo l&apos;asse Z (solo lato client)"/>
-			<spinner label="Morbidezza" name="FlexNumSections"/>
-			<spinner label="Gravità" name="FlexGravity"/>
-			<spinner label="Elasticità" name="FlexFriction"/>
-			<spinner label="Sventolio" name="FlexWind"/>
-			<spinner label="Tensione" name="FlexTension"/>
-			<spinner label="Forza X" name="FlexForceX"/>
-			<spinner label="Forza Y" name="FlexForceY"/>
-			<spinner label="Forza Z" name="FlexForceZ"/>
+			<spinner label="Morbidezza" label_width="72" name="FlexNumSections" width="135"/>
+			<spinner label="Gravità" label_width="72" name="FlexGravity" width="135"/>
+			<spinner label="Elasticità" label_width="72" name="FlexFriction" width="135"/>
+			<spinner label="Sventolio" label_width="72" name="FlexWind" width="135"/>
+			<spinner label="Tensione" label_width="72" name="FlexTension" width="135"/>
+			<spinner label="Forza X" label_width="72" name="FlexForceX" width="135"/>
+			<spinner label="Forza Y" label_width="72" name="FlexForceY" width="135"/>
+			<spinner label="Forza Z" label_width="72" name="FlexForceZ" width="135"/>
 			<check_box label="Luce" name="Light Checkbox Ctrl" tool_tip="Imposta l&apos;oggetto come sorgente di luce"/>
 			<color_swatch label="" name="colorswatch" tool_tip="Clicca per aprire il selettore dei colori"/>
 			<texture_picker label="" name="light texture control" tool_tip="Clicca per scegliere un&apos;immagine da proiettare (funziona solo con il rendering differito attivato)"/>
-			<spinner label="Intensità" name="Light Intensity"/>
+			<spinner label="Intensità" label_width="72" name="Light Intensity" width="135"/>
 			<spinner label="Angolo di vista" name="Light FOV"/>
-			<spinner label="Raggio" name="Light Radius"/>
+			<spinner label="Raggio" label_width="72" name="Light Radius" width="135"/>
 			<spinner label="Centro focale" name="Light Focus"/>
-			<spinner label="Attenuazione" name="Light Falloff"/>
+			<spinner label="Attenuazione" label_width="72" name="Light Falloff" width="135"/>
 			<spinner label="Atmosfera" name="Light Ambiance"/>
 		</panel>
 		<panel label="Texture" name="Texture">
@@ -398,27 +395,28 @@
 			<text name="glow label">
 				Bagliore
 			</text>
-			<check_box label="Massima luminosità" name="checkbox fullbright"/>
+			<check_box bottom_delta="-21" label="Massima  luminosità" name="checkbox fullbright"/>
 			<text name="tex gen">
-				Applicazione
+				Applicazione 
+della texture
 			</text>
-			<combo_box name="combobox texgen">
+			<combo_box bottom_delta="-38" name="combobox texgen">
 				<combo_box.item label="Default" name="Default"/>
 				<combo_box.item label="Planare" name="Planar"/>
 			</combo_box>
-			<text name="label shininess">
+			<text bottom="-120" name="label shininess">
 				Brillantezza
 			</text>
-			<combo_box name="combobox shininess">
+			<combo_box bottom_delta="-22" name="combobox shininess">
 				<combo_box.item label="Nessuna" name="None"/>
 				<combo_box.item label="Bassa" name="Low"/>
 				<combo_box.item label="Media" name="Medium"/>
 				<combo_box.item label="Alta" name="High"/>
 			</combo_box>
-			<text name="label bumpiness">
+			<text bottom="-120" name="label bumpiness">
 				Rilievo
 			</text>
-			<combo_box name="combobox bumpiness">
+			<combo_box bottom_delta="-22" name="combobox bumpiness" width="100">
 				<combo_box.item label="Nessuna" name="None"/>
 				<combo_box.item label="Luminoso" name="Brightness"/>
 				<combo_box.item label="Scuro" name="Darkness"/>
@@ -445,8 +443,8 @@
 			<check_box label="Inverti" name="checkbox flip s"/>
 			<spinner label="Verticale (V)" name="TexScaleV"/>
 			<check_box label="Inverti" name="checkbox flip t"/>
-			<spinner label="RotazioneËš" name="TexRot"/>
-			<spinner label="Ripetizioni / Metro" name="rptctrl"/>
+			<spinner label="RotazioneËš" name="TexRot" />
+			<spinner label="Ripetizioni / Metro" name="rptctrl" />
 			<button label="Applica" label_selected="Applica" name="button apply"/>
 			<text name="tex offset">
 				Bilanciamento della texture
@@ -478,17 +476,17 @@
 		<text name="label_area">
 			Zona: [AREA] m²
 		</text>
-		<button label="Informazioni sui terreni" label_selected="Informazioni sui terreni" name="button about land"/>
+		<button label="Informazioni sui terreni" label_selected="Informazioni sui terreni" name="button about land" width="156"/>
 		<check_box label="Mostra i proprietari" name="checkbox show owners" tool_tip="Colora i terreni in base ai loro proprietari:   Verde = il tuo terreno  Acqua = la terra del tuo gruppo  Rosso = posseduta da altri  Giallo = in vendita  Viola = in asta  Grigia = pubblica"/>
 		<text name="label_parcel_modify">
 			Modifica il terreno
 		</text>
-		<button label="Suddividi" label_selected="Suddividi" name="button subdivide land"/>
-		<button label="Iscriviti" label_selected="Iscriviti" name="button join land"/>
+		<button label="Suddividi" label_selected="Suddividi" name="button subdivide land" width="156"/>
+		<button label="Iscriviti" label_selected="Iscriviti" name="button join land" width="156"/>
 		<text name="label_parcel_trans">
 			Transazioni terreno
 		</text>
-		<button label="Acquista terreno" label_selected="Acquista terreno" name="button buy land"/>
-		<button label="Abbandona il terreno" label_selected="Abbandona il terreno" name="button abandon land"/>
+		<button label="Acquista terreno" label_selected="Acquista terreno" name="button buy land" width="156"/>
+		<button label="Abbandona il terreno" label_selected="Abbandona il terreno" name="button abandon land" width="156"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_voice_controls.xml b/indra/newview/skins/default/xui/it/floater_voice_controls.xml
index d2fd462062c415d23d6e7692dc156c44dc5c7e8a..07368da0dd7f9ec8a254036fd6c4a67c325997e8 100644
--- a/indra/newview/skins/default/xui/it/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/it/floater_voice_controls.xml
@@ -19,10 +19,8 @@
 		<layout_panel name="my_panel">
 			<text name="user_text" value="Il mio avatar:"/>
 		</layout_panel>
-		<layout_stack name="voice_effect_and_leave_call_stack">
-			<layout_panel name="leave_call_btn_panel">
-				<button label="Abbandona chiamata" name="leave_call_btn"/>
-			</layout_panel>
-		</layout_stack>
+		<layout_panel name="leave_call_btn_panel">
+			<button label="Abbandona chiamata" name="leave_call_btn"/>
+		</layout_panel>
 	</layout_stack>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/inspect_object.xml b/indra/newview/skins/default/xui/it/inspect_object.xml
index d8ab10cfda6a1bb1b7b1744f45f6cb092f98e34d..fd58c18e0be2e49e2a7a0b8ea048a51398a427f0 100644
--- a/indra/newview/skins/default/xui/it/inspect_object.xml
+++ b/indra/newview/skins/default/xui/it/inspect_object.xml
@@ -9,7 +9,7 @@
 	</string>
 	<string name="CreatorAndOwner">
 		Di [CREATOR]
-Proprietario [OWNER]
+proprietario [OWNER]
 	</string>
 	<string name="Price">
 		L$ [AMOUNT]
@@ -23,13 +23,6 @@ Proprietario [OWNER]
 	<string name="Sit">
 		Siediti
 	</string>
-	<text name="object_name" value="Nome oggetto di prova che si trova su due righe ed è molto lungo"/>
-	<text name="price_text">
-		L$ 30.000
-	</text>
-	<text name="object_description">
-		Questa è una descrizione di un oggetto che è molto lunga ed è di almeno 80 caratteri, ma potrebbe essere di 120 caratteri a questo punto. Chi lo sa veramente?
-	</text>
 	<button label="Acquista" name="buy_btn"/>
 	<button label="Paga" name="pay_btn"/>
 	<button label="Prendi copia" name="take_free_copy_btn"/>
diff --git a/indra/newview/skins/default/xui/it/language_settings.xml b/indra/newview/skins/default/xui/it/language_settings.xml
index 312b8e21aa91bb088b5eaca6b64e287c672bd029..82cf789a6b3604341a5bd10692f775fbab539902 100644
--- a/indra/newview/skins/default/xui/it/language_settings.xml
+++ b/indra/newview/skins/default/xui/it/language_settings.xml
@@ -17,7 +17,6 @@
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml
index 474bdca55f3ed1aad46109314d7485af2975af3c..6736c6a6f13dbfafce41d700f8c1070688291654 100644
--- a/indra/newview/skins/default/xui/it/notifications.xml
+++ b/indra/newview/skins/default/xui/it/notifications.xml
@@ -326,9 +326,6 @@ Hai bisogno di un account per entrare in [SECOND_LIFE]. Ne vuoi creare uno adess
 		</url>
 		<usetemplate name="okcancelbuttons" notext="Riprova" yestext="Crea un nuovo account"/>
 	</notification>
-	<notification name="InvalidCredentialFormat">
-		Immetti sia il nome che il cognome del tuo avatar nel campo del nome utente, quindi effettua l&apos;accesso.
-	</notification>
 	<notification name="AddClassified">
 		L&apos;inserzione comparirà nella sezione &apos;Annunci&apos; della Ricerca e su [http://secondlife.com/community/classifieds secondlife.com] per una settimana.
 Compila la tua inserzione, quindi clicca &apos;Pubblica...&apos; per aggiungerla all&apos;elenco degli annunci.
@@ -344,7 +341,7 @@ Non ci sono rimborsi per la tariffa pagata.
 	<notification name="DeleteMedia">
 		Hai selezionato la cancellazione del media associato a questa faccia.
 Vuoi continuare?
-		<usetemplate ignoretext="Conferma prima di eliminare elementi multimediali dall&apos;oggetto" name="okcancelignore" notext="No" yestext="Sì"/>
+		<usetemplate ignoretext="Conferma prima di eliminare elemnti multimediali dall&apos;oggetto" name="okcancelignore" notext="No" yestext="Sì"/>
 	</notification>
 	<notification name="ClassifiedSave">
 		Salva le modifiche all&apos;annuncio [NAME]?
@@ -355,11 +352,7 @@ Vuoi continuare?
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="DeleteAvatarPick">
-		Elimina preferito &lt;nolink&gt;[PICK]&lt;/nolink&gt;?
-		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
-	</notification>
-	<notification name="DeleteOutfits">
-		Elimina il vestiario selezionato?
+		Cancella il favorito [PICK]?
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="PromptGoToEventsPage">
@@ -476,9 +469,8 @@ La qualità grafica può essere aumentata in Preferenze &gt; Grafica.
 		La regione [REGION] non consente di terraformare.
 	</notification>
 	<notification name="CannotCopyWarning">
-		Non hai l&apos;autorizzazione a copiare i seguenti oggetti:
-[ITEMS]
-e se li dai via, verranno eliminati dal tuo inventario. Sicuro di volere offrire questi oggetti?
+		Non hai il permesso di copiare questo elemento e lo perderai dal tuo inventario se lo regali.
+Confermi veramente di offrire questo elemento?
 		<usetemplate name="okcancelbuttons" notext="No" yestext="Si"/>
 	</notification>
 	<notification name="CannotGiveItem">
@@ -616,10 +608,6 @@ Attese [VALIDS]
 	<notification name="CannotEncodeFile">
 		Impossibile codificare il file: [FILE]
 	</notification>
-	<notification name="CorruptedProtectedDataStore">
-		Impossibile inserire nome utente e password.  Ciò può succedere alla modifica delle impostazioni di rete.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
 	<notification name="CorruptResourceFile">
 		File risorsa corrotto: [FILE]
 	</notification>
@@ -637,7 +625,7 @@ Attese [VALIDS]
 Riprova più tardi.
 	</notification>
 	<notification name="LandmarkCreated">
-		Hai aggiunto &quot;[LANDMARK_NAME]&quot; alla tua cartella [FOLDER_NAME].
+		Hai aggiunto &quot;[LANDMARK_NAME]&quot; alla tua [FOLDER_NAME] cartella.
 	</notification>
 	<notification name="LandmarkAlreadyExists">
 		Hai già il punto di riferimento di questo luogo.
@@ -910,7 +898,7 @@ Unisci il terreno?
 In genere si tratta di un problema temporaneo. Attendi alcuni minuti per modificare e salvare nuovamente gli elementi indossabili.
 	</notification>
 	<notification name="YouHaveBeenLoggedOut">
-		Sei stato scollegato da [SECOND_LIFE].
+		Accidenti. Sei stato scollegato da [SECOND_LIFE]
             [MESSAGE]
 		<usetemplate name="okcancelbuttons" notext="Esci" yestext="Vedi IM &amp; Chat"/>
 	</notification>
@@ -936,36 +924,6 @@ Offri l&apos;amicizia a [NAME]?
 			<button name="Cancel" text="Annulla"/>
 		</form>
 	</notification>
-	<notification label="Salva vestiario" name="SaveOutfitAs">
-		Salva gli abiti che indosso come nuovo vestiario:
-		<form name="form">
-			<input name="message">
-				[DESC] (nuovo)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Annulla"/>
-		</form>
-	</notification>
-	<notification label="Salva capo da indossare" name="SaveWearableAs">
-		Salva oggetto nel mio inventario come:
-		<form name="form">
-			<input name="message">
-				[DESC] (nuovo)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Annulla"/>
-		</form>
-	</notification>
-	<notification label="Cambia nome del vestiario" name="RenameOutfit">
-		Nuovo nome per il vestiario:
-		<form name="form">
-			<input name="new_name">
-				[NAME]
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Annulla"/>
-		</form>
-	</notification>
 	<notification name="RemoveFromFriends">
 		Vuoi rimuovere remove [FIRST_NAME] [LAST_NAME] dalla lista dei tuoi amici?
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
@@ -1000,12 +958,6 @@ su TUTTI I TERRENI di questa sim?
 
 Introduci un prezzo più alto.
 	</notification>
-	<notification name="ConfirmItemDeleteHasLinks">
-		Almeno uno degli oggetti selezionati è collegato tramite link ad altri oggetti.  Se elimini l&apos;oggetto, i relativi link non funzioneranno più.  Pertanto si consiglia vivamente di eliminare prima i link.
-
-Sei sicuro di volere eliminare gli oggetti?
-		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
-	</notification>
 	<notification name="ConfirmObjectDeleteLock">
 		Almeno uno degli elementi selezionati è bloccato.
 
@@ -1155,42 +1107,6 @@ Premi F1 in qualunque momento per la guida o per apprendere altre cose di [SECON
 Scegli un avatar maschile o femminile. Puoi sempre cambiare idea più tardi.
 		<usetemplate name="okcancelbuttons" notext="Femminile" yestext="Maschile"/>
 	</notification>
-	<notification name="CantTeleportToGrid">
-		Impossibile effettuare il teleport su [SLURL], in quanto si trova su una griglia ([GRID]) diversa da quella attuale ([CURRENT_GRID]).  Chiudi il viewer e prova nuovamente.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="GeneralCertificateError">
-		Impossibile collegarsi al server.
-[REASON]
-
-Nome oggetto: [SUBJECT_NAME_STRING]
-Nome emittente: [ISSUER_NAME_STRING]
-Valido da: [VALID_FROM]
-Valido fino a: [VALID_TO]
-Impronta MD5: [SHA1_DIGEST]
-Impronta SHA1: [MD5_DIGEST]
-Uso chiave: [KEYUSAGE]
-Uso chiave estesa: [EXTENDEDKEYUSAGE]
-Identificatore chiave oggetto: [SUBJECTKEYIDENTIFIER]
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="TrustCertificateError">
-		Autorità di certificazione di questo server sconosciuta.
-
-Informazioni sul certificato:
-Nome oggetto: [SUBJECT_NAME_STRING]
-Nome emittente: [ISSUER_NAME_STRING]
-Valido da: [VALID_FROM]
-Valido fino a: [VALID_TO]
-Impronta MD5: [SHA1_DIGEST]
-Impronta SHA1: [MD5_DIGEST]
-Uso chiave: [KEYUSAGE]
-Uso chiave estesa: [EXTENDEDKEYUSAGE]
-Identificatore chiave oggetto: [SUBJECTKEYIDENTIFIER]
-
-Accettare questa autorità?
-		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="Accetta"/>
-	</notification>
 	<notification name="NotEnoughCurrency">
 		[NAME] [PRICE]L$ Non hai abbastanza L$ per farlo.
 	</notification>
@@ -1498,10 +1414,6 @@ La chat e gli IM verranno nascosti. Gli IM riceveranno la tua risposta di Non di
 		Teleport a [CLASSIFIED]?
 		<usetemplate ignoretext="Conferma il teleport verso questa posizione negli annunci" name="okcancelignore" notext="Annulla" yestext="Teleport"/>
 	</notification>
-	<notification name="TeleportToHistoryEntry">
-		Teleport a [HISTORY_ENTRY]?
-		<usetemplate ignoretext="Conferma il teleport verso un luogo che compare nella cronologia" name="okcancelignore" notext="Annulla" yestext="Teleport"/>
-	</notification>
 	<notification label="Manda un messaggio a tutti nella tua proprietà" name="MessageEstate">
 		Scrivi un annuncio breve che verrà mandato a tutti quelli che sono in questo momento nella tua proprietà.
 		<form name="form">
@@ -1584,18 +1496,15 @@ Vuoi andare alla Knowledge Base per ulteriori informazioni sulle categorie di ac
 		Non sei ammesso in questa regione a causa della tua categoria d&apos;accesso.
 	</notification>
 	<notification name="RegionEntryAccessBlocked_Change">
-		Non ti è consentito entrare in quella regione a causa della categoria di accesso impostata nelle preferenze.
+		Non ti è consentito entrare in quella regione a causa della tua categoria di accesso impostata nelle preferenze.
 
-Per entrare nella regione, dovrai modificare la tua categoria di accesso. Ciò ti consentirà inoltre di effettuare ricerche di contenuti di categoria [REGIONMATURITY]. Per annullare le modifiche in un secondo momento, vai a Io &gt; Preferenze &gt; Generali.
+Puoi cliccare su Cambia preferenze per modificare la categoria di accesso e quindi riuscire ad entrare. Da adesso potrai accedere ai contenuti [REGIONMATURITY] ed effettuare ricerche in questa categoria. Se in seguito tu volessi cambiare di nuovo le tue impostazioni, apri la finestra di dialogo da Io &gt; Preferenze &gt; Generale.
 		<form name="form">
 			<button name="OK" text="Cambia preferenza"/>
 			<button default="true" name="Cancel" text="Chiudi"/>
 			<ignore name="ignore" text="La categoria di accesso impostata mi impedisce di entrare in una regione"/>
 		</form>
 	</notification>
-	<notification name="PreferredMaturityChanged">
-		La tua categoria di accesso attuale è [RATING].
-	</notification>
 	<notification name="LandClaimAccessBlocked">
 		Non puoi prendere possesso di questo terreno a causa della tua categoria di accesso. Questo può essere dovuto ad una mancanza di informazioni valide che confermino la tua età.
 
@@ -1677,11 +1586,11 @@ Pubblica questo annuncio adesso per [AMOUNT]L$?
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="SetClassifiedMature">
-		Queste inserzioni includono contenuti di tipo Moderato?
+		Queste inserzioni includono contenuto Mature?
 		<usetemplate canceltext="Annulla" name="yesnocancelbuttons" notext="No" yestext="Si"/>
 	</notification>
 	<notification name="SetGroupMature">
-		Questo gruppo include contenuti di tipo Moderato?
+		Questo gruppo include contenuto Mature?
 		<usetemplate canceltext="Annulla" name="yesnocancelbuttons" notext="No" yestext="Si"/>
 	</notification>
 	<notification label="Conferma il riavvio" name="ConfirmRestart">
@@ -1696,7 +1605,7 @@ Pubblica questo annuncio adesso per [AMOUNT]L$?
 			<button name="Cancel" text="Annulla"/>
 		</form>
 	</notification>
-	<notification label="Cambiato il contenuto Moderato" name="RegionMaturityChange">
+	<notification label="Cambiato il contenuto Mature" name="RegionMaturityChange">
 		La classificazione di questa regione è stata aggiornata.
 Un periodo di tempo è necessario prima che la modifica venga integrata nella mappa.
 
@@ -2012,9 +1921,6 @@ Inseriscilo in una pagina web per dare ad altri un accesso facile a questa ubica
 	<notification name="SystemMessageTip">
 		[MESSAGE]
 	</notification>
-	<notification name="IMSystemMessageTip">
-		[MESSAGE]
-	</notification>
 	<notification name="Cancelled">
 		Annullato
 	</notification>
@@ -2161,7 +2067,7 @@ Prova a selezionare una parte di terreno più piccola.
 		Alcuni termini della ricerca sono stati esclusi a causa delle restrizioni di contenuto come esposto negli Standard della comunità.
 	</notification>
 	<notification name="NoContentToSearch">
-		Seleziona almeno un tipo di contenuto per la ricerca (Generale, Moderato o Adulti).
+		Seleziona almeno un tipo di contenuto per la ricerca (PG, Mature, o Adult).
 	</notification>
 	<notification name="GroupVote">
 		[NAME] ha proposto di votare su:
@@ -2345,6 +2251,15 @@ Riprova tra qualche istante.
 	</notification>
 	<notification name="ObjectGiveItem">
 		Un oggetto denominato [OBJECTFROMNAME] di proprietà di [NAME_SLURL] ti ha dato questo [OBJECTTYPE]:
+[ITEM_SLURL]
+		<form name="form">
+			<button name="Keep" text="Prendi"/>
+			<button name="Discard" text="Rifiuta"/>
+			<button name="Mute" text="Blocca"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItemUnknownUser">
+		Un oggetto chiamato [OBJECTFROMNAME] di proprietà di (residente sconosciuto) ti ha dato questo [OBJECTTYPE]:
 [ITEM_SLURL]
 		<form name="form">
 			<button name="Keep" text="Prendi"/>
@@ -2375,9 +2290,9 @@ Riprova tra qualche istante.
 		</form>
 	</notification>
 	<notification name="TeleportOffered">
-		[NAME_SLURL] ti ha offerto il teleport alla sua ubicazione:
+		[NAME] ti ha offerto di teleportarti nella sua ubicazione:
 
-[MESSAGE] - [MATURITY_STR] &lt;icon&gt;[MATURITY_ICON]&lt;/icon&gt;
+[MESSAGE]
 		<form name="form">
 			<button name="Teleport" text="Teleport"/>
 			<button name="Cancel" text="Cancella"/>
@@ -2395,11 +2310,11 @@ Riprova tra qualche istante.
 		</form>
 	</notification>
 	<notification name="OfferFriendship">
-		[NAME_SLURL] ti ha offerto di diventare amici.
+		[NAME] ti ha offerto la sua amicizia.
 
 [MESSAGE]
 
-(L&apos;impostazione predefinita consente a ciascuno di vedere se l&apos;altro è online.)
+(Di default, potrete vedervi reciprocamente online.)
 		<form name="form">
 			<button name="Accept" text="Accetta"/>
 			<button name="Decline" text="Rifiuta"/>
@@ -2593,21 +2508,6 @@ Clicca su Accetta per unirti alla chat oppure su Declina per declinare l&apos;in
 	<notification name="VoiceLoginRetry">
 		Stiamo creando una canale voice per te. Questo può richiedere fino a un minuto.
 	</notification>
-	<notification name="VoiceEffectsExpired">
-		Almeno una delle manipolazioni vocali alle quali sei iscritto è scaduta.
-[[URL] Fai clic qui] per rinnovare l&apos;abbonamento.
-	</notification>
-	<notification name="VoiceEffectsExpiredInUse">
-		Poiché la manipolazione vocale attiva è scaduta, sono state applicate le tue impostazioni normali.
-[[URL] Fai clic qui] per rinnovare l&apos;abbonamento.
-	</notification>
-	<notification name="VoiceEffectsWillExpire">
-		Almeno una delle tue manipolazioni vocali scadrà tra meno di [INTERVAL] giorni.
-[[URL] Fai clic qui] per rinnovare l&apos;abbonamento.
-	</notification>
-	<notification name="VoiceEffectsNew">
-		Sono disponibili nuove manipolazioni vocali.
-	</notification>
 	<notification name="Cannot enter parcel: not a group member">
 		Soltanto i membri di un determinato gruppo possono visitare questa zona.
 	</notification>
@@ -2673,96 +2573,6 @@ Per sicurezza, verranno bloccati per alcuni secondi.
 		Il pulsante selezionato non può essere visualizzato in questo momento.
 Il pulsante verrà visualizzato quando lo spazio sarà sufficiente.
 	</notification>
-	<notification name="ShareNotification">
-		Scegli i residenti con i quali condividere.
-	</notification>
-	<notification name="ShareItemsConfirmation">
-		Sei sicuro di volere condividere gli oggetti
-
-[ITEMS]
-
-Con i seguenti residenti?
-
-[RESIDENTS]
-		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="Ok"/>
-	</notification>
-	<notification name="ItemsShared">
-		Gli oggetti sono stati condivisi.
-	</notification>
-	<notification name="DeedToGroupFail">
-		Cessione al gruppo non riuscita.
-	</notification>
-	<notification name="AvatarRezNotification">
-		( in esistenza da [EXISTENCE] secondi )
-Nuvola avatar &apos;[NAME]&apos; dileguata dopo [TIME] secondi.
-	</notification>
-	<notification name="AvatarRezSelfBakedDoneNotification">
-		( in esistenza da [EXISTENCE] secondi )
-Baking dei vestiti terminato dopo [TIME] secondi.
-	</notification>
-	<notification name="AvatarRezSelfBakedUpdateNotification">
-		( in esistenza da [EXISTENCE] secondi )
-Hai inviato un aggiornamento al tuo aspetto dopo [TIME] secondi.
-[STATUS]
-	</notification>
-	<notification name="AvatarRezCloudNotification">
-		( presente da [EXISTENCE] secondi )
-Avatar &apos;[NAME]&apos; trasformato in nuvola.
-	</notification>
-	<notification name="AvatarRezArrivedNotification">
-		( presente da [EXISTENCE] secondi )
-È comparso l&apos;avatar &apos;[NAME]&apos;.
-	</notification>
-	<notification name="AvatarRezLeftCloudNotification">
-		( presente da [EXISTENCE] secondi )
-Avatar &apos;[NAME]&apos; partito dopo [TIME] secondi sotto forma di nuvola.
-	</notification>
-	<notification name="AvatarRezEnteredAppearanceNotification">
-		( presente da [EXISTENCE] secondi )
-Avatar &apos;[NAME]&apos; è entrato nella modalità aspetto.
-	</notification>
-	<notification name="AvatarRezLeftAppearanceNotification">
-		( presente da [EXISTENCE] secondi )
-Avatar &apos;[NAME]&apos; ha lasciato la modalità aspetto.
-	</notification>
-	<notification name="NoConnect">
-		Ci sono problemi di connessione tramite [PROTOCOL] [HOSTID].
-Ti consigliamo di controllare le tue impostazioni di rete e della firewall.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="NoVoiceConnect">
-		A causa di problemi di connessione al server vocale
-
-[HOSTID]
-
-le comunicazioni tramite voce non saranno disponibili.
-Ti consigliamo di controllare le tue impostazioni di rete e della firewall.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="AvatarRezLeftNotification">
-		( presente da [EXISTENCE] secondi )
-Avatar &apos;[NAME]&apos; è partito completamente caricato.
-	</notification>
-	<notification name="AvatarRezSelfBakeNotification">
-		( in esistenza da [EXISTENCE] secondi )
-Effettuata l&apos;azione: [ACTION] di una texture [RESOLUTION] completata per &apos;[BODYREGION]&apos; dopo [TIME] secondi.
-	</notification>
-	<notification name="ConfirmLeaveCall">
-		Sei sicuro di volere uscire dalla chiamata?
-		<usetemplate ignoretext="Conferma prima di uscire dalla chiamata" name="okcancelignore" notext="No" yestext="Sì"/>
-	</notification>
-	<notification name="ConfirmMuteAll">
-		Hai scelto di disattivare l&apos;audio di tutti i partecipanti alla chiamata di gruppo.
-In questo modo verrà disattivato l&apos;audio anche di tutti i residenti che si
-uniscono alla chiamata in un secondo momento, anche dopo che tu ti fossi scollegato.
-
-Disattiva audio di tutti?
-		<usetemplate ignoretext="Conferma prima di disattivare l&apos;audio di tutti i partecipanti alla chiamata di gruppo" name="okcancelignore" notext="Annulla" yestext="Ok"/>
-	</notification>
 	<global name="UnsupportedCPU">
 		- La velocità della tua CPU non soddisfa i requisiti minimi.
 	</global>
@@ -2787,7 +2597,4 @@ Se continui ad avere problemi, visita la pagina [SUPPORT_SITE].
 		Se sei proprietario di un appezzamento di terreno, puoi definirlo come la tua posizione iniziale.
 In alternativa, puoi guardare sulla mappa e trovare luoghi segnalati come &quot;Infohub&quot;.
 	</global>
-	<global name="You died and have been teleported to your home location">
-		Sei deceduto e sei stato teleportato a casa tua.
-	</global>
 </notifications>
diff --git a/indra/newview/skins/default/xui/it/panel_bottomtray.xml b/indra/newview/skins/default/xui/it/panel_bottomtray.xml
index e4d99cc40206f6844e45c6213a67732357c56125..c0218fad5e21d2e74643e080a17bccbef6990265 100644
--- a/indra/newview/skins/default/xui/it/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/it/panel_bottomtray.xml
@@ -1,7 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="bottom_tray">
-	<string name="SpeakBtnToolTip" value="Accende o spegne il microfono"/>
-	<string name="VoiceControlBtnToolTip" value="Mostra o nasconde il pannello di regolazione voce"/>
+	<string name="SpeakBtnToolTip">
+		Accende o spegne il microfono
+	</string>
+	<string name="VoiceControlBtnToolTip">
+		Mostra o nasconde il pannello di regolazione voce
+	</string>
 	<layout_stack name="toolbar_stack">
 		<layout_panel name="speak_panel">
 			<talk_button name="talk">
@@ -20,21 +24,6 @@
 		<layout_panel name="snapshot_panel">
 			<button label="" name="snapshots" tool_tip="Scatta una foto"/>
 		</layout_panel>
-		<layout_panel name="sidebar_btn_panel">
-			<button label="Barra laterale" name="sidebar_btn" tool_tip="Mostra o nasconde la barra laterale"/>
-		</layout_panel>
-		<layout_panel name="build_btn_panel">
-			<button label="Costruisci" name="build_btn" tool_tip="Mostra o nasconde gli strumenti di costruzione"/>
-		</layout_panel>
-		<layout_panel name="search_btn_panel">
-			<button label="Cerca" name="search_btn" tool_tip="Mostra o nasconde la ricerca"/>
-		</layout_panel>
-		<layout_panel name="world_map_btn_panel">
-			<button label="Mappa" name="world_map_btn" tool_tip="Mostra o nasconde la mappa del mondo"/>
-		</layout_panel>
-		<layout_panel name="mini_map_btn_panel">
-			<button label="Mini mappa" name="mini_map_btn" tool_tip="Mostra o nasconde la mini mappa"/>
-		</layout_panel>
 		<layout_panel name="im_well_panel">
 			<chiclet_im_well name="im_well">
 				<button name="Unread IM messages" tool_tip="Conversazioni"/>
diff --git a/indra/newview/skins/default/xui/it/panel_edit_skin.xml b/indra/newview/skins/default/xui/it/panel_edit_skin.xml
index a15489b333a9dfe9ef759d9ad0dc429497211d5a..9e05599470ad699722e5515086b217dd00778dcf 100644
--- a/indra/newview/skins/default/xui/it/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/it/panel_edit_skin.xml
@@ -5,12 +5,10 @@
 		<texture_picker label="Tatuaggi superiori" name="Upper Tattoos" tool_tip="Clicca per scegliere una fotografia"/>
 		<texture_picker label="Tatuaggi inferiori" name="Lower Tattoos" tool_tip="Clicca per scegliere una fotografia"/>
 	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="skin_color_tab" title="Colore della pelle"/>
-			<accordion_tab name="skin_face_tab" title="Dettagli del viso"/>
-			<accordion_tab name="skin_makeup_tab" title="Makeup"/>
-			<accordion_tab name="skin_body_tab" title="Dettagli del corpo"/>
-		</accordion>
-	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="skin_color_tab" title="Colore della pelle"/>
+		<accordion_tab name="skin_face_tab" title="Dettagli del viso"/>
+		<accordion_tab name="skin_makeup_tab" title="Makeup"/>
+		<accordion_tab name="skin_body_tab" title="Dettagli del corpo"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_edit_socks.xml b/indra/newview/skins/default/xui/it/panel_edit_socks.xml
index 6731511282148502670afd0e5902b939ee9fa8d7..d2af3ebd5a2d337863935feaa159028c4a614352 100644
--- a/indra/newview/skins/default/xui/it/panel_edit_socks.xml
+++ b/indra/newview/skins/default/xui/it/panel_edit_socks.xml
@@ -4,9 +4,7 @@
 		<texture_picker label="Tessuto" name="Fabric" tool_tip="Clicca per scegliere una fotografia"/>
 		<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="socks_main_tab" title="Calzini"/>
-		</accordion>
-	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="socks_main_tab" title="Calzini"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_edit_wearable.xml b/indra/newview/skins/default/xui/it/panel_edit_wearable.xml
index 19456281bb6ac7271d2f9f6968680bb12f4bd3a6..2583cf4e0ea60c7c1112199c5151b8bae10e3432 100644
--- a/indra/newview/skins/default/xui/it/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/it/panel_edit_wearable.xml
@@ -72,8 +72,8 @@
 	<string name="jacket_desc_text">
 		Giacca:
 	</string>
-	<string name="skirt_desc_text">
-		Gonna:
+	<string name="skirt_skirt_desc_text">
+		Giacca:
 	</string>
 	<string name="gloves_desc_text">
 		Guanti:
@@ -90,19 +90,12 @@
 	<string name="tattoo_desc_text">
 		Tatuaggio:
 	</string>
-	<labeled_back_button label="Salva" name="back_btn" tool_tip="Torna alla modifica del vestiario"/>
 	<text name="edit_wearable_title" value="Modifica della figura corporea"/>
 	<panel label="Camicia" name="wearable_type_panel">
 		<text name="description_text" value="Figura corporea:"/>
-		<radio_group name="sex_radio">
-			<radio_item label="" name="sex_male" tool_tip="Maschio" value="1"/>
-			<radio_item label="" name="sex_female" tool_tip="Femmina" value="0"/>
-		</radio_group>
-		<icon name="male_icon" tool_tip="Maschio"/>
-		<icon name="female_icon" tool_tip="Femmina"/>
 	</panel>
 	<panel name="button_panel">
 		<button label="Salva con nome" name="save_as_button"/>
-		<button label="Annulla modifiche" name="revert_button"/>
+		<button label="Ripristina" name="revert_button"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_group_land_money.xml b/indra/newview/skins/default/xui/it/panel_group_land_money.xml
index 16cc91cd9d9f445c7641ef30269db88bc1877213..1e3ef5e6574c1091110e6d65d8558a0bd6f087ea 100644
--- a/indra/newview/skins/default/xui/it/panel_group_land_money.xml
+++ b/indra/newview/skins/default/xui/it/panel_group_land_money.xml
@@ -6,9 +6,6 @@
 	<panel.string name="cant_view_group_land_text">
 		Non sei autorizzato a vedere quali terreni appartengono al gruppo.
 	</panel.string>
-	<panel.string name="epmty_view_group_land_text">
-		Nessuna voce
-	</panel.string>
 	<panel.string name="cant_view_group_accounting_text">
 		Non sei autorizzato a visionare le informazioni finanziarie del gruppo.
 	</panel.string>
diff --git a/indra/newview/skins/default/xui/it/panel_group_notices.xml b/indra/newview/skins/default/xui/it/panel_group_notices.xml
index 2e2f0dc7b0349ccbe4dd7c2127f569829ae551b9..9dac282de9ea90f3018e6d40d312d9be671d39f5 100644
--- a/indra/newview/skins/default/xui/it/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/it/panel_group_notices.xml
@@ -19,7 +19,7 @@ Massimo 200 per gruppo al giorno
 	<text name="notice_list_none_found">
 		Nessuno trovato
 	</text>
-	<button label="Nuovo avviso" label_selected="Crea una nuova notice" name="create_new_notice" tool_tip="Crea un nuovo avviso"/>
+	<button label="Crea un nuovo avviso" label_selected="Crea una nuova notice" name="create_new_notice" tool_tip="Crea un nuovo avviso"/>
 	<button label="Aggiorna" label_selected="Aggiorna l&apos;elenco" name="refresh_notices" tool_tip="Aggiorna la lista degli avvisi"/>
 	<panel label="Crea una nuova notice" name="panel_create_new_notice">
 		<text name="lbl">
@@ -40,7 +40,6 @@ Massimo 200 per gruppo al giorno
 		<text name="string">
 			Trascina e rilascia qui l&apos;oggetto da allegare:
 		</text>
-		<button label="Inventario" name="open_inventory" tool_tip="Apri l&apos;inventario"/>
 		<button label="Rimuovi" label_selected="Rimuovi allegato" name="remove_attachment" tool_tip="Rimuovi allegato dal tuo avviso"/>
 		<button label="Invia" label_selected="Invia" name="send_notice"/>
 		<group_drop_target name="drop_target" tool_tip="Trascina un oggetto dall&apos;inventario ín questa casella per spedirlo con questo avviso. Devi avere i diritti per la copia e il trasferimento per poter allegare l&apos;oggetto."/>
diff --git a/indra/newview/skins/default/xui/it/panel_login.xml b/indra/newview/skins/default/xui/it/panel_login.xml
index 473bcfa88d7a7100a9716d56950798f6948dbbce..287e938d57aa71c87d526b57aaf5fcbbdf5ef02f 100644
--- a/indra/newview/skins/default/xui/it/panel_login.xml
+++ b/indra/newview/skins/default/xui/it/panel_login.xml
@@ -8,15 +8,18 @@
 	</panel.string>
 	<layout_stack name="login_widgets">
 		<layout_panel name="login">
-			<text name="username_text">
-				Nome utente:
+			<text name="first_name_text">
+				Nome:
 			</text>
-			<line_editor label="Nome utente" name="username_edit" tool_tip="Nome utente [SECOND_LIFE]"/>
+			<line_editor label="Nome" name="first_name_edit" tool_tip="[SECOND_LIFE] First Name"/>
+			<text name="last_name_text">
+				Cognome:
+			</text>
+			<line_editor label="Cognome" name="last_name_edit" tool_tip="[SECOND_LIFE] Last Name"/>
 			<text name="password_text">
 				Password:
 			</text>
 			<check_box label="Ricorda password" name="remember_check"/>
-			<button label="Accedi" name="connect_btn"/>
 			<text name="start_location_text">
 				Inizia da:
 			</text>
@@ -25,6 +28,7 @@
 				<combo_box.item label="Casa mia" name="MyHome"/>
 				<combo_box.item label="&lt;Scrivi nome regione&gt;" name="Typeregionname"/>
 			</combo_box>
+			<button label="Accedi" name="connect_btn"/>
 		</layout_panel>
 		<layout_panel name="links">
 			<text name="create_new_account_text">
diff --git a/indra/newview/skins/default/xui/it/panel_place_profile.xml b/indra/newview/skins/default/xui/it/panel_place_profile.xml
index eace6c89ce1b157e9101c20c9def5817b9721f17..9a38909d47cdd6aa3badf8f67706406a9c883f74 100644
--- a/indra/newview/skins/default/xui/it/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/it/panel_place_profile.xml
@@ -5,7 +5,7 @@
 	<string name="anyone" value="Chiunque"/>
 	<string name="available" value="disponibile"/>
 	<string name="allocated" value="assegnato"/>
-	<string name="title_place" value="Profilo del luogo"/>
+	<string name="title_place" value="Profilo del posto"/>
 	<string name="title_teleport_history" value="Cronologia Teleport"/>
 	<string name="not_available" value="(non pert.)"/>
 	<string name="unknown" value="(sconosciuto)"/>
diff --git a/indra/newview/skins/default/xui/it/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/it/panel_preferences_graphics1.xml
index 71980695b6e8d1907be146c83c096625120db529..d02a794219b963ebb5642852558cbaa7fbeae29b 100644
--- a/indra/newview/skins/default/xui/it/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/it/panel_preferences_graphics1.xml
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Grafica" name="Display panel">
+	<text name="UI Size:">
+		Dimensioni UI:
+	</text>
 	<text name="QualitySpeed">
 		Qualità e velocità:
 	</text>
@@ -44,13 +47,12 @@
 		<check_box initial_value="true" label="Avatar bidimensionali (Impostor)" name="AvatarImpostors"/>
 		<check_box initial_value="true" label="Hardware Skinning" name="AvatarVertexProgram"/>
 		<check_box initial_value="true" label="Abiti dell&apos;avatar" name="AvatarCloth"/>
-		<slider label="Distanza di disegno:" name="DrawDistance"/>
+		<slider label="Distanza di disegno:" label_width="158" name="DrawDistance" width="255"/>
 		<text name="DrawDistanceMeterText2">
 			m
 		</text>
-		<slider label="Conteggio massimo particelle:" name="MaxParticleCount"/>
-		<slider label="N. max di avatar non impostori:" name="MaxNumberAvatarDrawn"/>
-		<slider label="Qualità in post-produzione:" name="RenderPostProcess"/>
+		<slider label="Conteggio massimo particelle:" label_width="158" name="MaxParticleCount" width="262"/>
+		<slider label="Qualità in post-produzione:" label_width="158" name="RenderPostProcess" width="223"/>
 		<text name="MeshDetailText">
 			Dettagli reticolo:
 		</text>
@@ -97,7 +99,7 @@
 		</radio_group>
 	</panel>
 	<button label="Applica" label_selected="Applica" name="Apply"/>
-	<button label="Reimposta" name="Defaults"/>
+	<button label="Reimposta" left="110" name="Defaults" width="190"/>
 	<button label="Avanzate" name="Advanced"/>
 	<button label="Hardware" label_selected="Hardware" name="GraphicsHardwareButton"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_preferences_sound.xml b/indra/newview/skins/default/xui/it/panel_preferences_sound.xml
index 2ddb226020bd64f40da11d852950030b0c99f2f5..6936f24a8a237fda034141ca6e03bb82f9df2d2e 100644
--- a/indra/newview/skins/default/xui/it/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/it/panel_preferences_sound.xml
@@ -11,8 +11,8 @@
 	<check_box label="Abilitato" name="enable_media"/>
 	<slider label="Chat vocale" name="Voice Volume"/>
 	<check_box label="Abilitato" name="enable_voice_check"/>
-	<check_box label="Consenti riproduzione multimediale automatica" name="media_auto_play_btn" tool_tip="Seleziona qui per consentire la riproduzione multimediale automatica" value="true"/>
-	<check_box label="Riproduci media in uso da altri avatar" name="media_show_on_others_btn" tool_tip="Deseleziona qui per nascondere i media in uso dagli altri avatar nei dintorni" value="true"/>
+	<check_box label="Consenti riproduzione multimediale automatica" name="media_auto_play_btn" tool_tip="Seleziona qui per consentire la riproduzione multimediale automatica" value="vero"/>
+	<check_box label="Riproduci media in uso da altri avatar" name="media_show_on_others_btn" tool_tip="Deseleziona qui per nascondere i media in uso dagli altri avatar nei dintorni" value="vero"/>
 	<text name="voice_chat_settings">
 		Impostazioni Chat vocale
 	</text>
@@ -28,12 +28,6 @@
 		<panel.string name="default_text">
 			Predefinito
 		</panel.string>
-		<panel.string name="default system device">
-			Dispositivo di sistema predefinito
-		</panel.string>
-		<panel.string name="no device">
-			Nessun dispositivo
-		</panel.string>
 		<text name="Input">
 			Input
 		</text>
diff --git a/indra/newview/skins/default/xui/it/panel_status_bar.xml b/indra/newview/skins/default/xui/it/panel_status_bar.xml
index 6b1a8aa71b9db320b754cc4acbc08c08c9ac25c3..584ac5e4b4e9730648b2079827ab0599f79ff097 100644
--- a/indra/newview/skins/default/xui/it/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/it/panel_status_bar.xml
@@ -21,10 +21,8 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
-		<text name="balance" tool_tip="Il mio saldo" value="L$ 20"/>
-		<button label="ACQUISTA L$" name="buyL" tool_tip="Clicca per acquistare più L$"/>
-	</panel>
+	<button label="" label_selected="" name="buycurrency" tool_tip="Il mio saldo"/>
+	<button label="Acquista" name="buyL" tool_tip="Clicca per comprare più L$"/>
 	<text name="TimeText" tool_tip="Orario attuale (Pacifico)">
 		24:00, ora del Pacifico
 	</text>
diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml
index fb479b4653a4e847bb6324126518a503ca86ce61..a1b570d7160ec64fe2c990c41f663b807ee68fdc 100644
--- a/indra/newview/skins/default/xui/it/strings.xml
+++ b/indra/newview/skins/default/xui/it/strings.xml
@@ -94,24 +94,6 @@
 	<string name="LoginDownloadingClothing">
 		Sto caricando i vestiti...
 	</string>
-	<string name="InvalidCertificate">
-		Il server ha inviato un certificato non valido o errato. Rivolgiti all&apos;amministratore della griglia.
-	</string>
-	<string name="CertInvalidHostname">
-		Per accedere al server è stato utilizzato un nome host non valido; controlla lo SLURL o il nome host della griglia.
-	</string>
-	<string name="CertExpired">
-		Il certificato inviato dalla griglia sembra essere scaduto.  Controlla l&apos;orologio del sistema o rivolgiti all&apos;amministratore della griglia.
-	</string>
-	<string name="CertKeyUsage">
-		Impossibile utilizzare per SSl il certificato inviato dal server.  Rivolgiti all&apos;amministratore della griglia.
-	</string>
-	<string name="CertBasicConstraints">
-		Nella catena dei certificati del server erano presenti troppi certificati.  Rivolgiti all&apos;amministratore della griglia.
-	</string>
-	<string name="CertInvalidSignature">
-		Impossibile verificare la firma del certificato inviato dal server della griglia.  Rivolgiti all&apos;amministratore della griglia.
-	</string>
 	<string name="LoginFailedNoNetwork">
 		Errore di rete: Non è stato possibile stabilire un collegamento, controlla la tua connessione.
 	</string>
@@ -190,7 +172,6 @@
 	<string name="TooltipMustSingleDrop">
 		Solo un singolo oggetto può essere creato qui
 	</string>
-	<string name="TooltipPrice" value="L$ [AMOUNT]:"/>
 	<string name="TooltipHttpUrl">
 		Clicca per visitare questa pagina web
 	</string>
@@ -243,6 +224,7 @@
 		Clicca per avviare il comando secondlife://
 	</string>
 	<string name="CurrentURL" value="URL attuale: [CurrentURL]"/>
+	<string name="TooltipPrice" value="L$ [PRICE]-"/>
 	<string name="SLurlLabelTeleport">
 		Teleportati a
 	</string>
@@ -273,9 +255,6 @@
 	<string name="BUTTON_CLOSE_WIN">
 		Chiudi (Ctrl+W)
 	</string>
-	<string name="BUTTON_CLOSE_CHROME">
-		Chiudi
-	</string>
 	<string name="BUTTON_RESTORE">
 		Ripristina
 	</string>
@@ -303,9 +282,6 @@
 	<string name="ReleaseNotes">
 		Note sulla versione
 	</string>
-	<string name="RELEASE_NOTES_BASE_URL">
-		http://wiki.secondlife.com/wiki/Release_Notes/
-	</string>
 	<string name="LoadingData">
 		In caricamento...
 	</string>
@@ -318,9 +294,6 @@
 	<string name="GroupNameNone">
 		(nessuno)
 	</string>
-	<string name="AvalineCaller">
-		Chiamante Avaline [ORDER]
-	</string>
 	<string name="AssetErrorNone">
 		Nessun errore
 	</string>
@@ -651,9 +624,6 @@
 	<string name="worldmap_offline">
 		Offline
 	</string>
-	<string name="worldmap_item_tooltip_format">
-		L$ [PRICE] - [AREA] m²
-	</string>
 	<string name="worldmap_results_none_found">
 		Nessun risultato.
 	</string>
@@ -727,13 +697,13 @@
 		Controllare la tua fotocamera
 	</string>
 	<string name="SIM_ACCESS_PG">
-		Generale
+		PG
 	</string>
 	<string name="SIM_ACCESS_MATURE">
-		Moderato
+		Mature
 	</string>
 	<string name="SIM_ACCESS_ADULT">
-		Adulti
+		Adult
 	</string>
 	<string name="SIM_ACCESS_DOWN">
 		Offline
@@ -744,12 +714,6 @@
 	<string name="land_type_unknown">
 		(sconosciuto)
 	</string>
-	<string name="Estate / Full Region">
-		Proprietà immobiliare / Regione completa
-	</string>
-	<string name="Mainland / Full Region">
-		Continente / Regione completa
-	</string>
 	<string name="all_files">
 		Tutti i file
 	</string>
@@ -855,93 +819,6 @@
 	<string name="invalid">
 		non valido
 	</string>
-	<string name="none">
-		nessuno
-	</string>
-	<string name="shirt_not_worn">
-		Camicia non indossata
-	</string>
-	<string name="pants_not_worn">
-		Pantaloni non indossati
-	</string>
-	<string name="shoes_not_worn">
-		Scarpe non indossate
-	</string>
-	<string name="socks_not_worn">
-		Calzini non indossati
-	</string>
-	<string name="jacket_not_worn">
-		Giacca non indossata
-	</string>
-	<string name="gloves_not_worn">
-		Guanti non indossati
-	</string>
-	<string name="undershirt_not_worn">
-		Maglietta intima non indossata
-	</string>
-	<string name="underpants_not_worn">
-		Slip non indossati
-	</string>
-	<string name="skirt_not_worn">
-		Gonna non indossata
-	</string>
-	<string name="alpha_not_worn">
-		Alpha non portato
-	</string>
-	<string name="tattoo_not_worn">
-		Tatuaggio non portato
-	</string>
-	<string name="invalid_not_worn">
-		non valido
-	</string>
-	<string name="create_new_shape">
-		Crea nuova figura corporea
-	</string>
-	<string name="create_new_skin">
-		Crea nuova pelle
-	</string>
-	<string name="create_new_hair">
-		Crea nuovi capelli
-	</string>
-	<string name="create_new_eyes">
-		Crea nuovi occhi
-	</string>
-	<string name="create_new_shirt">
-		Crea nuova camicia
-	</string>
-	<string name="create_new_pants">
-		Crea nuovi pantaloni
-	</string>
-	<string name="create_new_shoes">
-		Crea nuove scarpe
-	</string>
-	<string name="create_new_socks">
-		Crea nuove calze
-	</string>
-	<string name="create_new_jacket">
-		Crea nuova giacca
-	</string>
-	<string name="create_new_gloves">
-		Crea nuovi guanti
-	</string>
-	<string name="create_new_undershirt">
-		Crea nuova maglietta intima
-	</string>
-	<string name="create_new_underpants">
-		Crea nuovi slip
-	</string>
-	<string name="create_new_skirt">
-		Crea nuova gonna
-	</string>
-	<string name="create_new_alpha">
-		Crea nuovo Alpha
-	</string>
-	<string name="create_new_tattoo">
-		Crea un nuovo tatuaggio
-	</string>
-	<string name="create_new_invalid">
-		non valido
-	</string>
 	<string name="NewWearable">
 		Nuovo [WEARABLE_ITEM]
 	</string>
@@ -1009,16 +886,13 @@
 		Alto
 	</string>
 	<string name="LeaveMouselook">
-		Premi ESC per tornare in visualizzazione normale
+		Premi ESC per tornare in visulizzazione normale
 	</string>
 	<string name="InventoryNoMatchingItems">
-		Non riesci a trovare quello che cerchi? Prova [secondlife:///app/search/all/[SEARCH_TERM] Cerca].
-	</string>
-	<string name="PlacesNoMatchingItems">
-		Non riesci a trovare quello che cerchi? Prova [secondlife:///app/search/places/[SEARCH_TERM] Cerca].
+		Nessun oggetto corrispondente trovato in inventario.  Prova [secondlife:///app/search/groups &quot;Cerca&quot;].
 	</string>
 	<string name="FavoritesNoMatchingItems">
-		Trascina qui un punto di riferimento per aggiungerlo ai Preferiti.
+		Trascina qui un punto di riferimento per aggiungerlo ai tuoi preferiti.
 	</string>
 	<string name="InventoryNoTexture">
 		Non hai una copia di questa texture nel tuo inventario
@@ -1043,10 +917,8 @@
 	<string name="AnimFlagStop" value="Ferma l&apos;animazione :"/>
 	<string name="AnimFlagStart" value="Inizia l&apos;animazione :"/>
 	<string name="Wave" value="Saluta con la mano"/>
-	<string name="GestureActionNone" value="Nessuna"/>
 	<string name="HelloAvatar" value="Ciao, avatar!"/>
 	<string name="ViewAllGestures" value="Visualizza tutto &gt;&gt;"/>
-	<string name="GetMoreGestures" value="Altre &gt;&gt;"/>
 	<string name="Animations" value="Animazioni,"/>
 	<string name="Calling Cards" value="Biglietti da visita,"/>
 	<string name="Clothing" value="Vestiti,"/>
@@ -1123,15 +995,12 @@
 	<string name="InvFolder Gestures">
 		Gesture
 	</string>
-	<string name="InvFolder Favorite">
+	<string name="InvFolder favorite">
 		Preferiti
 	</string>
 	<string name="InvFolder Current Outfit">
 		Abbigliamento attuale
 	</string>
-	<string name="InvFolder Initial Outfits">
-		Vestiario iniziale
-	</string>
 	<string name="InvFolder My Outfits">
 		Il mio vestiario
 	</string>
@@ -1451,7 +1320,6 @@
 	<string name="SummaryForTheWeek" value="Riassunto della settimana, partendo dal"/>
 	<string name="NextStipendDay" value="Il prossimo giorno di stipendio è"/>
 	<string name="GroupIndividualShare" value="Gruppo       Dividendi individuali"/>
-	<string name="GroupColumn" value="Gruppo"/>
 	<string name="Balance">
 		Saldo
 	</string>
@@ -1647,44 +1515,32 @@
 	<string name="ATTACH_HUD_BOTTOM_RIGHT">
 		HUD basso a destra
 	</string>
-	<string name="Bad attachment point">
-		Punto di collegamento non valido
-	</string>
 	<string name="CursorPos">
 		Riga [LINE], Colonna [COLUMN]
 	</string>
 	<string name="PanelDirCountFound">
 		[COUNT] trovato/i
 	</string>
-	<string name="PanelContentsTooltip">
-		Contenuto dell&apos;oggetto
-	</string>
 	<string name="PanelContentsNewScript">
 		Nuovo script
 	</string>
+	<string name="PanelContentsTooltip">
+		Contenuto dell&apos;oggetto
+	</string>
 	<string name="BusyModeResponseDefault">
 		Il residente al quale hai inviato un messaggio è in modalità &apos;occupato&apos;, ovvero ha chiesto di non essere disturbato.  Il tuo messaggio comparirà nel suo pannello IM, dove potrà essere letto in un secondo momento.
 	</string>
-	<string name="NoOutfits">
-		Non hai ancora vestiario da indossare. Prova [secondlife:///app/search/all Cerca].
-	</string>
-	<string name="NoOutfitsTabsMatched">
-		Non riesci a trovare quello che cerchi? Prova [secondlife:///app/search/all/[SEARCH_TERM] Cerca].
-	</string>
 	<string name="MuteByName">
-		(In base al nome)
+		(in base al nome)
 	</string>
 	<string name="MuteAgent">
 		(Residente)
 	</string>
 	<string name="MuteObject">
-		(Oggetto)
+		(oggetto)
 	</string>
 	<string name="MuteGroup">
-		(Gruppo)
-	</string>
-	<string name="MuteExternal">
-		(esterno)
+		(gruppo)
 	</string>
 	<string name="RegionNoCovenant">
 		Non esiste alcun regolamento per questa proprietà.
@@ -1692,7 +1548,9 @@
 	<string name="RegionNoCovenantOtherOwner">
 		Non esiste alcun regolamento per questa proprietà. Il terreno di questa proprietà è messo in vendita dal proprietario, non dalla Linden Lab.  Contatta il proprietario del terreno per i dettagli della vendita.
 	</string>
-	<string name="covenant_last_modified" value="Ultima modifica:"/>
+	<string name="covenant_last_modified">
+		Ultima modifica:
+	</string>
 	<string name="none_text" value="(nessuno)"/>
 	<string name="never_text" value="(mai)"/>
 	<string name="GroupOwned">
@@ -1708,7 +1566,7 @@
 		(si aggiornerà dopo la pubblicazione)
 	</string>
 	<string name="NoPicksClassifiedsText">
-		Non hai creato luoghi preferiti né inserzioni. Clicca il pulsante + qui sotto per creare un luogo preferito o un&apos;inserzione.
+		Non hai creato luoghi preferiti né inserzioni. Clicca il pulsante più qui sotto per creare un luogo preferito o un&apos;inserzione.
 	</string>
 	<string name="NoAvatarPicksClassifiedsText">
 		L&apos;utente non ha luoghi preferiti né inserzioni
@@ -3369,15 +3227,6 @@ Se il messaggio persiste, contatta [SUPPORT_SITE].
 	<string name="LocationCtrlComboBtnTooltip">
 		La cronologia delle mie posizioni
 	</string>
-	<string name="LocationCtrlAdultIconTooltip">
-		Regione con categoria adulti
-	</string>
-	<string name="LocationCtrlModerateIconTooltip">
-		Regione con categoria moderata
-	</string>
-	<string name="LocationCtrlGeneralIconTooltip">
-		Regione generale
-	</string>
 	<string name="UpdaterWindowTitle">
 		Aggiornamento [APP_NAME]
 	</string>
@@ -3408,12 +3257,6 @@ Se il messaggio persiste, contatta [SUPPORT_SITE].
 	<string name="UpdaterFailStartTitle">
 		Errore nell&apos;avvio del viewer
 	</string>
-	<string name="ItemsComingInTooFastFrom">
-		[APP_NAME]: Oggetti in arrivo troppo velocemente da [FROM_NAME], anteprima automatica disattivata per [TIME] secondi
-	</string>
-	<string name="ItemsComingInTooFast">
-		[APP_NAME]: Oggetti in arrivo troppo velocemente, anteprima automatica disattivata per [TIME] secondi
-	</string>
 	<string name="IM_logging_string">
 		-- Registrazione messaggi instantanei abilitata --
 	</string>
@@ -3441,17 +3284,11 @@ Se il messaggio persiste, contatta [SUPPORT_SITE].
 	<string name="IM_moderator_label">
 		(Moderatore)
 	</string>
-	<string name="answered_call">
-		Risposto alla chiamata
+	<string name="started_call">
+		Chiamata vocale iniziata
 	</string>
-	<string name="you_started_call">
-		Hai iniziato una chiamata vocale
-	</string>
-	<string name="you_joined_call">
-		Ti sei collegato alla chiamata in voce
-	</string>
-	<string name="name_started_call">
-		[NAME] ha iniziato una chiamata vocale
+	<string name="joined_call">
+		Si è collegato alla chiamata in voce
 	</string>
 	<string name="ringing-im">
 		Collegamento alla chiamata vocale...
@@ -3528,21 +3365,12 @@ Se il messaggio persiste, contatta [SUPPORT_SITE].
 	<string name="unread_chat_multiple">
 		[SOURCES] ha detto qualcosa di nuovo
 	</string>
-	<string name="session_initialization_timed_out_error">
-		Sessione di inizializzazione scaduta
-	</string>
-	<string name="voice_morphing_url">
-		http://secondlife.com/landing/voicemorphing
-	</string>
 	<string name="paid_you_ldollars">
 		[NAME] ti ha inviato un pagamento di L$[AMOUNT].
 	</string>
 	<string name="you_paid_ldollars">
 		Hai inviato un pagamento di L$[AMOUNT] a [NAME] [REASON].
 	</string>
-	<string name="you_paid_ldollars_no_info">
-		Hai pagato L$ [AMOUNT].
-	</string>
 	<string name="you_paid_ldollars_no_reason">
 		Hai inviato un pagamento di L$[AMOUNT] a [NAME].
 	</string>
@@ -3591,9 +3419,6 @@ Se il messaggio persiste, contatta [SUPPORT_SITE].
 	<string name="group_role_owners">
 		Proprietari
 	</string>
-	<string name="group_member_status_online">
-		Online
-	</string>
 	<string name="uploading_abuse_report">
 		Caricamento in corso...
   
@@ -3647,203 +3472,13 @@ Segnala abuso
 	<string name="Invalid Wearable">
 		Capo da indossare non valido
 	</string>
-	<string name="New Gesture">
-		Nuova gesture
-	</string>
 	<string name="New Script">
 		Nuovo script
 	</string>
-	<string name="New Note">
-		Nuovo appunto
-	</string>
 	<string name="New Folder">
 		Nuova cartella
 	</string>
 	<string name="Contents">
 		Contenuto
 	</string>
-	<string name="Gesture">
-		Gesture
-	</string>
-	<string name="Male Gestures">
-		Gesture maschili
-	</string>
-	<string name="Female Gestures">
-		Gesture femminili
-	</string>
-	<string name="Other Gestures">
-		Altre gesture
-	</string>
-	<string name="Speech Gestures">
-		Gesture del parlato
-	</string>
-	<string name="Common Gestures">
-		Gesture comuni
-	</string>
-	<string name="Male - Excuse me">
-		Maschio - Chiedere scusa
-	</string>
-	<string name="Male - Get lost">
-		Maschio - Levati dai piedi!
-	</string>
-	<string name="Male - Blow kiss">
-		Maschio - Butta un bacio
-	</string>
-	<string name="Male - Boo">
-		Maschio - Bu
-	</string>
-	<string name="Male - Bored">
-		Maschio - Annoiato
-	</string>
-	<string name="Male - Hey">
-		Maschio - Ehi
-	</string>
-	<string name="Male - Laugh">
-		Maschio - Ridere
-	</string>
-	<string name="Male - Repulsed">
-		Maschio - Disgustato
-	</string>
-	<string name="Male - Shrug">
-		Maschio - Spallucce
-	</string>
-	<string name="Male - Stick tougue out">
-		Maschio - Tira fuori la lingua
-	</string>
-	<string name="Male - Wow">
-		Maschio - Accipicchia
-	</string>
-	<string name="Female - Chuckle">
-		Femmina - Risatina
-	</string>
-	<string name="Female - Cry">
-		Femmina - Pianto
-	</string>
-	<string name="Female - Embarrassed">
-		Femmina - Imbarazzata
-	</string>
-	<string name="Female - Excuse me">
-		Femmina - Chiedere scusa
-	</string>
-	<string name="Female - Get lost">
-		Femmina - Levati dai piedi!
-	</string>
-	<string name="Female - Blow kiss">
-		Femmina - Butta un bacio
-	</string>
-	<string name="Female - Boo">
-		Femmina - Bu
-	</string>
-	<string name="Female - Bored">
-		Femmina - Annoiata
-	</string>
-	<string name="Female - Hey">
-		Femmina - Ehi
-	</string>
-	<string name="Female - Hey baby">
-		Femmina - Ehi tu
-	</string>
-	<string name="Female - Laugh">
-		Femmina - Ridere
-	</string>
-	<string name="Female - Looking good">
-		Femmina - Sei in forma
-	</string>
-	<string name="Female - Over here">
-		Femmina - Per di qua
-	</string>
-	<string name="Female - Please">
-		Femmina - Per cortesia
-	</string>
-	<string name="Female - Repulsed">
-		Femmina - Disgustata
-	</string>
-	<string name="Female - Shrug">
-		Femmina - Spallucce
-	</string>
-	<string name="Female - Stick tougue out">
-		Femmina - Tira fuori la lingua
-	</string>
-	<string name="Female - Wow">
-		Femmina - Accipicchia
-	</string>
-	<string name="AvatarBirthDateFormat">
-		[day,datetime,slt]/[mthnum,datetime,slt]/[year,datetime,slt]
-	</string>
-	<string name="DefaultMimeType">
-		nessuna/nessuna
-	</string>
-	<string name="texture_load_dimensions_error">
-		Impossibile caricare immagini di dimensioni superiori a [WIDTH]*[HEIGHT]
-	</string>
-	<string name="words_separator" value=","/>
-	<string name="server_is_down">
-		Nonostante i nostri tentativi, si è verificato un errore imprevisto.
-
-	Consulta la pagina status.secondlifegrid.net per determinare se si sia verificato un problema noto con il servizio.  
-        Se il problema continua, ti consigliamo di controllare le tue impostazioni di rete e della firewall.
-	</string>
-	<string name="dateTimeWeekdaysNames">
-		lunedì:martedì:mercoledì:giovedì:venerdì:sabato:domenica
-	</string>
-	<string name="dateTimeWeekdaysShortNames">
-		lun:mar:mer:gio:ven:sab:dom
-	</string>
-	<string name="dateTimeMonthNames">
-		gennaio:febbraio:marzo:aprile:maggio:giugno:luglio:agosto:settembre:ottobre:novembre:dicembre
-	</string>
-	<string name="dateTimeMonthShortNames">
-		gen:feb:mar:apr:mag:giu:lug:ago:sett:ott:nov:dic
-	</string>
-	<string name="dateTimeDayFormat">
-		[MDAY]
-	</string>
-	<string name="dateTimeAM">
-		antemeridiane
-	</string>
-	<string name="dateTimePM">
-		pomeridiane
-	</string>
-	<string name="LocalEstimateUSD">
-		US$ [AMOUNT]
-	</string>
-	<string name="Membership">
-		Abbonamento
-	</string>
-	<string name="Roles">
-		Ruoli
-	</string>
-	<string name="Group Identity">
-		Identità gruppo
-	</string>
-	<string name="Parcel Management">
-		Gestione lotto
-	</string>
-	<string name="Parcel Identity">
-		Identità lotto
-	</string>
-	<string name="Parcel Settings">
-		Impostazioni lotto
-	</string>
-	<string name="Parcel Powers">
-		Poteri lotto
-	</string>
-	<string name="Parcel Access">
-		Accesso al lotto
-	</string>
-	<string name="Parcel Content">
-		Contenuto lotto
-	</string>
-	<string name="Object Management">
-		Gestione oggetti
-	</string>
-	<string name="Accounting">
-		Contabilità
-	</string>
-	<string name="Notices">
-		Avvisi
-	</string>
-	<string name="Chat">
-		Chat
-	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/ja/language_settings.xml b/indra/newview/skins/default/xui/ja/language_settings.xml
index a6023f9b56d8284f05cb100d24954783ea3d3bec..72382417d9cd79168192a8e2882c2fddf50ab2f4 100644
--- a/indra/newview/skins/default/xui/ja/language_settings.xml
+++ b/indra/newview/skins/default/xui/ja/language_settings.xml
@@ -17,7 +17,6 @@
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
diff --git a/indra/newview/skins/default/xui/nl/language_settings.xml b/indra/newview/skins/default/xui/nl/language_settings.xml
index 53501d5dcb57849df6a1a42f65fa249c76227407..dc4663705fb44fdab83f6e3f47877c1ff8f881dd 100644
--- a/indra/newview/skins/default/xui/nl/language_settings.xml
+++ b/indra/newview/skins/default/xui/nl/language_settings.xml
@@ -17,7 +17,6 @@
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
diff --git a/indra/newview/skins/default/xui/pl/floater_about.xml b/indra/newview/skins/default/xui/pl/floater_about.xml
index e032008e7b7666373141cac7578bf880cb43b885..b49247c4bfb2737d5e473bb79d2515b8dbfb9a5a 100644
--- a/indra/newview/skins/default/xui/pl/floater_about.xml
+++ b/indra/newview/skins/default/xui/pl/floater_about.xml
@@ -27,9 +27,9 @@ Karta graficzna: [GRAPHICS_CARD]
 
 Wersja libcurl: [LIBCURL_VERSION]
 Wersja dekodera J2C: [J2C_VERSION]
-Wersja Audio Driver: [AUDIO_DRIVER_VERSION]
+Wersja sterownika audio: [AUDIO_DRIVER_VERSION]
 Wersja Qt Webkit: [QT_WEBKIT_VERSION]
-Wersja serwera głosu: [VOICE_VERSION]
+Wersja Vivox: [VIVOX_VERSION]
 	</floater.string>
 	<floater.string name="none">
 		(żadne)
@@ -43,14 +43,11 @@ Wersja serwera głosu: [VOICE_VERSION]
 		</panel>
 		<panel label="Podziękowania" name="credits_panel">
 			<text_editor name="credits_editor">
-				Second Life zostało stworzone dla Was przez Philip, Tessa, Andrew, Cory, Ian, James, Phoenix, Ryan, Haney, Dan, Char, Ben, John, Tanya, Eddie, Richard, Mitch, Doug, Eric, Frank, Bruce, Aaron, Peter, Alice, Charlie, Debra, Eileen, Helen, Janet, Steffan, Steve, Tom, Mark, Hunter, Xenon, Burgess, Bill, Jim, Lee, Hamlet, Daniel, Jeff, Todd, Sarah, Tim, Stephanie, Colin, Michael, Evan, Nicolas, Catherine, Rachelle, Dave, Holly, Bub, Kelly, Ramzi, Don, Sabin, Jill, Rheya, Jeska, Torley, Kona, Callum, Charity, Jack, Vektor, Chris, Nicole, Mick, Reuben, Blue, Babbage, Yedwab, Deana, Lauren, Brent, Pathfinder, Chadrick, Jesse, David, Tess, Lizzie, Patsy, Isaac, Lawrence, Cyn, Bo, Gia, Annette, Marius, Tbone, Jonathan, Karen, Ginsu, Yuko, Makiko, Thomas, Harry, Seth, Brian, Guy, Runitai, Ethan, Data, Cornelius, Kenny, Swiss, Zero, Brad, Natria, Wendy, Stephen, Teeple, Thumper, Lucy, Dee, Mia, Liana, Warren, Branka, Aura, Beez, Milo, Hermia, Red, Thrax, Gulliver, Joe, Sally, Paul, Jose, Rejean, Dore, Henrik, Lexie, Amber, Logan, Xan, Nora, Morpheus, Donovan, Leyla, MichaelFrancis, Beast, Cube, Bucky, Joshua, Stryfe, Harmony, Teresa, Claudia, Walker, Glenn, Fritz, Fordak, June, Cleopetra, Ivy, Betsy, Roosevelt, Spike, Ken, Which, Tofu, Chiyo, Rob, Zee, Dustin, George, Del, Matthew, Cat, Jacqui, Adrian, Viola, Alfred, Noel, Irfan, Yool, Rika, Jane, Frontier, Neo, Siobhan, Yoz, Justin, Elle, Qarl, Benjamin, Isabel, Everett, Christopher, Izzy, Stephany, Garry, Sejong, Sean, Tobin, Iridium, Meta, Jeremy, JP, Jake, Anthony, Maurice, Madhavi, Leopard, Kyle, Joon, Bert, Belinda, Jon, Kristi, Bridie, Pramod, Socrates, Maria, Aric, Adreanne, Jay, Kari, Ceren, Coco, Durl, Jenny, Periapse, Kartic, Storrs, Lotte, Sandy, Colossus, Zen, BigPapi, Pastrami, Kurz, Mani, Neuro, Mel, Sardonyx, MJ, Rowan, Sgt, Elvis, Samuel, Leo, Bryan, Niko, Austin, Soft, Poppy, Rachel, Aki, Banzai, Alexa, Sue, Bender, CG, Angelo, Gillian, Pelle, Nick, Echo, Zara, Christine, Shamiran, Emma, Blake, Keiko, Plexus, Joppa, Sidewinder, Erica, Ashlei, Twilight, Kristen, Brett, Q, Enus, Simon, Bevis, Kraft, Kip, Chandler, Ron, LauraP, Ram, KyleJM, Scouse, Prospero, Melissa, Marty, Nat, Hamilton, Kend, Lordan, Jimmy, Kosmo, Seraph, Green, Ekim, Wiggo, JT, Rome, Doris, Miz, Benoc, Whump, Trinity, Patch, Kate, TJ, Bao, Joohwan, Christy, Sofia, Matias, Cogsworth, Johan, Oreh, Cheah, Angela, Brandy, Mango, Lan, Aleks, Gloria, Mitchell, Space, Colton, Bambers, Einstein, Maggie, Malbers, Rose, Rothman, Niall, Marin, Allison, Katie, Dawn, Dusty, Katt, Judy, Andrea, Ambroff, Infinity, Rico, Gail, Kalpana, Raymond, Yi, William, Christa, M, Teagan, Scout, Molly, Dante, Corr, Dynamike, Usi, Kaylee, Lil, Danica, Sascha, Kelv, Jacob, Nya, Rodney, Brandon, Elsie, Blondin, Grant, Katrin, Nyx, Gabriel, Locklainn, Claire, Devin, Minerva, Monty, Bradford, Si, Keira, H, Caitlin, Dita, Makai, Jenn, Ann, Meredith, Clare, Joy, Praveen, Cody, Edmund, Ruthe, Sirena, Gayathri, Spider, FJ, Davidoff, Tian, Jennie, Louise, Oskar, Landon, Noelle, Jarv, Ingrid, Al, Sommer, Doc, Aria, Huin, Gray, Lili, Vir, DJ, Maestro, Simone, Yang, T, Shannon, Nelson, Khanh, Scott, Courtney, Charlene, Quixote, Susan, Zed, Amanda, Katelin, Enkidu, Roxie, Esbee, JoRoan, Scarlet, Tay, Kevin, Wolfgang, Johnny, Ray, Andren, Merov, Bob, Rand, Howard, Callen, Heff, Galen, Newell, Dessie, Les, Michon, Jenelle, Geo, Siz, Shapiro, Pete, Calyle, Selene, Allen, Phoebe, Goldin, Kimmora, Dakota, Slaton, Lindquist, Zoey, Hari, Othello, Rohit, Sheldon, Petra, Viale, Gordon, Kaye, Pink, Ferny, Emerson, Davy, Bri, Chan, Juan, Robert, Terrence, Nathan, Carl, Ashley, JessieAnn, Huseby, Karina, Paris, Kurt, Rick, Lis, Kotler, Theeba, Lynx, Murphy, Doten, Taka, Norm, Jillian, Marcus, Mae, Novack, Esther, Perry, Dana, Ducot, Javier, Porter, Madison, Gecko, Dough, JR, Gisele, Crimp, Norie, Arch, Kimi, Fisher, Barbara, Jason, Peggy, Bernard, Jules, Leroy, Eva, Khederian, Campbell, Vogt, Masido, Karel, Torres, Lo, Breezer, Delby, Rountree, Anna, Servus, Rue, Itiaes, Chuck, Luna, Novella, Zaza, Wen, Gino, Lex, Cassandra, Limey, Nancy, Anukul, Silver, Brodesky, Jinsai, Squid, Gez, Rakesh, Ladan, Edelman, Marcet, Squire, Tatem, Tony, Jerm, Tia, Falcon, BK, Tiggs, Driscoll, Bacon, Timothee, Cru, Carmilla, Coyot, Webb, Kazu, Rudas, LJ, Sea, Ali Wallace, Bewest, Pup, Drub, Dragon, Inoshiro, Byron, Rhett, Xandix, Aimee, Fredrik, Thor, Teddy, Baron, Nelly, Ghengis, Epic, Eli, Stone, Grapes, Irie, Prep, Scobu, Valerie, Alain, and many others.
+				Second Life zostało stworzone dla Was przez: Philip, Tessa, Andrew, Cory, James, Ben, Char, Charlie, Colin, Dan, Daniel, Doug, Eric, Hamlet, Haney, Eve, Hunter, Ian, Jeff, Jennifer, Jim, John, Lee, Mark, Peter, Phoenix, Richard, Robin, Xenon, Steve, Tanya, Eddie, Avi, Frank, Bruce, Aaron, Alice, Bob, Debra, Eileen, Helen, Janet, Louie, Leviathania, Stefan, Ray, Kevin, Tom, Mikeb, MikeT, Burgess, Elena, Tracy, Bill, Todd, Ryan, Zach, Sarah, Nova, Tim, Stephanie, Michael, Evan, Nicolas, Catherine, Rachelle, Dave, Holly, Bub, Kelly, Magellan, Ramzi, Don, Sabin, Jill, Rheya, Jeska, Torley, Kona, Callum, Charity, Ventrella, Jack, Vektor, Iris, Chris, Nicole, Mick, Reuben, Blue, Babbage, Yedwab, Deana, Lauren, Brent, Pathfinder, Chadrick, Altruima, Jesse, Teeny, Monroe, Icculus, David, Tess, Lizzie, Patsy, Isaac, Lawrence, Cyn, Bo, Gia, Annette, Marius, Tbone, Jonathan, Karen, Ginsu, Satoko, Yuko, Makiko, Thomas, Harry, Seth, Alexei, Brian, Guy, Runitai, Ethan, Data, Cornelius, Kenny, Swiss, Zero, Natria, Wendy, Stephen, Teeple, Thumper, Lucy, Dee, Mia, Liana, Warren, Branka, Aura, beez, Milo, Hermia, Red, Thrax, Joe, Sally, Magenta, Mogura, Paul, Jose, Rejean, Henrik, Lexie, Amber, Logan, Xan, Nora, Morpheus, Donovan, Leyla, MichaelFrancis, Beast, Cube, Bucky, Joshua, Stryfe, Harmony, Teresa, Claudia, Walker, Glenn, Fritz, Fordak, June, Cleopetra, Jean, Ivy, Betsy, Roosevelt, Spike, Ken, Which, Tofu, Chiyo, Rob, Zee, dustin, George, Del, Matthew, Cat, Jacqui, Lightfoot, Adrian, Viola, Alfred, Noel, Irfan, Sunil, Yool, Rika, Jane, Xtreme, Frontier, a2, Neo, Siobhan, Yoz, Justin, Elle, Qarl, Benjamin, Isabel, Gulliver, Everett, Christopher, Izzy, Stephany, Garry, Sejong, Sean, Tobin, Iridium, Meta, Anthony, Jeremy, JP, Jake, Maurice, Madhavi, Leopard, Kyle, Joon, Kari, Bert, Belinda, Jon, Kristi, Bridie, Pramod, KJ, Socrates, Maria, Ivan, Aric, Yamasaki, Adreanne, Jay, MitchK, Ceren, Coco, Durl, Jenny, Periapse, Kartic, Storrs, Lotte, Sandy, Rohn, Colossus, Zen, BigPapi, Brad, Pastrami, Kurz, Mani, Neuro, Jaime, MJ, Rowan, Sgt, Elvis, Gecko, Samuel, Sardonyx, Leo, Bryan, Niko, Soft, Poppy, Rachel, Aki, Angelo, Banzai, Alexa, Sue, CeeLo, Bender, CG, Gillian, Pelle, Nick, Echo, Zara, Christine, Shamiran, Emma, Blake, Keiko, Plexus, Joppa, Sidewinder, Erica, Ashlei, Twilight, Kristen, Brett, Q, Enus, Simon, Bevis, Kraft, Kip, Chandler, Ron, LauraP, Ram, KyleJM, Scouse, Prospero, Melissa, Marty, Nat, Hamilton, Kend, Lordan, Jimmy, Kosmo, Seraph, Green, Ekim, Wiggo, JT, Rome, Doris, Miz, Benoc, Whump, Trinity, Patch, Kate, TJ, Bao, Joohwan, Christy, Sofia, Matias, Cogsworth, Johan, Oreh, Cheah, Angela, Brandy, Mango, Lan, Aleks, Gloria, Heidy, Mitchell, Space, Colton, Bambers, Einstein, Maggie, Malbers, Rose, Winnie, Stella, Milton, Rothman, Niall, Marin, Allison, Katie, Dawn, Katt, Dusty, Kalpana, Judy, Andrea, Ambroff, Infinity, Gail, Rico, Raymond, Yi, William, Christa, M, Teagan, Scout, Molly, Dante, Corr, Dynamike, Usi, Kaylee, Vidtuts, Lil, Danica, Sascha, Kelv, Jacob, Nya, Rodney, Brandon, Elsie, Blondin, Grant, Katrin, Nyx, Gabriel, Locklainn, Claire, Devin, Minerva, Monty, Austin, Bradford, Si, Keira, H, Caitlin, Dita, Makai, Jenn, Ann, Meredith, Clare, Joy, Praveen, Cody, Edmund, Ruthe, Sirena, Gayathri, Spider, FJ, Davidoff, Tian, Jennie, Louise, Oskar, Landon, Noelle, Jarv, Ingrid, Al, Sommer, Doc, Aria, Huin, Gray, Lili, Vir, DJ, Yang, T, Simone, Maestro, Scott, Charlene, Quixote, Amanda, Susan, Zed, Anne, Enkidu, Esbee, Joroan, Katelin, Roxie, Tay, Scarlet, Kevin, Johnny, Wolfgang, Andren, Bob, Howard, Merov, Rand, Ray, Michon, Newell, Galen, Dessie, Les and many others.
 
-Podziękowania dla następujących Rezydentów za pomoc w pracy nad obecną wersją Second Life: Drew Dwi, Zai Lynch, Latif Khalifa, Ellla McMahon, Harleen Gretzky, Squirrel Wood, Malarthi Behemoth, Dante Tucker, Buckaroo Mu, Eddi Decosta, Dirk, Talamasca, Torben Trautman, Irene Muni, Lilly Zenovka, Vick Forcella, Sasy Scarborough, Gentle Welinder, Elric Anatine, Techwolf Lupindo, Dusan Writer, WolfPup Lowenhar, Marianne McCann, Fiachra Lach, Sitearm Madonna, Sudane Erato, Sahkolihaa Contepomi, Sachi Vixen, Questar Utu, Dimitrio Lewis, Matto Destiny, Scrim Pinion, Radio Signals, Psi Merlin, Pixel Gausman, Mel Vanbeeck, Laurent Bechir, Lamorna Proctor, Lares Carter, Gwyneth Llewelyn, Hydra Shaftoe, Holger Gilruth, Gentle Heron, Carla Broek, Boroondas Gupte, Fury Rosewood, Flower Ducatillon, Colpo Wexler, gwampa Lomu, Borg Capalini, Beansy Twine, Ardy Lay, , 45ms Zhong, Adeon Writer, Aeonix Aeon, Ai Austin, Aiko Ying, Alexandrea Fride, Alliez Mysterio, Annie Milestone, Annika Genezzia, Ansariel Hiller, ArminasX Saiman, Arya Braveheart, Asaeda Meltingdots, Asturkon Jua, Avallyn Oakleaf, Avatar Quinzet, BabyA Littlething, Bacchus Ireto, Bazaar, Riva, Benjamin Bigdipper, Beth Walcher, Bezilon Kasei, Biancaluce Robbiani, Bill Walach, blakopal Galicia, Blitzckreed Levenque, Bryn Oh, Callipygian Christensen, Cap Carver, Carr Arbenlow, Chantal Harvey, Charles Courtois, Charlie Sazaland, Cherry Cheevers, ChickyBabes Zuzu, Christopher  Organiser, Ciaran Laval, Clara Young, Celierra Darling, Corinne Helendale, Corro Moseley, Coughdrop Littlething, Darien Caldwell, Dartagan Shepherd, Debs Regent, Decro Schmooz, Denim Kamachi, DiJodi Dubratt, Dil Spitz, Edgware Marker, Egehan Dryke, Emma Portilo, Emmie Fairymeadow, Evangelista Emerald, Faelon Swordthain, Frenchimmo Sabra, Gaberoonie Zanzibar, Ganymedes Costagravas, Gene Frostbite, GeneJ Composer, Giggles Littlebird, Grady Echegaray, Guni Greenstein, Gypsy Tripsa, Hackshaven Harford, Ham Rambler, Han Shuffle, Hanglow Short, Hatzfeld Runo, herina Bode, Horatio Freund, Hypatia Callisto, Hypatia Pickens, Identity Euler, Imnotgoing Sideways, Innula Zenovka, Iyoba Tarantal, Jack Abraham, Jagga Meredith, Jennifer Boyle, Jeremy Marquez, Jessica Qin, Jinx Nordberg, Jo Bernandes, Jocial Sonnenkern, Joel Savard, Jondan Lundquist, Josef Munster, Josette Windlow, Juilan Tripsa, Juro Kothari, Justin RiversRunRed, Kagehi Kohn, Kaimen Takahe, Keklily Longfall, Ken Lavender, Kestral Karas, Khisme Nitely, Kimar Coba, Kithrak Kirkorian, Kitty Barnett, Kolor Fall, Komiko Okamoto, Korvel Noh, Larry Pixel, Leal Choche, len Starship, Lenae Munz, Lexi Frua, Lillie Cordeaux, Lizzy Macarthur, LSL Scientist, Luban Yiyuan, Luc Starsider, Maccus McCullough, Madison Blanc, Maggie Darwin, Mallory Destiny, Manx Wharton, Marc Claridge, Marc2 Sands, Matthew Anthony, Maxim RiversRunRed, Medhue Simoni, Melinda Latynina, Mencius Watts, Michi Lumin, Midian Farspire, Miles Glaz, Mindy Mathy, Mitch Wagner, Mo Hax, Mourna Biziou, Nao Noe, naofan Teardrop, Naomah Beaumont, Nathiel Siamendes, Nber Medici, Neko Link, Netpat Igaly, Neutron Chesnokov, Newfie Pendragon, Nicholai Laviscu, Nick Rhodes, Nicoladie Gymnast, Ollie Kubrick, Orenj Marat, Orion Delphis, Oryx Tempel, Parvati Silverweb, PeterPunk Mooney, Pixel Scientist, Pounce Teazle, Professor Noarlunga, Quantum Destiny, Quicksilver Hermes, Ralf Setsuko, RAT Quan, RedMokum Bravin, Revolution Perenti, Rezit Sideways, Rich Grainger, Rosco Teardrop, Rose Evans, Rudee Voom, RufusTT Horsefly, Saii Hallard, SaintLEOlions Zimer, Samm Larkham, Satanello Miami, SexySteven Morrisey, Sheet Spotter, Shnurui Troughton, sicarius Thorne, Sicarius Toxx, Sini Nubalo, SLB Wirefly, snowy Sidran, Soupa Segura, ST Mensing, Starshine Halasy, Stickman Ingmann, Synystyr Texan, Takeda Terrawyng, Tali Rosca, Templar Merlin, Tezcatlipoca Bisiani, Tiel Stonecutter, Tony Kembia, TouchaHoney Perhaps, Trey Reanimator, TriloByte Zanzibar, Trinity Dechou, Trinity Dejavu, Unlikely Quintessa, UsikuFarasi Kanarik, Veritas Raymaker, Vex Streeter, Viaticus Speculaas, Villain Baroque, Vixie Durant, Void Singer, Watty Berkson, Westley Schridde, Westley Streeter, Whimsy Winx, Winter Ventura, Wundur Primbee, xstorm Radek, YongYong Francois, Zak Westminster, Zana Kohime, Zaren Alexander, Zeja Pyle, ZenMondo Wormser, Zoex Flanagan, and many others.
-
-
-
-
-&quot;The work goes on, the cause endures, the hope still lives, and the dreams shall never die&quot; - Edward Kennedy
+Podziękowania dla następujących rezydentów za pomoc w pracy nad obecną wersją Second Life: (in progress)
+It is a rare mind indeed that can render the hitherto non-existent blindingly obvious. The cry &apos;I could have thought of that&apos; is a very popular and misleading one, for the fact is that they didn&apos;t, and a very significant and revealing fact it is too.
+ -- Douglas Adams
 			</text_editor>
 		</panel>
 		<panel label="Licencje" name="licenses_panel">
diff --git a/indra/newview/skins/default/xui/pl/floater_about_land.xml b/indra/newview/skins/default/xui/pl/floater_about_land.xml
index c68e1c72ce3d1308f3b85c11eaabb1d8bc82ca99..e4908deb079499749fc0dc6aed2959ffea3f1430 100644
--- a/indra/newview/skins/default/xui/pl/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/pl/floater_about_land.xml
@@ -63,9 +63,6 @@
 				Posiadłość nie wybrana.
 Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokazać jej dane.
 			</panel.string>
-			<panel.string name="time_stamp_template">
-				[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
-			</panel.string>
 			<text name="Name:">
 				Nazwa:
 			</text>
@@ -199,13 +196,13 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 			<text name="resellable_lbl">
 				Odsprzedaj:
 			</text>
-			<text left="115" name="resellable_clause">
+			<text left="115" name="resellable_clause" width="338">
 				Posiadłość zakupiona w tym Regionie nie może być odsprzedana.
 			</text>
 			<text name="changeable_lbl">
 				Podziel:
 			</text>
-			<text left="115" name="changeable_clause">
+			<text left="115" name="changeable_clause" width="338">
 				Posiadłość zakupiona w tym Regionie nie może być
 Å‚Ä…czona/dzielona.
 			</text>
@@ -327,7 +324,7 @@ Jedynie większe posiadłości mogą być umieszczone w bazie wyszukiwarki.
 			<check_box label="Wszyscy" name="edit objects check"/>
 			<check_box label="Grupa" name="edit group objects check"/>
 			<text name="allow_label3">
-				Nowe obiekty:
+				Nowe Obiekty:
 			</text>
 			<check_box label="Wszyscy" name="all object entry check"/>
 			<check_box label="Grupa" name="group object entry check"/>
@@ -380,7 +377,7 @@ Jedynie większe posiadłości mogą być umieszczone w bazie wyszukiwarki.
 				Punkt LÄ…dowania: [LANDING]
 			</text>
 			<button label="Ustaw" label_selected="Ustaw" name="Set" tool_tip="Ustal miejsce lądowania dla przybywających gości. Używa położenia Twojego awatara na tej posiadłości."/>
-			<button label="Nowy" label_selected="Nowy" name="Clear" tool_tip="Usuń dotychczasowe miejsce lądowania."/>
+			<button label="Nowy" label_selected="Nowy" name="Clear" tool_tip="Clear the landing point."/>
 			<text name="Teleport Routing: ">
 				Trasa teleportacji:
 			</text>
@@ -399,7 +396,7 @@ Jedynie większe posiadłości mogą być umieszczone w bazie wyszukiwarki.
 				URL mediów:
 			</text>
 			<button label="Ustaw" name="set_media_url"/>
-			<check_box label="Ukryj URL mediów" name="hide_media_url" tool_tip="Wybranie tej opcji, zablokuje widok adresu do medów wszystkim nieautoryzowanym Rezydentom. Nie dotyczy to jednak typów HTML."/>
+			<check_box label="Ukryj URL mediów" name="hide_media_url" tool_tip="Wybranie tej opcji, zablokuje widok adresu do medów wszystkim nieautoryzowanym Użytkownikom. Nie dotyczy to jednak typów HTML."/>
 			<text name="Description:">
 				Opis:
 			</text>
@@ -431,14 +428,14 @@ Mediów:
 			<check_box label="Ukryj URL muzyki" name="hide_music_url" tool_tip="Wybranie tej opcji, zablokuje widok adresu do medów muzycznych w posiadłości wszystkim nieautoryzowanym Użytkownikom"/>
 			<check_box label="Rozmowy dozwolone" name="parcel_enable_voice_channel"/>
 			<check_box label="Rozmowy dozwolone (ustawione przez MajÄ…tek)" name="parcel_enable_voice_channel_is_estate_disabled"/>
-			<check_box label="Ogranicz komunikację głosową w tej Posiadłości." name="parcel_enable_voice_channel_local"/>
+			<check_box label="Ogranicz komunikację głosową w tej posiadłości." name="parcel_enable_voice_channel_local"/>
 		</panel>
 		<panel label="DOSTĘP" name="land_access_panel">
 			<panel.string name="access_estate_defined">
 				(Zdefiniowane przez MajÄ…tek)
 			</panel.string>
 			<panel.string name="allow_public_access">
-				Udostępnij publicznie ([MATURITY])
+				Udostępnij dostęp publiczny ([MATURITY])
 			</panel.string>
 			<panel.string name="estate_override">
 				Jedna lub więcej z tych opcji ustawiona jest z poziomu Posiadłości
diff --git a/indra/newview/skins/default/xui/pl/floater_animation_preview.xml b/indra/newview/skins/default/xui/pl/floater_animation_preview.xml
index 3402d8d31fd287f20e4c2ca5b50ac9c7a83d0de1..ca06665c659e3f66fb7611005a43a178363509e1 100644
--- a/indra/newview/skins/default/xui/pl/floater_animation_preview.xml
+++ b/indra/newview/skins/default/xui/pl/floater_animation_preview.xml
@@ -26,7 +26,7 @@ Maksymalna długość pliku animacji wynosi [MAX_LENGTH] sekund.
 		Plik BVH nie może zostać otworzony.
 	</floater.string>
 	<floater.string name="E_ST_NO_HIER">
-		Niewłaściwy nagłówek HIERARCHII.
+		Niewłaściwy nagłówek HIERARCHI.
 	</floater.string>
 	<floater.string name="E_ST_NO_JOINT">
 		ROOT oraz JOINT nieodnalezione.
@@ -104,7 +104,7 @@ Maksymalna długość pliku animacji wynosi [MAX_LENGTH] sekund.
 		Brak otrzymania wartości morfizacji.
 	</floater.string>
 	<floater.string name="E_ST_NO_XLT_EMOTE">
-		Nie można odczytać nazwy emocji.
+		Niemożliwość przeczytania nazwy emocji.
 	</floater.string>
 	<floater.string name="E_ST_BAD_ROOT">
 		Nieprawidłowa nazwa, użyj &quot;hip&quot;.
@@ -120,7 +120,7 @@ Maksymalna długość pliku animacji wynosi [MAX_LENGTH] sekund.
 	<spinner label="Od(%)" name="loop_in_point" tool_tip="Wybierz punkt, od którego chcesz zacząć powtarzać animację"/>
 	<spinner label="Do(%)" name="loop_out_point" tool_tip="Wybierz punkt, od którego chcesz zakończyć powtarzanie animacji"/>
 	<text name="hand_label">
-		Pozycja ręki
+		Pozycja Ręki
 	</text>
 	<combo_box label="" name="hand_pose_combo" tool_tip="Kontroluje co robi ręka podczas animacji">
 		<combo_box.item label="RozciÄ…gaj" name="Spread"/>
@@ -128,54 +128,54 @@ Maksymalna długość pliku animacji wynosi [MAX_LENGTH] sekund.
 		<combo_box.item label="Wskazuj" name="PointBoth"/>
 		<combo_box.item label="Pięść" name="Fist"/>
 		<combo_box.item label="Lewa-Odpocznij" name="RelaxedLeft"/>
-		<combo_box.item label="Wskazuj lewÄ…" name="PointLeft"/>
-		<combo_box.item label="Zaciśnij lewą" name="FistLeft"/>
-		<combo_box.item label="Prawa-odpocznij" name="RelaxedRight"/>
-		<combo_box.item label="Wskazuj prawÄ…" name="PointRight"/>
-		<combo_box.item label="Zaciśnij prawą" name="FistRight"/>
-		<combo_box.item label="Salutuj prawÄ…" name="SaluteRight"/>
+		<combo_box.item label="Wskazuj LewÄ…" name="PointLeft"/>
+		<combo_box.item label="Zaciśnij Lewą" name="FistLeft"/>
+		<combo_box.item label="Prawa-Odpocznij" name="RelaxedRight"/>
+		<combo_box.item label="Wskazuj PrawÄ…" name="PointRight"/>
+		<combo_box.item label="Zaciśnij Prawą" name="FistRight"/>
+		<combo_box.item label="Salutuj PrawÄ…" name="SaluteRight"/>
 		<combo_box.item label="Pisz" name="Typing"/>
-		<combo_box.item label="Prawa-pokój" name="PeaceRight"/>
+		<combo_box.item label="Prawa-Pokój" name="PeaceRight"/>
 	</combo_box>
 	<text name="emote_label">
 		Ekspresja
 	</text>
 	<combo_box label="" name="emote_combo" tool_tip="Kontroluj mimikÄ™ twarzy w czasie animacji">
-		<item label="(Żadne)" name="[None]" value=""/>
-		<item label="Aaaaah" name="Aaaaah" value="Aaaaah"/>
-		<item label="Obawa" name="Afraid" value="Obawa"/>
-		<item label="Złość" name="Angry" value="Złość"/>
-		<item label="Duży uśmiech" name="BigSmile" value="Duży uśmiech"/>
-		<item label="Znudzenie" name="Bored" value="Znudzenie"/>
-		<item label="PÅ‚acz" name="Cry" value="PÅ‚acz"/>
-		<item label="Wzgarda" name="Disdain" value="Wzgarda"/>
-		<item label="Zakłopotanie" name="Embarrassed" value="Zakłopotanie"/>
-		<item label="Marszczenie brwi" name="Frown" value="Marszczenie brwi"/>
-		<item label="Pocałunek" name="Kiss" value="Pocałunek"/>
-		<item label="Åšmiech" name="Laugh" value="Åšmiech"/>
-		<item label="Plllppt" name="Plllppt" value="Plllppt"/>
-		<item label="Odrzucenie" name="Repulsed" value="Odrzucenie"/>
-		<item label="Smutek" name="Sad" value="Smutek"/>
-		<item label="Wzruszenie ramionami" name="Shrug" value="Wzruszenie ramionami"/>
-		<item label="Uśmiech" name="Smile" value="Uśmiech"/>
-		<item label="Niespodzianka" name="Surprise" value="Niespodzianka"/>
-		<item label="Mrugnięcie" name="Wink" value="Mrugnięcie"/>
-		<item label="Zmartwienie" name="Worry" value="Zmartwienie"/>
+		<combo_box.item label="(Żadne)" name="[None]"/>
+		<combo_box.item label="Aaaaah" name="Aaaaah"/>
+		<combo_box.item label="Obawa" name="Afraid"/>
+		<combo_box.item label="Złość" name="Angry"/>
+		<combo_box.item label="Duży Uśmiech" name="BigSmile"/>
+		<combo_box.item label="Znudzenie" name="Bored"/>
+		<combo_box.item label="PÅ‚acz" name="Cry"/>
+		<combo_box.item label="Wzgarda" name="Disdain"/>
+		<combo_box.item label="Zakłopotanie" name="Embarrassed"/>
+		<combo_box.item label="Marszczenie Brwi" name="Frown"/>
+		<combo_box.item label="Pocałunek" name="Kiss"/>
+		<combo_box.item label="Åšmiech" name="Laugh"/>
+		<combo_box.item label="Plllppt" name="Plllppt"/>
+		<combo_box.item label="Odrzucenie" name="Repulsed"/>
+		<combo_box.item label="Smutek" name="Sad"/>
+		<combo_box.item label="Wzruszenie Ramionami" name="Shrug"/>
+		<combo_box.item label="Uśmiech" name="Smile"/>
+		<combo_box.item label="Niespodzianka" name="Surprise"/>
+		<combo_box.item label="Mrugnięcie" name="Wink"/>
+		<combo_box.item label="Zmartwienie" name="Worry"/>
 	</combo_box>
 	<text name="preview_label">
 		PrzeglÄ…daj kiedy:
 	</text>
 	<combo_box label="" name="preview_base_anim" tool_tip="Przetestuj zachowanie animacji kiedy awatar wykonuje normalne czynności">
-		<item label="Stoisz" name="Standing" value="Stoisz"/>
-		<item label="Chodzisz" name="Walking" value="Chodzisz"/>
-		<item label="Siedzisz" name="Sitting" value="Siedzisz"/>
-		<item label="Latasz" name="Flying" value="Latasz"/>
+		<combo_box.item label="Stoisz" name="Standing"/>
+		<combo_box.item label="Chodzisz" name="Walking"/>
+		<combo_box.item label="Siedzisz" name="Sitting"/>
+		<combo_box.item label="Latasz" name="Flying"/>
 	</combo_box>
 	<spinner label="Złagodzić w (sekund)" name="ease_in_time" tool_tip="Ilość Czasu (w sekundach), w których animacje mieszają się"/>
 	<spinner label="Złagodzić na zewnątrz (sekund)" name="ease_out_time" tool_tip="Ilość Czasu (w sekundach), w których animacje oddzielają się"/>
 	<button label="" name="play_btn" tool_tip="Odtwarzaj animacjÄ™"/>
 	<button name="pause_btn" tool_tip="Zatrzymaj animacjÄ™"/>
-	<button label="" name="stop_btn" tool_tip="Zakończ odtwarzanie animacji"/>
+	<button label="" name="stop_btn" tool_tip="Stop animation playback"/>
 	<slider label="" name="playback_slider"/>
 	<text name="bad_animation_text">
 		Brak możliwości wczytania pliku animacji.
diff --git a/indra/newview/skins/default/xui/pl/floater_avatar_textures.xml b/indra/newview/skins/default/xui/pl/floater_avatar_textures.xml
index 45b9e066e958cc1b5eab283916ef9f9a4c5fe210..11651ad7e84dafb7b1f5f4efd83f49a61d3e56d4 100644
--- a/indra/newview/skins/default/xui/pl/floater_avatar_textures.xml
+++ b/indra/newview/skins/default/xui/pl/floater_avatar_textures.xml
@@ -3,46 +3,41 @@
 	<floater.string name="InvalidAvatar">
 		NIEWŁAŚCIWY AWATAR
 	</floater.string>
+	<text name="composite_label">
+		Tekstury kompozytowe
+	</text>
+	<button label="Zrzuć" label_selected="Zrzuć" name="Dump"/>
 	<scroll_container name="profile_scroll">
 		<panel name="scroll_content_panel">
-			<text name="label">
-				Tekstury bakowane
-			</text>
-			<text name="composite_label">
-				Tekstury kompozytowe
-			</text>
-			<button label="Dump IDs to Console" label_selected="Dump" name="Dump"/>
-			<panel name="scroll_content_panel">
-				<texture_picker label="WÅ‚osy" name="hair-baked"/>
-				<texture_picker label="WÅ‚osy" name="hair_grain"/>
-				<texture_picker label="Alpha włosów" name="hair_alpha"/>
-				<texture_picker label="GÅ‚owa" name="head-baked"/>
-				<texture_picker label="Makijaż" name="head_bodypaint"/>
-				<texture_picker label="Alpha głowy" name="head_alpha"/>
-				<texture_picker label="Tatuaż głowy" name="head_tattoo"/>
-				<texture_picker label="Oczy" name="eyes-baked"/>
-				<texture_picker label="Oko" name="eyes_iris"/>
-				<texture_picker label="Alpha oczu" name="eyes_alpha"/>
-				<texture_picker label="Górna część ciała" name="upper-baked"/>
-				<texture_picker label="Górny rysunek na ciele" name="upper_bodypaint"/>
-				<texture_picker label="Podkoszulek" name="upper_undershirt"/>
-				<texture_picker label="Rękawiczki" name="upper_gloves"/>
-				<texture_picker label="Koszula" name="upper_shirt"/>
-				<texture_picker label="Kurtka górna" name="upper_jacket"/>
-				<texture_picker label="Górna alpha" name="upper_alpha"/>
-				<texture_picker label="Górny tatuaż" name="upper_tattoo"/>
-				<texture_picker label="Dolna część ciała" name="lower-baked"/>
-				<texture_picker label="Dolny rysunek na ciele" name="lower_bodypaint"/>
-				<texture_picker label="Bielizna" name="lower_underpants"/>
-				<texture_picker label="Skarpetki" name="lower_socks"/>
-				<texture_picker label="Buty" name="lower_shoes"/>
-				<texture_picker label="Spodnie" name="lower_pants"/>
-				<texture_picker label="Kurtka" name="lower_jacket"/>
-				<texture_picker label="Dolna alpha" name="lower_alpha"/>
-				<texture_picker label="Dolny tatuaż" name="lower_tattoo"/>
-				<texture_picker label="Spódnica" name="skirt-baked"/>
-				<texture_picker label="Spódnica" name="skirt"/>
-			</panel>
+			<texture_picker label="WÅ‚osy" name="hair-baked"/>
+			<texture_picker label="WÅ‚osy" name="hair_grain"/>
+			<texture_picker label="Alpha włosów" name="hair_alpha"/>
+			<texture_picker label="GÅ‚owa" name="head-baked"/>
+			<texture_picker label="Makijaż" name="head_bodypaint"/>
+			<texture_picker label="Alpha głowy" name="head_alpha"/>
+			<texture_picker label="Tatuaż głowy" name="head_tattoo"/>
+			<texture_picker label="Oczy" name="eyes-baked"/>
+			<texture_picker label="Oko" name="eyes_iris"/>
+			<texture_picker label="Alpha oczu" name="eyes_alpha"/>
+			<texture_picker label="Górna część ciała" name="upper-baked"/>
+			<texture_picker label="Górny wzór na ciele" name="upper_bodypaint"/>
+			<texture_picker label="Podkoszulek" name="upper_undershirt"/>
+			<texture_picker label="Rękawiczki" name="upper_gloves"/>
+			<texture_picker label="Koszula" name="upper_shirt"/>
+			<texture_picker label="Kurtka górna" name="upper_jacket"/>
+			<texture_picker label="Alpha górna" name="upper_alpha"/>
+			<texture_picker label="Tatuaż górny" name="upper_tattoo"/>
+			<texture_picker label="Dolna część ciała" name="lower-baked"/>
+			<texture_picker label="Dolny wzór na ciele" name="lower_bodypaint"/>
+			<texture_picker label="Bielizna" name="lower_underpants"/>
+			<texture_picker label="Skarpetki" name="lower_socks"/>
+			<texture_picker label="Buty" name="lower_shoes"/>
+			<texture_picker label="Spodnie" name="lower_pants"/>
+			<texture_picker label="Kurtka" name="lower_jacket"/>
+			<texture_picker label="Alpha dolna" name="lower_alpha"/>
+			<texture_picker label="Tatuaż dolny" name="lower_tattoo"/>
+			<texture_picker label="Spódnica" name="skirt-baked"/>
+			<texture_picker label="Spódnica" name="skirt"/>
 		</panel>
 	</scroll_container>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_bulk_perms.xml b/indra/newview/skins/default/xui/pl/floater_bulk_perms.xml
index ed2e037d3c0c0317715f69e65574d058b6fc8d3a..f4721b05d8d9e180f60aa69f4ef8d9cf6e184f73 100644
--- a/indra/newview/skins/default/xui/pl/floater_bulk_perms.xml
+++ b/indra/newview/skins/default/xui/pl/floater_bulk_perms.xml
@@ -48,7 +48,7 @@
 	</text>
 	<check_box label="Modyfikuje" name="next_owner_modify"/>
 	<check_box label="Kopiuje" name="next_owner_copy"/>
-	<check_box initial_value="true" label="Oddaj/Sprzedaj" name="next_owner_transfer" tool_tip="Następny Właściciel może oddać lub sprzedać ten obiekt."/>
+	<check_box initial_value="true" label="Oddaj/Sprzedaj" name="next_owner_transfer" tool_tip="Następny właściciel może oddać lub sprzedać ten obiekt."/>
 	<button label="OK" name="apply"/>
 	<button label="Anuluj" name="close"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_buy_land.xml b/indra/newview/skins/default/xui/pl/floater_buy_land.xml
index 7b4f459b4e4a1b2b66709b603fbdae20b86a747d..3d01129d9bd332a98e3fe2886264a5c0dcb3c561 100644
--- a/indra/newview/skins/default/xui/pl/floater_buy_land.xml
+++ b/indra/newview/skins/default/xui/pl/floater_buy_land.xml
@@ -125,6 +125,9 @@ używanie Posiadłości żeby sfinalizować ten zakup.
 	<floater.string name="no_parcel_selected">
 		(Posiadłość nie została wybrana)
 	</floater.string>
+	<floater.string name="icon_PG" value="Parcel_PG_Dark"/>
+	<floater.string name="icon_M" value="Parcel_M_Dark"/>
+	<floater.string name="icon_R" value="Parcel_R_Dark"/>
 	<text name="region_name_label">
 		Region:
 	</text>
diff --git a/indra/newview/skins/default/xui/pl/floater_camera.xml b/indra/newview/skins/default/xui/pl/floater_camera.xml
index 5b9dd476160be1619e0ac4f9a28820d726ba8df5..aec75f026f083ba51cd0c8ec7d93940cd016ce3b 100644
--- a/indra/newview/skins/default/xui/pl/floater_camera.xml
+++ b/indra/newview/skins/default/xui/pl/floater_camera.xml
@@ -9,57 +9,35 @@
 	<floater.string name="move_tooltip">
 		Poruszaj kamerą w dół/górę oraz w prawo/lewo
 	</floater.string>
-	<floater.string name="camera_modes_title">
-		Ustawienia
+	<floater.string name="orbit_mode_title">
+		Obracaj
 	</floater.string>
 	<floater.string name="pan_mode_title">
 		W prawo lub w lewo
 	</floater.string>
-	<floater.string name="presets_mode_title">
-		Ustaw widok
+	<floater.string name="avatar_view_mode_title">
+		Ustawienia
 	</floater.string>
 	<floater.string name="free_mode_title">
 		Zobacz obiekt
 	</floater.string>
 	<panel name="controls">
-		<panel name="preset_views_list">
-			<panel_camera_item name="front_view">
-				<panel_camera_item.text name="front_view_text">
-					Widok z przodu
-				</panel_camera_item.text>
-			</panel_camera_item>
-			<panel_camera_item name="group_view">
-				<panel_camera_item.text name="side_view_text">
-					PodglÄ…d grupy
-				</panel_camera_item.text>
-			</panel_camera_item>
-			<panel_camera_item name="rear_view">
-				<panel_camera_item.text name="rear_view_text">
-					Widok z tyłu
-				</panel_camera_item.text>
-			</panel_camera_item>
-		</panel>
-		<panel name="camera_modes_list">
-			<panel_camera_item name="object_view">
-				<panel_camera_item.text name="object_view_text">
-					Widok obiektu
-				</panel_camera_item.text>
-			</panel_camera_item>
-			<panel_camera_item name="mouselook_view">
-				<panel_camera_item.text name="mouselook_view_text">
-					Widok panoramiczny
-				</panel_camera_item.text>
-			</panel_camera_item>
-		</panel>
+		<joystick_track name="cam_track_stick" tool_tip="Poruszaj kamerą w górę, w dół, w lewo i w prawo"/>
 		<panel name="zoom" tool_tip="Najedź kamerą w kierunku obiektu">
-			<joystick_rotate name="cam_rotate_stick" tool_tip="Obracaj kamerę wokoł osi"/>
 			<slider_bar name="zoom_slider" tool_tip="Przybliż kamerę do ogniskowej"/>
-			<joystick_track name="cam_track_stick" tool_tip="Poruszaj kamerą w górę, w dół, w lewo i w prawo"/>
+		</panel>
+		<joystick_rotate name="cam_rotate_stick" tool_tip="Obracaj kamerę wokoł osi"/>
+		<panel name="camera_presets">
+			<button name="rear_view" tool_tip="Widok z tyłu"/>
+			<button name="group_view" tool_tip="PodglÄ…d Grupy"/>
+			<button name="front_view" tool_tip="Widok z przodu"/>
+			<button name="mouselook_view" tool_tip="Widok panoramiczny"/>
 		</panel>
 	</panel>
 	<panel name="buttons">
-		<button label="" name="presets_btn" tool_tip="Ustaw widok"/>
+		<button label="" name="orbit_btn" tool_tip="Obracaj kamerÄ™"/>
 		<button label="" name="pan_btn" tool_tip="Kamera horyzontalna"/>
 		<button label="" name="avatarview_btn" tool_tip="Ustawienia"/>
+		<button label="" name="freecamera_btn" tool_tip="PodglÄ…d obiektu"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_customize.xml b/indra/newview/skins/default/xui/pl/floater_customize.xml
index 373e74ffe0d48a80e162d0e8c34820433dc488b0..dd1d5cf684b2b35af01c0db52603b0c407129e9e 100644
--- a/indra/newview/skins/default/xui/pl/floater_customize.xml
+++ b/indra/newview/skins/default/xui/pl/floater_customize.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater customize" title="WYGLÄ„D">
 	<tab_container name="customize tab container">
-		<text label="Części ciała" name="body_parts_placeholder">
+		<text label="Części Ciała" name="body_parts_placeholder">
 			Części ciała
 		</text>
 		<panel label="Kształt" name="Shape">
@@ -157,7 +157,7 @@
 			<texture_picker label="Materiał" name="Fabric" tool_tip="Kliknij by wybrać teksturę"/>
 			<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
-			<button label="Nowa koszula" label_selected="Nowa Koszula" name="Create New"/>
+			<button label="Nowa Koszula" label_selected="Nowa Koszula" name="Create New"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
 			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
@@ -183,7 +183,7 @@
 				Nie posiadasz prawa do modyfikowania tej koszuli.
 			</text>
 			<text name="Item Action Label">
-				Koszula:
+				Koszulka:
 			</text>
 		</panel>
 		<panel label="Spodnie" name="Pants">
@@ -504,7 +504,7 @@
 			<text name="not worn instructions">
 				Załóż nową maskę alpha poprzez przeciągnięcie jej ze swojej szafy na awatara. Alternatywnie, możesz także stworzyć własną z plików roboczych.
 			</text>
-			<button label="Stwórz nową Alpha" label_selected="Utwórz nową Alpha" name="Create New"/>
+			<button label="Stwórz nową Alpha" label_selected="Utwórz Nową Alpha" name="Create New"/>
 			<text name="no modify instructions">
 				Nie posiadasz uprawnień do modyfikowania tych ubrań/części ciała.
 			</text>
diff --git a/indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml b/indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml
index f3929df3e39dcc1470e6bea6e1a35bfa8052fd42..0cb2114f99798abf45f05bfeaf844d6f81735abf 100644
--- a/indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml
+++ b/indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater name="Day Cycle Floater" title="EDYTOR CYKLU DNIA">
 	<tab_container name="Day Cycle Tabs">
-		<panel label="Cykl dnia" name="Day Cycle">
-			<button label="?" name="WLDayCycleHelp"/>
-			<multi_slider label="" name="WLTimeSlider"/>
-			<multi_slider label="" name="WLDayCycleKeys"/>
+		<panel label="Cykl Dnia" name="Day Cycle">
+			<button label="?" name="WLDayCycleHelp" />
+			<multi_slider label="" name="WLTimeSlider" />
+			<multi_slider label="" name="WLDayCycleKeys" />
 			<text name="WL12am">
 				12am
 			</text>
@@ -59,38 +59,41 @@
 			<text name="WL12amHash2">
 				|
 			</text>
-			<button label="Dodaj" label_selected="Dodaj" name="WLAddKey"/>
-			<button label="Usuń" label_selected="Usuń" name="WLDeleteKey"/>
+			<button label="Dodaj" label_selected="Dodaj" name="WLAddKey" />
+			<button label="Usuń" label_selected="Usuń" name="WLDeleteKey" />
 			<text name="WLCurKeyFrameText">
 				Preferencje czasu:
 			</text>
 			<text name="WLCurKeyTimeText">
 				Czas:
 			</text>
-			<spinner label="Godz" name="WLCurKeyHour"/>
-			<spinner label="Min" name="WLCurKeyMin"/>
+			<spinner label="Godz" name="WLCurKeyHour" />
+			<spinner label="Min" name="WLCurKeyMin" />
 			<text name="WLCurKeyTimeText2">
 				Ustawienia:
 			</text>
-			<combo_box label="Preset" name="WLKeyPresets"/>
+			<combo_box label="Preset" name="WLKeyPresets" />
 			<text name="DayCycleText">
 				Przerwij:
 			</text>
-			<combo_box label="5 min" name="WLSnapOptions"/>
+			<combo_box label="5 min" name="WLSnapOptions" />
 			<text name="DayCycleText2">
 				Długość cyklu:
 			</text>
-			<spinner label="Godz" name="WLLengthOfDayHour"/>
-			<spinner label="Min" name="WLLengthOfDayMin"/>
-			<spinner label="Sek" name="WLLengthOfDaySec"/>
+			<spinner label="Godz" name="WLLengthOfDayHour" />
+			<spinner label="Min" name="WLLengthOfDayMin" />
+			<spinner label="Sek" name="WLLengthOfDaySec" />
 			<text name="DayCycleText3">
-				PrzeglÄ…daj:
-			</text>
-			<button label="Start" label_selected="Start" name="WLAnimSky"/>
-			<button label="Stop" label_selected="Stop" name="WLStopAnimSky"/>
-			<button label="Używaj czasu regionu" label_selected="Używaj czasu regionu" name="WLUseLindenTime"/>
-			<button label="Zapisz test dnia" label_selected="Zapisz test dnia" name="WLSaveDayCycle"/>
-			<button label="Załaduj test dnia" label_selected="Załaduj test dnia" name="WLLoadDayCycle"/>
+				WyglÄ…d:
+			</text>
+			<button label="Start" label_selected="Start" name="WLAnimSky" />
+			<button label="Stop" label_selected="Stop" name="WLStopAnimSky" />
+			<button label="Używaj czasu regionu" label_selected="Używaj czasu regionu"
+			     name="WLUseLindenTime" />
+			<button label="Zapisz test dnia" label_selected="Zapisz test dnia"
+			     name="WLSaveDayCycle" />
+			<button label="Załaduj test dnia" label_selected="Załaduj test dnia"
+			     name="WLLoadDayCycle" />
 		</panel>
 	</tab_container>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_event.xml b/indra/newview/skins/default/xui/pl/floater_event.xml
index 80862bfd2f4f5d385234edefe4b8bedfd5ad8ec9..758849346421866d2fc82bb4460f72f7454045f1 100644
--- a/indra/newview/skins/default/xui/pl/floater_event.xml
+++ b/indra/newview/skins/default/xui/pl/floater_event.xml
@@ -16,7 +16,7 @@
 		Adult
 	</floater.string>
 	<floater.string name="general">
-		General
+		PG
 	</floater.string>
 	<floater.string name="unknown">
 		Nieznana
@@ -62,8 +62,8 @@
 			</expandable_text>
 		</layout_panel>
 		<layout_panel name="button_panel">
-			<button name="create_event_btn" tool_tip="Stwórz imprezę"/>
-			<button name="god_delete_event_btn" tool_tip="Skasuj imprezÄ™"/>
+			<button name="create_event_btn" tool_tip="Stwórz Imprezę"/>
+			<button name="god_delete_event_btn" tool_tip="Skasuj ImprezÄ™"/>
 			<button label="Zawiadom mnie" name="notify_btn"/>
 			<button label="Teleportuj" name="teleport_btn"/>
 			<button label="Mapa" name="map_btn"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_gesture.xml b/indra/newview/skins/default/xui/pl/floater_gesture.xml
index 0c27e4d0bb6e3a3dfa13c31266e5f840eefcde95..750a9e4a66f8c9b8b96ec9961f7f360e4f1a9de0 100644
--- a/indra/newview/skins/default/xui/pl/floater_gesture.xml
+++ b/indra/newview/skins/default/xui/pl/floater_gesture.xml
@@ -18,8 +18,8 @@
 	<panel label="bottom_panel" name="bottom_panel">
 		<menu_button name="gear_btn" tool_tip="Więcej opcji"/>
 		<button name="new_gesture_btn" tool_tip="Stwórz nową gesturę"/>
-		<button name="activate_btn" tool_tip="Aktywuj/Dezaktywuj wybranÄ… gesturÄ™"/>
-		<button name="del_btn" tool_tip="Usuń gesturę"/>
+		<button name="activate_btn" tool_tip="Aktywuj/Dezaktywuj wybrany gest"/>
+		<button name="del_btn" tool_tip="Usuń gest"/>
 	</panel>
 	<button label="Edytuj" name="edit_btn"/>
 	<button label="Odtwarzaj" name="play_btn"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_god_tools.xml b/indra/newview/skins/default/xui/pl/floater_god_tools.xml
index 828898de546470c40c0e53b9072b40c7a6d9f894..4d49c32fc182e24855300fdded0163889a90b009 100644
--- a/indra/newview/skins/default/xui/pl/floater_god_tools.xml
+++ b/indra/newview/skins/default/xui/pl/floater_god_tools.xml
@@ -2,24 +2,25 @@
 <floater name="godtools floater" title="BOSKIE NARZĘDZIA">
 	<tab_container name="GodTools Tabs">
 		<panel label="Grid" name="grid">
+			<button label="Wyrzuć wszystkich Rezydentów" label_selected="Wyrzuć wszystkich Rezydentów" name="Kick all users" width="205"/>
 			<button label="Wyrównaj widoczność buforu mapy Regionu" label_selected="Wyrównaj widoczność buforu mapy Regionu" name="Flush This Region&apos;s Map Visibility Caches" width="285"/>
 		</panel>
 		<panel label="Region" name="region">
-			<text name="Region Name:">
-				Nazwa Regionu:
+			<text name="Sim Name:" width="100">
+				Nazwa Symulatora:
 			</text>
 			<line_editor left="115" name="region name" width="178"/>
 			<check_box label="Wstęp" name="check prelude" tool_tip="Set this to make the region a prelude"/>
-			<check_box label="Korekta słońca" name="check fixed sun" tool_tip="Skoryguj ustawienia pozycji słońca."/>
+			<check_box label="Korekta Słońca" name="check fixed sun" tool_tip="Skorektuj ustawienia pozycji słońca."/>
 			<check_box height="32" label="Zresetuj pozycję  Miejsca Startowego" name="check reset home" tool_tip="Zresetuj miejsce startu Rezydentów po teleportacji"/>
 			<check_box bottom_delta="-32" label="Widoczny" name="check visible" tool_tip="Wybierz tą opcję by ustawić region widocznym dla wszystkich."/>
 			<check_box label="Zniszczenia" name="check damage" tool_tip="Wybierz tę opcję by uruchomić opcję zniszczeń w regionie."/>
-			<check_box label="Zablokuj monitorowanie trafficu" name="block dwell" tool_tip="Wybierz tą opcję by zablokować monitorowanie trafficu w regionie."/>
-			<check_box label="Zablokuj terraformowanie" name="block terraform" tool_tip="Wybierz tą opcję by zablokować terraforming w regionie"/>
+			<check_box label="Zablokuj Monitorowanie Trafficu" name="block dwell" tool_tip="Wybierz tą opcję by zablokować monitorowanie trafficu w regionie."/>
+			<check_box label="Zablokuj Terraformowanie" name="block terraform" tool_tip="Wybierz tą opcję by zablokować terraforming w regionie"/>
 			<check_box label="Piaskownica" name="is sandbox" tool_tip="Toggle whether this is a sandbox region"/>
 			<button label="Ustal teren" label_selected="Ustal teren" name="Bake Terrain" tool_tip="Zapamiętaj obecny teren jako początkowy dla cofnięcia modyfikacji terenu." width="138"/>
 			<button label="Cofnięcie modyfikacji" label_selected="Cofnięcie modyfikacji" name="Revert Terrain" tool_tip="Przywróć ustawienia domyślne Regionu." width="138"/>
-			<button label="Zamień teren" label_selected="Zamień teren" name="Swap Terrain" tool_tip="Zmień bieżący teren domyślnie" width="138"/>
+			<button label="Zamień teren" label_selected="Zamień teren" name="Swap Terrain" tool_tip="Swap current terrain with default" width="138"/>
 			<text name="estate id">
 				ID Regionu:
 			</text>
@@ -46,29 +47,29 @@
 				L$/m²:
 			</text>
 			<spinner name="land cost"/>
-			<button label="Odśwież" label_selected="Odśwież" name="Refresh" tool_tip="Kliknij tutaj aby odswieżyć powyższe informacje"/>
-			<button label="Zastosuj" label_selected="Zastosuj" name="Apply" tool_tip="Kliknij tutaj aby zastosować powyższe zmiany"/>
+			<button label="Odśwież" label_selected="Odśwież" name="Refresh" tool_tip="Click here to refresh the above information"/>
+			<button label="Zastosuj" label_selected="Zastosuj" name="Apply" tool_tip="Click here to apply any changes from above"/>
 			<button label="Wybierz Region" label_selected="Wybierz Region" left="156" name="Select Region" tool_tip="Wybierz cały Region za pomocą narzędzi edycji terenu" width="150"/>
 			<button label="Automatyczne zapisanie" label_selected="Automatyczne zapisanie" left="156" name="Autosave now" tool_tip="Save gzipped state to autosave directory" width="150"/>
 		</panel>
 		<panel label="Obiekty" name="objects">
-			<text name="Region Name:">
-				Nazwa Regionu:
+			<text name="Sim Name:" width="105">
+				Nazwa Symulatora:
 			</text>
 			<text left_delta="110" name="region name">
 				Welsh
 			</text>
-			<check_box label="Wyłącz skrypty" name="disable scripts" tool_tip="Wybierz aby wyłączyć skrypty w tym Regionie"/>
+			<check_box label="Wyłącz skrypty" name="disable scripts" tool_tip="Set this to disable all scripts in this region"/>
 			<check_box label="Deaktywuj kolizje" name="disable collisions" tool_tip="Set this to disable non-agent collisions in this region"/>
-			<check_box label="Wylącz fizykę" name="disable physics" tool_tip="Wybierz aby wyłączyć fizykę w tym Regionie"/>
-			<button label="Zastosuj" label_selected="Zastosuj" name="Apply" tool_tip="Kliknij tu aby zastosować powyższe zmiany"/>
-			<button label="Ustaw cel" label_selected="Ustaw cel" name="Set Target" tool_tip="Ustaw docelowego awatara w celu skasowania obiektów"/>
+			<check_box label="WylÄ…cz fizykÄ™" name="disable physics" tool_tip="Set this to disable all physics in this region"/>
+			<button label="Zastosuj" label_selected="Zastosuj" name="Apply" tool_tip="Click here to apply any changes from above"/>
+			<button label="Ustaw Cel" label_selected="Set Target" name="Set Target" tool_tip="Set the target avatar for object deletion"/>
 			<text name="target_avatar_name">
 				(brak)
 			</text>
-			<button label="Usuń cel z oskryptowanych obiektów na innych posiadłościach" label_selected="Usuń cel &apos;s skryptowane obiekty na innych posiadłościach" name="Delete Target&apos;s Scripted Objects On Others Land" tool_tip="Skasuj wszystkie oskryptowane obiekty posiadane przez cel na Posiadłości, której nie jest właścicielem. (obiekty bez praw kopiowania zostaną zwrócone)"/>
-			<button label="Usuń cel z oskryptowanych obiektów na jakichkolwiek posiadłościach" label_selected="Usuń cel &apos;s skryptowane obiekty na jakichkolwiek posiadłościach" name="Delete Target&apos;s Scripted Objects On *Any* Land" tool_tip="Skasuj wszystkie oksryptowane obiekty posiadane przez cel w tym Regionie. (obiekty bez praw kopiowania zostaną zwrócone)"/>
-			<button label="Usuń wszystkie cele i obiekty" label_selected="Usuń wszystkie cele i obiekty" name="Delete *ALL* Of Target&apos;s Objects" tool_tip="Skasuj wszystkie obiekty posiadane przez cel w tym Regionie. (obiekty bez praw kopiowania zostaną zwrócone)"/>
+			<button label="Usuń cel z oskryptowanych obiektów na innych posiadłościach" label_selected="Usuń cel &apos;s skryptowane obiekty na innych posiadłościach" name="Delete Target&apos;s Scripted Objects On Others Land" tool_tip="Delete all scripted objects owned by the target on land not owned by the target. (no copy) objects will be returned."/>
+			<button label="Usuń cel z oskryptowanych obiektów na jakichkolwiek posiadłościach" label_selected="Usuń cel &apos;s skryptowane obiekty na jakichkolwiek posiadłościach" name="Delete Target&apos;s Scripted Objects On *Any* Land" tool_tip="Delete all scripted objects owned by the target in this region. (no copy) objects will be returned."/>
+			<button label="Usuń wszystkie cele i obiekty" label_selected="Usuń wszystkie cele i obiekty" name="Delete *ALL* Of Target&apos;s Objects" tool_tip="Delete all objects owned by the target in this region. (no copy) objects will be returned."/>
 			<button label="Główne kolizje" label_selected="Główne kolizje" name="Get Top Colliders" tool_tip="Gets list of objects experiencing the most narrowphase callbacks"/>
 			<button label="Główne skrypty" label_selected="Główne skrypty" name="Get Top Scripts" tool_tip="Gets list of objects spending the most time running scripts"/>
 			<button label="Treść skryptów" label_selected="Treść skryptów" name="Scripts digest" tool_tip="Wyświetla listę wszystkich skryptów i liczbę ich zastosowań."/>
diff --git a/indra/newview/skins/default/xui/pl/floater_image_preview.xml b/indra/newview/skins/default/xui/pl/floater_image_preview.xml
index ba9724ff9a85e45fcef23a940db02a5b35fd12f8..a27e8ffed36f32b67cd7a6e29335c378dbf92ada 100644
--- a/indra/newview/skins/default/xui/pl/floater_image_preview.xml
+++ b/indra/newview/skins/default/xui/pl/floater_image_preview.xml
@@ -10,16 +10,16 @@
 		Wyświetl obraz jako:
 	</text>
 	<combo_box label="Rodzaj Ubrania" name="clothing_type_combo">
-		<item label="Obraz" name="Image" value="Tekstura"/>
-		<item label="WÅ‚osy" name="Hair" value="WÅ‚osy"/>
-		<item label="GÅ‚owa kobiety" name="FemaleHead" value="GÅ‚owa kobiety"/>
-		<item label="Górna część ciała kobiety" name="FemaleUpperBody" value="Górna część ciała kobiety"/>
-		<item label="Dolna część ciała kobiety" name="FemaleLowerBody" value="Dolna część ciała kobiety"/>
-		<item label="Głowa mężczyzny" name="MaleHead" value="Głowa mężczyzny"/>
-		<item label="Górna część ciała mężczyzny" name="MaleUpperBody" value="Górna część ciała mężczyzny"/>
-		<item label="Dona część ciała mężczyzny" name="MaleLowerBody" value="Dolna część ciała mężczyzny"/>
-		<item label="Spódnica" name="Skirt" value="Spódnica"/>
-		<item label="Prim sculptowy" name="SculptedPrim" value="Prim sculptowy"/>
+		<combo_box.item label="Obraz" name="Image"/>
+		<combo_box.item label="WÅ‚osy" name="Hair"/>
+		<combo_box.item label="Damska głowa" name="FemaleHead"/>
+		<combo_box.item label="Damska górna część ciała" name="FemaleUpperBody"/>
+		<combo_box.item label="Damska górna część ciała" name="FemaleLowerBody"/>
+		<combo_box.item label="Męska głowa" name="MaleHead"/>
+		<combo_box.item label="Męska górna część ciała" name="MaleUpperBody"/>
+		<combo_box.item label="Męska dolna część ciała" name="MaleLowerBody"/>
+		<combo_box.item label="Spódnica" name="Skirt"/>
+		<combo_box.item label="Prim sculptowy" name="SculptedPrim"/>
 	</combo_box>
 	<text name="bad_image_text">
 		Nie można wczytać obrazu.
diff --git a/indra/newview/skins/default/xui/pl/floater_incoming_call.xml b/indra/newview/skins/default/xui/pl/floater_incoming_call.xml
index 8de60095dffcf09015cbf15cea23f29dad1de372..e5ec3804aeb1842e030e8f0b7dae8691da14fbd2 100644
--- a/indra/newview/skins/default/xui/pl/floater_incoming_call.xml
+++ b/indra/newview/skins/default/xui/pl/floater_incoming_call.xml
@@ -16,13 +16,7 @@
 		rozpoczął rozmowę głosową w czacie konferencji.
 	</floater.string>
 	<floater.string name="VoiceInviteGroup">
-		dołączył/dołączyła do &apos;[GROUP]&apos; rozmowy głosowej.
-	</floater.string>
-	<floater.string name="VoiceInviteQuestionGroup">
-		Czy chcesz opuścić [CURRENT_CHAT] i dołączyć do rozmowy z &apos;[GROUP]&apos;?
-	</floater.string>
-	<floater.string name="VoiceInviteQuestionDefault">
-		Czy chcesz opuścić [CURRENT_CHAT] i dołączyć do tej rozmowy głosowej?
+		zaczyna rozmowÄ™ z grupÄ… [GROUP].
 	</floater.string>
 	<text name="question">
 		Czy chcesz opuścić [CURRENT_CHAT] i dołączyć do tej rozmowy głosowej?
diff --git a/indra/newview/skins/default/xui/pl/floater_inventory.xml b/indra/newview/skins/default/xui/pl/floater_inventory.xml
index c42f57fb551ec7f6c568124a752b91c6c1aef205..0dc4d5b96d66c84a3372c6f5ca13c897080d19db 100644
--- a/indra/newview/skins/default/xui/pl/floater_inventory.xml
+++ b/indra/newview/skins/default/xui/pl/floater_inventory.xml
@@ -7,7 +7,7 @@
 		MOJA SZAFA (Dostarczanie [ITEM_COUNT] obiektów...) [FILTER]
 	</floater.string>
 	<floater.string name="TitleCompleted">
-		MOJA SZAFA ([ITEM_COUNT] obiektów) [FILTER]
+		MOJA SZAFA ([ITEM_COUNT] Obiektów) [FILTER]
 	</floater.string>
 	<floater.string name="Fetched">
 		Dostarczono
diff --git a/indra/newview/skins/default/xui/pl/floater_joystick.xml b/indra/newview/skins/default/xui/pl/floater_joystick.xml
index 2b1e362b9831afaef897ecd7f687b17ac319388e..78742c39d1dc13667835f531574f6b6f602ad14c 100644
--- a/indra/newview/skins/default/xui/pl/floater_joystick.xml
+++ b/indra/newview/skins/default/xui/pl/floater_joystick.xml
@@ -1,108 +1,108 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Joystick" title="KONFIGURACJA JOYSTICKA">
+<floater name="Joystick" title="KONFIGURACJA JOYSTICKA" width="590">
 	<check_box label="Aktywuj Joystick:" name="enable_joystick"/>
 	<text left="130" name="joystick_type" width="360"/>
 	<spinner label="Kalibracja Osi X" label_width="130" left="20" name="JoystickAxis1" width="170"/>
 	<spinner label="Kalibracja Osi Y" label_width="130" left="210" name="JoystickAxis2" width="170"/>
-	<spinner label="Kalibracja Osi Z" label_width="100" left="400" name="JoystickAxis0" width="140"/>
+	<spinner label="Kalibracja Osi Z" label_width="130" left="400" name="JoystickAxis0" width="170"/>
 	<spinner label="Kalibracja wznoszenia" label_width="130" left="20" name="JoystickAxis4" width="170"/>
 	<spinner label="Kalibracja wychylania" label_width="130" left="210" name="JoystickAxis5" width="170"/>
-	<spinner label="Kalibracja obrotu" label_width="100" left="400" name="JoystickAxis3" width="140"/>
+	<spinner label="Kalibracja obrotu" label_width="130" left="400" name="JoystickAxis3" width="170"/>
 	<spinner label="Kalibracja powiększania" label_width="130" name="JoystickAxis6" width="170"/>
 	<check_box label="Bezpośrednie" left="205" name="ZoomDirect"/>
 	<check_box label="Kursor 3D" left="340" name="Cursor3D"/>
 	<check_box label="Automatyczne" left="450" name="AutoLeveling"/>
-	<text name="Control Modes:">
+	<text left="22" name="Control Modes:">
 		Kontroluj:
 	</text>
-	<check_box label="Awatara" name="JoystickAvatarEnabled" width="90"/>
-	<check_box label="Budowanie" name="JoystickBuildEnabled" width="90"/>
-	<check_box label="KamerÄ™ podczas latania" left="300" name="JoystickFlycamEnabled" width="90"/>
-	<text name="XScale">
+	<check_box label="Awatara" left="130" name="JoystickAvatarEnabled" width="90"/>
+	<check_box label="Budowanie" left="205" name="JoystickBuildEnabled" width="90"/>
+	<check_box label="KamerÄ™ podczas latania" left="282" name="JoystickFlycamEnabled" width="90"/>
+	<text name="XScale" width="104">
 		Skala X
 	</text>
-	<spinner name="AvatarAxisScale1"/>
-	<spinner name="BuildAxisScale1"/>
-	<spinner left="300" name="FlycamAxisScale1"/>
-	<text name="YScale">
+	<spinner left="133" name="AvatarAxisScale1"/>
+	<spinner left="208" name="BuildAxisScale1"/>
+	<spinner left="283" name="FlycamAxisScale1"/>
+	<text name="YScale" width="104">
 		Skala Y
 	</text>
-	<spinner name="AvatarAxisScale2"/>
-	<spinner name="BuildAxisScale2"/>
-	<spinner left="300" name="FlycamAxisScale2"/>
-	<text name="ZScale">
+	<spinner left="133" name="AvatarAxisScale2"/>
+	<spinner left="208" name="BuildAxisScale2"/>
+	<spinner left="283" name="FlycamAxisScale2"/>
+	<text name="ZScale" width="104">
 		Skala Z
 	</text>
-	<spinner name="AvatarAxisScale0"/>
-	<spinner name="BuildAxisScale0"/>
-	<spinner left="300" name="FlycamAxisScale0"/>
-	<text name="PitchScale">
+	<spinner left="133" name="AvatarAxisScale0"/>
+	<spinner left="208" name="BuildAxisScale0"/>
+	<spinner left="283" name="FlycamAxisScale0"/>
+	<text name="PitchScale" width="104">
 		Skala wznoszenia
 	</text>
-	<spinner name="AvatarAxisScale4"/>
-	<spinner name="BuildAxisScale4"/>
-	<spinner left="300" name="FlycamAxisScale4"/>
-	<text name="YawScale">
+	<spinner left="133" name="AvatarAxisScale4"/>
+	<spinner left="208" name="BuildAxisScale4"/>
+	<spinner left="283" name="FlycamAxisScale4"/>
+	<text name="YawScale" width="104">
 		Skala odchylania
 	</text>
-	<spinner name="AvatarAxisScale5"/>
-	<spinner name="BuildAxisScale5"/>
-	<spinner left="300" name="FlycamAxisScale5"/>
-	<text name="RollScale">
+	<spinner left="133" name="AvatarAxisScale5"/>
+	<spinner left="208" name="BuildAxisScale5"/>
+	<spinner left="283" name="FlycamAxisScale5"/>
+	<text name="RollScale" width="104">
 		Skala obrotu
 	</text>
-	<spinner name="BuildAxisScale3"/>
-	<spinner left="300" name="FlycamAxisScale3"/>
-	<text name="XDeadZone">
+	<spinner left="208" name="BuildAxisScale3"/>
+	<spinner left="283" name="FlycamAxisScale3"/>
+	<text name="XDeadZone" width="104">
 		Tolerancja osi X
 	</text>
-	<spinner name="AvatarAxisDeadZone1"/>
-	<spinner name="BuildAxisDeadZone1"/>
-	<spinner left="300" name="FlycamAxisDeadZone1"/>
-	<text name="YDeadZone">
+	<spinner left="133" name="AvatarAxisDeadZone1"/>
+	<spinner left="208" name="BuildAxisDeadZone1"/>
+	<spinner left="283" name="FlycamAxisDeadZone1"/>
+	<text name="YDeadZone" width="104">
 		Tolerancja osi Y
 	</text>
-	<spinner name="AvatarAxisDeadZone2"/>
-	<spinner name="BuildAxisDeadZone2"/>
-	<spinner left="300" name="FlycamAxisDeadZone2"/>
-	<text name="ZDeadZone">
+	<spinner left="133" name="AvatarAxisDeadZone2"/>
+	<spinner left="208" name="BuildAxisDeadZone2"/>
+	<spinner left="283" name="FlycamAxisDeadZone2"/>
+	<text name="ZDeadZone" width="104">
 		Tolerancja osi Z
 	</text>
-	<spinner name="AvatarAxisDeadZone0"/>
-	<spinner name="BuildAxisDeadZone0"/>
-	<spinner left="300" name="FlycamAxisDeadZone0"/>
-	<text name="PitchDeadZone">
+	<spinner left="133" name="AvatarAxisDeadZone0"/>
+	<spinner left="208" name="BuildAxisDeadZone0"/>
+	<spinner left="283" name="FlycamAxisDeadZone0"/>
+	<text name="PitchDeadZone" width="104">
 		Tolerancja wznoszenia
 	</text>
-	<spinner name="AvatarAxisDeadZone4"/>
-	<spinner name="BuildAxisDeadZone4"/>
-	<spinner left="300" name="FlycamAxisDeadZone4"/>
-	<text name="YawDeadZone">
+	<spinner left="133" name="AvatarAxisDeadZone4"/>
+	<spinner left="208" name="BuildAxisDeadZone4"/>
+	<spinner left="283" name="FlycamAxisDeadZone4"/>
+	<text name="YawDeadZone" width="104">
 		Tolerancja odchylania
 	</text>
-	<spinner name="AvatarAxisDeadZone5"/>
-	<spinner name="BuildAxisDeadZone5"/>
-	<spinner left="300" name="FlycamAxisDeadZone5"/>
-	<text name="RollDeadZone">
+	<spinner left="133" name="AvatarAxisDeadZone5"/>
+	<spinner left="208" name="BuildAxisDeadZone5"/>
+	<spinner left="283" name="FlycamAxisDeadZone5"/>
+	<text name="RollDeadZone" width="104">
 		Tolerancja obrotu
 	</text>
-	<spinner name="BuildAxisDeadZone3"/>
-	<spinner left="300" name="FlycamAxisDeadZone3"/>
-	<text name="Feathering">
+	<spinner left="208" name="BuildAxisDeadZone3"/>
+	<spinner left="283" name="FlycamAxisDeadZone3"/>
+	<text name="Feathering" width="104">
 		Przenikanie
 	</text>
-	<slider label="" name="AvatarFeathering"/>
-	<slider label="" name="BuildFeathering"/>
-	<slider label="" left_delta="81" name="FlycamFeathering"/>
-	<text name="ZoomScale2">
+	<slider label="" left="125" name="AvatarFeathering"/>
+	<slider label="" left="200" name="BuildFeathering"/>
+	<slider label="" left="275" name="FlycamFeathering"/>
+	<text name="ZoomScale2" width="104">
 		Skala powiększania
 	</text>
-	<spinner label="" left="300" name="FlycamAxisScale6"/>
-	<text name="ZoomDeadZone">
+	<spinner label="" left="283" name="FlycamAxisScale6"/>
+	<text name="ZoomDeadZone" width="104">
 		Tolerancja powiększania
 	</text>
-	<spinner label="" left="300" name="FlycamAxisDeadZone6"/>
-	<button label="Ustawienia domyślne" name="SpaceNavigatorDefaults"/>
+	<spinner label="" left="283" name="FlycamAxisDeadZone6"/>
+	<button label="Ustawienia domyślne" left="366" name="SpaceNavigatorDefaults"/>
 	<button label="OK" label_selected="OK" left="366" name="ok_btn"/>
 	<button label="Anuluj" label_selected="Anuluj" name="cancel_btn"/>
 	<stat_view label="Monitor Joysticka" name="axis_view">
diff --git a/indra/newview/skins/default/xui/pl/floater_moveview.xml b/indra/newview/skins/default/xui/pl/floater_moveview.xml
index 592814dbc0c17994c07bfed3f759a841268d83b4..9c97a8a0e7dcd4d2ef05060f93277f2c80cf9366 100644
--- a/indra/newview/skins/default/xui/pl/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/pl/floater_moveview.xml
@@ -6,48 +6,18 @@
 	<string name="walk_back_tooltip">
 		Idź do tyłu (naciśnij Strzałkę w Dół lub S)
 	</string>
-	<string name="walk_left_tooltip">
-		Idź w lewo (naciśnij Shift + lewą strzałkę lub A)
-	</string>
-	<string name="walk_right_tooltip">
-		Idź w prawo (naciśnij Shift + prawą strzałkę lub D)
-	</string>
 	<string name="run_forward_tooltip">
 		Biegnij do przodu (naciśnij Strzałkę w Górę lub W)
 	</string>
 	<string name="run_back_tooltip">
 		Biegnij do przodu (naciśnij Strzałkę w Dół lub S)
 	</string>
-	<string name="run_left_tooltip">
-		Biegnij w lewo (naciśnij Shift + lewą strzałkę lub A)
-	</string>
-	<string name="run_right_tooltip">
-		Biegnij w lewo (naciśnij Shift + prawą strzałkę lub D)
-	</string>
 	<string name="fly_forward_tooltip">
 		Leć do przodu (naciśnij Strzałkę w Górę lub W)
 	</string>
 	<string name="fly_back_tooltip">
 		Leć do tyłu (naciśnij Strzałkę na Dół lub S)
 	</string>
-	<string name="fly_left_tooltip">
-		Leć w lewo (naciśnij Shift + lewą strzałkę lub A)
-	</string>
-	<string name="fly_right_tooltip">
-		Leć w prawo (naciśnij Shift + prawą strzałkę lub D)
-	</string>
-	<string name="fly_up_tooltip">
-		Leć do góry (nacisnij E)
-	</string>
-	<string name="fly_down_tooltip">
-		Leć w dół (naciśnij C)
-	</string>
-	<string name="jump_tooltip">
-		Skacz (naciśnij E)
-	</string>
-	<string name="crouch_tooltip">
-		Crouch (naciśnij C)
-	</string>
 	<string name="walk_title">
 		Idź
 	</string>
@@ -58,12 +28,10 @@
 		Lataj
 	</string>
 	<panel name="panel_actions">
-		<button label="" label_selected="" name="move up btn" tool_tip="Leć do góry (naciśnij E)"/>
 		<button label="" label_selected="" name="turn left btn" tool_tip="Obróć w lewo (naciśnij Lewą Strzałkę lub A)"/>
-		<joystick_slide name="move left btn" tool_tip="Idź w lewo (naciśnij Shift + lewą strzałkę lub A)"/>
-		<button label="" label_selected="" name="move down btn" tool_tip="Leć w dół (naciśnij C)"/>
 		<button label="" label_selected="" name="turn right btn" tool_tip="Obróć w prawo (naciśnij Prawą Strzałkę lub D)"/>
-		<joystick_slide name="move right btn" tool_tip="Idź w prawo (naciśnij Shift + prawą strzałkę lub D)"/>
+		<button label="" label_selected="" name="move up btn" tool_tip="Leć do góry, naciśnij E"/>
+		<button label="" label_selected="" name="move down btn" tool_tip="Leć w dół, naciśnij C"/>
 		<joystick_turn name="forward btn" tool_tip="Idź (naciśnij Strzałkę w Górę lub W)"/>
 		<joystick_turn name="backward btn" tool_tip="Cofaj się (naciśnij Strzałkę w Dół lub S)"/>
 	</panel>
diff --git a/indra/newview/skins/default/xui/pl/floater_outgoing_call.xml b/indra/newview/skins/default/xui/pl/floater_outgoing_call.xml
index de0b4d08c00a1eb4e47f394998717521184085db..8a70cb3247e0da9e777ad2c968030ad0708b7d14 100644
--- a/indra/newview/skins/default/xui/pl/floater_outgoing_call.xml
+++ b/indra/newview/skins/default/xui/pl/floater_outgoing_call.xml
@@ -28,7 +28,7 @@
 		Zostaleś rozłączony z [VOICE_CHANNEL_NAME].  [RECONNECT_NEARBY]
 	</text>
 	<text name="nearby_P2P_by_other">
-		Twoja rozmowa głosowa została zakończona.  [RECONNECT_NEARBY]
+		[VOICE_CHANNEL_NAME] zakończył/a rozmowę głosową.  [RECONNECT_NEARBY]
 	</text>
 	<text name="nearby_P2P_by_agent">
 		Zakończyłeś rozmowę.  [RECONNECT_NEARBY]
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_gesture.xml b/indra/newview/skins/default/xui/pl/floater_preview_gesture.xml
index 9ae63031b6ac657caeaa02c66b6b878f88279578..05758ac04d980bcaa0842c4279cb5e393d656ec9 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_gesture.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_gesture.xml
@@ -24,6 +24,9 @@
 	<floater.string name="Title">
 		Gest: [NAME]
 	</floater.string>
+	<text name="name_text">
+		Nazwa:
+	</text>
 	<text name="desc_label">
 		Opis:
 	</text>
@@ -42,12 +45,7 @@
 	<text name="library_label">
 		Zbiór:
 	</text>
-	<scroll_list name="library_list">
-		<scroll_list.rows name="action_animation" value="Animacja"/>
-		<scroll_list.rows name="action_sound" value="Dźwięk"/>
-		<scroll_list.rows name="action_chat" value="Czat"/>
-		<scroll_list.rows name="action_wait" value="Wstrzymaj"/>
-	</scroll_list>
+	<scroll_list name="library_list"/>
 	<button label="Dodaj &gt;&gt;" name="add_btn"/>
 	<text name="steps_label">
 		Etapy:
@@ -55,15 +53,12 @@
 	<button label="W górę" name="up_btn"/>
 	<button label="W dół" name="down_btn"/>
 	<button label="Usuń" name="delete_btn"/>
-	<text name="options_text">
-		(opcje)
-	</text>
 	<radio_group name="animation_trigger_type">
 		<radio_item label="Start" name="start"/>
 		<radio_item label="Stop" name="stop"/>
 	</radio_group>
 	<check_box label="do końca animacji" name="wait_anim_check"/>
-	<check_box label="czas w sekundach:" name="wait_time_check"/>
+	<check_box label="czas w sekundach" name="wait_time_check"/>
 	<text name="help_label">
 		Wszystkie etapy nastąpią razem, chyba, że dodasz pauzy.
 	</text>
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_notecard.xml b/indra/newview/skins/default/xui/pl/floater_preview_notecard.xml
index b3275cb7b5917838dac07071da92db5fda5f5d78..1ad07c236bc37f18eb16c61e2daa173100a1753f 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_notecard.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_notecard.xml
@@ -9,6 +9,9 @@
 	<floater.string name="Title">
 		Notka: [NAME]
 	</floater.string>
+	<floater.string label="Zapisz" label_selected="Zapisz" name="Save">
+		Zapisz
+	</floater.string>
 	<text name="desc txt">
 		Opis:
 	</text>
@@ -16,5 +19,4 @@
 		Ładowanie...
 	</text_editor>
 	<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-	<button label="Usuń" label_selected="Usuń" name="Delete"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_snapshot.xml b/indra/newview/skins/default/xui/pl/floater_snapshot.xml
index be92ef917d7f7f40b16c49c4c23b943891869f56..df4e5b43bcfd8fcff9457a9078d1c37d6f97093a 100644
--- a/indra/newview/skins/default/xui/pl/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/pl/floater_snapshot.xml
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Snapshot" title="PODGLĄD ZDJĘCIA">
-	<floater.string name="unknown">
-		nieznany
-	</floater.string>
-	<radio_group label="Rodzaj zdjęcia" name="snapshot_type_radio">
+<floater name="Snapshot" title="WYGLĄD ZDJĘCIA">
+	<text name="type_label">
+		Lokacja zapisu
+	</text>
+	<radio_group label="Rodzaje zdjęć" name="snapshot_type_radio">
 		<radio_item label="Email" name="postcard"/>
 		<radio_item label="Załaduj do Szafy (L$[AMOUNT])" name="texture"/>
-		<radio_item label="Zapisz na dysku" name="local"/>
+		<radio_item label="Zapisz na dysk" name="local"/>
 	</radio_group>
 	<text name="file_size_label">
 		[SIZE] KB
@@ -14,13 +14,13 @@
 	<button label="Odśwież zdjęcie" name="new_snapshot_btn"/>
 	<button label="Wyślij" name="send_btn"/>
 	<button label="Załaduj (L$[AMOUNT])" name="upload_btn"/>
-	<flyout_button label="Zapisz" name="save_btn" tool_tip="Zapisz zdjęcie w pliku">
+	<flyout_button label="Zapisz" name="save_btn" tool_tip="Zapisz zdjęcie na dysk">
 		<flyout_button.item label="Zapisz" name="save_item"/>
 		<flyout_button.item label="Zapisz jako..." name="saveas_item"/>
 	</flyout_button>
+	<button label="Anuluj" name="discard_btn"/>
 	<button label="Więcej" name="more_btn" tool_tip="Zaawansowane"/>
 	<button label="Mniej" name="less_btn" tool_tip="Zaawansowane"/>
-	<button label="Anuluj" name="discard_btn"/>
 	<text name="type_label2">
 		Wymiar
 	</text>
@@ -28,28 +28,28 @@
 		Format
 	</text>
 	<combo_box label="Rozdzielczość" name="postcard_size_combo">
-		<combo_box.item label="Obecne okno" name="CurrentWindow"/>
+		<combo_box.item label="Obecne Okno" name="CurrentWindow"/>
 		<combo_box.item label="640x480" name="640x480"/>
 		<combo_box.item label="800x600" name="800x600"/>
 		<combo_box.item label="1024x768" name="1024x768"/>
-		<combo_box.item label="Niestandardowy" name="Custom"/>
+		<combo_box.item label="Wybierz" name="Custom"/>
 	</combo_box>
 	<combo_box label="Rozdzielczość" name="texture_size_combo">
-		<combo_box.item label="Obecne okno" name="CurrentWindow"/>
+		<combo_box.item label="Obecne Okno" name="CurrentWindow"/>
 		<combo_box.item label="Mały (128x128)" name="Small(128x128)"/>
 		<combo_box.item label="Åšredni (256x256)" name="Medium(256x256)"/>
 		<combo_box.item label="Duży (512x512)" name="Large(512x512)"/>
-		<combo_box.item label="Niestandardowy" name="Custom"/>
+		<combo_box.item label="Wybierz" name="Custom"/>
 	</combo_box>
 	<combo_box label="Rozdzielczość" name="local_size_combo">
-		<combo_box.item label="Obecne okno" name="CurrentWindow"/>
+		<combo_box.item label="Obecne Okno" name="CurrentWindow"/>
 		<combo_box.item label="320x240" name="320x240"/>
 		<combo_box.item label="640x480" name="640x480"/>
 		<combo_box.item label="800x600" name="800x600"/>
 		<combo_box.item label="1024x768" name="1024x768"/>
 		<combo_box.item label="1280x1024" name="1280x1024"/>
 		<combo_box.item label="1600x1200" name="1600x1200"/>
-		<combo_box.item label="Niestandardowy" name="Custom"/>
+		<combo_box.item label="Wybierz" name="Custom"/>
 	</combo_box>
 	<combo_box label="Format" name="local_format_combo">
 		<combo_box.item label="PNG" name="PNG"/>
@@ -61,15 +61,19 @@
 	<check_box label="Ograniczone proporcje" name="keep_aspect_check"/>
 	<slider label="Jakość zdjęcia" name="image_quality_slider"/>
 	<text name="layer_type_label">
-		Warstwy obrazu:
+		Zapisz:
 	</text>
-	<combo_box label="Warstwy obrazu" name="layer_types">
+	<combo_box label="Warstwy Obrazu" name="layer_types">
 		<combo_box.item label="Kolory" name="Colors"/>
 		<combo_box.item label="Głębokość" name="Depth"/>
+		<combo_box.item label="Obiekty ślepe" name="ObjectMattes"/>
 	</combo_box>
 	<check_box label="Pokaż interfejs na zdjęciu" name="ui_check"/>
-	<check_box label="Pokaż obiekty Hud na zdjęciu" name="hud_check"/>
-	<check_box label="Pozostaw otwarty po zapisaniu" name="keep_open_check"/>
-	<check_box label="Widok pełnego okna" name="freeze_frame_check"/>
-	<check_box label="Automatyczne odswieżanie" name="auto_snapshot_check"/>
+	<check_box label="Pokaż obiekty HUD na zdjęciu" name="hud_check"/>
+	<check_box label="Pozostaw otwarte po zapisaniu" name="keep_open_check"/>
+	<check_box label="Widok pełnego ekranu" name="freeze_frame_check"/>
+	<check_box label="Automatyczne odświeżenie" name="auto_snapshot_check"/>
+	<string name="unknown">
+		nieznany
+	</string>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_tools.xml b/indra/newview/skins/default/xui/pl/floater_tools.xml
index 7e97297bca2422838614abc7ec1639173c2597f1..5bc3811ef628d374bdc2e7e78ffe1ca48e41a1df 100644
--- a/indra/newview/skins/default/xui/pl/floater_tools.xml
+++ b/indra/newview/skins/default/xui/pl/floater_tools.xml
@@ -67,10 +67,7 @@
 	<text name="RenderingCost" tool_tip="Pokazuje koszt renderowania tego obiektu">
 		þ: [COUNT]
 	</text>
-	<check_box label="" name="checkbox uniform"/>
-	<text label="RozciÄ…gnij 2 strony" name="checkbox uniform label">
-		RozciÄ…gnij 2 strony
-	</text>
+	<check_box label="RozciÄ…gnij 2 Strony" name="checkbox uniform"/>
 	<check_box initial_value="true" label="RozciÄ…gnij TeksturÄ™" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Użyj siatki" name="checkbox snap to grid"/>
 	<combo_box name="combobox grid mode" tool_tip="Wybierz rodzaj linijki siatki dla pozycjonowania obiektu">
@@ -487,7 +484,14 @@
 			Obszar: [AREA] m²
 		</text>
 		<button label="O Posiadłości" label_selected="O Posiadłości" name="button about land"/>
-		<check_box label="Pokaż Właścicieli" name="checkbox show owners" tool_tip="Pokoloruj Posiadłości zgodnie z przynależnością do Właściciela:   Zielony = Twoja Posiadłość  Morski = Posiadłość Twojej Grupy  Czerwony = Posiadłości innych  Żółty = Na sprzedaż  Fioletowy = Na aukcję  Szary = Publiczna"/>
+		<check_box label="Pokaż Właścicieli" name="checkbox show owners" tool_tip="Pokoloruj Posiadłości zgodnie z przynależnością do Właściciela: 
+
+Zielony = Twoja Posiadłość 
+Morski = Posiadłość Twojej Grupy 
+Czerwony = Posiadłości innych 
+Żółty = Na sprzedaż 
+Fioletowy = Na aukcjÄ™ 
+Szary = Publiczna"/>
 		<text name="label_parcel_modify">
 			Modyfikuj Posiadłość
 		</text>
diff --git a/indra/newview/skins/default/xui/pl/floater_voice_controls.xml b/indra/newview/skins/default/xui/pl/floater_voice_controls.xml
index c222e4edbbc078eebb95f3632b5f9cf82dad8838..6bee3e911c557767115ae65ff58e924e7a6e3376 100644
--- a/indra/newview/skins/default/xui/pl/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/pl/floater_voice_controls.xml
@@ -19,10 +19,8 @@
 		<layout_panel name="my_panel">
 			<text name="user_text" value="Mój awatar:"/>
 		</layout_panel>
-		<layout_stack name="voice_effect_and_leave_call_stack">
-			<layout_panel name="leave_call_btn_panel">
-				<button label="Zakończ rozmowę" name="leave_call_btn"/>
-			</layout_panel>
-		</layout_stack>
+		<layout_panel name="leave_call_btn_panel">
+			<button label="Zakończ" name="leave_call_btn"/>
+		</layout_panel>
 	</layout_stack>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_world_map.xml b/indra/newview/skins/default/xui/pl/floater_world_map.xml
index 5bf394f45abfe9d477bbc344430c04e8109fe32f..95010e0b91b08646c334c7768a0b8296714157af 100644
--- a/indra/newview/skins/default/xui/pl/floater_world_map.xml
+++ b/indra/newview/skins/default/xui/pl/floater_world_map.xml
@@ -19,12 +19,12 @@
 		<text name="land_sale_label">
 			Sprzedaż Posiadłości
 		</text>
-		<text name="auction_label">
-			aukcja Posiadłości
-		</text>
 		<text name="by_owner_label">
 			przez Właściciela
 		</text>
+		<text name="auction_label">
+			aukcja Posiadłości
+		</text>
 		<button name="Go Home" tool_tip="Teleportuj do mojego Miejsca Startowego"/>
 		<text name="Home_label">
 			Miejsce Startu
@@ -35,11 +35,11 @@
 		<text name="pg_label">
 			Ogólne
 		</text>
-		<check_box initial_value="true" name="events_mature_chk"/>
-		<text name="events_mature_label">
+		<check_box initial_value="prawda" name="event_mature_chk"/>
+		<text name="mature_label">
 			Moderuj
 		</text>
-		<text name="events_adult_label">
+		<text name="adult_label">
 			Adult
 		</text>
 	</panel>
@@ -58,9 +58,6 @@
 		<search_editor label="Regiony Według Nazwy" name="location" tool_tip="Wpisz nazwę regionu"/>
 		<button label="Znajdź" name="DoSearch" tool_tip="Szukaj regionu"/>
 		<button name="Clear" tool_tip="Wyczyść zapamiętane linie oraz zresetuj mapę"/>
-		<text name="events_label">
-			Lokalizacja:
-		</text>
 		<button label="Teleportuj" name="Teleport" tool_tip="Teleportuj do wybranego miejsca"/>
 		<button label="Kopiuj SLurl" name="copy_slurl" tool_tip="Kopie obecnego miejsca jako SLurl mogą zostać użyte na stronie internetowej."/>
 		<button label="Pokaż wybrane" name="Show Destination" tool_tip="Wyśrodkuj mapę w wybranym miejscu"/>
diff --git a/indra/newview/skins/default/xui/pl/inspect_object.xml b/indra/newview/skins/default/xui/pl/inspect_object.xml
index 4217731ef70896bca4a74403410fa5a62dca6c92..2e15691463e10712dbcf3ce4fc6796bcaddd2000 100644
--- a/indra/newview/skins/default/xui/pl/inspect_object.xml
+++ b/indra/newview/skins/default/xui/pl/inspect_object.xml
@@ -8,8 +8,8 @@
 		Przez [CREATOR]
 	</string>
 	<string name="CreatorAndOwner">
-		Kreator [CREATOR]
-Właściciel [OWNER]
+		przez [CREATOR]
+właściciel [OWNER]
 	</string>
 	<string name="Price">
 		L$[AMOUNT]
@@ -23,13 +23,6 @@ Właściciel [OWNER]
 	<string name="Sit">
 		Usiądź tutaj
 	</string>
-	<text name="object_name" value="Test Object Name That Is actually two lines and Really Long"/>
-	<text name="price_text">
-		L$30,000
-	</text>
-	<text name="object_description">
-		This is a really long description for an object being as how it is at least 80 characters in length and so but maybe more like 120 at this point. Who knows, really?
-	</text>
 	<button label="Kup" name="buy_btn"/>
 	<button label="Zapłać" name="pay_btn"/>
 	<button label="Weź kopię" name="take_free_copy_btn"/>
diff --git a/indra/newview/skins/default/xui/pl/language_settings.xml b/indra/newview/skins/default/xui/pl/language_settings.xml
index 681b38e9cf6d5c0b2cdc8b8a75db616f5affa9c9..debc451a338beee6b159e58ec5867a72af30345e 100644
--- a/indra/newview/skins/default/xui/pl/language_settings.xml
+++ b/indra/newview/skins/default/xui/pl/language_settings.xml
@@ -17,7 +17,6 @@
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
diff --git a/indra/newview/skins/default/xui/pl/menu_attachment_self.xml b/indra/newview/skins/default/xui/pl/menu_attachment_self.xml
index 39fe83ad2ff0de00d1af095b9e86d9ba470984bc..ff695be205b7a0475123501c0d840e0588d947ad 100644
--- a/indra/newview/skins/default/xui/pl/menu_attachment_self.xml
+++ b/indra/newview/skins/default/xui/pl/menu_attachment_self.xml
@@ -3,13 +3,10 @@
 	<menu_item_call label="Dotknij" name="Attachment Object Touch"/>
 	<menu_item_call label="Edytuj" name="Edit..."/>
 	<menu_item_call label="Odłącz" name="Detach"/>
+	<menu_item_call label="Opuść" name="Drop"/>
 	<menu_item_call label="Wstań" name="Stand Up"/>
-	<menu_item_call label="Zmień strój" name="Change Outfit"/>
-	<menu_item_call label="Edytuj mój strój" name="Edit Outfit"/>
-	<menu_item_call label="Edytuj mój kształt" name="Edit My Shape"/>
+	<menu_item_call label="Mój Wygląd" name="Appearance..."/>
 	<menu_item_call label="Moi Znajomi" name="Friends..."/>
 	<menu_item_call label="Moje Grupy" name="Groups..."/>
 	<menu_item_call label="Mój Profil" name="Profile..."/>
-	<menu_item_call label="Debugowanie  tekstur" name="Debug..."/>
-	<menu_item_call label="Opuść" name="Drop"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_bottomtray.xml b/indra/newview/skins/default/xui/pl/menu_bottomtray.xml
index 7e1b37f2dd31812cee8f1e01b1a1b353e1bd6b4d..9fcf1b3440437c4c76611effdb4cdaa6598d8db9 100644
--- a/indra/newview/skins/default/xui/pl/menu_bottomtray.xml
+++ b/indra/newview/skins/default/xui/pl/menu_bottomtray.xml
@@ -4,11 +4,6 @@
 	<menu_item_check label="Przycisk Ruchu" name="ShowMoveButton"/>
 	<menu_item_check label="Przycisk Widoku" name="ShowCameraButton"/>
 	<menu_item_check label="Przycisk Zdjęć" name="ShowSnapshotButton"/>
-	<menu_item_check label="Schowek" name="ShowSidebarButton"/>
-	<menu_item_check label="Buduj" name="ShowBuildButton"/>
-	<menu_item_check label="Szukaj" name="ShowSearchButton"/>
-	<menu_item_check label="Mapa" name="ShowWorldMapButton"/>
-	<menu_item_check label="Mini-Mapa" name="ShowMiniMapButton"/>
 	<menu_item_call label="Wytnij" name="NearbyChatBar_Cut"/>
 	<menu_item_call label="Kopiuj" name="NearbyChatBar_Copy"/>
 	<menu_item_call label="Wklej" name="NearbyChatBar_Paste"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_hide_navbar.xml b/indra/newview/skins/default/xui/pl/menu_hide_navbar.xml
index 19d9510cd3f05c26ac4174f8308ea7febacf338c..d30f5a4d3fc946c216740d3ff4ab81f41fb946c0 100644
--- a/indra/newview/skins/default/xui/pl/menu_hide_navbar.xml
+++ b/indra/newview/skins/default/xui/pl/menu_hide_navbar.xml
@@ -2,5 +2,4 @@
 <menu name="hide_navbar_menu">
 	<menu_item_check label="Pokaż pasek Nawigacji" name="ShowNavbarNavigationPanel"/>
 	<menu_item_check label="Pokaż pasek Ulubionych" name="ShowNavbarFavoritesPanel"/>
-	<menu_item_check label="Pokaż pasek mini-lokalizacji" name="ShowMiniLocationPanel"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/pl/menu_inspect_avatar_gear.xml
index 9a102e14163a91453958ccf36d3df5cd53c75575..325072d0fb88465a1be16a6abebe7bc97c015035 100644
--- a/indra/newview/skins/default/xui/pl/menu_inspect_avatar_gear.xml
+++ b/indra/newview/skins/default/xui/pl/menu_inspect_avatar_gear.xml
@@ -11,7 +11,7 @@
 	<menu_item_call label="Raport" name="report"/>
 	<menu_item_call label="Unieruchom" name="freeze"/>
 	<menu_item_call label="Wyrzuć" name="eject"/>
-	<menu_item_call label="Debugowanie tekstur" name="debug"/>
+	<menu_item_call label="Debug" name="debug"/>
 	<menu_item_call label="Znajdź na mapie" name="find_on_map"/>
 	<menu_item_call label="Przybliż" name="zoom_in"/>
 	<menu_item_call label="Zapłać" name="pay"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_inventory.xml b/indra/newview/skins/default/xui/pl/menu_inventory.xml
index f1f7d0d85525d5d8cc09db3b549b3dcf1c2bf3cd..7fe9da3c0c89ef5fb34899c14c1fc21a713a21d9 100644
--- a/indra/newview/skins/default/xui/pl/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/pl/menu_inventory.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="Popup">
-	<menu_item_call label="Udostępnij" name="Share"/>
 	<menu_item_call label="Kupuj" name="Task Buy"/>
 	<menu_item_call label="Otwórz" name="Task Open"/>
 	<menu_item_call label="Odtwarzaj" name="Task Play"/>
@@ -52,14 +51,12 @@
 	<menu_item_call label="Usuń obiekt" name="Purge Item"/>
 	<menu_item_call label="Przywróć obiekt" name="Restore Item"/>
 	<menu_item_call label="Otwórz" name="Open"/>
-	<menu_item_call label="Otwórz oryginalne" name="Open Original"/>
 	<menu_item_call label="Właściwości" name="Properties"/>
 	<menu_item_call label="Zmień nazwę" name="Rename"/>
 	<menu_item_call label="Kopiuj dane UUID" name="Copy Asset UUID"/>
 	<menu_item_call label="Kopiuj" name="Copy"/>
 	<menu_item_call label="Wklej" name="Paste"/>
 	<menu_item_call label="Wklej jako link" name="Paste As Link"/>
-	<menu_item_call label="Usuń" name="Remove Link"/>
 	<menu_item_call label="Usuń" name="Delete"/>
 	<menu_item_call label="Skasuj Folder Systemu" name="Delete System Folder"/>
 	<menu_item_call label="Rozpocznij konferencjÄ™ czatowÄ…" name="Conference Chat Folder"/>
@@ -74,11 +71,11 @@
 	<menu_item_call label="Deaktywuj" name="Deactivate"/>
 	<menu_item_call label="Zapisz jako" name="Save As"/>
 	<menu_item_call label="Odłącz od siebie" name="Detach From Yourself"/>
-	<menu_item_call label="Załóż" name="Wearable And Object Wear"/>
+	<menu_item_call label="Ubierz" name="Object Wear"/>
 	<menu label="Dołącz do" name="Attach To"/>
 	<menu label="Dołącz do Załączników HUD" name="Attach To HUD"/>
 	<menu_item_call label="Edytuj" name="Wearable Edit"/>
-	<menu_item_call label="Dodaj" name="Wearable Add"/>
+	<menu_item_call label="Ubierz" name="Wearable Wear"/>
 	<menu_item_call label="Zdejmij" name="Take Off"/>
 	<menu_item_call label="--brak opcji--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_inventory_add.xml b/indra/newview/skins/default/xui/pl/menu_inventory_add.xml
index 8f520113c06c1b236940bef1d6cd1259afa35103..b4d85c2c5cd343e52bb3533e9477df7d67ec6c1c 100644
--- a/indra/newview/skins/default/xui/pl/menu_inventory_add.xml
+++ b/indra/newview/skins/default/xui/pl/menu_inventory_add.xml
@@ -5,7 +5,6 @@
 		<menu_item_call label="dźwięk (L$[COST])..." name="Upload Sound"/>
 		<menu_item_call label="animacjÄ™ (L$[COST])..." name="Upload Animation"/>
 		<menu_item_call label="zbiór plików (L$[COST] za jeden plik)..." name="Bulk Upload"/>
-		<menu_item_call label="Ustaw domyślne pozwolenia ładowania" name="perm prefs"/>
 	</menu>
 	<menu_item_call label="Nowy folder" name="New Folder"/>
 	<menu_item_call label="Nowy skrypt" name="New Script"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/pl/menu_inventory_gear_default.xml
index 382a7506cca9bfa28469aae95656d61b3955f32f..2ec3741682683b02995ef684c30e0a257bb08149 100644
--- a/indra/newview/skins/default/xui/pl/menu_inventory_gear_default.xml
+++ b/indra/newview/skins/default/xui/pl/menu_inventory_gear_default.xml
@@ -6,10 +6,9 @@
 	<menu_item_call label="Pokaż filtry" name="show_filters"/>
 	<menu_item_call label="Zresetuj filtry" name="reset_filters"/>
 	<menu_item_call label="Zamknij wszystkie foldery" name="close_folders"/>
+	<menu_item_call label="Opróżnij Kosz" name="empty_trash"/>
 	<menu_item_call label="Opróżnij Zagubione i Odnalezione" name="empty_lostnfound"/>
 	<menu_item_call label="Zapisz teksturÄ™ jako" name="Save Texture As"/>
-	<menu_item_call label="Udostępnij" name="Share"/>
 	<menu_item_call label="Znajdź oryginał" name="Find Original"/>
 	<menu_item_call label="Znajdź wszystkie linki" name="Find All Links"/>
-	<menu_item_call label="Opróżnij Kosz" name="empty_trash"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_login.xml b/indra/newview/skins/default/xui/pl/menu_login.xml
index 810862dfd9653b9f907c1fc76bdd9d8ff995a539..2673f5c27136340062b5ec46c2cce52cb5574579 100644
--- a/indra/newview/skins/default/xui/pl/menu_login.xml
+++ b/indra/newview/skins/default/xui/pl/menu_login.xml
@@ -2,14 +2,23 @@
 <menu_bar name="Login Menu">
 	<menu label="Ja" name="File">
 		<menu_item_call label="Ustawienia" name="Preferences..."/>
-		<menu_item_call label="Wyłącz [APP_NAME]" name="Quit"/>
+		<menu_item_call label="Wyłącz program" name="Quit"/>
 	</menu>
 	<menu label="Pomoc" name="Help">
 		<menu_item_call label="[SECOND_LIFE]: Pomoc" name="Second Life Help"/>
-		<menu_item_call label="O [APP_NAME]" name="About Second Life"/>
 	</menu>
-	<menu_item_check label="Pokaż Ustawienia Debugowania" name="Show Debug Menu"/>
 	<menu label="Debug" name="Debug">
+		<menu label="Edytuj" name="Edit">
+			<menu_item_call label="Cofnij" name="Undo"/>
+			<menu_item_call label="Powtórz" name="Redo"/>
+			<menu_item_call label="Wytnij" name="Cut"/>
+			<menu_item_call label="Kopiuj" name="Copy"/>
+			<menu_item_call label="Wklej" name="Paste"/>
+			<menu_item_call label="Usuń" name="Delete"/>
+			<menu_item_call label="Powiel" name="Duplicate"/>
+			<menu_item_call label="Zaznacz wszystko" name="Select All"/>
+			<menu_item_call label="Odznacz" name="Deselect"/>
+		</menu>
 		<menu_item_call label="Ustawienia debugowania" name="Debug Settings"/>
 		<menu_item_call label="Ustawienia UI/kolor" name="UI/Color Settings"/>
 		<menu label="UI Testy" name="UI Tests"/>
@@ -17,7 +26,5 @@
 		<menu_item_call label="Wyświetl TOS" name="TOS"/>
 		<menu_item_call label="Wyświetl wiadomość krytyczną" name="Critical"/>
 		<menu_item_call label="Test przeglÄ…darki internetowej" name="Web Browser Test"/>
-		<menu_item_check label="Pokaż Siatkę" name="Show Grid Picker"/>
-		<menu_item_call label="Pokaż konsolę Zawiadomień" name="Show Notifications Console"/>
 	</menu>
 </menu_bar>
diff --git a/indra/newview/skins/default/xui/pl/menu_object.xml b/indra/newview/skins/default/xui/pl/menu_object.xml
index f25495e8e6b7b9203a943a6c2f14f9af0d9ac7b3..763b120f89bb1cc75dde7ca4ce0e1b7f7c28a6ca 100644
--- a/indra/newview/skins/default/xui/pl/menu_object.xml
+++ b/indra/newview/skins/default/xui/pl/menu_object.xml
@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Object Pie">
-	<menu_item_call label="Dotknij" name="Object Touch">
-		<on_enable parameter="Dotknij" name="EnableTouch"/>
-	</menu_item_call>
+	<menu_item_call label="Dotknij" name="Object Touch"/>
 	<menu_item_call label="Edytuj" name="Edit..."/>
 	<menu_item_call label="Buduj" name="Build"/>
 	<menu_item_call label="Otwórz" name="Open"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_participant_list.xml b/indra/newview/skins/default/xui/pl/menu_participant_list.xml
index 59b4fec6b0d6b6fd3fb523dd30c912159fa42b30..079b8558da701859cb4c8022d7a09b5e38b012ab 100644
--- a/indra/newview/skins/default/xui/pl/menu_participant_list.xml
+++ b/indra/newview/skins/default/xui/pl/menu_participant_list.xml
@@ -8,14 +8,13 @@
 	<menu_item_call label="Zadzwoń" name="Call"/>
 	<menu_item_call label="Udostępnij" name="Share"/>
 	<menu_item_call label="Zapłać" name="Pay"/>
-	<menu_item_check label="PrzeglÄ…daj ikonki" name="View Icons"/>
 	<menu_item_check label="Zablokuj głos" name="Block/Unblock"/>
 	<menu_item_check label="Zablokuj tekst" name="MuteText"/>
 	<context_menu label="Opcje Moderatora &gt;" name="Moderator Options">
 		<menu_item_check label="Czat/IM dozwolony" name="AllowTextChat"/>
 		<menu_item_call label="Wycisz tego uczestnika" name="ModerateVoiceMuteSelected"/>
+		<menu_item_call label="Wycisz wszystkich pozostałych" name="ModerateVoiceMuteOthers"/>
 		<menu_item_call label="Odblokuj wyciszenie tego uczestnika" name="ModerateVoiceUnMuteSelected"/>
-		<menu_item_call label="Wycisz wszystkich" name="ModerateVoiceMute"/>
-		<menu_item_call label="Cofnij wyciszenie wszystkim" name="ModerateVoiceUnmute"/>
+		<menu_item_call label="Odblokuj wyciszenie wszystkich" name="ModerateVoiceUnMuteOthers"/>
 	</context_menu>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_viewer.xml b/indra/newview/skins/default/xui/pl/menu_viewer.xml
index 97a94584c45ac083de98289dcfa647b5a05c05c6..85ceb9592fe9374a9dbadd43e4b221807032ae84 100644
--- a/indra/newview/skins/default/xui/pl/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/pl/menu_viewer.xml
@@ -5,11 +5,10 @@
 		<menu_item_call label="Moja Tablica" name="Manage My Account"/>
 		<menu_item_call label="Kup L$" name="Buy and Sell L$"/>
 		<menu_item_call label="Mój Profil" name="Profile"/>
-		<menu_item_call label="Zmień strój" name="ChangeOutfit"/>
+		<menu_item_call label="Mój Wygląd" name="Appearance"/>
 		<menu_item_check label="Moja Szafa" name="Inventory"/>
 		<menu_item_check label="Moja Szafa" name="ShowSidetrayInventory"/>
 		<menu_item_check label="Moje Gesty" name="Gestures"/>
-		<menu_item_check label="Mój głos" name="ShowVoice"/>
 		<menu label="Mój Status" name="Status">
 			<menu_item_call label="Tryb Oddalenia" name="Set Away"/>
 			<menu_item_call label="Tryb Pracy" name="Set Busy"/>
@@ -30,7 +29,6 @@
 		<menu_item_call label="Zrób Zdjęcie" name="Take Snapshot"/>
 		<menu_item_call label="Zapamiętaj to Miejsce" name="Create Landmark Here"/>
 		<menu label="Miejsce" name="Land">
-			<menu_item_call label="Profil miejsca" name="Place Profile"/>
 			<menu_item_call label="O Posiadłości" name="About Land"/>
 			<menu_item_call label="Region/MajÄ…tek" name="Region/Estate"/>
 		</menu>
@@ -66,15 +64,20 @@
 			<menu_item_call label="Stwórz Narzędzie" name="Create"/>
 			<menu_item_call label="Narzędzie Posiadłości" name="Land"/>
 		</menu>
+		<menu label="Edytuj" name="Edit">
+			<menu_item_call label="Cofnij" name="Undo"/>
+			<menu_item_call label="Cofnij" name="Redo"/>
+			<menu_item_call label="Wytnij" name="Cut"/>
+			<menu_item_call label="Kopiuj" name="Copy"/>
+			<menu_item_call label="Wklej" name="Paste"/>
+			<menu_item_call label="Usuń" name="Delete"/>
+			<menu_item_call label="Zduplikuj" name="Duplicate"/>
+			<menu_item_call label="Zaznacz Wszystko" name="Select All"/>
+			<menu_item_call label="Cofnij Zaznaczenie" name="Deselect"/>
+		</menu>
 		<menu_item_call label="Linkuj" name="Link"/>
 		<menu_item_call label="Rozlinkuj" name="Unlink"/>
 		<menu_item_check label="Edytuj Zgrupowane Obiekty" name="Edit Linked Parts"/>
-		<menu label="Wybierz Zlinkowane Części" name="Select Linked Parts">
-			<menu_item_call label="Wybierz Następną Część" name="Select Next Part"/>
-			<menu_item_call label="Zaznacz Poprzednią Część" name="Select Previous Part"/>
-			<menu_item_call label="Uwzględnij Następną Część" name="Include Next Part"/>
-			<menu_item_call label="Uwzględnij Poprzednią Część" name="Include Previous Part"/>
-		</menu>
 		<menu_item_call label="Ogniskowa Selekcji" name="Focus on Selection"/>
 		<menu_item_call label="Przybliż do Selekcji" name="Zoom to Selection"/>
 		<menu label="Obiekt" name="Object">
@@ -92,7 +95,7 @@
 			<menu_item_call label="Wstrzymaj Działanie Skryptów w Selekcji" name="Set Scripts to Not Running"/>
 		</menu>
 		<menu label="Opcje" name="Options">
-			<menu_item_call label="Ustaw domyślne pozwolenia ładowania" name="perm prefs"/>
+			<menu_item_call label="Ustaw Domyślne Pozwolenia Ładowania" name="perm prefs"/>
 			<menu_item_check label="Pokaż Zaawansowane Pozwolenia" name="DebugPermissions"/>
 			<menu_item_check label="Wybierz Tylko Moje Obiekty" name="Select Only My Objects"/>
 			<menu_item_check label="Wybierz Tylko Obiekty Przesuwalne" name="Select Only Movable Objects"/>
@@ -105,21 +108,19 @@
 			<menu_item_call label="Wybierz Zaznaczenie Siatki" name="Use Selection for Grid"/>
 			<menu_item_call label="Opcje Siatki" name="Grid Options"/>
 		</menu>
-		<menu label="Załaduj" name="Upload">
-			<menu_item_call label="teksturÄ™ (L$[COST])..." name="Upload Image"/>
-			<menu_item_call label="dźwięk (L$[COST])..." name="Upload Sound"/>
-			<menu_item_call label="animacjÄ™ (L$[COST])..." name="Upload Animation"/>
-			<menu_item_call label="zbiór plików (L$[COST] za jeden plik)..." name="Bulk Upload"/>
+		<menu label="Wybierz Zlinkowane Części" name="Select Linked Parts">
+			<menu_item_call label="Wybierz Następną Część" name="Select Next Part"/>
+			<menu_item_call label="Zaznacz Poprzednią Część" name="Select Previous Part"/>
+			<menu_item_call label="Uwzględnij Następną Część" name="Include Next Part"/>
+			<menu_item_call label="Uwzględnij Poprzednią Część" name="Include Previous Part"/>
 		</menu>
 	</menu>
 	<menu label="Pomoc" name="Help">
 		<menu_item_call label="[SECOND_LIFE] Portal Pomocy" name="Second Life Help"/>
 		<menu_item_call label="Złóż Raport o Nadużyciu" name="Report Abuse"/>
 		<menu_item_call label="Zgłoś Błędy Klienta" name="Report Bug"/>
-		<menu_item_call label="O [APP_NAME]" name="About Second Life"/>
 	</menu>
 	<menu label="Zaawansowane" name="Advanced">
-		<menu_item_check label="Pokaż menu Zaawansowane" name="Show Advanced Menu"/>
 		<menu_item_call label="Zatrzymaj Wszystkie Animacje" name="Stop Animating My Avatar"/>
 		<menu_item_call label="Odswież Wyświetlanie Tekstur" name="Rebake Texture"/>
 		<menu_item_call label="Domyślne Ustawienia Rozmiaru Interfejsu" name="Set UI Size to Default"/>
@@ -141,6 +142,7 @@
 			<menu_item_check label="Pokaż Przeźroczyste Obiekty" name="Highlight Transparent"/>
 			<menu_item_check label="Pokaż Załączniki HUD" name="Show HUD Attachments"/>
 			<menu_item_check label="Pokaż Celownik Myszki" name="ShowCrosshairs"/>
+			<menu_item_check label="Pokaż Podpowiedzi Posiadłości" name="Land Tips"/>
 		</menu>
 		<menu label="Rodzaje Renderowania" name="Rendering Types">
 			<menu_item_check label="Podstawowe" name="Simple"/>
@@ -167,7 +169,6 @@
 			<menu_item_check label="Obiekty Elastyczne" name="Flexible Objects"/>
 		</menu>
 		<menu_item_check label="Uruchom Wiele Wątków" name="Run Multiple Threads"/>
-		<menu_item_check label="Use Plugin Read Thread" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Wyczyść Bufor Danych Grupy" name="ClearGroupCache"/>
 		<menu_item_check label="Wygładzanie Ruchu Myszki" name="Mouse Smoothing"/>
 		<menu label="Skróty" name="Shortcuts">
@@ -175,7 +176,6 @@
 			<menu_item_check label="Szukaj" name="Search"/>
 			<menu_item_call label="Zwolnij Klawisze" name="Release Keys"/>
 			<menu_item_call label="Domyślne Ustawienia Rozmiaru Interfejsu" name="Set UI Size to Default"/>
-			<menu_item_check label="Pokaż menu Zaawansowane" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_check label="Biegnij" name="Always Run"/>
 			<menu_item_check label="Zacznij Latać" name="Fly"/>
 			<menu_item_call label="Zamknij Okno" name="Close Window"/>
@@ -195,6 +195,7 @@
 			<menu_item_call label="Przybliż" name="Zoom In"/>
 			<menu_item_call label="Domyślne Przybliżenie" name="Zoom Default"/>
 			<menu_item_call label="Oddal" name="Zoom Out"/>
+			<menu_item_call label="Rozwiń Widok Pełnoekranowy" name="Toggle Fullscreen"/>
 		</menu>
 		<menu_item_call label="Pokaż Ustawienia Debugowania" name="Debug Settings"/>
 		<menu_item_check label="Pokaż Menu Progresu" name="Debug Mode"/>
diff --git a/indra/newview/skins/default/xui/pl/notifications.xml b/indra/newview/skins/default/xui/pl/notifications.xml
index 14718e8f6fb1e5f0651d6c3fd1e1189c7b84de30..12d68ed30edd2e2c41426711640816f0eb943274 100644
--- a/indra/newview/skins/default/xui/pl/notifications.xml
+++ b/indra/newview/skins/default/xui/pl/notifications.xml
@@ -322,9 +322,6 @@ Limit [MAX_ATTACHMENTS] załączników został przekroczony. Proszę najpierw od
 Czy chcesz przejść na stronę www.secondlife.com by założyć konto?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
-	<notification name="InvalidCredentialFormat">
-		Wpisz imię i nazwisko Twojego awatara w pole Użytkownika a następnie zaloguj się ponownie.
-	</notification>
 	<notification name="AddClassified">
 		Ogłoszenia reklamowe ukazują się w zakładce Reklama w wyszukiwarce (Szukaj) oraz na [http://secondlife.com/community/classifieds secondlife.com] przez tydzień.
 Napisz treść swojej reklamy, kliknij Zamieść by dodać katalogu ogłoszeń.
@@ -351,11 +348,7 @@ Czy na pewno chcesz kontynuować?
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="DeleteAvatarPick">
-		Usuń zdjęcie &lt;nolink&gt;[PICK]&lt;/nolink&gt;?
-		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
-	</notification>
-	<notification name="DeleteOutfits">
-		Skasować wybrane stroje?
+		Usunąć wybór [PICK] z kategorii Lubię?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="PromptGoToEventsPage">
@@ -469,9 +462,8 @@ Możesz podnieść jakość grafiki pod Ustawienia &gt; Grafika.
 		Region [REGION] nie pozwala na formowanie powierzchni ziemi.
 	</notification>
 	<notification name="CannotCopyWarning">
-		Nie masz pozwolenia na kopiowanie następujących obiektów:
-[ITEMS]
-i stracisz je w momencie przekazania. Czy na pewno chcesz oddać te obiekty?
+		Nie masz praw do kopiowania tego obiektu. Ten obiek zniknie z Twojej szafy jeżeli go dasz innej osobie.
+Na pewno chcesz podarować ten obiekt?
 		<usetemplate name="okcancelbuttons" notext="Nie" yestext="Tak"/>
 	</notification>
 	<notification name="CannotGiveItem">
@@ -591,10 +583,6 @@ Oczekiwana - [VALIDS]
 	<notification name="CannotEncodeFile">
 		Kodowanie pliku: [FILE] nie powidło się.
 	</notification>
-	<notification name="CorruptedProtectedDataStore">
-		Nie można wpisać Twojego imienia użytkownika ani hasła. To może się zdarzyć kiedy zmieniasz ustawienia sieci.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
 	<notification name="CorruptResourceFile">
 		Skorumpowany plik zasobów: [FILE]
 	</notification>
@@ -915,36 +903,6 @@ Zaproponować znajomość [NAME]?
 			<button name="Cancel" text="Anuluj"/>
 		</form>
 	</notification>
-	<notification label="Zapisz strój" name="SaveOutfitAs">
-		Zapisz to co noszę jako nowy strój:
-		<form name="form">
-			<input name="message">
-				[DESC] (nowe)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Anuluj"/>
-		</form>
-	</notification>
-	<notification label="Zapisz część stroju" name="SaveWearableAs">
-		Zapisz obiekt w mojej Szafie jako:
-		<form name="form">
-			<input name="message">
-				[DESC] (nowy)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Anuluj"/>
-		</form>
-	</notification>
-	<notification label="Zmień nazwę stroju" name="RenameOutfit">
-		Nowa nazwa stroju:
-		<form name="form">
-			<input name="new_name">
-				[NAME]
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Anuluj"/>
-		</form>
-	</notification>
 	<notification name="RemoveFromFriends">
 		Chcesz usunąć [FIRST_NAME] [LAST_NAME] z listy Twoich znajomych?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
@@ -979,12 +937,6 @@ ze wszystkich posiadłości w tym symulatorze?
 
 Wybierz wyższą cenę.
 	</notification>
-	<notification name="ConfirmItemDeleteHasLinks">
-		Co najmiej jeden z elementów, które masz posiada połączone z nim obiekty. Jeśli go usuniesz połączenia zostaną usunięte na stałe. Zaleca się usunięcie połączeń w pierwszej kolejności.
-
-Jesteś pewnien/pewna, że chcesz usunąć te elementy?
-		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
-	</notification>
 	<notification name="ConfirmObjectDeleteLock">
 		Przynajmnie jeden z wybranych obiektów jest zablokowany.
 
@@ -1127,42 +1079,6 @@ Wybierz awatara właściwej płci.
 Ten wybór będzie można później zmienić.
 		<usetemplate name="okcancelbuttons" notext="Kobieta" yestext="Mężczyzna"/>
 	</notification>
-	<notification name="CantTeleportToGrid">
-		Nie można teleportować do [SLURL], ponieważ jest na innym gridzie ([GRID]) niż obecny grid ([CURRENT_GRID]). Proszę zamknąć przeglądarkę i spróbować ponownie.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="GeneralCertificateError">
-		Połączenie z serwerem nie mogło zostać nawiązane.
-[REASON]
-
-SubjectName: [SUBJECT_NAME_STRING]
-IssuerName: [ISSUER_NAME_STRING]
-Valid From: [VALID_FROM]
-Valid To: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-SHA1 Fingerprint: [MD5_DIGEST]
-Key Usage: [KEYUSAGE]
-Extended Key Usage: [EXTENDEDKEYUSAGE]
-Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="TrustCertificateError">
-		Wydawca certyfikatu dla tego serwera nie jest znany.
-
-Informacje o certyfikacie:
-SubjectName: [SUBJECT_NAME_STRING]
-IssuerName: [ISSUER_NAME_STRING]
-Valid From: [VALID_FROM]
-Valid To: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-SHA1 Fingerprint: [MD5_DIGEST]
-Key Usage: [KEYUSAGE]
-Extended Key Usage: [EXTENDEDKEYUSAGE]
-Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
-
-Czy chcesz zaufać temu wydawcy?
-		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="Zaufaj"/>
-	</notification>
 	<notification name="NotEnoughCurrency">
 		[NAME] [PRICE]L$ Masz za mało L$.
 	</notification>
@@ -1468,10 +1384,6 @@ Dodatkowo, wszystkie podarowane dla Ciebie obiekty będą automatycznie zapisywa
 		Teleportuj do [CLASSIFIED]?
 		<usetemplate ignoretext="Potwierdź, że chcesz teleportować się do lokalizacji z Reklamy" name="okcancelignore" notext="Anuluj" yestext="Teleportuj"/>
 	</notification>
-	<notification name="TeleportToHistoryEntry">
-		Teleportuj do [HISTORY_ENTRY]?
-		<usetemplate ignoretext="Potwierdź teleportację do lokalizacji z historii" name="okcancelignore" notext="Anuluj" yestext="Teleportuj"/>
-	</notification>
 	<notification label="Wiadomość do Wszystkich w Twoim Majątku" name="MessageEstate">
 		Wpisz krótką wiadomość która zostanie wysłana do wszystkich osób w Twoim majątku.
 		<form name="form">
@@ -1556,18 +1468,15 @@ Skorzystaj z [SECOND_LIFE]:Pomoc by uzyskać więcej informacji na temat dostęp
 		Ze względu na Twój wiek, nie jesteś uprawniony do przebywania w tym regionie.
 	</notification>
 	<notification name="RegionEntryAccessBlocked_Change">
-		Nie masz zezwolenia na przebywanie w tym Regionie z powodu Twojego statusu ustawień wieku.
+		Ze względu na Twój wiek, nie jesteś uprawniony do przebywania w tym regionie.
 
-W celu uzyskania dostępu do tego regiony zmień proszę swój status ustawień wieku. Będziesz mógł/mogła szukać i mieć dostęp do treści [REGIONMATURITY]. W celu cofnięcia zmian wybierz z menu Ja &gt; Ustawienia &gt; Ogólne.
+Możesz wybrać &apos;Zmień Ustawienia&apos; by dokonać zmian w ustawieniach Twojego wieku by uzyskać dostęp do regionu. Wówczas będziesz w stanie znaleźć oraz mieć dostęp do [REGIONMATURITY] treści. Jeżeli zdecydujesz się na powrót do poprzednich ustawień, wybierz Ja &gt; Ustawienia &gt; Główne.
 		<form name="form">
 			<button name="OK" text="Zmień Ustawienia"/>
 			<button default="true" name="Cancel" text="Zamknij"/>
 			<ignore name="ignore" text="Moje ustawienia wieku nie dopuszczajÄ… do regionu"/>
 		</form>
 	</notification>
-	<notification name="PreferredMaturityChanged">
-		Twoja obecna klasyfikacja wieku to [RATING].
-	</notification>
 	<notification name="LandClaimAccessBlocked">
 		W związku ze statusem ustawień Twojego wieku, nie możesz odzyskać tej posiadłości. Możesz potrzebować weryfikacji wieku bądź instalacji najnowszej wersji klienta.
 
@@ -1980,9 +1889,6 @@ Zamieść go na stronie internetowej żeby umożliwić innym łatwy dostęp do t
 	<notification name="SystemMessageTip">
 		[MESSAGE]
 	</notification>
-	<notification name="IMSystemMessageTip">
-		[MESSAGE]
-	</notification>
 	<notification name="Cancelled">
 		Anulowane
 	</notification>
@@ -2315,6 +2221,15 @@ Spróbuj ponowanie za kilka minut.
 	</notification>
 	<notification name="ObjectGiveItem">
 		Obiekt [OBJECTFROMNAME] należący do [NAME_SLURL] dał Ci [OBJECTTYPE]:
+[ITEM_SLURL]
+		<form name="form">
+			<button name="Keep" text="Zachowaj"/>
+			<button name="Discard" text="Wyrzuć"/>
+			<button name="Mute" text="Zablokuj"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItemUnknownUser">
+		Obiekt [OBJECTFROMNAME] należący (właściciel nieznany) dał Ci [OBJECTTYPE]:
 [ITEM_SLURL]
 		<form name="form">
 			<button name="Keep" text="Zachowaj"/>
@@ -2345,9 +2260,9 @@ Spróbuj ponowanie za kilka minut.
 		</form>
 	</notification>
 	<notification name="TeleportOffered">
-		[NAME_SLURL] proponuje Ci teleportacjÄ™ do siebie:
+		[NAME] proponuje Ci teleportcjÄ™ do siebie:
 
-[MESSAGE] - [MATURITY_STR] &lt;icon&gt;[MATURITY_ICON]&lt;/icon&gt;
+[MESSAGE]
 		<form name="form">
 			<button name="Teleport" text="Teleportuj"/>
 			<button name="Cancel" text="Anuluj"/>
@@ -2365,11 +2280,11 @@ Spróbuj ponowanie za kilka minut.
 		</form>
 	</notification>
 	<notification name="OfferFriendship">
-		[NAME_SLURL] proponuje znajomość.
+		[NAME] proponuje Ci znajomość.
 
 [MESSAGE]
 
-(Będziecie mogli widzieć swój status online)
+(Z zalożenia będzie widzić swój status online.)
 		<form name="form">
 			<button name="Accept" text="Zaakceptuj"/>
 			<button name="Decline" text="Odmów"/>
@@ -2565,21 +2480,6 @@ Wybierz Zaakceptuj żeby zacząć czat albo Odmów żeby nie przyjąć zaproszen
 	<notification name="VoiceLoginRetry">
 		Tworzymy kanał głosu dla Ciebie. Moze potrwać minutę.
 	</notification>
-	<notification name="VoiceEffectsExpired">
-		Subskrypcja jednego lub więcej z Voice Morph wygasła.
-[[URL] Kliknij tutaj] oby odnowić subskrypcję.
-	</notification>
-	<notification name="VoiceEffectsExpiredInUse">
-		Czas aktywności Voice Morph wygasł, normalne ustawienia Twojego głosu zostały zastosowane.
-[[URL] Kliknij tutaj] aby odnowić subskrypcję.
-	</notification>
-	<notification name="VoiceEffectsWillExpire">
-		Jedno lub więcej z Twoich Voice Morph wygaśnie za mniej niż [INTERVAL] dni.
-[[URL] Klinij tutaj] aby odnowić subskrypcję.
-	</notification>
-	<notification name="VoiceEffectsNew">
-		Nowe Voice Morph są dostępne!
-	</notification>
 	<notification name="Cannot enter parcel: not a group member">
 		Nie masz dostępu do posiadłości, nie należysz do właściwej grupy.
 	</notification>
@@ -2645,95 +2545,6 @@ Zostaną zablokowane na kilka sekund dla bezpieczeństwa.
 		Wybrany przycisk nie może zostać wyświetlony w tej chwili.
 Przycisk zostanie wyświetlony w przypadku dostatecznej ilości przestrzeni.
 	</notification>
-	<notification name="ShareNotification">
-		Zaznacz Rezydentów, z którymi chcesz się podzielić.
-	</notification>
-	<notification name="ShareItemsConfirmation">
-		Jesteś pewien/pewna, że chcesz udostępnić następujące obiekty:
-
-[ITEMS]
-
-następującym Rezydentom:
-
-[RESIDENTS]
-		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="Ok"/>
-	</notification>
-	<notification name="ItemsShared">
-		Obiekty zostały udostępnione.
-	</notification>
-	<notification name="DeedToGroupFail">
-		Przekazanie grupie nie powiodło się.
-	</notification>
-	<notification name="AvatarRezNotification">
-		( [EXISTENCE] sekund w Second Life)
-Awatar &apos;[NAME]&apos; rozchmurzył się po [TIME] sekundach.
-	</notification>
-	<notification name="AvatarRezSelfBakedDoneNotification">
-		( [EXISTENCE] sekund w Second Life)
-You finished baking your outfit after [TIME] seconds.
-	</notification>
-	<notification name="AvatarRezSelfBakedUpdateNotification">
-		( [EXISTENCE] sekund w Second Life )
-Wysłano aktualizację wyglądu po [TIME] sekundach.
-[STATUS]
-	</notification>
-	<notification name="AvatarRezCloudNotification">
-		( [EXISTENCE] sekund w Second Life )
-Awatar &apos;[NAME]&apos; stał się chmurą.
-	</notification>
-	<notification name="AvatarRezArrivedNotification">
-		( [EXISTENCE] sekund w Second Life)
-Awatar &apos;[NAME]&apos; pojawił się.
-	</notification>
-	<notification name="AvatarRezLeftCloudNotification">
-		( [EXISTENCE] sekund w Second Life )
-Awatar &apos;[NAME]&apos; pozostał [TIME] sekund chmurą.
-	</notification>
-	<notification name="AvatarRezEnteredAppearanceNotification">
-		( [EXISTENCE] sekund w Second Life )
-Awatar &apos;[NAME]&apos; rozpoczÄ…Å‚ edycjÄ™ wyglÄ…du.
-	</notification>
-	<notification name="AvatarRezLeftAppearanceNotification">
-		( [EXISTENCE] sekund w Second Life )
-Awatar &apos;[NAME]&apos; opuścił edycję wyglądu.
-	</notification>
-	<notification name="NoConnect">
-		Występuje problem z połączeniem [PROTOCOL] [HOSTID].
-Proszę sprawdź swoją sieć i ustawienia firewall.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="NoVoiceConnect">
-		Występuje problem z Twoim połączniem głosowym:
-
-[HOSTID]
-
-Komunikacja głosowa nie będzie dostępna.
-Proszę sprawdź swoją sieć i ustawienia firewall.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="AvatarRezLeftNotification">
-		( [EXISTENCE] sekund w Second Life)
-Awatar &apos;[NAME]&apos; pozostał w pełni załadowany.
-	</notification>
-	<notification name="AvatarRezSelfBakeNotification">
-		( [EXISTENCE] sekund w Second Life )
-You [ACTION] a [RESOLUTION] baked texture for &apos;[BODYREGION]&apos; after [TIME] seconds.
-	</notification>
-	<notification name="ConfirmLeaveCall">
-		Czy jestes pewien/pewna, że chcesz zakończyć rozmowę?
-		<usetemplate ignoretext="Potwierdź zanim rozmowa głosowa zostanie zakończona" name="okcancelignore" notext="Nie" yestext="Tak"/>
-	</notification>
-	<notification name="ConfirmMuteAll">
-		Wybrano wyciszenie wszystkich uczestników rozmowy głosowej w grupie.
-To spowoduje również wyciszenie wszystkich Rezydentów, którzy dołączą póżniej do rozmowy, nawet jeśli zakończysz rozmowę.
-
-Wyciszyć wszystkich?
-		<usetemplate ignoretext="Potwierdź zanim zostaną wyciszeni wszyscy uczestnicy rozmowy głosowej w grupie" name="okcancelignore" notext="Anuluj" yestext="Ok"/>
-	</notification>
 	<global name="UnsupportedCPU">
 		- Prędkość Twojego CPU nie spełnia minimalnych wymagań.
 	</global>
@@ -2758,7 +2569,4 @@ Jeżeli wciąż masz problemy sprawdź: [SUPPORT_SITE].
 		Jeśli jesteś właścicielem posiadłości, możesz ustawić na niej miejsce startu.
 W innym przypadku możesz poszukać na mapie miejsca oznaczone jako &quot;Infohub&quot;.
 	</global>
-	<global name="You died and have been teleported to your home location">
-		Nastąpiła śmierć i teleportacja do Miejsca Startu.
-	</global>
 </notifications>
diff --git a/indra/newview/skins/default/xui/pl/panel_bottomtray.xml b/indra/newview/skins/default/xui/pl/panel_bottomtray.xml
index cf73ae53dd2dbe00036736fb2f56e51c370b4966..e21d8a077d41de16538d404e5adda840a7c2991f 100644
--- a/indra/newview/skins/default/xui/pl/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/pl/panel_bottomtray.xml
@@ -1,7 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="bottom_tray">
-	<string name="SpeakBtnToolTip" value="Włącza/wyłącza mikrofon"/>
-	<string name="VoiceControlBtnToolTip" value="Pokazuje/Ukrywa panel kontroli głosu"/>
+	<string name="SpeakBtnToolTip">
+		Włącza/Wyłącza mikrofon
+	</string>
+	<string name="VoiceControlBtnToolTip">
+		Pokazuje/Ukrywa panel kontroli głosu
+	</string>
 	<layout_stack name="toolbar_stack">
 		<layout_panel name="speak_panel">
 			<talk_button name="talk">
@@ -20,21 +24,6 @@
 		<layout_panel name="snapshot_panel">
 			<button label="" name="snapshots" tool_tip="Zrób Zdjęcie"/>
 		</layout_panel>
-		<layout_panel name="sidebar_btn_panel">
-			<button label="Schowek" name="sidebar_btn" tool_tip="Pokazuje/ukrywa Schowek"/>
-		</layout_panel>
-		<layout_panel name="build_btn_panel">
-			<button label="Buduj" name="build_btn" tool_tip="Pokazuje/ukrywa Narzędzia Budowania"/>
-		</layout_panel>
-		<layout_panel name="search_btn_panel">
-			<button label="Szukaj" name="search_btn" tool_tip="Pokazuje/ukrywa Szukaj"/>
-		</layout_panel>
-		<layout_panel name="world_map_btn_panel">
-			<button label="Mapa" name="world_map_btn" tool_tip="Pokazuje/ukrywa MapÄ™ Åšwiata"/>
-		</layout_panel>
-		<layout_panel name="mini_map_btn_panel">
-			<button label="Mini-Mapa" name="mini_map_btn" tool_tip="Pokazuje/ukrywa Mini-MapÄ™"/>
-		</layout_panel>
 		<layout_panel name="im_well_panel">
 			<chiclet_im_well name="im_well">
 				<button name="Unread IM messages" tool_tip="Rozmowy"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_edit_jacket.xml b/indra/newview/skins/default/xui/pl/panel_edit_jacket.xml
index ba0b908394bdb649874d48008b1adf267e8e3f4d..f4ea9303aaacd3215ce50485c3388c80d1f31cd2 100644
--- a/indra/newview/skins/default/xui/pl/panel_edit_jacket.xml
+++ b/indra/newview/skins/default/xui/pl/panel_edit_jacket.xml
@@ -5,9 +5,7 @@
 		<texture_picker label="Dolny materiał" name="Lower Fabric" tool_tip="Kliknij aby wybrać teksturę"/>
 		<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 	</panel>
-	<panel name="accordion_panel">
-		<accordion name="wearable_accordion">
-			<accordion_tab name="jacket_main_tab" title="Kurtka"/>
-		</accordion>
-	</panel>
+	<accordion name="wearable_accordion">
+		<accordion_tab name="jacket_main_tab" title="Kurtka"/>
+	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_edit_tattoo.xml b/indra/newview/skins/default/xui/pl/panel_edit_tattoo.xml
index 6fd1e2277a8943987783bd89d66ce82c681c6f8c..b5e18285885886a7a832d1fcfdc64fbd5efdadd1 100644
--- a/indra/newview/skins/default/xui/pl/panel_edit_tattoo.xml
+++ b/indra/newview/skins/default/xui/pl/panel_edit_tattoo.xml
@@ -4,6 +4,5 @@
 		<texture_picker label="Tatuaż głowy" name="Head Tattoo" tool_tip="Kliknij by wybrać grafikę"/>
 		<texture_picker label="Tatuaż górnej części ciała" name="Upper Tattoo" tool_tip="Kliknij by wybrać grafikę"/>
 		<texture_picker label="Tatuaż dolnej części ciała" name="Lower Tattoo" tool_tip="Kliknij by wybrać grafikę"/>
-		<color_swatch label="Color/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_edit_wearable.xml b/indra/newview/skins/default/xui/pl/panel_edit_wearable.xml
index 194b26a97eac808a9c51dc3f5b1f45f507b8d5ee..cf17afea3fc02dd04085083fac4c689d7508b0f4 100644
--- a/indra/newview/skins/default/xui/pl/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/pl/panel_edit_wearable.xml
@@ -72,8 +72,8 @@
 	<string name="jacket_desc_text">
 		Kurtka:
 	</string>
-	<string name="skirt_desc_text">
-		spódnica:
+	<string name="skirt_skirt_desc_text">
+		Spódnica:
 	</string>
 	<string name="gloves_desc_text">
 		Rękawiczki:
@@ -90,19 +90,12 @@
 	<string name="tattoo_desc_text">
 		Tatuaż:
 	</string>
-	<labeled_back_button label="Zapisz" name="back_btn" tool_tip="Powrót do edycji stroju"/>
 	<text name="edit_wearable_title" value="Edycja Kształtu"/>
 	<panel label="Koszula" name="wearable_type_panel">
 		<text name="description_text" value="Kształt:"/>
-		<radio_group name="sex_radio">
-			<radio_item label="" name="sex_male" tool_tip="Mężczyzna" value="1"/>
-			<radio_item label="" name="sex_female" tool_tip="Kobieta" value="0"/>
-		</radio_group>
-		<icon name="male_icon" tool_tip="Mężczyzna"/>
-		<icon name="female_icon" tool_tip="Kobieta"/>
 	</panel>
 	<panel name="button_panel">
 		<button label="Zapisz" name="save_as_button"/>
-		<button label="Cofnij zmiany" name="revert_button"/>
+		<button label="Wróć" name="revert_button"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_group_general.xml b/indra/newview/skins/default/xui/pl/panel_group_general.xml
index 43f0103ab78c0e3a85b9d91e2a7e131e1bfa2a91..67fa0bf085150cf0e19872357c0fffd221275094 100644
--- a/indra/newview/skins/default/xui/pl/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/pl/panel_group_general.xml
@@ -47,11 +47,8 @@ By otrzymać pomoc i dodatkowe wskazówki przesuń kursor na przyciski.
 		<check_box label="Opłata wstępu" name="check_enrollment_fee" tool_tip="Ustaw opłatę za przyłączenie się do grupy."/>
 		<spinner label="L$" name="spin_enrollment_fee" tool_tip="Nowi członkowie grupy muszą zapłacić wymaganą opłatę by dołączyć do grupy."/>
 		<combo_box name="group_mature_check" tool_tip="Wybierz jeżeli uważasz, iż Twoja grupa klasyfikowana jest jako &apos;Mature&apos;.">
-			<combo_item name="select_mature">
-				- Wybierz klasyfikacjÄ™ wieku -
-			</combo_item>
-			<combo_box.item label="Treść &apos;Mature&apos;" name="mature"/>
 			<combo_box.item label="Treść &apos;PG&apos;" name="pg"/>
+			<combo_box.item label="Treść &apos;Mature&apos;" name="mature"/>
 		</combo_box>
 		<check_box initial_value="true" label="Wyświetlaj w wyszukiwarce" name="show_in_group_list" tool_tip="Udostępnij info o grupie w wyszukiwarce"/>
 	</panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_group_notices.xml b/indra/newview/skins/default/xui/pl/panel_group_notices.xml
index 1d727148e9dc2ea1c5fa67c22ed14ab018c5d4af..31882ab0e6fc948cd52aae96605e602aab035a2d 100644
--- a/indra/newview/skins/default/xui/pl/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/pl/panel_group_notices.xml
@@ -37,7 +37,6 @@ Limit dzienny ogłoszeń dla grupy wynosi 200.
 		<text name="string">
 			Przeciągnij i upuść załącznik tutaj aby go dodać:
 		</text>
-		<button label="Szafa" name="open_inventory" tool_tip="Otwórz Szafę"/>
 		<button label="Usuń załącznik" label_selected="Usuń Załącznik" name="remove_attachment" tool_tip="Usuń załącznik z noty"/>
 		<button label="Wyślij" label_selected="Wyślij" name="send_notice"/>
 		<group_drop_target name="drop_target" tool_tip="Przeciągnij załącznik ze swojej Szafy na pole docelowe aby wysłać go z Ogłoszeniem. Musisz posiadać prawo do kopiowania i transferu załącznika aby go dodać do ogłoszenia."/>
diff --git a/indra/newview/skins/default/xui/pl/panel_main_inventory.xml b/indra/newview/skins/default/xui/pl/panel_main_inventory.xml
index 8d6fa1173cf254136a262ad0e417c2951e9f9cfd..e0d9def8b32810d4d76371d13664494585a52110 100644
--- a/indra/newview/skins/default/xui/pl/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/pl/panel_main_inventory.xml
@@ -9,20 +9,62 @@
 	<text name="ItemcountText">
 		Obiekty:
 	</text>
+	<menu_bar name="Inventory Menu">
+		<menu label="Plik" name="File">
+			<menu_item_call label="Otwórz" name="Open"/>
+			<menu label="Załaduj" name="upload">
+				<menu_item_call label="obraz (L$[COST])..." name="Upload Image"/>
+				<menu_item_call label="dźwięk (L$[COST])..." name="Upload Sound"/>
+				<menu_item_call label="animacjÄ™ (L$[COST])..." name="Upload Animation"/>
+				<menu_item_call label="zbiór plików (L$[COST] za jeden plik)..." name="Bulk Upload"/>
+			</menu>
+			<menu_item_call label="Nowe Okno" name="New Window"/>
+			<menu_item_call label="Pokaż Filtry" name="Show Filters"/>
+			<menu_item_call label="Zresetuj Filtry" name="Reset Current"/>
+			<menu_item_call label="Zamknij Wszystkie Foldery" name="Close All Folders"/>
+			<menu_item_call label="Opróżnij Kosz" name="Empty Trash"/>
+			<menu_item_call label="Opróżnij Folder Zgubione i Znalezione" name="Empty Lost And Found"/>
+		</menu>
+		<menu label="Stwórz" name="Create">
+			<menu_item_call label="Nowy folder" name="New Folder"/>
+			<menu_item_call label="Nowy skrypt" name="New Script"/>
+			<menu_item_call label="Nowa nota" name="New Note"/>
+			<menu_item_call label="Nowy gest" name="New Gesture"/>
+			<menu label="Nowe Ubranie" name="New Clothes">
+				<menu_item_call label="NowÄ… kkoszulkÄ™" name="New Shirt"/>
+				<menu_item_call label="Nowe spodnie" name="New Pants"/>
+				<menu_item_call label="Nowe buty" name="New Shoes"/>
+				<menu_item_call label="Nowe skarpetki" name="New Socks"/>
+				<menu_item_call label="NowÄ… kurtkÄ™" name="New Jacket"/>
+				<menu_item_call label="Nową spódnicę" name="New Skirt"/>
+				<menu_item_call label="Nowe rękawiczki" name="New Gloves"/>
+				<menu_item_call label="Nowy podkoszulek" name="New Undershirt"/>
+				<menu_item_call label="NowÄ… bieliznÄ™" name="New Underpants"/>
+				<menu_item_call label="Nowe ubranie Alpha" name="New Alpha"/>
+				<menu_item_call label="Nowy tatuaż" name="New Tattoo"/>
+			</menu>
+			<menu label="Nową Część Ciała" name="New Body Parts">
+				<menu_item_call label="Nowy kształt" name="New Shape"/>
+				<menu_item_call label="Nową skórkę" name="New Skin"/>
+				<menu_item_call label="Nowe włosy" name="New Hair"/>
+				<menu_item_call label="Nowe oczy" name="New Eyes"/>
+			</menu>
+		</menu>
+		<menu label="UporzÄ…dkuj" name="Sort">
+			<menu_item_check label="Wegług bazwy" name="By Name"/>
+			<menu_item_check label="Według daty" name="By Date"/>
+			<menu_item_check label="Foldery zawsze według nazwy" name="Folders Always By Name"/>
+			<menu_item_check label="Foldery Systemowe od góry" name="System Folders To Top"/>
+		</menu>
+	</menu_bar>
 	<filter_editor label="Filtr" name="inventory search editor"/>
 	<tab_container name="inventory filter tabs">
 		<inventory_panel label="Wszystkie obiekty" name="All Items"/>
-		<recent_inventory_panel label="Ostatnio dodane obiekty" name="Recent Items"/>
+		<inventory_panel label="Ostatnio dodane obiekty" name="Recent Items"/>
 	</tab_container>
-	<layout_stack name="bottom_panel">
-		<layout_panel name="options_gear_btn_panel">
-			<button name="options_gear_btn" tool_tip="Pokaż dodatkowe opcje"/>
-		</layout_panel>
-		<layout_panel name="add_btn_panel">
-			<button name="add_btn" tool_tip="Dodaj nowy obiekt"/>
-		</layout_panel>
-		<layout_panel name="trash_btn_panel">
-			<dnd_button name="trash_btn" tool_tip="Usuń zaznaczony obiekt"/>
-		</layout_panel>
-	</layout_stack>
+	<panel name="bottom_panel">
+		<button name="options_gear_btn" tool_tip="Pokaż dodatkowe opcje"/>
+		<button name="add_btn" tool_tip="Dodaj nowy obiekt"/>
+		<dnd_button name="trash_btn" tool_tip="Usuń wybrany obiekt"/>
+	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_media_settings_permissions.xml b/indra/newview/skins/default/xui/pl/panel_media_settings_permissions.xml
index 6b93981accb3ffcb65941a82daa1843459e02625..939bcbbb4273eaf49a2bab4f023aa7d9bbed3853 100644
--- a/indra/newview/skins/default/xui/pl/panel_media_settings_permissions.xml
+++ b/indra/newview/skins/default/xui/pl/panel_media_settings_permissions.xml
@@ -11,19 +11,10 @@
 			Mini
 		</combo_item>
 	</combo_box>
-	<text name="owner_label">
-		Właściciel
-	</text>
 	<check_box initial_value="false" label="Pozwól na nawigację &amp; interaktywność" name="perms_owner_interact"/>
 	<check_box initial_value="false" label="Pokaż Pasek Kontroli" name="perms_owner_control"/>
-	<text name="group_label">
-		Grupa:
-	</text>
 	<check_box initial_value="false" label="Pozwól na nawigację &amp; Interaktywność" name="perms_group_interact"/>
 	<check_box initial_value="false" label="Pokaż Pasek Kontroli" name="perms_group_control"/>
-	<text name="anyone_label">
-		Każdy
-	</text>
 	<check_box initial_value="false" label="Pozwól na nawigację &amp; interaktywność" name="perms_anyone_interact"/>
 	<check_box initial_value="false" label="Pokaż Pasek Kontroli" name="perms_anyone_control"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_nearby_media.xml b/indra/newview/skins/default/xui/pl/panel_nearby_media.xml
index a78ab4d6f83a653d9c3d90cb08e964c13975a44d..a05c0d856fc25a7d242e2fbc1723e31b6dec06ee 100644
--- a/indra/newview/skins/default/xui/pl/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/pl/panel_nearby_media.xml
@@ -1,8 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="nearby_media">
-	<string name="media_item_count_format">
-		(%ld media items)
-	</string>
 	<string name="empty_item_text">
 		&lt;empty&gt;
 	</string>
@@ -19,14 +16,13 @@
 		<button label="Zatrzymaj" name="all_nearby_media_disable_btn" tool_tip="Wyłącz wszystkie media w pobliżu"/>
 		<button label="Włącz" name="all_nearby_media_enable_btn" tool_tip="Włącz wszystkie media w pobliżu"/>
 		<button name="open_prefs_btn" tool_tip="Uruchom preferencje medialne"/>
-		<button label="Więcej &gt;&gt;" label_selected="Mniej &lt;&lt;" name="more_btn" tool_tip="Zaawansowane"/>
-		<button label="Więcej &gt;&gt;" label_selected="Mniej &lt;&lt;" name="less_btn" tool_tip="Zaawansowane"/>
+		<button label="Więcej &gt;&gt;" label_selected="Mniej &lt;&lt;" name="more_less_btn" tool_tip="Zaawansowane"/>
 	</panel>
 	<panel name="nearby_media_panel">
-		<text name="nearby_media_title">
+		<text name="nearby_media">
 			Media w pobliżu
 		</text>
-		<text name="show_text">
+		<text name="show">
 			Pokaż:
 		</text>
 		<combo_box name="show_combo">
@@ -48,19 +44,19 @@
 					<button name="stop_btn" tool_tip="Zatrzymaj wybrane media"/>
 				</layout_panel>
 				<layout_panel name="play">
-					<button name="play_btn" tool_tip="WÅ‚Ä…cz wybrane media"/>
+					<button name="play_btn" tool_tip="Odtwarzaj wybrane media"/>
 				</layout_panel>
 				<layout_panel name="pause">
 					<button name="pause_btn" tool_tip="Zatrzymaj wybrane media"/>
 				</layout_panel>
 				<layout_panel name="volume_slider_ctrl">
-					<slider_bar initial_value="0.5" name="volume_slider" tool_tip="Głośność audio dla wybranych mediów"/>
+					<slider_bar initial_value="0.5" name="volume_slider" tool_tip="Regulacja audio dla wybranych mediów"/>
 				</layout_panel>
 				<layout_panel name="mute">
 					<button name="mute_btn" tool_tip="Wycisz audio wybranych mediów"/>
 				</layout_panel>
 				<layout_panel name="zoom">
-					<button name="zoom_btn" tool_tip="Przybliż wybrane media"/>
+					<button name="zoom_btn" tool_tip="Przybliż do wybranych mediów"/>
 				</layout_panel>
 				<layout_panel name="unzoom">
 					<button name="unzoom_btn" tool_tip="Oddal od wybranych mediów"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_people.xml b/indra/newview/skins/default/xui/pl/panel_people.xml
index 50fc0ba8af6b3bf371dbce5213ca98ad39be8b42..5ea5356c60c62b75de522460b9cbd1d95d613f32 100644
--- a/indra/newview/skins/default/xui/pl/panel_people.xml
+++ b/indra/newview/skins/default/xui/pl/panel_people.xml
@@ -1,23 +1,14 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <!-- Side tray panel -->
 <panel label="Ludzie" name="people_panel">
-	<string name="no_recent_people" value="Brak ostatnich rozmówców. Chcesz spotkać ludzi? Spróbuj [secondlife:///app/search/people Search] or the [secondlife:///app/worldmap Mapa Świata]."/>
-	<string name="no_filtered_recent_people" value="Nie znaleziono tego czego szukasz? Spróbuj [secondlife:///app/search/groups/[SEARCH_TERM] Szukaj]."/>
-	<string name="no_one_near" value="Nie ma nikogo w pobliżu. Chcesz spotkać ludzi? Spróbuj[secondlife:///app/search/people Search] lub [secondlife:///app/worldmap Mapa Świata]."/>
-	<string name="no_one_filtered_near" value="Nie znaleziono tego czego szukasz? Spróbuj [secondlife:///app/search/groups/[SEARCH_TERM] Szukaj]."/>
+	<string name="no_people" value="Brak ludzi"/>
+	<string name="no_one_near" value="Nikogo w pobliżu"/>
 	<string name="no_friends_online" value="Brak dostępnych Znajomych"/>
 	<string name="no_friends" value="Brak Znajomych"/>
-	<string name="no_friends_msg">
-		Wyszukaj znajomych [secondlife:///app/search/people Szukaj] lub kliknij prawym przyciskiem na Rezydenta aby zaproponować mu znajomość.
-Chcesz spotkać ludzi? Spróbuj [secondlife:///app/worldmap Mapa Świata].
-	</string>
-	<string name="no_filtered_friends_msg">
-		Nie znaleziono tego czego szukasz? Spróbuj [secondlife:///app/search/groups/[SEARCH_TERM] Szukaj].
-	</string>
 	<string name="people_filter_label" value="Filtruj Ludzi"/>
 	<string name="groups_filter_label" value="Filtruj Grupy"/>
-	<string name="no_filtered_groups_msg" value="Nie znaleziono tego czego szukasz? Spróbuj [secondlife:///app/search/groups/[SEARCH_TERM] Szukaj]."/>
-	<string name="no_groups_msg" value="Chcesz dołączyć do grup? Spróbuj [secondlife:///app/search/groups Szukaj]."/>
+	<string name="no_filtered_groups_msg" value="[secondlife:///app/search/groups Może spróbuj odnaleźć Grupę korzystając z Szukaj?]"/>
+	<string name="no_groups_msg" value="[secondlife:///app/search/groups Spróbuj wyszukać grupy aby do nich dołączyć.]"/>
 	<filter_editor label="Filtr" name="filter_input"/>
 	<tab_container name="tabs">
 		<panel label="W POBLIŻU" name="nearby_panel">
@@ -36,6 +27,10 @@ Chcesz spotkać ludzi? Spróbuj [secondlife:///app/worldmap Mapa Świata].
 				<button name="add_btn" tool_tip="Zaproponuj znajomość"/>
 				<button name="del_btn" tool_tip="Usuń wybraną osobę ze swojej listy znajomych"/>
 			</panel>
+			<text name="no_friends_msg">
+				By dodać nową znajomość skorzystaj ze strony [secondlife:///app/search/people ogólne wyszukiwanie] lub kliknij prawym przyciskiem myszki na Rezydenta by wysłać mu zaproszenie.
+Jeżeli szukasz ludzi, z którymi można się spotkać, kliknij tutaj [secondlife:///app/worldmap skorzystaj z mapy].
+			</text>
 		</panel>
 		<panel label="GRUPY" name="groups_panel">
 			<panel label="bottom_panel" name="bottom_panel">
@@ -52,13 +47,13 @@ Chcesz spotkać ludzi? Spróbuj [secondlife:///app/worldmap Mapa Świata].
 		</panel>
 	</tab_container>
 	<panel name="button_bar">
-		<button label="Profil" name="view_profile_btn" tool_tip="Pokaż zdjęcie, grupy i inne informacje o Rezydencie" width="55"/>
-		<button label="IM" name="im_btn" tool_tip="Rozpocznij rozmowÄ™ prywatnÄ… (IM)" width="35"/>
-		<button label="Zadzwoń" name="call_btn" tool_tip="Zadzwoń do tego Rezydenta" width="62"/>
-		<button label="Podziel się" name="share_btn" tool_tip="Udostępnij obiekt z Szafy" width="72"/>
-		<button label="Teleportuj" name="teleport_btn" tool_tip="Zaproponuj teleportacjÄ™" width="70"/>
-		<button label="Profil grupy" name="group_info_btn" tool_tip="Pokaż informacje o grupie" width="69"/>
-		<button label="Konferencja Grupowa" name="chat_btn" tool_tip="Rozpocznij konferencÄ™" width="124"/>
-		<button label="Rozmowa GÅ‚osowa" name="group_call_btn" tool_tip="Rozmowa GÅ‚osowa w tej Grupie" width="108"/>
+		<button label="Profil" name="view_profile_btn" tool_tip="Pokaż zdjęcie, grupy i inne informacje o Rezydencie"/>
+		<button label="IM" name="im_btn" tool_tip="Rozpocznij rozmowÄ™ prywatnÄ… (IM)"/>
+		<button label="Zadzwoń" name="call_btn" tool_tip="Zadzwoń do tego Rezydenta"/>
+		<button label="Podziel siÄ™" name="share_btn"/>
+		<button label="Teleportuj" name="teleport_btn" tool_tip="Zaproponuj teleportacjÄ™"/>
+		<button label="Profil grupy" name="group_info_btn" tool_tip="Pokaż informacje o grupie"/>
+		<button label="Konferencja Grupowa" name="chat_btn" tool_tip="Rozpocznij konferencÄ™"/>
+		<button label="Rozmowa GÅ‚osowa" name="group_call_btn" tool_tip="Rozmowa GÅ‚osowa w tej Grupie"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml b/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml
index 5805df402cf30c8592a23bfb9c46b49ccdb7f404..ae13cf662f615a223453e7e90016a9cb9297bf92 100644
--- a/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml
@@ -45,7 +45,6 @@
 	</text>
 	<check_box initial_value="true" label="Używaj animacji podczas pisania" name="play_typing_animation"/>
 	<check_box label="Wysyłaj wszystkie wiadomości (IM) na moją skrzynkę pocztową kiedy jestem niedostępny" name="send_im_to_email"/>
-	<check_box label="Zwykły tekst IM i historia czatu" name="plain_text_chat_history"/>
 	<text name="show_ims_in_label">
 		Pokaż wiadomości (IM) w:
 	</text>
diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml
index 99b3074fcb3d65fc5983364e188c069200873e97..bc08e025dd6287cbc3eb7cd720c387c659124a2a 100644
--- a/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Grafika" name="Display panel">
+	<text name="UI Size:">
+		UI rozmiar:
+	</text>
 	<text name="QualitySpeed">
 		Jakość i prędkość:
 	</text>
@@ -50,7 +53,6 @@
 			m
 		</text>
 		<slider label="Liczba czÄ…steczek:" name="MaxParticleCount"/>
-		<slider label="Max. # awatarów bez impostoryzacji:" name="MaxNumberAvatarDrawn"/>
 		<slider label="Jakość Post-Procesu:" name="RenderPostProcess"/>
 		<text name="MeshDetailText">
 			Szczególy obiektów:
diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml b/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml
index b0d02179fd44604cba2163c7eb4b6c645ed12197..04372208d6cc16c1f024d13c96ff24b65b7c3593 100644
--- a/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml
@@ -11,8 +11,8 @@
 	<check_box label="Odtwarzaj media" name="enable_media"/>
 	<slider label="Komunikacja GÅ‚osowa" name="Voice Volume"/>
 	<check_box label="Pozwól na rozmowy głosowe" name="enable_voice_check"/>
-	<check_box label="Automatycznie odtwarzaj media" name="media_auto_play_btn" tool_tip="Zaznacz tę funkcję by uruchomić automatyczne uruchamianie mediów" value="true"/>
-	<check_box label="Uruchom media załączone do innych awatarów" name="media_show_on_others_btn" tool_tip="Odznacz tę funkcję by ukryć media załączone to awatarów w publiżu" value="true"/>
+	<check_box label="Automatycznie odtwarzaj media" name="media_auto_play_btn" tool_tip="Zaznacz tę funkcję by uruchomić automatyczne uruchamianie mediów" value="prawda"/>
+	<check_box label="Uruchom media załączone do innych awatarów" name="media_show_on_others_btn" tool_tip="Odznacz tę funkcję by ukryć media załączone to awatarów w publiżu" value="prawda"/>
 	<text name="voice_chat_settings">
 		Ustawienia Komunikacji GÅ‚osowej
 	</text>
@@ -28,12 +28,6 @@
 		<panel.string name="default_text">
 			Domyślne
 		</panel.string>
-		<panel.string name="default system device">
-			Domyślne ustawienia sprzętowe
-		</panel.string>
-		<panel.string name="no device">
-			Brak sprzętu
-		</panel.string>
 		<text name="Input">
 			Wejściowe
 		</text>
diff --git a/indra/newview/skins/default/xui/pl/panel_status_bar.xml b/indra/newview/skins/default/xui/pl/panel_status_bar.xml
index 241848c280dac709c12dbe679a102e6eaf89f905..cd2ae14f6ccd75a0e9a8e768ce634b80f4d493f7 100644
--- a/indra/newview/skins/default/xui/pl/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/pl/panel_status_bar.xml
@@ -21,10 +21,8 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
-		<text name="balance" tool_tip="Mój bilans" value="L$20"/>
-		<button label="Kup L$" name="buyL" tool_tip="Kliknij aby kupić więcej L$"/>
-	</panel>
+	<button label="" label_selected="" name="buycurrency" tool_tip="Bilans"/>
+	<button label="Kup" name="buyL" tool_tip="Kliknij aby kupić L$"/>
 	<text name="TimeText" tool_tip="Obecny Czas (Pacyficzny)">
 		24:00 AM PST
 	</text>
diff --git a/indra/newview/skins/default/xui/pl/panel_world_map.xml b/indra/newview/skins/default/xui/pl/panel_world_map.xml
index 69f18be76700245110d82474de8e81bd2d976b80..849b01a1cef5d2e3b3183296a6f9e4305c008eac 100644
--- a/indra/newview/skins/default/xui/pl/panel_world_map.xml
+++ b/indra/newview/skins/default/xui/pl/panel_world_map.xml
@@ -30,12 +30,6 @@
 	<panel.string name="world_map_northwest">
 		NW
 	</panel.string>
-	<panel.string name="world_map_person">
-		1 osoba
-	</panel.string>
-	<panel.string name="world_map_people">
-		[NUMBER] ludzi
-	</panel.string>
 	<text label="N" name="floater_map_north" text="N">
 		N
 	</text>
diff --git a/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml b/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml
index 3282926bcd781361145315ffda8ba01b9683bf73..3b038a71028a4f8b06f0b24c588250f9982b5528 100644
--- a/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel name="item properties" title="Profil obiektu">
+<panel name="item properties" title="Profil Obiektu">
 	<panel.string name="unknown">
 		(nieznany)
 	</panel.string>
@@ -15,15 +15,9 @@
 	<panel.string name="acquiredDate">
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
-	<panel.string name="origin_inventory">
-		(Szafa)
-	</panel.string>
-	<panel.string name="origin_inworld">
-		(W Åšwiecie)
-	</panel.string>
-	<text name="title" value="Profil obiektu"/>
-	<text name="origin" value="(Szafa)"/>
-	<panel label="" name="item_profile">
+	<text name="title" value="Profil Obiektu"/>
+	<text name="where" value="(Szafa)"/>
+	<panel label="">
 		<text name="LabelItemNameTitle">
 			Nazwa:
 		</text>
@@ -41,13 +35,15 @@
 		<text name="LabelAcquiredTitle">
 			Nabyte:
 		</text>
-		<text name="LabelAcquiredDate"/>
+		<text name="LabelAcquiredDate">
+			Wed May 24 12:50:46 2006
+		</text>
 		<panel name="perms_inv">
 			<text name="perm_modify">
-				Możesz:
+				Ty możesz:
 			</text>
 			<check_box label="Zmienia" name="CheckOwnerModify"/>
-			<check_box label="Kopiuj" name="CheckOwnerCopy"/>
+			<check_box label="Kopiuje" name="CheckOwnerCopy"/>
 			<check_box label="Sprzedaje/Oddaje" name="CheckOwnerTransfer"/>
 			<text name="AnyoneLabel">
 				Każdy:
@@ -56,18 +52,18 @@
 			<text name="GroupLabel">
 				Grupa:
 			</text>
-			<check_box label="Udostępnij" name="CheckShareWithGroup" tool_tip="Pozwól wszystkim członkom ustawionej grupy na dzielenie prawa do modyfikacji dla tego obiektu. Musisz przypisać obiekt grupie aby aktywować ograniczenia wynikające z roli."/>
+			<check_box label="Udostępnij" name="CheckShareWithGroup" tool_tip="Pozwól wszystkim członkom ustawionej grupy na dzielenie prawa do modyfikacji dla tego obiektu. Musisz Przypisać aby aktywować ograniczenia wynikające z roli."/>
 			<text name="NextOwnerLabel">
 				Następny Właściciel:
 			</text>
 			<check_box label="Modyfikuje" name="CheckNextOwnerModify"/>
 			<check_box label="Kopiuje" name="CheckNextOwnerCopy"/>
-			<check_box label="Sprzedaje/Oddaje" name="CheckNextOwnerTransfer" tool_tip="Następny Właściciel może oddawać lub sprzedawać ten obiekt"/>
+			<check_box label="Sprzedaje/Oddaje" name="CheckNextOwnerTransfer" tool_tip="Następny właściciel może oddać lub sprzedać ten obiekt"/>
 		</panel>
-		<check_box label="Na sprzedaż" name="CheckPurchase"/>
+		<check_box label="Na Sprzedaż" name="CheckPurchase"/>
 		<combo_box name="combobox sale copy">
-			<combo_box.item label="Kopiuje" name="Copy"/>
-			<combo_box.item label="Oryginalny" name="Original"/>
+			<combo_box.item label="Kopia" name="Copy"/>
+			<combo_box.item label="Originał" name="Original"/>
 		</combo_box>
 		<spinner label="Cena: L$" name="Edit Cost"/>
 	</panel>
diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml
index e4423dc5ce11935a2d3b78f884c68b355539e025..c72f783a5189840a5b01f7efdf7bfa69882578c6 100644
--- a/indra/newview/skins/default/xui/pl/strings.xml
+++ b/indra/newview/skins/default/xui/pl/strings.xml
@@ -88,24 +88,6 @@
 	<string name="LoginDownloadingClothing">
 		Ładowanie ubrania...
 	</string>
-	<string name="InvalidCertificate">
-		Serwer zwrócił nieważny lub zniekształcony certyfikat. Proszę skontaktuj się z administratorem Grida.
-	</string>
-	<string name="CertInvalidHostname">
-		Nazwa hosta jest nieważna, proszę sprawdź SLURL lub nazwę hosta Grida.
-	</string>
-	<string name="CertExpired">
-		Termin ważności certyfikatu zwróconego przez Grid minął. Proszę sprawdzić swój zegar systemowy lub skontaktować się z administratorem Grida.
-	</string>
-	<string name="CertKeyUsage">
-		Certyfikat zwrócony przez serwer nie może być użyty dla SSL.  Proszę skontaktuj się z administratorem Grida.
-	</string>
-	<string name="CertBasicConstraints">
-		Zbyt wiele certyfikatów w łańcuchu certyfikatów serwera. Proszę skontaktować się z administratorem Grida.
-	</string>
-	<string name="CertInvalidSignature">
-		Podpis certyfikatu zwrócony przez Grid nie mógł zostać zweryfikowany. Proszę skontaktować się z administratorem Grida.
-	</string>
 	<string name="LoginFailedNoNetwork">
 		Błąd sieci: Brak połączenia z siecią, sprawdź status swojego połączenia internetowego.
 	</string>
@@ -181,7 +163,6 @@
 	<string name="TooltipMustSingleDrop">
 		Tylko pojedynczy obiekt może być tutaj przeciągnięty
 	</string>
-	<string name="TooltipPrice" value="L$[AMOUNT]:"/>
 	<string name="TooltipHttpUrl">
 		Kliknij by zobaczyć zawartość tej strony internetowej
 	</string>
@@ -234,6 +215,7 @@
 		Kliknij by uruchomić secondlife:// command
 	</string>
 	<string name="CurrentURL" value=" Obecny Adres: [CurrentURL]"/>
+	<string name="TooltipPrice" value="L$[PRICE]-"/>
 	<string name="SLurlLabelTeleport">
 		Teleportuj do
 	</string>
@@ -264,9 +246,6 @@
 	<string name="BUTTON_CLOSE_WIN">
 		Zamknij (Ctrl+W)
 	</string>
-	<string name="BUTTON_CLOSE_CHROME">
-		Zamknij
-	</string>
 	<string name="BUTTON_RESTORE">
 		Odzyskaj
 	</string>
@@ -294,9 +273,6 @@
 	<string name="ReleaseNotes">
 		O Tej Wersji
 	</string>
-	<string name="RELEASE_NOTES_BASE_URL">
-		http://wiki.secondlife.com/wiki/Release_Notes/
-	</string>
 	<string name="LoadingData">
 		Ładowanie danych...
 	</string>
@@ -309,9 +285,6 @@
 	<string name="GroupNameNone">
 		(brak danych)
 	</string>
-	<string name="AvalineCaller">
-		Avaline Caller [ORDER]
-	</string>
 	<string name="AssetErrorNone">
 		OK
 	</string>
@@ -642,9 +615,6 @@
 	<string name="worldmap_offline">
 		Mapa Świata jest Niedostępna
 	</string>
-	<string name="worldmap_item_tooltip_format">
-		[AREA] m² L$[PRICE]
-	</string>
 	<string name="worldmap_results_none_found">
 		Miejsce Nieodnalezione.
 	</string>
@@ -735,12 +705,6 @@
 	<string name="land_type_unknown">
 		(nieznane)
 	</string>
-	<string name="Estate / Full Region">
-		MajÄ…tek / Region
-	</string>
-	<string name="Mainland / Full Region">
-		Mainland / Region
-	</string>
 	<string name="all_files">
 		Wszystkie Pliki
 	</string>
@@ -846,93 +810,6 @@
 	<string name="invalid">
 		niewłaściwa funkcja
 	</string>
-	<string name="none">
-		żadne
-	</string>
-	<string name="shirt_not_worn">
-		Koszula niezałożona
-	</string>
-	<string name="pants_not_worn">
-		Spodnie niezałożone
-	</string>
-	<string name="shoes_not_worn">
-		Buty niezałożone
-	</string>
-	<string name="socks_not_worn">
-		Skarpetki niezałożone
-	</string>
-	<string name="jacket_not_worn">
-		Kurtka niezałożona
-	</string>
-	<string name="gloves_not_worn">
-		Rękawiczki niezałożone
-	</string>
-	<string name="undershirt_not_worn">
-		Podkoszulek niezałożony
-	</string>
-	<string name="underpants_not_worn">
-		Bielizna niezałożona
-	</string>
-	<string name="skirt_not_worn">
-		Spódnica niezałożona
-	</string>
-	<string name="alpha_not_worn">
-		Alpha niezałożone
-	</string>
-	<string name="tattoo_not_worn">
-		Tatuaż niezałożony
-	</string>
-	<string name="invalid_not_worn">
-		nieważny
-	</string>
-	<string name="create_new_shape">
-		Nowy kształt
-	</string>
-	<string name="create_new_skin">
-		Nowa skórka
-	</string>
-	<string name="create_new_hair">
-		Nowe włosy
-	</string>
-	<string name="create_new_eyes">
-		Nowe oczy
-	</string>
-	<string name="create_new_shirt">
-		Nowa koszula
-	</string>
-	<string name="create_new_pants">
-		Nowe spodnie
-	</string>
-	<string name="create_new_shoes">
-		Nowe buty
-	</string>
-	<string name="create_new_socks">
-		Nowe skarpetki
-	</string>
-	<string name="create_new_jacket">
-		Nowa kurtka
-	</string>
-	<string name="create_new_gloves">
-		Nowe rękawiczki
-	</string>
-	<string name="create_new_undershirt">
-		Nowy podkoszulek
-	</string>
-	<string name="create_new_underpants">
-		Nowa bielizna
-	</string>
-	<string name="create_new_skirt">
-		Nowa spódnica
-	</string>
-	<string name="create_new_alpha">
-		Nowe alpha
-	</string>
-	<string name="create_new_tattoo">
-		Nowy tatuaż
-	</string>
-	<string name="create_new_invalid">
-		nieważny
-	</string>
 	<string name="NewWearable">
 		Nowa [WEARABLE_ITEM]
 	</string>
@@ -1003,10 +880,7 @@
 		Wybierz ESC by powrócić do trybu widoku normalne
 	</string>
 	<string name="InventoryNoMatchingItems">
-		Nie znaleziono tego czego szukasz? Spróbuj [secondlife:///app/search/all/[SEARCH_TERM] Szukaj].
-	</string>
-	<string name="PlacesNoMatchingItems">
-		Nie znaleziono tego czego szukasz? Spróbuj [secondlife:///app/search/places/[SEARCH_TERM] Szukaj].
+		Obiektu nie znaleziono w Szafie.  Spróbuj [secondlife:///app/search/groups &quot;Search&quot;].
 	</string>
 	<string name="FavoritesNoMatchingItems">
 		Przeciągnij landmark tutaj aby dodać go do swoich ulubionych.
@@ -1034,10 +908,8 @@
 	<string name="AnimFlagStop" value=" Zatrzymaj AnimacjÄ™ :"/>
 	<string name="AnimFlagStart" value=" Rozpocznij AnimacjÄ™ :"/>
 	<string name="Wave" value=" Wave"/>
-	<string name="GestureActionNone" value="Żadne"/>
 	<string name="HelloAvatar" value=" Witaj, Awatarze!"/>
 	<string name="ViewAllGestures" value="  Zobacz Wszystkie &gt;&gt;"/>
-	<string name="GetMoreGestures" value="Więcej gesturek &gt;&gt;"/>
 	<string name="Animations" value=" Animacje,"/>
 	<string name="Calling Cards" value=" Wizytówki,"/>
 	<string name="Clothing" value=" Ubrania,"/>
@@ -1114,12 +986,12 @@
 	<string name="InvFolder Gestures">
 		Gesturki
 	</string>
+	<string name="InvFolder favorite">
+		Ulubione
+	</string>
 	<string name="InvFolder Current Outfit">
 		Obecne Ubranie
 	</string>
-	<string name="InvFolder Initial Outfits">
-		PoczÄ…tkowe stroje
-	</string>
 	<string name="InvFolder My Outfits">
 		Moje Ubranie
 	</string>
@@ -1439,7 +1311,6 @@
 	<string name="SummaryForTheWeek" value="Podsumowanie dla tego tygodnia, poczÄ…wszy od "/>
 	<string name="NextStipendDay" value="Następna wypłata będzie w "/>
 	<string name="GroupIndividualShare" value="                      Groupa       Udziały Indywidualne"/>
-	<string name="GroupColumn" value="Grupa"/>
 	<string name="Balance">
 		Stan
 	</string>
@@ -1635,44 +1506,32 @@
 	<string name="ATTACH_HUD_BOTTOM_RIGHT">
 		HUD Dolna P Strona
 	</string>
-	<string name="Bad attachment point">
-		Nieprawidłowy punkt załączenia
-	</string>
 	<string name="CursorPos">
 		Linia [LINE], Kolumna [COLUMN]
 	</string>
 	<string name="PanelDirCountFound">
 		[COUNT] odnalezionych
 	</string>
-	<string name="PanelContentsTooltip">
-		Zawartość obiektu
-	</string>
 	<string name="PanelContentsNewScript">
 		Nowy Skrypt
 	</string>
+	<string name="PanelContentsTooltip">
+		Zawartość obiektu
+	</string>
 	<string name="BusyModeResponseDefault">
 		Rezydent, do którego wysłałeś wiadomość prywatną znajduje się w trybie pracy. Oznacza to, iż Twoja wiadomość zostanie zapisana do przeglądnięcia poźniej.
 	</string>
-	<string name="NoOutfits">
-		Nie posiadasz jeszcze żadnych strojów. Spróbuj [secondlife:///app/search/all/ Szukaj]
-	</string>
-	<string name="NoOutfitsTabsMatched">
-		Nie znaleziono tego czego szukasz? Spróbuj [secondlife:///app/search/all/[SEARCH_TERM] Szukaj].
-	</string>
 	<string name="MuteByName">
-		(Nazwa)
+		(według nazwy)
 	</string>
 	<string name="MuteAgent">
 		(Rezydent)
 	</string>
 	<string name="MuteObject">
-		(Obiekt)
+		(obiekt)
 	</string>
 	<string name="MuteGroup">
-		(GrupÄ™)
-	</string>
-	<string name="MuteExternal">
-		(Zewnętrzne)
+		(grupÄ™)
 	</string>
 	<string name="RegionNoCovenant">
 		Brak umowy dla tego majÄ…tku.
@@ -1680,7 +1539,9 @@
 	<string name="RegionNoCovenantOtherOwner">
 		Brak umowy dla tego majątku. Każda posiadłość w tym majątku została sprzedana przez Właściciela majątku nie Linden Lab. Skontaktuj się z właścicielem majątku w celu uzuskania szczegółów sprzedaży.
 	</string>
-	<string name="covenant_last_modified" value="Ostatnio modyfikowano:"/>
+	<string name="covenant_last_modified">
+		Ostatnia Modyfikacja:
+	</string>
 	<string name="none_text" value=" (żadne) "/>
 	<string name="never_text" value=" (nigdy) "/>
 	<string name="GroupOwned">
@@ -3357,15 +3218,6 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 	<string name="LocationCtrlComboBtnTooltip">
 		Historia odwiedzonych miejsc
 	</string>
-	<string name="LocationCtrlAdultIconTooltip">
-		Region Adult
-	</string>
-	<string name="LocationCtrlModerateIconTooltip">
-		Region Moderate
-	</string>
-	<string name="LocationCtrlGeneralIconTooltip">
-		Region
-	</string>
 	<string name="UpdaterWindowTitle">
 		[APP_NAME] Aktualizacja
 	</string>
@@ -3396,12 +3248,6 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 	<string name="UpdaterFailStartTitle">
 		Uruchomienie klienta nie powiodło się
 	</string>
-	<string name="ItemsComingInTooFastFrom">
-		[APP_NAME]: Obiekty ładują się zbyt szybko od [FROM_NAME], automatyczny podgląd jest wyłączony na [TIME] sekund
-	</string>
-	<string name="ItemsComingInTooFast">
-		[APP_NAME]: Obiekty ładują się zbyt szybko, automatyczny podgląd jest wyłączony na [TIME] sekund
-	</string>
 	<string name="IM_logging_string">
 		-- Zapisywanie logów rozmowy aktywowane --
 	</string>
@@ -3429,17 +3275,11 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 	<string name="IM_moderator_label">
 		(Moderator)
 	</string>
-	<string name="answered_call">
-		Twoja rozmowa głosowa została odebrana
+	<string name="started_call">
+		Rozpoczęta rozmowa głosowa
 	</string>
-	<string name="you_started_call">
-		Rozmowa głosowa została rozpoczęta
-	</string>
-	<string name="you_joined_call">
-		Dołączyłeś/Dołączyłaś do rozmowy głosowej
-	</string>
-	<string name="name_started_call">
-		[NAME] zaczyna rozmowę głosową
+	<string name="joined_call">
+		Dołączył do rozmowy głosowej
 	</string>
 	<string name="ringing-im">
 		Rozmowa głosowa...
@@ -3516,21 +3356,12 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 	<string name="unread_chat_multiple">
 		[SOURCES] powiedział/a coś nowego
 	</string>
-	<string name="session_initialization_timed_out_error">
-		Inicjalizacja sesji wygasła
-	</string>
-	<string name="voice_morphing_url">
-		http://secondlife.com/landing/voicemorphing
-	</string>
 	<string name="paid_you_ldollars">
 		[NAME] zapłacił Ci L$[AMOUNT]
 	</string>
 	<string name="you_paid_ldollars">
 		Zapłacono [NAME] [AMOUNT]L$ [REASON].
 	</string>
-	<string name="you_paid_ldollars_no_info">
-		Zapłacono L$[AMOUNT].
-	</string>
 	<string name="you_paid_ldollars_no_reason">
 		Zapłacono [NAME] [AMOUNT]L$.
 	</string>
@@ -3579,9 +3410,6 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 	<string name="group_role_owners">
 		Właściciele
 	</string>
-	<string name="group_member_status_online">
-		Obecnie w SL
-	</string>
 	<string name="uploading_abuse_report">
 		Pobieranie...
   
@@ -3635,203 +3463,13 @@ Raport o Nadużyciu
 	<string name="Invalid Wearable">
 		Nieaktualne ubranie/część ciała
 	</string>
-	<string name="New Gesture">
-		Nowy gest
-	</string>
 	<string name="New Script">
 		Nowy skrypt
 	</string>
-	<string name="New Note">
-		Stwórz nowe ogłoszenie
-	</string>
 	<string name="New Folder">
 		Nowy folder
 	</string>
 	<string name="Contents">
 		Zawartość
 	</string>
-	<string name="Gesture">
-		Gesturki
-	</string>
-	<string name="Male Gestures">
-		Gesturki dla mężczyzn
-	</string>
-	<string name="Female Gestures">
-		Gesturki dla kobiet
-	</string>
-	<string name="Other Gestures">
-		Inne gesturki
-	</string>
-	<string name="Speech Gestures">
-		Gesturki przemówienia
-	</string>
-	<string name="Common Gestures">
-		Gesturki
-	</string>
-	<string name="Male - Excuse me">
-		Mężczyzna - Excuse me
-	</string>
-	<string name="Male - Get lost">
-		Mężczyzna - Get lost
-	</string>
-	<string name="Male - Blow kiss">
-		Mężczyzna - Blow kiss
-	</string>
-	<string name="Male - Boo">
-		Mężczyzna - Boo
-	</string>
-	<string name="Male - Bored">
-		Mężczyzna - Znudzony
-	</string>
-	<string name="Male - Hey">
-		Mężczyzna - Hey
-	</string>
-	<string name="Male - Laugh">
-		Mężczyzna - Śmiech
-	</string>
-	<string name="Male - Repulsed">
-		Mężczyzna - Odrzucenie
-	</string>
-	<string name="Male - Shrug">
-		Mężczyzna - Wzruszenie ramionami
-	</string>
-	<string name="Male - Stick tougue out">
-		Mężczyzna - Pokaż język
-	</string>
-	<string name="Male - Wow">
-		Mężczyzna - Wow
-	</string>
-	<string name="Female - Chuckle">
-		Kobieta - Chichot
-	</string>
-	<string name="Female - Cry">
-		Kobieta - PÅ‚acze
-	</string>
-	<string name="Female - Embarrassed">
-		Kobieta - Zakłopotana
-	</string>
-	<string name="Female - Excuse me">
-		Kobieta - Excuse me
-	</string>
-	<string name="Female - Get lost">
-		Kobieta - Get lost
-	</string>
-	<string name="Female - Blow kiss">
-		Kobieta - Blow kiss
-	</string>
-	<string name="Female - Boo">
-		Kobieta - Boo
-	</string>
-	<string name="Female - Bored">
-		Kobieta - Znudzona
-	</string>
-	<string name="Female - Hey">
-		Kobieta - Hey
-	</string>
-	<string name="Female - Hey baby">
-		Kobieta - Hey baby
-	</string>
-	<string name="Female - Laugh">
-		Kobieta - Åšmiech
-	</string>
-	<string name="Female - Looking good">
-		Kobieta - Looking good
-	</string>
-	<string name="Female - Over here">
-		Kobieta - Over here
-	</string>
-	<string name="Female - Please">
-		Kobieta - Please
-	</string>
-	<string name="Female - Repulsed">
-		Kobieta - Odrzucenie
-	</string>
-	<string name="Female - Shrug">
-		Kobieta - Wzruszenie ramionami
-	</string>
-	<string name="Female - Stick tougue out">
-		Kobieta - Pokaż język
-	</string>
-	<string name="Female - Wow">
-		Kobieta - Wow
-	</string>
-	<string name="AvatarBirthDateFormat">
-		[mthnum,datetime,slt]/[day,datetime,slt]/[year,datetime,slt]
-	</string>
-	<string name="DefaultMimeType">
-		żadne/żadne
-	</string>
-	<string name="texture_load_dimensions_error">
-		Nie można załadować zdjęcia większego niż [WIDTH]*[HEIGHT]
-	</string>
-	<string name="words_separator" value=","/>
-	<string name="server_is_down">
-		Pomimo naszych najlepszych starań wystąpił niespodziewany problem.
-
-	Proszę sprawdzić czy na stronie status.secondlifegrid.net nie zostały umieszczone informacje o rozpoznanych problemach serwera.
-        Jeśli problemy będą występowały nadal, proszę sprawdź sieć i ustawienia firewall.
-	</string>
-	<string name="dateTimeWeekdaysNames">
-		Niedziela:Poniedziałek:Wtorek:Środa:Czwartek:Piątek:Sobota
-	</string>
-	<string name="dateTimeWeekdaysShortNames">
-		Niedz.:Pon.:Wt.:Åšr.:Czw.:Pt.:Sob.
-	</string>
-	<string name="dateTimeMonthNames">
-		Styczeń:Luty:Marzec:Kwiecień:Maj:Czerwiec:Lipiec:Sierpień:Wrzesień:Październik:Listopad:Grudzień
-	</string>
-	<string name="dateTimeMonthShortNames">
-		St.:Lt.:Mrz.:Kw.:Maj:Cz.:Lp.:Sie.:Wrz.:Li.:Paź.:Gru.
-	</string>
-	<string name="dateTimeDayFormat">
-		[MDAY]
-	</string>
-	<string name="dateTimeAM">
-		AM
-	</string>
-	<string name="dateTimePM">
-		PM
-	</string>
-	<string name="LocalEstimateUSD">
-		US$ [AMOUNT]
-	</string>
-	<string name="Membership">
-		Członkostwo
-	</string>
-	<string name="Roles">
-		Funkcje
-	</string>
-	<string name="Group Identity">
-		Status Grupy
-	</string>
-	<string name="Parcel Management">
-		Parcel Management
-	</string>
-	<string name="Parcel Identity">
-		Parcel Identity
-	</string>
-	<string name="Parcel Settings">
-		Parcel Settings
-	</string>
-	<string name="Parcel Powers">
-		Parcel Powers
-	</string>
-	<string name="Parcel Access">
-		Dostęp do posiadłości
-	</string>
-	<string name="Parcel Content">
-		Parcel Content
-	</string>
-	<string name="Object Management">
-		Object Management
-	</string>
-	<string name="Accounting">
-		Accounting
-	</string>
-	<string name="Notices">
-		Ogłoszenia
-	</string>
-	<string name="Chat">
-		Czat
-	</string>
 </strings>
diff --git a/indra/newview/skins/default/xui/pt/floater_about.xml b/indra/newview/skins/default/xui/pt/floater_about.xml
index 4044110b47cc722977543556a6ead8abad10a0ea..f1f6ff9aea581b2c2756acbb8684e8968c95f1cc 100644
--- a/indra/newview/skins/default/xui/pt/floater_about.xml
+++ b/indra/newview/skins/default/xui/pt/floater_about.xml
@@ -26,9 +26,9 @@ Placa gráfica: [GRAPHICS_CARD]
 
 Versão libcurl: [LIBCURL_VERSION]
 Versão J2C Decoder: [J2C_VERSION]
-Versão do driver de áudio: [AUDIO_DRIVER_VERSION]
+Versão do driver de áudio: [AUDIO_DRIVER_VERSION] 
 Versão Qt Webkit: [QT_WEBKIT_VERSION]
-Versão do servidor de voz: [VOICE_VERSION]
+Versão Vivox: [VIVOX_VERSION]
 	</floater.string>
 	<floater.string name="none">
 		(nenhum)
@@ -44,12 +44,17 @@ Versão do servidor de voz: [VOICE_VERSION]
 			<text_editor name="credits_editor">
 				O Second Life é o resultado do trabalho de Philip, Tessa, Andrew, Cory, James, Ben, Char, Charlie, Colin, Dan, Daniel, Doug, Eric, Hamlet, Haney, Eve, Hunter, Ian, Jeff, Jennifer, Jim, John, Lee, Mark, Peter, Phoenix, Richard, Robin, Xenon, Steve, Tanya, Eddie, Avi, Frank, Bruce, Aaron, Alice, Bob, Debra, Eileen, Helen, Janet, Louie, Leviathania, Stefan, Ray, Kevin, Tom, Mikeb, MikeT, Burgess, Elena, Tracy, Bill, Todd, Ryan, Zach, Sarah, Nova, Tim, Stephanie, Michael, Evan, Nicolas, Catherine, Rachelle, Dave, Holly, Bub, Kelly, Magellan, Ramzi, Don, Sabin, Jill, Rheya, Jeska, Torley, Kona, Callum, Charity, Ventrella, Jack, Vektor, Iris, Chris, Nicole, Mick, Reuben, Blue, Babbage, Yedwab, Deana, Lauren, Brent, Pathfinder, Chadrick, Altruima, Jesse, Teeny, Monroe, Icculus, David, Tess, Lizzie, Patsy, Isaac, Lawrence, Cyn, Bo, Gia, Annette, Marius, Tbone, Jonathan, Karen, Ginsu, Satoko, Yuko, Makiko, Thomas, Harry, Seth, Alexei, Brian, Guy, Runitai, Ethan, Data, Cornelius, Kenny, Swiss, Zero, Natria, Wendy, Stephen, Teeple, Thumper, Lucy, Dee, Mia, Liana, Warren, Branka, Aura, beez, Milo, Hermia, Red, Thrax, Joe, Sally, Magenta, Mogura, Paul, Jose, Rejean, Henrik, Lexie, Amber, Logan, Xan, Nora, Morpheus, Donovan, Leyla, MichaelFrancis, Beast, Cube, Bucky, Joshua, Stryfe, Harmony, Teresa, Claudia, Walker, Glenn, Fritz, Fordak, June, Cleopetra, Jean, Ivy, Betsy, Roosevelt, Spike, Ken, Which, Tofu, Chiyo, Rob, Zee, dustin, George, Del, Matthew, Cat, Jacqui, Lightfoot, Adrian, Viola, Alfred, Noel, Irfan, Sunil, Yool, Rika, Jane, Xtreme, Frontier, a2, Neo, Siobhan, Yoz, Justin, Elle, Qarl, Benjamin, Isabel, Gulliver, Everett, Christopher, Izzy, Stephany, Garry, Sejong, Sean, Tobin, Iridium, Meta, Anthony, Jeremy, JP, Jake, Maurice, Madhavi, Leopard, Kyle, Joon, Kari, Bert, Belinda, Jon, Kristi, Bridie, Pramod, KJ, Socrates, Maria, Ivan, Aric, Yamasaki, Adreanne, Jay, MitchK, Ceren, Coco, Durl, Jenny, Periapse, Kartic, Storrs, Lotte, Sandy, Rohn, Colossus, Zen, BigPapi, Brad, Pastrami, Kurz, Mani, Neuro, Jaime, MJ, Rowan, Sgt, Elvis, Gecko, Samuel, Sardonyx, Leo, Bryan, Niko, Soft, Poppy, Rachel, Aki, Angelo, Banzai, Alexa, Sue, CeeLo, Bender, CG, Gillian, Pelle, Nick, Echo, Zara, Christine, Shamiran, Emma, Blake, Keiko, Plexus, Joppa, Sidewinder, Erica, Ashlei, Twilight, Kristen, Brett, Q, Enus, Simon, Bevis, Kraft, Kip, Chandler, Ron, LauraP, Ram, KyleJM, Scouse, Prospero, Melissa, Marty, Nat, Hamilton, Kend, Lordan, Jimmy, Kosmo, Seraph, Green, Ekim, Wiggo, JT, Rome, Doris, Miz, Benoc, Whump, Trinity, Patch, Kate, TJ, Bao, Joohwan, Christy, Sofia, Matias, Cogsworth, Johan, Oreh, Cheah, Angela, Brandy, Mango, Lan, Aleks, Gloria, Heidy, Mitchell, Space, Colton, Bambers, Einstein, Maggie, Malbers, Rose, Winnie, Stella, Milton, Rothman, Niall, Marin, Allison, Katie, Dawn, Katt, Dusty, Kalpana, Judy, Andrea, Ambroff, Infinity, Gail, Rico, Raymond, Yi, William, Christa, M, Teagan, Scout, Molly, Dante, Corr, Dynamike, Usi, Kaylee, Vidtuts, Lil, Danica, Sascha, Kelv, Jacob, Nya, Rodney, Brandon, Elsie, Blondin, Grant, Katrin, Nyx, Gabriel, Locklainn, Claire, Devin, Minerva, Monty, Austin, Bradford, Si, Keira, H, Caitlin, Dita, Makai, Jenn, Ann, Meredith, Clare, Joy, Praveen, Cody, Edmund, Ruthe, Sirena, Gayathri, Spider, FJ, Davidoff, Tian, Jennie, Louise, Oskar, Landon, Noelle, Jarv, Ingrid, Al, Sommer, Doc, Aria, Huin, Gray, Lili, Vir, DJ, Yang, T, Simone, Maestro, Scott, Charlene, Quixote, Amanda, Susan, Zed, Anne, Enkidu, Esbee, Joroan, Katelin, Roxie, Tay, Scarlet, Kevin, Johnny, Wolfgang, Andren, Bob, Howard, Merov, Rand, Ray, Michon, Newell, Galen, Dessie, Les e muitos mais.
 
-Agradecemos também aos seguintes residentes por sua colaboração na mais nova versão do Second Life: Drew Dwi, Zai Lynch, Latif Khalifa, Ellla McMahon, Harleen Gretzky, Squirrel Wood, Malarthi Behemoth, Dante Tucker, Buckaroo Mu, Eddi Decosta, Dirk, Talamasca, Torben Trautman, Irene Muni, Lilly Zenovka, Vick Forcella, Sasy Scarborough, Gentle Welinder, Elric Anatine, Techwolf Lupindo, Dusan Writer, WolfPup Lowenhar, Marianne McCann, Fiachra Lach, Sitearm Madonna, Sudane Erato, Sahkolihaa Contepomi, Sachi Vixen, Questar Utu, Dimitrio Lewis, Matto Destiny, Scrim Pinion, Radio Signals, Psi Merlin, Pixel Gausman, Mel Vanbeeck, Laurent Bechir, Lamorna Proctor, Lares Carter, Gwyneth Llewelyn, Hydra Shaftoe, Holger Gilruth, Gentle Heron, Carla Broek, Boroondas Gupte, Fury Rosewood, Flower Ducatillon, Colpo Wexler, gwampa Lomu, Borg Capalini, Beansy Twine, Ardy Lay, , 45ms Zhong, Adeon Writer, Aeonix Aeon, Ai Austin, Aiko Ying, Alexandrea Fride, Alliez Mysterio, Annie Milestone, Annika Genezzia, Ansariel Hiller, ArminasX Saiman, Arya Braveheart, Asaeda Meltingdots, Asturkon Jua, Avallyn Oakleaf, Avatar Quinzet, BabyA Littlething, Bacchus Ireto, Bazaar, Riva, Benjamin Bigdipper, Beth Walcher, Bezilon Kasei, Biancaluce Robbiani, Bill Walach, blakopal Galicia, Blitzckreed Levenque, Bryn Oh, Callipygian Christensen, Cap Carver, Carr Arbenlow, Chantal Harvey, Charles Courtois, Charlie Sazaland, Cherry Cheevers, ChickyBabes Zuzu, Christopher  Organiser, Ciaran Laval, Clara Young, Celierra Darling, Corinne Helendale, Corro Moseley, Coughdrop Littlething, Darien Caldwell, Dartagan Shepherd, Debs Regent, Decro Schmooz, Denim Kamachi, DiJodi Dubratt, Dil Spitz, Edgware Marker, Egehan Dryke, Emma Portilo, Emmie Fairymeadow, Evangelista Emerald, Faelon Swordthain, Frenchimmo Sabra, Gaberoonie Zanzibar, Ganymedes Costagravas, Gene Frostbite, GeneJ Composer, Giggles Littlebird, Grady Echegaray, Guni Greenstein, Gypsy Tripsa, Hackshaven Harford, Ham Rambler, Han Shuffle, Hanglow Short, Hatzfeld Runo, herina Bode, Horatio Freund, Hypatia Callisto, Hypatia Pickens, Identity Euler, Imnotgoing Sideways, Innula Zenovka, Iyoba Tarantal, Jack Abraham, Jagga Meredith, Jennifer Boyle, Jeremy Marquez, Jessica Qin, Jinx Nordberg, Jo Bernandes, Jocial Sonnenkern, Joel Savard, Jondan Lundquist, Josef Munster, Josette Windlow, Juilan Tripsa, Juro Kothari, Justin RiversRunRed, Kagehi Kohn, Kaimen Takahe, Keklily Longfall, Ken Lavender, Kestral Karas, Khisme Nitely, Kimar Coba, Kithrak Kirkorian, Kitty Barnett, Kolor Fall, Komiko Okamoto, Korvel Noh, Larry Pixel, Leal Choche, len Starship, Lenae Munz, Lexi Frua, Lillie Cordeaux, Lizzy Macarthur, LSL Scientist, Luban Yiyuan, Luc Starsider, Maccus McCullough, Madison Blanc, Maggie Darwin, Mallory Destiny, Manx Wharton, Marc Claridge, Marc2 Sands, Matthew Anthony, Maxim RiversRunRed, Medhue Simoni, Melinda Latynina, Mencius Watts, Michi Lumin, Midian Farspire, Miles Glaz, Mindy Mathy, Mitch Wagner, Mo Hax, Mourna Biziou, Nao Noe, naofan Teardrop, Naomah Beaumont, Nathiel Siamendes, Nber Medici, Neko Link, Netpat Igaly, Neutron Chesnokov, Newfie Pendragon, Nicholai Laviscu, Nick Rhodes, Nicoladie Gymnast, Ollie Kubrick, Orenj Marat, Orion Delphis, Oryx Tempel, Parvati Silverweb, PeterPunk Mooney, Pixel Scientist, Pounce Teazle, Professor Noarlunga, Quantum Destiny, Quicksilver Hermes, Ralf Setsuko, RAT Quan, RedMokum Bravin, Revolution Perenti, Rezit Sideways, Rich Grainger, Rosco Teardrop, Rose Evans, Rudee Voom, RufusTT Horsefly, Saii Hallard, SaintLEOlions Zimer, Samm Larkham, Satanello Miami, SexySteven Morrisey, Sheet Spotter, Shnurui Troughton, sicarius Thorne, Sicarius Toxx, Sini Nubalo, SLB Wirefly, snowy Sidran, Soupa Segura, ST Mensing, Starshine Halasy, Stickman Ingmann, Synystyr Texan, Takeda Terrawyng, Tali Rosca, Templar Merlin, Tezcatlipoca Bisiani, Tiel Stonecutter, Tony Kembia, TouchaHoney Perhaps, Trey Reanimator, TriloByte Zanzibar, Trinity Dechou, Trinity Dejavu, Unlikely Quintessa, UsikuFarasi Kanarik, Veritas Raymaker, Vex Streeter, Viaticus Speculaas, Villain Baroque, Vixie Durant, Void Singer, Watty Berkson, Westley Schridde, Westley Streeter, Whimsy Winx, Winter Ventura, Wundur Primbee, xstorm Radek, YongYong Francois, Zak Westminster, Zana Kohime, Zaren Alexander, Zeja Pyle, ZenMondo Wormser, Zoex Flanagan e muitos mais.
+Agradecemos também aos seguintes residentes por sua colaboração na mais nova versão do Second Life: (in progress)
 
 
 
 
-&quot;O trabalho continua, a causa vive, a esperança persiste, e os sonhos nunca morrem&quot; - Edward Kennedy
+
+
+
+
+Raras são as mentes capazes de tornar óbvio o até então inexistente. Dizer &apos;eu poderia ter pensado a mesma coisa&apos; é comum, revelador e nem sempre a verdade; porque de fato não pensaram.
+ -- Douglas Adams
 			</text_editor>
 		</panel>
 		<panel label="Licenças" name="licenses_panel">
diff --git a/indra/newview/skins/default/xui/pt/floater_about_land.xml b/indra/newview/skins/default/xui/pt/floater_about_land.xml
index 1767a3149615e22cb0a9ca5a66da3b6a93174dff..252969609a568ba6b7809a664db33b28c84af083 100644
--- a/indra/newview/skins/default/xui/pt/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/pt/floater_about_land.xml
@@ -39,10 +39,10 @@
 				ID do Leilão: [ID]
 			</panel.string>
 			<panel.string name="need_tier_to_modify">
-				Sua compra deve ser aprovada para você modificar este terreno.
+				Você deve ter sua compra aprovada para modificar este terreno.
 			</panel.string>
 			<panel.string name="group_owned_text">
-				(Propriedade do grupo)
+				(Possuído pelo Grupo)
 			</panel.string>
 			<panel.string name="profile_text">
 				Perfil...
@@ -57,14 +57,11 @@
 				(nenhum)
 			</panel.string>
 			<panel.string name="sale_pending_text">
-				(Venda pendendo)
+				(Venda Pendente)
 			</panel.string>
 			<panel.string name="no_selection_text">
 				Nenhum lote selecionado.
-Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar os detalhes.
-			</panel.string>
-			<panel.string name="time_stamp_template">
-				[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
+Vá para o menu Mundo &gt; Sobre a Terra ou selecione outro lote para mostrar seus detalhes.
 			</panel.string>
 			<text name="Name:">
 				Nome:
@@ -82,7 +79,7 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				Classificação:
 			</text>
 			<text name="ContentRatingText">
-				Adulto
+				Adult
 			</text>
 			<text name="Owner:">
 				Proprietário:
@@ -97,14 +94,14 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				Leyla Linden
 			</text>
 			<button label="Ajustar" name="Set..."/>
-			<check_box label="Permitir doação para o grupo" name="check deed" tool_tip="Oficiais do grupo podem doar esse terreno ao grupo, passando a administração para o gestor da ilha"/>
-			<button label="Passar" name="Deed..." tool_tip="Você só pode doar o terreno se você for um dos oficiais do grupo selecionado."/>
-			<check_box label="Proprietário faz contribuição com doação" name="check contrib" tool_tip="Quando o terreno é doado ao grupo, o proprietário anterior contribui alocando terra suficiente para mantê-la."/>
+			<check_box label="Permitir posse para o grupo" name="check deed" tool_tip="O gerente do grupo pode acionar essa terra ao grupo, então esta será mantida pelo gestor da ilha"/>
+			<button label="Passar" name="Deed..." tool_tip="Você só pode delegar esta terra se você for um gerente selecionado pelo grupo."/>
+			<check_box label="Proprietário faz contribuição com delegação" name="check contrib" tool_tip="Quando a terra é delegada ao grupo, o proprietário anterior contribui alocando terra suficiente para mantê-la."/>
 			<text name="For Sale:">
-				À venda:
+				À Venda:
 			</text>
 			<text name="Not for sale.">
-				Não está à venda.
+				Não está à Venda.
 			</text>
 			<text name="For Sale: Price L$[PRICE].">
 				Preço: L$[PRICE] (L$[PRICE_PER_SQM]/m²).
@@ -114,10 +111,10 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				À venda para: [BUYER]
 			</text>
 			<text name="Sell with landowners objects in parcel.">
-				À venda (objetos incluídos).
+				À venda (Objetos incluídos).
 			</text>
 			<text name="Selling with no objects in parcel.">
-				À venda (objetos não incluídos).
+				À venda (Objetos não incluídos).
 			</text>
 			<button label="Cancelar venda do terreno" label_selected="Cancelar venda do terreno" left="275" name="Cancel Land Sale" width="165"/>
 			<text name="Claimed:">
@@ -140,7 +137,7 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 			</text>
 			<button label="Comprar terreno..." label_selected="Comprar terreno..." left="130" name="Buy Land..." width="125"/>
 			<button label="Dados do script" name="Scripts..."/>
-			<button label="Comprar para o grupo" name="Buy For Group..."/>
+			<button label="Comprar para o Grupo" name="Buy For Group..."/>
 			<button label="Comprar passe..." label_selected="Comprar passe..." left="130" name="Buy Pass..." tool_tip="Um passe concede a você acesso temporário a este terreno." width="125"/>
 			<button label="Abandonar terreno..." label_selected="Abandonar terreno..." name="Abandon Land..."/>
 			<button label="Pedir terreno" name="Reclaim Land..."/>
@@ -148,22 +145,24 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 		</panel>
 		<panel label="CONTRATO" name="land_covenant_panel">
 			<panel.string name="can_resell">
-				Permitido para terrenos comprados nesta região.
+				Terrenos comprados nesta região podem ser revendidos.
 			</panel.string>
 			<panel.string name="can_not_resell">
-				Proibido para terrenos comprados nesta região.
+				Terrenos comprados nesta região não podem ser revendidos.
 			</panel.string>
 			<panel.string name="can_change">
-				Permitido subdividir terrenos comprados nesta região.
+				Terrenos comprados nesta região podem ser compartilhados
+ou sub-divididos.
 			</panel.string>
 			<panel.string name="can_not_change">
-				Proibido compartilhar ou subdividir terrenos comprados nesta região.
+				Terrenos comprados nesta região não podem ser compartilhados
+ou sub-divididos.
 			</panel.string>
 			<text name="estate_section_lbl">
 				Propriedade:
 			</text>
 			<text name="estate_name_text">
-				continente
+				mainland
 			</text>
 			<text name="estate_owner_lbl">
 				Dono:
@@ -175,7 +174,7 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				Não há corretor para esta Propriedade.
 			</text_editor>
 			<text name="covenant_timestamp_text">
-				Última modificação: Qua, Dez 31 16:00:00 1969
+				Última Alteração: Qua, Dez 31 16:00:00 1969
 			</text>
 			<text name="region_section_lbl">
 				Região:
@@ -193,19 +192,19 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				Classificação:
 			</text>
 			<text name="region_maturity_text">
-				Adulto
+				Adult
 			</text>
 			<text name="resellable_lbl">
 				Revender:
 			</text>
 			<text name="resellable_clause">
-				Proibido revender terrenos nesta região.
+				Terra nesta região não pode ser revendida.
 			</text>
 			<text name="changeable_lbl">
 				Subdividir:
 			</text>
 			<text name="changeable_clause">
-				Proibido juntar/subdividir terrenos nesta região.
+				Terra nesta região não pode ser unida/sub-dividida.
 			</text>
 		</panel>
 		<panel label="OBJETOS" name="land_objects_panel">
@@ -225,13 +224,13 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				[COUNT] de [MAX] ([AVAILABLE] disponíveis)
 			</text>
 			<text name="Primitives parcel supports:" width="200">
-				Prims suportados pelo lote:
+				Prims suportadas pelo lote:
 			</text>
 			<text left="214" name="object_contrib_text" width="152">
 				[COUNT]
 			</text>
 			<text name="Primitives on parcel:">
-				Prims no lote:
+				Prims no Lote:
 			</text>
 			<text left="214" name="total_objects_text" width="48">
 				[COUNT]
@@ -243,15 +242,15 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				[COUNT]
 			</text>
 			<button label="Mostrar" label_selected="Mostrar" name="ShowOwner" right="-135" width="60"/>
-			<button label="Devolver" name="ReturnOwner..." right="-10" tool_tip="Devolver objetos a seus donos." width="119"/>
+			<button label="Retornar" name="ReturnOwner..." right="-10" tool_tip="Retornar os objetos aos seus donos." width="119"/>
 			<text left="14" name="Set to group:" width="180">
-				Reservado para o grupo:
+				Configurados ao grupo:
 			</text>
 			<text left="214" name="group_objects_text" width="48">
 				[COUNT]
 			</text>
 			<button label="Mostrar" label_selected="Mostrar" name="ShowGroup" right="-135" width="60"/>
-			<button label="Devolver" name="ReturnGroup..." right="-10" tool_tip="Devolver objetos a seus donos." width="119"/>
+			<button label="Retornar" name="ReturnGroup..." right="-10" tool_tip="Retornar os objetos para seus donos." width="119"/>
 			<text left="14" name="Owned by others:" width="128">
 				Propriedade de outros:
 			</text>
@@ -259,14 +258,14 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				[COUNT]
 			</text>
 			<button label="Mostrar" label_selected="Mostrar" name="ShowOther" right="-135" width="60"/>
-			<button label="Devolver" name="ReturnOther..." right="-10" tool_tip="Devolver objetos a seus donos." width="119"/>
+			<button label="Retornar" name="ReturnOther..." right="-10" tool_tip="Retornar os objetos aos seus donos." width="119"/>
 			<text left="14" name="Selected / sat upon:" width="193">
 				Selecionado/Sentado:
 			</text>
 			<text left="214" name="selected_objects_text" width="48">
 				[COUNT]
 			</text>
-			<text name="Autoreturn">
+			<text left="4" name="Autoreturn" width="412">
 				Devolver objetos de outros residentes (p/ desligar tecle 0)
 			</text>
 			<line_editor name="clean other time" right="-10"/>
@@ -274,7 +273,7 @@ Vá para o menu Mundo &gt; Sobre o terreno ou selecione outro lote para mostrar
 				Donos dos objetos:
 			</text>
 			<button label="Atualizar lista" label_selected="Atualizar lista" left="118" name="Refresh List" tool_tip="Refresh Object List"/>
-			<button label="Devolver objetos..." label_selected="Devolver objetos..." left="230" name="Return objects..."/>
+			<button label="Retornar objetos..." label_selected="Retornar objetos..." left="230" name="Return objects..."/>
 			<name_list name="owner list">
 				<name_list.columns label="Tipo" name="type"/>
 				<name_list.columns label="Nome" name="name"/>
@@ -300,32 +299,32 @@ Apenas lotes maiores podem ser listados na busca.
 				Conteúdo Adulto
 			</panel.string>
 			<panel.string name="mature_check_mature_tooltip">
-				Os dados do seu lote ou seu conteúdo são considerados adulto.
+				A informação do seu lote ou seu conteúdo são considerados adulto.
 			</panel.string>
 			<panel.string name="mature_check_adult_tooltip">
-				Os dados do seu lote ou seu conteúdo são considerados adulto.
+				A informação do seu lote ou seu conteúdo são considerados adulto.
 			</panel.string>
 			<panel.string name="landing_point_none">
 				(nenhum)
 			</panel.string>
 			<panel.string name="push_restrict_text">
-				Proibido empurrar
+				Sem empurrar
 			</panel.string>
 			<panel.string name="push_restrict_region_text">
-				Proibido empurrar (regulamento da região)
+				Sem empurrar (imposição na região)
 			</panel.string>
 			<text name="allow_label">
 				Autorizar outros residentes a:
 			</text>
-			<check_box label="Editar terreno" name="edit land check" tool_tip="Se ativado, qualquer um pode modificar o terreno. É melhor deixar esta opção desativada, uma vez que você sempre pode editar seu próprio terreno."/>
-			<check_box label="Voar" name="check fly" tool_tip="Se ativado,  residentes podem voar sobre seu terreno. Se desativado, eles podem voar apenas até chegar ou sobrevoar o seu terreno."/>
+			<check_box label="Editar Terreno" name="edit land check" tool_tip="Se ativado, qualquer um pode modificar a forma da sua terra. É melhor deixar esta opção desativada, uma vez que você sempre pode editar seu próprio terreno."/>
+			<check_box label="Voar" name="check fly" tool_tip="Se ativado, os Residentes podem voar na sua terra. Se desativado, eles podem voar apenas para dentro e por cima de sua terra."/>
 			<text name="allow_label2">
 				Criar objetos:
 			</text>
 			<check_box label="Residentes" name="edit objects check"/>
 			<check_box label="Grupo" name="edit group objects check"/>
 			<text name="allow_label3">
-				Entrada de objetos:
+				Entrada do objeto:
 			</text>
 			<check_box label="Residentes" name="all object entry check"/>
 			<check_box label="Grupo" name="group object entry check"/>
@@ -335,10 +334,10 @@ Apenas lotes maiores podem ser listados na busca.
 			<check_box label="Residentes" name="check other scripts"/>
 			<check_box label="Grupo" name="check group scripts"/>
 			<text name="land_options_label">
-				Opções do terreno:
+				Opções de terra:
 			</text>
-			<check_box label="Seguro (sem danos)" name="check safe" tool_tip="Se ativado, ajusta o terreno para Seguro, impedindo lutas com danos. Se não ativado, lutas com danos é habilitado."/>
-			<check_box label="Proibido empurrar" name="PushRestrictCheck" tool_tip="Evita scripts que empurram. Ativar essa opção ajuda a prevenir comportamentos desordeiros no seu terreno."/>
+			<check_box label="Salvo (sem dano)" name="check safe" tool_tip="Se ativado, ajusta o terreno para Seguro, desabilitando combate com danos. Se não ativado, o combate com danos é habilitado."/>
+			<check_box label="Sem Empurrar" name="PushRestrictCheck" tool_tip="Evita scripts que empurram. A ativação dessa opção pode ser útil para prevenir comportamentos desordeiros na sua terra."/>
 			<check_box label="Mostrar terreno nos resultados de busca (L$30/semana)" name="ShowDirectoryCheck" tool_tip="Permitir que as pessoas vejam este terreno nos resultados de busca"/>
 			<combo_box left="265" name="land category with adult" width="155">
 				<combo_box.item label="Qualquer categoria" name="item0"/>
@@ -349,7 +348,7 @@ Apenas lotes maiores podem ser listados na busca.
 				<combo_box.item label="Educacional" name="item5"/>
 				<combo_box.item label="Jogos" name="item6"/>
 				<combo_box.item label="Moradia" name="item7"/>
-				<combo_box.item label="Amigável a novos usuários" name="item8"/>
+				<combo_box.item label="Amigável a Novos Usuários" name="item8"/>
 				<combo_box.item label="Parques &amp; Natureza" name="item9"/>
 				<combo_box.item label="Residencial" name="item10"/>
 				<combo_box.item label="Compras" name="item11"/>
@@ -363,7 +362,7 @@ Apenas lotes maiores podem ser listados na busca.
 				<combo_box.item label="Educacional" name="item5"/>
 				<combo_box.item label="Jogos" name="item6"/>
 				<combo_box.item label="Moradia" name="item7"/>
-				<combo_box.item label="Amigável a novos usuários" name="item8"/>
+				<combo_box.item label="Amigável a Novos Usuários" name="item8"/>
 				<combo_box.item label="Parques e Natureza" name="item9"/>
 				<combo_box.item label="Residencial" name="item10"/>
 				<combo_box.item label="Compras" name="item11"/>
@@ -377,10 +376,10 @@ Apenas lotes maiores podem ser listados na busca.
 			<text name="landing_point">
 				Ponto de Aterrissagem: [LANDING]
 			</text>
-			<button label="Definir" label_selected="Definir" name="Set" tool_tip="Define o ponto de aterrissagem de visitantes. Define para o ponto em que seu avatar se encontra neste lote."/>
+			<button label="Definir" label_selected="Definir" name="Set" tool_tip="Define o ponto de aterrissagem aonde o visitante chega. Define para o ponto em que seu avatar se encontra neste lote."/>
 			<button label="Limpar" label_selected="Limpar" name="Clear" tool_tip="Limpar o ponto de aterrissagem."/>
 			<text name="Teleport Routing: ">
-				Rota de teletransporte:
+				Rota de Teletransporte:
 			</text>
 			<combo_box left="140" name="landing type" tool_tip="Rota de Teletransporte -- Selecione como tratar os teletransportes no seu lote." width="160">
 				<combo_box.item label="Bloqueado" name="Blocked"/>
@@ -409,7 +408,7 @@ Textura:
 			</text>
 			<texture_picker label="" left="97" name="media texture" tool_tip="Clique para escolher uma imagem"/>
 			<text name="replace_texture_help">
-				Objetos com esta textura vão aparecer no filme ou página da web depois de clicar em Tocar. Selecione outras texturas clicando nas miniaturas.
+				Objetos com esta textura vão aparecer no filme ou página da web depois de clicar em Tocar.   Selecione outras texturas clicando nas miniaturas.
 			</text>
 			<check_box label="Escala automática" left="97" name="media_auto_scale" tool_tip="Marcando esta opção o conteúdo se ajustará ao lote automaticamente. A mídia pode se tornar lenta e com baixa qualidade visual mas nenhum outro ajuste de textura ou alinhamento será necessário."/>
 			<text left="102" name="media_size" tool_tip="Tamanho para desenhar a mídia Web, deixar 0 como padrão." width="115">
@@ -424,20 +423,10 @@ Textura:
 				Opções de
 Mídia:
 			</text>
-			<check_box label="Repetir mídia" name="media_loop" tool_tip="Executar a mídia repetidamente. Quando a mídia chegar ao fim, ela recomeça."/>
+			<check_box label="Mídia em Repetição" name="media_loop" tool_tip="Executar a mídia repetidamente. Quando a mídia terminar a execução, ela reiniciará do começo."/>
 		</panel>
 		<panel label="SOM" name="land_audio_panel">
-			<text name="MusicURL:">
-				URL de música:
-			</text>
 			<check_box label="Ocultar URL" name="hide_music_url" tool_tip="Selecionar esta opção oculta o URL de música a visitantes não autorizados aos dados do terreno."/>
-			<text name="Sound:">
-				Som:
-			</text>
-			<check_box label="Limitar sons de gestos e objetos a esta parcela" name="check sound local"/>
-			<text name="Voice settings:">
-				Voz:
-			</text>
 			<check_box label="Ativar voz" name="parcel_enable_voice_channel"/>
 			<check_box label="Ativar voz (definições do terreno)" name="parcel_enable_voice_channel_is_estate_disabled"/>
 			<check_box label="Limitar bate-papo de voz a este lote" name="parcel_enable_voice_channel_local"/>
diff --git a/indra/newview/skins/default/xui/pt/floater_customize.xml b/indra/newview/skins/default/xui/pt/floater_customize.xml
index a9ec0b9b1ff84d140e2d5dfb7d361dbc3c70f3be..2a367cb24a5505b9c3fc2affbd3ec0058a23080c 100644
--- a/indra/newview/skins/default/xui/pt/floater_customize.xml
+++ b/indra/newview/skins/default/xui/pt/floater_customize.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="floater customize" title="APARÊNCIA">
-	<tab_container name="customize tab container" tab_min_width="115">
+<floater name="floater customize" title="APARÊNCIA" width="546">
+	<tab_container name="customize tab container" tab_min_width="115" width="544">
 		<text label="Corpo" name="body_parts_placeholder">
 			Partes do corpo
 		</text>
diff --git a/indra/newview/skins/default/xui/pt/floater_snapshot.xml b/indra/newview/skins/default/xui/pt/floater_snapshot.xml
index d62fe3dd20ae1f3866d4448a3f19ab3b1da04a5b..bb852cb11a4850861cb78658889a075a18489b72 100644
--- a/indra/newview/skins/default/xui/pt/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/pt/floater_snapshot.xml
@@ -1,26 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Snapshot" title="VISUALIZAR FOTO">
-	<floater.string name="unknown">
-		desconhecido
-	</floater.string>
+<floater name="Snapshot" title="VER FOTO">
+	<text name="type_label">
+		Destino da foto
+	</text>
 	<radio_group label="Tipo de foto" name="snapshot_type_radio">
 		<radio_item label="Email" name="postcard"/>
 		<radio_item label="Meu inventário (L$[AMOUNT])" name="texture"/>
 		<radio_item label="Salvar no meu PC" name="local"/>
 	</radio_group>
 	<text name="file_size_label">
-		[TAMANHO] KB
+		[SIZE] KB
 	</text>
 	<button label="Atualizar a foto" name="new_snapshot_btn"/>
 	<button label="Enviar" name="send_btn"/>
-	<button label="Economize (L$[AMOUNT])" name="upload_btn"/>
+	<button label="Salvar (L$[AMOUNT])" name="upload_btn"/>
 	<flyout_button label="Salvar" name="save_btn" tool_tip="Salvar imagem em um arquivo">
 		<flyout_button.item label="Salvar" name="save_item"/>
 		<flyout_button.item label="Salvar como..." name="saveas_item"/>
 	</flyout_button>
+	<button label="Cancelar" name="discard_btn"/>
 	<button label="Mais" name="more_btn" tool_tip="Opções avançadas"/>
 	<button label="Menos" name="less_btn" tool_tip="Opções avançadas"/>
-	<button label="Cancelar" name="discard_btn"/>
 	<text name="type_label2">
 		Tamanho
 	</text>
@@ -56,8 +56,8 @@
 		<combo_box.item label="JPEG" name="JPEG"/>
 		<combo_box.item label="BMP" name="BMP"/>
 	</combo_box>
-	<spinner label="Largura" name="snapshot_width"/>
-	<spinner label="Altura" name="snapshot_height"/>
+	<spinner label="Largura" label_width="41" name="snapshot_width" width="101"/>
+	<spinner label="Altura" label_width="31" left="119" name="snapshot_height" width="91"/>
 	<check_box label="Limitar proproções" name="keep_aspect_check"/>
 	<slider label="Qualidade da imagem" name="image_quality_slider"/>
 	<text name="layer_type_label">
@@ -65,11 +65,15 @@
 	</text>
 	<combo_box label="Camadas da imagem" name="layer_types">
 		<combo_box.item label="Cores" name="Colors"/>
-		<combo_box.item label="Profundidade" name="Depth"/>
+		<combo_box.item label="Formato" name="Depth"/>
+		<combo_box.item label="Decoração do objeto" name="ObjectMattes"/>
 	</combo_box>
 	<check_box label="Interface" name="ui_check"/>
-	<check_box label="HUDs" name="hud_check"/>
-	<check_box label="Deixar aberto depois de salvo" name="keep_open_check"/>
-	<check_box label="Gerar quadro (tela inteira)" name="freeze_frame_check"/>
-	<check_box label="Atualizar" name="auto_snapshot_check"/>
+	<check_box bottom_delta="-17" label="HUDs" name="hud_check"/>
+	<check_box bottom_delta="-17" label="Manter aberto após salvar" name="keep_open_check"/>
+	<check_box bottom_delta="-17" label="Gerar quadro (tela inteira)" name="freeze_frame_check"/>
+	<check_box bottom_delta="-29" label="Auto-atualizar" name="auto_snapshot_check"/>
+	<string name="unknown">
+		desconhecido
+	</string>
 </floater>
diff --git a/indra/newview/skins/default/xui/pt/floater_tools.xml b/indra/newview/skins/default/xui/pt/floater_tools.xml
index 67d8e35cf2e36227424d613cb8637542fd4dd4ec..958a166dfcc956ffcd412a1b1d9f9d4a4def1064 100644
--- a/indra/newview/skins/default/xui/pt/floater_tools.xml
+++ b/indra/newview/skins/default/xui/pt/floater_tools.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="toolbox floater" short_title="BUILD TOOLS" title="" width="288">
 	<floater.string name="status_rotate">
-		Arrastar as faixas coloridas para girar o objeto
+		Arrastar as bandas coloridas para girar o objeto
 	</floater.string>
 	<floater.string name="status_scale">
 		Clicar e arrastar para esticar o lado selecionado
@@ -13,13 +13,13 @@
 		Clicar e reter para modificar a terra
 	</floater.string>
 	<floater.string name="status_camera">
-		Clicar e arrastar para mover a câmera
+		Clique e arraste para mexer a câmera
 	</floater.string>
 	<floater.string name="status_grab">
-		Arrastar para mexer, Ctrl para levantar, Ctrl+Shift para girar
+		Arraste para mexer, Ctrl para levantar, Ctrl+Shift para girar
 	</floater.string>
 	<floater.string name="status_place">
-		Clicar em um lugar para construir
+		Clique no mundo para construir
 	</floater.string>
 	<floater.string name="status_selectland">
 		Clicar e arrastar para selecionar a terra
@@ -45,7 +45,7 @@
 	<button label="" label_selected="" name="button create" tool_tip="Criar"/>
 	<button label="" label_selected="" name="button land" tool_tip="Terra"/>
 	<text name="text status" width="280">
-		Arrastar para mover, shift+Arrastar para copiar
+		Arraste para mover, shift+Arrastar para Copiar
 	</text>
 	<radio_group name="focus_radio_group">
 		<radio_item label="Zoom" name="radio zoom"/>
@@ -58,25 +58,22 @@
 		<radio_item label="Spin (Ctrl+Shift)" name="radio spin"/>
 	</radio_group>
 	<radio_group name="edit_radio_group">
-		<radio_item label="Mover" name="radio position"/>
+		<radio_item label="Movimentar" name="radio position"/>
 		<radio_item label="Rotacionar (Ctrl)" name="radio rotate"/>
-		<radio_item label="Esticar (Ctrl+Shift)" name="radio stretch"/>
-		<radio_item label="Selecionar face" name="radio select face"/>
+		<radio_item label="Stretch (Ctrl+Shift)" name="radio stretch"/>
+		<radio_item label="Face selecionada" name="radio select face"/>
 	</radio_group>
 	<check_box label="Editar partes linkadas" name="checkbox edit linked parts"/>
 	<text name="RenderingCost" tool_tip="Mostra o cálculo do custo de renderização do objeto">
 		þ: [COUNT]
 	</text>
-	<check_box label="" name="checkbox uniform"/>
-	<text label="Esticar ambos lados" name="checkbox uniform label">
-		Esticar ambos lados
-	</text>
-	<check_box initial_value="true" label="Esticar texturas" name="checkbox stretch textures"/>
+	<check_box label="Esticar ambos os lados" name="checkbox uniform"/>
+	<check_box initial_value="true" label="Esticar Texturas" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="Mostrar na grade" name="checkbox snap to grid"/>
-	<combo_box name="combobox grid mode" tool_tip="Selecione a régua da grade onde o objeto será colocado">
-		<combo_box.item label="Grade SL" name="World"/>
-		<combo_box.item label="Local" name="Local"/>
-		<combo_box.item label="Referência" name="Reference"/>
+	<combo_box name="combobox grid mode" tool_tip="Selecione o tipo de régua da grade onde o objeto será colocado">
+		<combo_box.item label="Grid SL" name="World"/>
+		<combo_box.item label="Grid local" name="Local"/>
+		<combo_box.item label="Grid de referência" name="Reference"/>
 	</combo_box>
 	<button label="Opções..." label_selected="Opções..." name="Options..." tool_tip="Mais opções de grade"/>
 	<button label="" label_selected="" name="ToolCube" tool_tip="Cubo"/>
@@ -99,12 +96,12 @@
 	<check_box initial_value="true" label="Copiar parte central" name="checkbox copy centers"/>
 	<check_box label="Girar cópia" name="checkbox copy rotates"/>
 	<radio_group name="land_radio_group">
-		<radio_item label="Selecionar terra" name="radio select land"/>
+		<radio_item label="Selecionar Terra" name="radio select land"/>
 		<radio_item label="Aplainar" name="radio flatten"/>
-		<radio_item label="Elevar" name="radio raise"/>
+		<radio_item label="Subir" name="radio raise"/>
 		<radio_item label="Abaixar" name="radio lower"/>
-		<radio_item label="Alisar" name="radio smooth"/>
-		<radio_item label="Irregularizar" name="radio noise"/>
+		<radio_item label="Suavizar" name="radio smooth"/>
+		<radio_item label="Endurecer" name="radio noise"/>
 		<radio_item label="Reverter" name="radio revert"/>
 	</radio_group>
 	<text name="Bulldozer:">
@@ -118,7 +115,7 @@
 	</text>
 	<button label="Aplicar" label_selected="Aplicar" name="button apply to selection" tool_tip="Modificar a terra selecionada"/>
 	<text left="134" name="obj_count">
-		Objetos: [COUNT]
+		Objects: [COUNT]
 	</text>
 	<text left="134" name="prim_count">
 		Prims: [COUNT]
@@ -144,7 +141,7 @@
 				Você não pode modificar estes objetos
 			</panel.string>
 			<panel.string name="text modify warning">
-				Selecione o objeto inteiro para configurar as autorizações
+				Selecione o objeto intereiro para configurar as autorizações
 			</panel.string>
 			<panel.string name="Cost Default">
 				Preço: L$
@@ -156,10 +153,10 @@
 				Preço unitário: L$
 			</panel.string>
 			<panel.string name="Cost Mixed">
-				Preço misto
+				Preço Misturado
 			</panel.string>
 			<panel.string name="Sale Mixed">
-				Venda mista
+				Venda Misturada
 			</panel.string>
 			<text name="Name:">
 				Nome:
@@ -186,14 +183,14 @@
 			<name_box initial_value="Carregando..." name="Group Name Proxy"/>
 			<button label="Doar" label_selected="Doar" name="button deed" tool_tip="Ao doar este item, o próximo dono terá permissões de próximo dono.  Objetos de grupos podem ser doados por um oficial do grupo."/>
 			<check_box label="Compartilhar" name="checkbox share with group" tool_tip="Permitir que todos os membros do grupo tenhas suas permissões de modificação para este objeto.  Faça uma doação para ativar restrições de função."/>
-			<text name="label click action">
+			<text name="label click action" width="220">
 				Clique para:
 			</text>
-			<combo_box name="clickaction">
+			<combo_box name="clickaction" width="192">
 				<combo_box.item label="Tocar (padrão)" name="Touch/grab(default)"/>
 				<combo_box.item label="Sentar no objeto" name="Sitonobject"/>
 				<combo_box.item label="Comprar objeto" name="Buyobject"/>
-				<combo_box.item label="Pagar objeto" name="Payobject"/>
+				<combo_box.item label="Pagar Objeto" name="Payobject"/>
 				<combo_box.item label="Abrir" name="Open"/>
 				<combo_box.item label="Zoom" name="Zoom"/>
 			</combo_box>
@@ -342,9 +339,9 @@
 			<text name="text revolutions">
 				Revoluções
 			</text>
-			<texture_picker label="Textura de escultura" name="sculpt texture control" tool_tip="Selecionar imagem"/>
-			<check_box label="Espelho" name="sculpt mirror control" tool_tip="Inverte o prim esculpido no eixo X"/>
-			<check_box label="De dentro para fora" name="sculpt invert control" tool_tip="Inverte o prim esculpido normals, making it appear inside-out"/>
+			<texture_picker label="Texture de Escultura" name="sculpt texture control" tool_tip="Click to choose a picture"/>
+			<check_box label="Espelho" name="sculpt mirror control" tool_tip="Flips sculpted prim along the X axis"/>
+			<check_box label="De dentro para fora" name="sculpt invert control" tool_tip="Inverts the sculpted prims normals, making it appear inside-out"/>
 			<text name="label sculpt type">
 				Tipo costura
 			</text>
@@ -358,12 +355,12 @@
 		</panel>
 		<panel label="Recursos" name="Features">
 			<text name="select_single" width="272">
-				Selecione apenas um prim para editar suas características.
+				Selecione apenas uma primitiva para editar suas características.
 			</text>
 			<text name="edit_object">
-				Editar características do objeto:
+				Editar características do Objeto:
 			</text>
-			<check_box label="Flexibilidade" name="Flexible1D Checkbox Ctrl" tool_tip="Allows object to flex about the Z axis (Client-side only)"/>
+			<check_box label="Flexíbilidade" name="Flexible1D Checkbox Ctrl" tool_tip="Allows object to flex about the Z axis (Client-side only)"/>
 			<spinner label="Suavidade" name="FlexNumSections"/>
 			<spinner label="Gravidade" name="FlexGravity"/>
 			<spinner label="Arrastar" name="FlexFriction"/>
@@ -438,17 +435,17 @@
 				<combo_box.item label="Weave" name="weave"/>
 			</combo_box>
 			<text name="tex scale">
-				Repetições/Face
+				Repeats / Face
 			</text>
 			<spinner label="Horizontal (U)" name="TexScaleU"/>
-			<check_box label="Inverter" name="checkbox flip s"/>
+			<check_box label="Flip" name="checkbox flip s"/>
 			<spinner label="Vertical (V)" name="TexScaleV"/>
-			<check_box label="Inverter" name="checkbox flip t"/>
-			<spinner label="Rotação˚" name="TexRot"/>
-			<spinner label="Repetições/Metro" name="rptctrl"/>
+			<check_box label="Flip" name="checkbox flip t"/>
+			<spinner label="RotationËš" name="TexRot"/>
+			<spinner label="Repeats / Meter" name="rptctrl"/>
 			<button label="Aplicar" label_selected="Aplicar" name="button apply"/>
 			<text name="tex offset">
-				Offset de textura
+				Texture Offset
 			</text>
 			<spinner label="Horizontal (U)" name="TexOffsetU"/>
 			<spinner label="Vertical (V)" name="TexOffsetV"/>
@@ -463,13 +460,13 @@
 			</panel>
 		</panel>
 		<panel label="Conteúdo" name="Contents">
-			<button label="Novo script" label_selected="Novo script" name="button new script"/>
+			<button label="Novo Script" label_selected="Novo script" name="button new script"/>
 			<button label="Autorizações" name="button permissions"/>
 		</panel>
 	</tab_container>
 	<panel name="land info panel">
 		<text name="label_parcel_info">
-			Informações do lote
+			Informações do Lote
 		</text>
 		<text name="label_area_price">
 			Preço: L$[PRICE] por [AREA] m²
@@ -480,7 +477,7 @@
 		<button label="Sobre terrenos" label_selected="Sobre terrenos" name="button about land"/>
 		<check_box label="Mostrar donos" name="checkbox show owners" tool_tip="Colorir lotes de acordo com seus donos:    Green = Sua terra  Aqua = Terra do seu grupo  Red = Possuída por outros  Yellow = À venda  Purple = A leilão  Grey = Pública"/>
 		<text name="label_parcel_modify">
-			Modificar lote
+			Modificar Lote
 		</text>
 		<button label="Subdividir" label_selected="Subdividir" name="button subdivide land"/>
 		<button label="Juntar" label_selected="Juntar" name="button join land"/>
diff --git a/indra/newview/skins/default/xui/pt/language_settings.xml b/indra/newview/skins/default/xui/pt/language_settings.xml
index e1de6ffea76f7a79094dd5e88fd659c3c4f6ce48..f25e77574d24c1c41b9e60352c334508aa7fdcb2 100644
--- a/indra/newview/skins/default/xui/pt/language_settings.xml
+++ b/indra/newview/skins/default/xui/pt/language_settings.xml
@@ -17,7 +17,6 @@
 	datetimeToCodes["month"]	= "%B";		// August
 	datetimeToCodes["mthnum"]	= "%m";		// 08
 	datetimeToCodes["day"]		= "%d";		// 31
-	datetimeToCodes["sday"]		= "%-d";	// 9
 	datetimeToCodes["hour24"]	= "%H";		// 14
 	datetimeToCodes["hour"]		= "%H";		// 14
 	datetimeToCodes["hour12"]	= "%I";		// 02
diff --git a/indra/newview/skins/default/xui/pt/menu_inventory.xml b/indra/newview/skins/default/xui/pt/menu_inventory.xml
index 1b1efd3270448befc153a9a2b5fc728f541690ca..2691ac81b34453bfc37e58203c6e3ea33c7b64fd 100644
--- a/indra/newview/skins/default/xui/pt/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/pt/menu_inventory.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="Popup">
-	<menu_item_call label="Compartilhar" name="Share"/>
 	<menu_item_call label="Comprar" name="Task Buy"/>
 	<menu_item_call label="Abrir" name="Task Open"/>
 	<menu_item_call label="Executar" name="Task Play"/>
@@ -16,7 +15,7 @@
 	<menu label="Novas roupas" name="New Clothes">
 		<menu_item_call label="Nova camisa" name="New Shirt"/>
 		<menu_item_call label="Nova calça" name="New Pants"/>
-		<menu_item_call label="Novos sapatos" name="New Shoes"/>
+		<menu_item_call label="Novos calçados" name="New Shoes"/>
 		<menu_item_call label="Novas meias" name="New Socks"/>
 		<menu_item_call label="Nova jaqueta" name="New Jacket"/>
 		<menu_item_call label="Nova saia" name="New Skirt"/>
@@ -47,21 +46,17 @@
 	<menu_item_call label="Teletransporte" name="Landmark Open"/>
 	<menu_item_call label="Abrir" name="Animation Open"/>
 	<menu_item_call label="Abrir" name="Sound Open"/>
-	<menu_item_call label="Substituir look" name="Replace Outfit"/>
-	<menu_item_call label="Adicionar a look" name="Add To Outfit"/>
-	<menu_item_call label="Tirar do look atual" name="Remove From Outfit"/>
-	<menu_item_call label="Encontrar original" name="Find Original"/>
+	<menu_item_call label="Substituir equipamento" name="Replace Outfit"/>
+	<menu_item_call label="Adicionar ao equipamento" name="Add To Outfit"/>
 	<menu_item_call label="Remover item" name="Purge Item"/>
 	<menu_item_call label="Restaurar item" name="Restore Item"/>
 	<menu_item_call label="Abrir" name="Open"/>
-	<menu_item_call label="Abrir original" name="Open Original"/>
 	<menu_item_call label="Propriedades" name="Properties"/>
 	<menu_item_call label="Renomear" name="Rename"/>
 	<menu_item_call label="Copiar item UUID" name="Copy Asset UUID"/>
 	<menu_item_call label="Copiar" name="Copy"/>
 	<menu_item_call label="Colar" name="Paste"/>
 	<menu_item_call label="Colar como link" name="Paste As Link"/>
-	<menu_item_call label="Excluir" name="Remove Link"/>
 	<menu_item_call label="Apagar" name="Delete"/>
 	<menu_item_call label="Excluir pasta do sistema" name="Delete System Folder"/>
 	<menu_item_call label="Pasta conversa em conferência" name="Conference Chat Folder"/>
@@ -75,12 +70,12 @@
 	<menu_item_call label="Ativar" name="Activate"/>
 	<menu_item_call label="Desativar" name="Deactivate"/>
 	<menu_item_call label="Salvar como" name="Save As"/>
-	<menu_item_call label="Tirar de si mesmo" name="Detach From Yourself"/>
-	<menu_item_call label="Vestir" name="Wearable And Object Wear"/>
+	<menu_item_call label="Retirar de si mesmo" name="Detach From Yourself"/>
+	<menu_item_call label="Vestir objeto" name="Object Wear"/>
 	<menu label="Anexar a" name="Attach To"/>
 	<menu label="Anexar ao HUD" name="Attach To HUD"/>
 	<menu_item_call label="Editar" name="Wearable Edit"/>
-	<menu_item_call label="Adicionar" name="Wearable Add"/>
+	<menu_item_call label="Vestir" name="Wearable Wear"/>
 	<menu_item_call label="Tirar" name="Take Off"/>
 	<menu_item_call label="--Sem opções--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pt/menu_inventory_add.xml b/indra/newview/skins/default/xui/pt/menu_inventory_add.xml
index 2723f39287d43544a58066c4b02ad5208d5088e4..fc40384891dad3671b8752f3a06103a1bc39664e 100644
--- a/indra/newview/skins/default/xui/pt/menu_inventory_add.xml
+++ b/indra/newview/skins/default/xui/pt/menu_inventory_add.xml
@@ -5,7 +5,6 @@
 		<menu_item_call label="Som (L$[COST])..." name="Upload Sound"/>
 		<menu_item_call label="Animação (L$[COST])..." name="Upload Animation"/>
 		<menu_item_call label="Volume (L$[COST] per file)..." name="Bulk Upload"/>
-		<menu_item_call label="Autorizações de upload padrão" name="perm prefs"/>
 	</menu>
 	<menu_item_call label="Nova pasta" name="New Folder"/>
 	<menu_item_call label="Novo script" name="New Script"/>
diff --git a/indra/newview/skins/default/xui/pt/menu_viewer.xml b/indra/newview/skins/default/xui/pt/menu_viewer.xml
index 33fccbedcce7bd75bd4d96a02313f64cf41a5ad6..45f7ca1424dae0165009ccaf35bef1c4df569e13 100644
--- a/indra/newview/skins/default/xui/pt/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/pt/menu_viewer.xml
@@ -7,11 +7,10 @@
 		</menu_item_call>
 		<menu_item_call label="Comprar L$" name="Buy and Sell L$"/>
 		<menu_item_call label="Meu perfil" name="Profile"/>
-		<menu_item_call label="Trocar de look" name="ChangeOutfit"/>
+		<menu_item_call label="Minha aparência" name="Appearance"/>
 		<menu_item_check label="Meu inventário" name="Inventory"/>
 		<menu_item_check label="Meu inventário" name="ShowSidetrayInventory"/>
 		<menu_item_check label="Meus gestos" name="Gestures"/>
-		<menu_item_check label="Minha voz" name="ShowVoice"/>
 		<menu label="Meu status" name="Status">
 			<menu_item_call label="Ausente" name="Set Away"/>
 			<menu_item_call label="Ocupado" name="Set Busy"/>
@@ -32,7 +31,6 @@
 		<menu_item_call label="Foto" name="Take Snapshot"/>
 		<menu_item_call label="Criar marco deste lugar" name="Create Landmark Here"/>
 		<menu label="Perfil da região" name="Land">
-			<menu_item_call label="Perfil da região" name="Place Profile"/>
 			<menu_item_call label="Sobre terrenos" name="About Land"/>
 			<menu_item_call label="Região/Propriedade" name="Region/Estate"/>
 		</menu>
@@ -48,8 +46,8 @@
 			<menu_item_check label="Coordenadas" name="Coordinates"/>
 			<menu_item_check label="Propriedades do lote" name="Parcel Properties"/>
 		</menu>
-		<menu_item_call label="Teletransportar para meu início" name="Teleport Home"/>
-		<menu_item_call label="Definir como Início" name="Set Home to Here"/>
+		<menu_item_call label="Teletransportar para início" name="Teleport Home"/>
+		<menu_item_call label="Definir como casa" name="Set Home to Here"/>
 		<menu label="Sol" name="Environment Settings">
 			<menu_item_call label="Amanhecer" name="Sunrise"/>
 			<menu_item_call label="Meio-dia" name="Noon"/>
@@ -68,15 +66,20 @@
 			<menu_item_call label="Ferramenta criar" name="Create"/>
 			<menu_item_call label="Ferramenta de terrenos" name="Land"/>
 		</menu>
+		<menu label="Editar" name="Edit">
+			<menu_item_call label="Desfazer" name="Undo"/>
+			<menu_item_call label="Repetir" name="Redo"/>
+			<menu_item_call label="Cortar" name="Cut"/>
+			<menu_item_call label="Copiar" name="Copy"/>
+			<menu_item_call label="Colar" name="Paste"/>
+			<menu_item_call label="Excluir" name="Delete"/>
+			<menu_item_call label="Replicar" name="Duplicate"/>
+			<menu_item_call label="Selecionar tudo" name="Select All"/>
+			<menu_item_call label="Desfazer seleção" name="Deselect"/>
+		</menu>
 		<menu_item_call label="Link" name="Link"/>
 		<menu_item_call label="Desconectar links" name="Unlink"/>
 		<menu_item_check label="Edit Linked Parts" name="Edit Linked Parts"/>
-		<menu label="Selecionar partes conectadas" name="Select Linked Parts">
-			<menu_item_call label="Selecionar próxima parte" name="Select Next Part"/>
-			<menu_item_call label="Selecionar parte anterior" name="Select Previous Part"/>
-			<menu_item_call label="Incluir próxima parte" name="Include Next Part"/>
-			<menu_item_call label="Incluir parte anterior" name="Include Previous Part"/>
-		</menu>
 		<menu_item_call label="Enfocar seleção" name="Focus on Selection"/>
 		<menu_item_call label="Ampliar seleção" name="Zoom to Selection"/>
 		<menu label="Objeto:" name="Object">
@@ -94,7 +97,7 @@
 			<menu_item_call label="Scripts em modo não execução" name="Set Scripts to Not Running"/>
 		</menu>
 		<menu label="Opções" name="Options">
-			<menu_item_call label="Autorizações de upload padrão" name="perm prefs"/>
+			<menu_item_call label="Definir permissões padrão de upload" name="perm prefs"/>
 			<menu_item_check label="Mostrar permissões avançadas" name="DebugPermissions"/>
 			<menu_item_check label="Só selecionar meus objetos" name="Select Only My Objects"/>
 			<menu_item_check label="Só selecionar objetos móveis" name="Select Only Movable Objects"/>
@@ -107,21 +110,19 @@
 			<menu_item_call label="Usar seleção em grade" name="Use Selection for Grid"/>
 			<menu_item_call label="Opções de grade" name="Grid Options"/>
 		</menu>
-		<menu label="Upload" name="Upload">
-			<menu_item_call label="Imagem (L$[COST])..." name="Upload Image"/>
-			<menu_item_call label="Som (L$[COST])..." name="Upload Sound"/>
-			<menu_item_call label="Animação (L$[COST])..." name="Upload Animation"/>
-			<menu_item_call label="Volume (L$[COST] por arquivo)..." name="Bulk Upload"/>
+		<menu label="Selecionar partes conectadas" name="Select Linked Parts">
+			<menu_item_call label="Selecionar próxima parte" name="Select Next Part"/>
+			<menu_item_call label="Selecionar parte anterior" name="Select Previous Part"/>
+			<menu_item_call label="Incluir próxima parte" name="Include Next Part"/>
+			<menu_item_call label="Incluir parte anterior" name="Include Previous Part"/>
 		</menu>
 	</menu>
 	<menu label="Ajuda" name="Help">
 		<menu_item_call label="[SECOND_LIFE] Ajuda" name="Second Life Help"/>
 		<menu_item_call label="Denunciar abuso" name="Report Abuse"/>
 		<menu_item_call label="Relatar bug" name="Report Bug"/>
-		<menu_item_call label="Sobre [APP_NAME]" name="About Second Life"/>
 	</menu>
 	<menu label="Avançado" name="Advanced">
-		<menu_item_check label="Exibir menu avançado" name="Show Advanced Menu"/>
 		<menu_item_call label="Parar minha animação" name="Stop Animating My Avatar"/>
 		<menu_item_call label="Recarregar texturas" name="Rebake Texture"/>
 		<menu_item_call label="Interface tamanho padrão" name="Set UI Size to Default"/>
@@ -143,6 +144,7 @@
 			<menu_item_check label="Realçar transparentes" name="Highlight Transparent"/>
 			<menu_item_check label="Mostrar anexos HUD" name="Show HUD Attachments"/>
 			<menu_item_check label="Mostrar retículo na vista subjetiva" name="ShowCrosshairs"/>
+			<menu_item_check label="Mostrar dicas de terreno" name="Land Tips"/>
 		</menu>
 		<menu label="Tipos de renderização" name="Rendering Types">
 			<menu_item_check label="Simples" name="Simple"/>
@@ -169,7 +171,6 @@
 			<menu_item_check label="Objetos flexíveis" name="Flexible Objects"/>
 		</menu>
 		<menu_item_check label="Executar diversas instâncias" name="Run Multiple Threads"/>
-		<menu_item_check label="Usar plugin de leitura de threads" name="Use Plugin Read Thread"/>
 		<menu_item_call label="Limpar cache de grupo" name="ClearGroupCache"/>
 		<menu_item_check label="Smoothing de mouse" name="Mouse Smoothing"/>
 		<menu label="Atalhos" name="Shortcuts">
@@ -177,7 +178,6 @@
 			<menu_item_check label="Busca" name="Search"/>
 			<menu_item_call label="Soltar objeto" name="Release Keys"/>
 			<menu_item_call label="Interface tamanho padrão" name="Set UI Size to Default"/>
-			<menu_item_check label="Mostrar menu avançado - atalho antigo" name="Show Advanced Menu - legacy shortcut"/>
 			<menu_item_check label="Correr sempre" name="Always Run"/>
 			<menu_item_check label="Voar" name="Fly"/>
 			<menu_item_call label="Fechar janela" name="Close Window"/>
@@ -197,6 +197,7 @@
 			<menu_item_call label="Mais zoom" name="Zoom In"/>
 			<menu_item_call label="Zoom padrão" name="Zoom Default"/>
 			<menu_item_call label="Menos zoom" name="Zoom Out"/>
+			<menu_item_call label="Alternar tela inteira" name="Toggle Fullscreen"/>
 		</menu>
 		<menu_item_call label="Mostrar configurações de depuração" name="Debug Settings"/>
 		<menu_item_check label="Show Develop Menu" name="Debug Mode"/>
@@ -305,7 +306,7 @@
 			<menu_item_call label="Force Owner To Me" name="Force Owner To Me"/>
 			<menu_item_call label="Force Owner Permissive" name="Force Owner Permissive"/>
 			<menu_item_call label="Excluir" name="Delete"/>
-			<menu_item_call label="Bloquear" name="Lock"/>
+			<menu_item_call label="Lock" name="Lock"/>
 		</menu>
 		<menu label="Lote" name="Parcel">
 			<menu_item_call label="Force Owner To Me" name="Owner To Me"/>
diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml
index a6645d8b134dc1f10c0c367c0e614c000975f765..5f91ff09e5600faec5767b9a6647b2bf301fbe36 100644
--- a/indra/newview/skins/default/xui/pt/notifications.xml
+++ b/indra/newview/skins/default/xui/pt/notifications.xml
@@ -199,7 +199,7 @@ Convite outros membros dentro de 48 horas.
 Por favor, selecione um indivíduo para realizar a venda se o valor for 0 L$.
 	</notification>
 	<notification name="ConfirmLandSaleChange">
-		[LAND_SIZE] m² selecionados de terreno estão sendo configurados para venda.
+		[LAND_SIZE] m² selecionados de terra estão sendo configurados para venda.
 Seu preço de venda será  L$[SALE_PRICE] e está autorizado para venda para [NAME]. Gostaria de continuar a fazer essa alteração?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Continuar"/>
 	</notification>
@@ -211,24 +211,24 @@ O preço será L$[SALE_PRICE] e [NAME] pode comprar o terreno.
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
 	<notification name="ReturnObjectsDeededToGroup">
-		Tem certeza de que quer devolver todos os objetos compartilhados com o grupo &apos;[NAME]&apos; neste lote, para o inventário do seu antigo Proprietário?
+		Você tem certeza de que quer retornar todos os objetos compartilhados com o grupo &apos;[NAME]&apos; neste lote de terra, para o inventário do seu antigo Proprietário?
 
 *AVISO* Isso irá deletar os objetos não transferíveis doados ao grupo!
 
 Objetos: [N]
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
 	</notification>
 	<notification name="ReturnObjectsOwnedByUser">
-		Você tem certeza de que deseja devolver todos os objetos do residente &apos;[NAME]&apos; neste lote para o inventário dele?
+		Você tem certeza de que deseja retornar todos os objetos do residente &apos;[NAME]&apos; neste lote para o inventário dele?
 
 Objetos: [N]
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
 	</notification>
 	<notification name="ReturnObjectsOwnedBySelf">
 		Você tem certeza de que deseja retornar todos os objetos de sua propriedade neste lote para seu inventário?
 
 Objetos: [N]
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
 	</notification>
 	<notification name="ReturnObjectsNotOwnedBySelf">
 		Você tem certeza de que deseja retornar todos os objetos que NÃO são seus para o inventário de seus proprietários?
@@ -237,7 +237,7 @@ Objetos transferíveis doados ao grupo retornarão para seu proprietários.
 *AVISO* Isso fará com que os objetos não-transferíveis sejam deletados!
 
 Objetos: [N]
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
 	</notification>
 	<notification name="ReturnObjectsNotOwnedByUser">
 		Você tem certeza de que deseja retornar todos os objetos deste lote NÃO pertencentes a [NAME]  para o inventário do proprietário?
@@ -245,11 +245,11 @@ Objetos: [N]
 *AVISO* Esta ação irá apagar os objetos não transferíveis doados ao grupo!
 
 Objetos: [N]
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
 	</notification>
 	<notification name="ReturnAllTopObjects">
 		Você tem certeza de que deseja enviar todos os objetos listados de volta aos inventários de seus proprietários?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
 	</notification>
 	<notification name="DisableAllTopObjects">
 		Você tem certeza que deseja desativar todos os objetos desta região?
@@ -259,10 +259,10 @@ Objetos: [N]
 		Retornar os objetos deste lote que NÃO são compartilhados com o grupo [NAME] de volta para seus proprietários?
 
 Objetos: [N]
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Devolver"/>
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Retornar"/>
 	</notification>
 	<notification name="UnableToDisableOutsideScripts">
-		Não é possível desativar scripts externos.
+		Não é possível desabilitar scripts externos.
 Toda esta região possui dano habilitado.
 Scripts devem ser permitidos para fazer as armas funcionarem.
 	</notification>
@@ -301,7 +301,7 @@ Para colocar a mídia em só uma face, selecione Selecionar face e clique na fac
 		Você deve concordar com os Termos de Serviço para continuar a entrar no [SECOND_LIFE].
 	</notification>
 	<notification name="CouldNotPutOnOutfit">
-		Não foi possível vestir o look. A pasta do look não contém roupas, partes do corpo ou acessórios.
+		Não foi possível vestir o conjunto. A pasta do conjunto não contém roupas, partes do corpo ou acessórios.
 	</notification>
 	<notification name="CannotWearTrash">
 		Não é possível usar roupas ou partes do corpo que estão no lixo.
@@ -311,20 +311,17 @@ Para colocar a mídia em só uma face, selecione Selecionar face e clique na fac
 Ele ultrapassa o limite de anexos, de [MAX_ATTACHMENTS] objetos. Remova um objeto para poder anexar outro.
 	</notification>
 	<notification name="CannotWearInfoNotComplete">
-		Você não pode vestir este item porque ele ainda não carregou. Tente novamente em um minuto.
+		Você não pode vestir este item porque ele ainda não carregou. Por favor, tente novamente em um minuto.
 	</notification>
 	<notification name="MustHaveAccountToLogIn">
 		Oops! Alguma coisa foi deixada em branco.
 Você precisa entrar com ambos os Nome e Sobrenome do seu avatar.
 
-Você precisa de uma conta para entrar no [SECOND_LIFE]. Você gostaria de abrir uma conta agora?
+Você precisa de uma conta para entrar no [SECOND_LIFE]. Você gostaria de criar uma conta agora?
 		<url name="url">
 			https://join.secondlife.com/index.php?lang=pt-BR
 		</url>
-		<usetemplate name="okcancelbuttons" notext="Tentar novamente" yestext="Abrir conta"/>
-	</notification>
-	<notification name="InvalidCredentialFormat">
-		Digite o nome e sobrenome do seu avatar no campo Nome de usuário, depois faça o login novamente.
+		<usetemplate name="okcancelbuttons" notext="Tentar novamente" yestext="Criar uma nova conta"/>
 	</notification>
 	<notification name="AddClassified">
 		Os anúncios serão publicados na seção &apos;Classificados&apos; das buscas e em [http://secondlife.com/community/classifieds secondlife.com] durante uma semana.
@@ -352,12 +349,8 @@ Tem certeza de que quer prosseguir?
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="DeleteAvatarPick">
-		Excluir destaque &lt;nolink&gt;[PICK]&lt;/nolink&gt;?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Apagar"/>
-	</notification>
-	<notification name="DeleteOutfits">
-		Excluir look(s) selecionado(s)?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
+		Apagar pegar [PICK]?
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Delete"/>
 	</notification>
 	<notification name="PromptGoToEventsPage">
 		Ir até a página web de enventos [SECOND_LIFE] ?
@@ -367,10 +360,10 @@ Tem certeza de que quer prosseguir?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Ir à página"/>
 	</notification>
 	<notification name="SelectProposalToView">
-		Selecione uma proposta para visualizar.
+		Por favor, selecione uma proposta para visualizar.
 	</notification>
 	<notification name="SelectHistoryItemToView">
-		Selecione um item do histórico para exibi-lo.
+		Por favor, selecione um item do histórico para exibí-lo.
 	</notification>
 	<notification name="CacheWillClear">
 		O cache será limpo quando o [APP_NAME] for iniciado.
@@ -413,7 +406,7 @@ O objeto pode estar fora de alcance ou foi deletado.
 O objeto pode estar fora de alcance ou foi deletado.
 	</notification>
 	<notification name="SaveNotecardFailReason">
-		Houve um problema em salvar uma nota devido a seguinte razão: [REASON]. Tente salvar a nota novamente mais tarde.
+		Houve um problema em salvar uma nota devido a seguinte razão: [REASON].  Por favor, tente salvar a nota novamente mais tarde.
 	</notification>
 	<notification name="ScriptCannotUndo">
 		Não foi possível desfazer todas as mudanças na sua versão de script.
@@ -422,7 +415,7 @@ Gostaria de carregar a última versão salva?
 		<usetemplate name="okcancelbuttons" notext="Não" yestext="Sim"/>
 	</notification>
 	<notification name="SaveScriptFailReason">
-		Houve um problema em salvar um script devido à seguinte razão: [REASON].  Tente salvar novamente o script mais tarde.
+		Houve um problema em salvar um script devido à seguinte razão: [REASON].  Por favor, tente salvar novamente o script mais tarde.
 	</notification>
 	<notification name="SaveScriptFailObjectNotFound">
 		Não foi possível salvar o script pois o objeto em que ele está não pôde ser encontrado.
@@ -433,7 +426,7 @@ O objeto pode estar fora de alcance ou ter sido deletado.
 	</notification>
 	<notification name="StartRegionEmpty">
 		Oops, você ainda não definiu sua região de partida. 
-Digite o nome da região na caixa &apos;Ponto de partida&apos; ou selecione &apos;Última localização&apos; ou &apos;Meu início&apos; como ponto de partida.
+Digite o nome da região na caixa &apos;Ponto de partida&apos; ou selecione &apos;Última localização&apos; ou &apos;Minha casa&apos; como ponto de partida.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CouldNotStartStopScript">
@@ -473,9 +466,7 @@ Para aumentar a qualidade do vídeo, vá para Preferências &gt; Vídeo.
 		A região [REGION] não permite ser aplainada.
 	</notification>
 	<notification name="CannotCopyWarning">
-		Você não tem autorização para copiar os itens abaixo:
-[ITENS]
-ao dá-los, você ficará sem eles no seu inventário. Deseja realmente dar estes itens?
+		Você não tem permissão para copiar este item e irá perdê-lo do seu inventário se entregá-lo a alguém. Quer realmente oferecer este item?
 		<usetemplate name="okcancelbuttons" notext="Não" yestext="Sim"/>
 	</notification>
 	<notification name="CannotGiveItem">
@@ -509,15 +500,15 @@ Ele ou ela vai ficar temporariamente incapaz de se mover, usar o bate-papo ou in
 		<usetemplate canceltext="Cancelar" name="yesnocancelbuttons" notext="Descongelar" yestext="Congelar"/>
 	</notification>
 	<notification name="EjectAvatarFullname">
-		Ejetar [AVATAR_NAME] do seu terreno?
+		Ejetar [AVATAR_NAME] da sua terra?
 		<usetemplate canceltext="Cancelar" name="yesnocancelbuttons" notext="Ejetar e Banir" yestext="Ejetar"/>
 	</notification>
 	<notification name="EjectAvatarNoBan">
-		Ejetar este avatar do seu terreno?
+		Ejetar este avatar da sua terra?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Ejetar"/>
 	</notification>
 	<notification name="EjectAvatarFullnameNoBan">
-		Ejetar [AVATAR_NAME] do seu terreno?
+		Ejetar [AVATAR_NAME] da sua terra?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Ejetar"/>
 	</notification>
 	<notification name="EjectAvatarFromGroup">
@@ -528,7 +519,7 @@ Ele ou ela vai ficar temporariamente incapaz de se mover, usar o bate-papo ou in
 	</notification>
 	<notification name="AcquireErrorObjectSpan">
 		Erro de aquisição: Objetos criados em mais de uma região.
-Mova todos os objetos a serem adquiridos para uma mesma região.
+Por favor, mova todos os objetos a serem adquiridos para uma mesma região.
 	</notification>
 	<notification name="PromptGoToCurrencyPage">
 		[EXTRA]
@@ -612,10 +603,6 @@ Esperada [VALIDS]
 	<notification name="CannotEncodeFile">
 		Impossível codificar o arquivo: [FILE]
 	</notification>
-	<notification name="CorruptedProtectedDataStore">
-		Não podemos preencher seu nome e senha.   Isso pode ocorrer após mudanças na configuração da rede
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
 	<notification name="CorruptResourceFile">
 		Fonte do arquivo corrompida: [FILE]
 	</notification>
@@ -779,29 +766,29 @@ Nenhum grupo selecionado.
 A região do terreno não pôde ser localizada.
 	</notification>
 	<notification name="CannotDeedLandMultipleSelected">
-		Não é possível doar o terreno:
-Vários lotes foram selecionados.
+		Impossibilitado de passar a propriedade da terra:
+Selecionados vários lotes.
 
 Tente selecionar um único lote.
 	</notification>
 	<notification name="CannotDeedLandWaitingForServer">
-		Não é possível doar o terreno:
-Esperando o servidor informar de quem é a propriedade.
+		Impossibilitado de passar a propriedade da terra:
+Esperando pelo servidor informar de quem é a propriedade.
 
 Por favor, tente novamente.
 	</notification>
 	<notification name="CannotDeedLandNoTransfer">
-		Não é possível doar o terreno:
-A região [REGION] não permite transferências de terreno.
+		Não é possível transferir posse do terreno:
+A região [REGION] não permite transferência do terreno.
 	</notification>
 	<notification name="CannotReleaseLandWatingForServer">
-		Não é possível abandonar o terreno:
+		Impossibilitado de abandonar a terra:
 Esperando o servidor atualizar as informações do lote.
 
 Tente novamente em alguns segundos.
 	</notification>
 	<notification name="CannotReleaseLandSelected">
-		Não é possível abandonar o terreno:
+		Impossibilitado de abandonar a terra:
 Você não é dono de todos os lotes selecionados.
 
 Por favor, selecione um único lote.
@@ -820,25 +807,25 @@ A região do terreno não pôde ser localizada.
 A região [REGION] não permite transferência de terreno.
 	</notification>
 	<notification name="CannotReleaseLandPartialSelection">
-		Não é possível abandonar o terreno:
-Selecione um lote inteiro e abra mão dele.
+		Impossibilitado de abandonar a terra:
+Você deve selecionar um lote inteiro para liberá-lo.
 
 Selecione um lote inteiro ou primeiro divida seu lote.
 	</notification>
 	<notification name="ReleaseLandWarning">
-		Você está prestes a abrir mão de [AREA] m².
-Ao abrir mão deste terreno, ele deixa de ser uma propriedade. Note que você não receberá nenhum L$.
+		Você está para liberar [AREA] m² de terra.
+Liberando este terreno, o liberará de suas posses, mas não lhe concederá quaisquer L$.
 
-Abrir mão deste terreno?
+Liberar esta terra?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Renunciar"/>
 	</notification>
 	<notification name="CannotDivideLandNothingSelected">
-		Não é possível dividir o terreno:
+		Impossibilitado de dividir a terra:
 
-Nenhum lote foi selecionado.
+Nenhum lote selecionado.
 	</notification>
 	<notification name="CannotDivideLandPartialSelection">
-		Não é possível dividir o terreno:
+		Impossibilitado de dividir a terra:
 
 Você selecionou um lote inteiro.
 Tente selecionar uma parte do lote.
@@ -854,34 +841,34 @@ Quer dividir o terreno?
 A região do terreno não pôde ser localizada.
 	</notification>
 	<notification name="CannotJoinLandNoRegion">
-		Houve um problema ao processar a união dos terrenos: 
+		Houve um problema ao processar a junção dos terrenos: 
 A região do terreno não pôde ser localizada.
 	</notification>
 	<notification name="CannotJoinLandNothingSelected">
-		Não é possível unir os terrenos:
+		Não é possível unir terreno:
 Nenhum lote selecionado.
 	</notification>
 	<notification name="CannotJoinLandEntireParcelSelected">
-		Não é possível unir os terrenos:
+		Impossibilitado de unir a terra:
 Você selecionou apenas um lote.
 
 Selecione a terra através de ambos os lotes.
 	</notification>
 	<notification name="CannotJoinLandSelection">
-		Não é possível unir os terrenos:
+		Impossibilitado de unir a terra:
 Você deve selecionar mais de um lote.
 
-Selecione terrenos localizados em dois lotes.
+Selecione a terra através de ambos os lotes.
 	</notification>
 	<notification name="JoinLandWarning">
-		Unir os terrenos vai criar um grande lote, formado por todos os lotes que intersectam o retângulo selecionado.
+		Unir esta terra vai criar um grande lote que envolve todos os lotes que intersectam o retângulo selecionado.
 Você vai ter que redefinir nome e as opções do novo lote.
 
-Unir os terrenos?
+Unir a terra?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Unir"/>
 	</notification>
 	<notification name="ConfirmNotecardSave">
-		Esta anotação precisa ser salva antes de o item ser copiado ou visualizado. Salvar anotação?
+		Esta nota precisa ser salva antes do item ser copiado ou visualizado. Salvar nota?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Salvar"/>
 	</notification>
 	<notification name="ConfirmItemCopy">
@@ -931,36 +918,6 @@ Oferecer amizade para [NAME]?
 			<button name="Cancel" text="Cancelar"/>
 		</form>
 	</notification>
-	<notification label="Salvar este look" name="SaveOutfitAs">
-		Veja o meu novo visual:
-		<form name="form">
-			<input name="message">
-				[DESC] (novo)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Cancelar"/>
-		</form>
-	</notification>
-	<notification label="Salvar item de vestuário" name="SaveWearableAs">
-		Salvar item no meu inventário como:
-		<form name="form">
-			<input name="message">
-				[DESC] (novo)
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Cancelar"/>
-		</form>
-	</notification>
-	<notification label="Renomear look" name="RenameOutfit">
-		Nome do novo look:
-		<form name="form">
-			<input name="new_name">
-				[NAME]
-			</input>
-			<button name="Offer" text="OK"/>
-			<button name="Cancel" text="Cancelar"/>
-		</form>
-	</notification>
 	<notification name="RemoveFromFriends">
 		Você quer remover [FIRST_NAME] [LAST_NAME] da sua lista de amigos?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Remover"/>
@@ -995,12 +952,6 @@ em TODOS OS TERRENOS deste sim?
 
 Por favor, insira um valor maior.
 	</notification>
-	<notification name="ConfirmItemDeleteHasLinks">
-		Pelo menos um dos itens possui links que levam a ele.  Ao excluir o item, os links não funcionarão mais.   Por isso, recomendamos excluir os links primeiro.
-
-Tem certeza de que quer excluir estes items?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
-	</notification>
 	<notification name="ConfirmObjectDeleteLock">
 		Pelo menos um dos itens que você selecionou está trancado.
 
@@ -1066,23 +1017,24 @@ Tem certeza de que deseja pegar estes itens?
 		<usetemplate name="okcancelbuttons" notext="Não" yestext="Sim"/>
 	</notification>
 	<notification name="CantBuyLandAcrossMultipleRegions">
-		Não foi possível comprar o terreno, pois a seleção abrange várias regiões.
+		Não foi possível comprar terreno, pois a seleção abrange várias regiões.
 
 Por favor, selecione uma área menor e tente novamente.
 	</notification>
 	<notification name="DeedLandToGroup">
-		No ato da doação deste lote, o grupo deverá ter e manter créditos suficientes para ter o terreno.
-O preço de aquisição dos terrenos não é restituído ao proprietário. Se uma parcela doada for vendida, o preço de venda é dividido igualmente entre os membros do grupo.
+		Na transferência de propriedade deste lote, o grupo deverá ter e manter créditos suficientes de uso da terra.
+O preço de aquisição dos terrenos não é restituído ao o proprietário. Se uma parcela transferida é vendida, o preço de venda é dividido igualmente entre os membros do grupo.
 
-Doar [AREA] m² ao grupo &apos;[GROUP_NAME]&apos;?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
+Transferir propriedade de [AREA] m² de terra ao grupo &apos;[GROUP_NAME]&apos;?
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Acionar"/>
 	</notification>
 	<notification name="DeedLandToGroupWithContribution">
-		No ato da doação deste lote, o grupo deverá ter e manter créditos suficientes para ter o terreno. A doação inclui uma contribuição simultânea para o grupo de &apos;[FIRST_NAME] [LAST_NAME]&apos;.
-O preço de aquisição dos terrenos não é restituído ao proprietário. Se uma parcela doada for vendida, o preço de venda é dividido igualmente entre os membros do grupo.
+		Na transferência de propriedade deste lote, o grupo deverá ter e manter créditos suficientes de uso da terra.
+A Transferência incluirá uma contribuição de terra simultanea para o grupo de &apos;[FIRST_NAME] [LAST_NAME]&apos;.
+O preço da compra não será restituído ao proprietário. Se um lote for vendido, o preço da venda será dividido igualmente entre os membros do grupo.
 
-Doar [AREA] m² para o grupo &apos;[GROUP_NAME]&apos;?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
+Transferir propriedade destes [AREA] m² de terreno para o grupo &apos;[GROUP_NAME]&apos;?
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Acionar"/>
 	</notification>
 	<notification name="DisplaySetToSafe">
 		Configurações de display foram ajustadas para níveis de segurança porque você especificou -- opção de segurança.
@@ -1105,7 +1057,7 @@ Você chegou a uma região próxima.
 	<notification name="AvatarMovedHome">
 		Esse destino não está disponível no momento. 
 Você chegou a uma região próxima. 
-Pense em usar outra região como seu início.
+Pense em usar outra região como casa.
 	</notification>
 	<notification name="ClothingLoading">
 		As suas roupas estão sendo transferidas. 
@@ -1142,42 +1094,6 @@ Pressione a tecla F1 para ajuda ou aprender mais sobre [SECOND_LIFE].
 Por favor, escolha se o seu avatar é feminino ou masculino. Você pode mudar de idéia depois.
 		<usetemplate name="okcancelbuttons" notext="Feminino" yestext="Masculino"/>
 	</notification>
-	<notification name="CantTeleportToGrid">
-		Não foi possível ir para [SLURL], que fica em outro grid ([GRID]) em relação ao grid atual, ([CURRENT_GRID]).  Feche o Visualizador e tente novamente.
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="GeneralCertificateError">
-		Falha de conexão com o servidor.
-[REASON]
-
-SubjectName: [SUBJECT_NAME_STRING]
-IssuerName: [ISSUER_NAME_STRING]
-Válido de: [VALID_FROM]
-Válido até: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-Impressão digital SHA1: [MD5_DIGEST]
-Uso da chave: [KEYUSAGE]
-Uso estendido da chave: [EXTENDEDKEYUSAGE]
-Identificador chave de assunto: [SUBJECTKEYIDENTIFIER]
-		<usetemplate name="okbutton" yestext="OK"/>
-	</notification>
-	<notification name="TrustCertificateError">
-		A autoridade de certificação deste servidor é desconhecida.
-
-Dados do certificado:
-SubjectName: [SUBJECT_NAME_STRING]
-IssuerName: [ISSUER_NAME_STRING]
-Válido de: [VALID_FROM]
-Válido até: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-Impressão digital SHA1: [MD5_DIGEST]
-Uso da chave: [KEYUSAGE]
-Uso estendido da chave: [EXTENDEDKEYUSAGE]
-Identificador chave de assunto: [SUBJECTKEYIDENTIFIER]
-
-Confiar nesta autoridade?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Confiança"/>
-	</notification>
 	<notification name="NotEnoughCurrency">
 		[NAME] L$ [PRICE] Você não possui suficientes L$ para fazer isso.
 	</notification>
@@ -1201,7 +1117,7 @@ Isso é realmente útil apenas para depuração.
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
 	<notification name="KickUsersFromRegion">
-		Teletransportar para o início todos os residentes nesta região?
+		Teletransportar para casa todos os residentes nesta região?
 		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
 	</notification>
 	<notification name="EstateObjectReturn">
@@ -1482,10 +1398,6 @@ O bate-papo e MIs não serão exibidos.  MIs enviadas para você receberão sua
 		Teletransportar para [CLASSIFIED]?
 		<usetemplate ignoretext="Confirmar se eu quero ser teletransportado lugar do anúncio" name="okcancelignore" notext="Cancelar" yestext="Teletransportar"/>
 	</notification>
-	<notification name="TeleportToHistoryEntry">
-		Teletransportar para [HISTORY_ENTRY]?
-		<usetemplate ignoretext="Confirmar se eu quero ser teletransportado para marcos" name="okcancelignore" notext="Cancelar" yestext="Teletransportar"/>
-	</notification>
 	<notification label="Mensagem para todos na sua Propriedade" name="MessageEstate">
 		Digite um breve anúncio que será enviado para todos que estejam atualmente na sua propriedade.
 		<form name="form">
@@ -1568,18 +1480,15 @@ Ir para o Banco de Conhecimento para maiores informações sobre Classificaçõe
 		Você não é permitido nesta região devido à sua Classificação de maturidade.
 	</notification>
 	<notification name="RegionEntryAccessBlocked_Change">
-		Você não pode entrar nessa região devido à sua seleção de maturidade.
+		Você não pode entrar nessa região devido à sua seleção de maturidade. 
 
-Para entrar na região desejada, mude o nível de maturidade.  Você então poderá fazer buscas e acessar conteúdo [REGIONMATURITY]. Para desfazer qualquer mudança, vá para Eu &gt; Preferências &gt; Geral.
+Clique em &apos;Mudar preferência&apos; para aumentar o nível de maturidade e entrar nessa região.  De agora em diante você pode buscar e acessar conteúdo [REGIONMATURITY] .  Para modificar esta configuração, vá à Eu &gt; Preferências &gt; Geral.
 		<form name="form">
 			<button name="OK" text="Mudar preferência"/>
 			<button default="true" name="Cancel" text="Fechar"/>
 			<ignore name="ignore" text="Minha preferência de maturidade impede que eu vá a uma região"/>
 		</form>
 	</notification>
-	<notification name="PreferredMaturityChanged">
-		Sua opção de nível de maturidade é [RATING].
-	</notification>
 	<notification name="LandClaimAccessBlocked">
 		Você não pode reclamar esta terra devido à sua Classificação de maturidade. Isto pode ser o resultado de falta de informação na validação de sua idade.
 
@@ -1995,9 +1904,6 @@ Inclua um link para facilitar o acesso para visitantes. Teste o link na barra de
 	<notification name="SystemMessageTip">
 		[MESSAGE]
 	</notification>
-	<notification name="IMSystemMessageTip">
-		[MESSAGE]
-	</notification>
 	<notification name="Cancelled">
 		Cancelado
 	</notification>
@@ -2219,7 +2125,7 @@ Objetos não transferíveis dados ao grupo foram deletados.
 	</notification>
 	<notification name="NotSafe">
 		A opção &apos;danos&apos; desta região está ativada. 
-Você pode se dar mal aqui.  Se você morrer, você será teletransportado de volta para seu início.
+Você pode se dar mal aqui.  Se você morre, você será teletransportado de volta para casa.
 	</notification>
 	<notification name="NoFly">
 		Esta área desativou a opção de voar. 
@@ -2325,6 +2231,15 @@ Por favor, tente novamente em alguns instantes.
 	</notification>
 	<notification name="ObjectGiveItem">
 		Um objeto chamado [OBJECTFROMNAME] de [NAME_SLURL] lhe deu [OBJECTTYPE]:
+[ITEM_SLURL]
+		<form name="form">
+			<button name="Keep" text="Segure"/>
+			<button name="Discard" text="Descarte"/>
+			<button name="Mute" text="Bloquear"/>
+		</form>
+	</notification>
+	<notification name="ObjectGiveItemUnknownUser">
+		Um objeto chamado [OBJECTFROMNAME] de (residente desconhecido) lhe deu [OBJECTTYPE]:
 [ITEM_SLURL]
 		<form name="form">
 			<button name="Keep" text="Segure"/>
@@ -2355,9 +2270,9 @@ Por favor, tente novamente em alguns instantes.
 		</form>
 	</notification>
 	<notification name="TeleportOffered">
-		[NAME_SLURL] quer teletransportar você para a região deles:
+		[NAME] quer te teletransportar para a região deles:
 
-[MESSAGE] - [MATURITY_STR] &lt;icon&gt;[MATURITY_ICON]&lt;/icon&gt;
+[MESSAGE]
 		<form name="form">
 			<button name="Teleport" text="Teletransporte"/>
 			<button name="Cancel" text="Cancelar"/>
@@ -2375,11 +2290,11 @@ Por favor, tente novamente em alguns instantes.
 		</form>
 	</notification>
 	<notification name="OfferFriendship">
-		[NAME_SLURL] quer a sua amizade.
+		[NAME] está lhe oferecendo sua amizade
 
 [MESSAGE]
 
-Cada um pode ver o status do outro (definição padrão).
+(Por definição vocês serão capazes de ver um ao outro online)
 		<form name="form">
 			<button name="Accept" text="Aceitar"/>
 			<button name="Decline" text="Recusar"/>
@@ -2573,21 +2488,6 @@ Clique em Aceitar para atender ou em Recusar para recusar este convite.  Clique
 	<notification name="VoiceLoginRetry">
 		Estamos criando uma canal de voz para você. Isto pode levar até um minuto.
 	</notification>
-	<notification name="VoiceEffectsExpired">
-		Um ou mais serviços de distorção de voz que você assinou veceu.
-[[URL] Clique aqui] para renovar o serviço.
-	</notification>
-	<notification name="VoiceEffectsExpiredInUse">
-		A Distorção de voz ativa expirou. Suas configurações de voz padrão foram ativadas.
-[[URL] Clique aqui] para renovar o serviço.
-	</notification>
-	<notification name="VoiceEffectsWillExpire">
-		Uma ou mais das suas distorções de voz tem vencimento em menos de [INTERVAL] dias.
-[[URL] Clique aqui] para renovar o serviço.
-	</notification>
-	<notification name="VoiceEffectsNew">
-		Novas Distorções de voz!
-	</notification>
 	<notification name="Cannot enter parcel: not a group member">
 		Só membros de um grupo podem acessar esta área.
 	</notification>
@@ -2653,96 +2553,6 @@ Para sua segurança, os SLurls serão bloqueados por alguns instantes.
 		O botão selecionado não pode ser exibido no momento. 
 O botão será exibido quando houver espaço suficente.
 	</notification>
-	<notification name="ShareNotification">
-		Selecione os residentes com quem compartilhar.
-	</notification>
-	<notification name="ShareItemsConfirmation">
-		Tem certeza de que quer compartilhar os items abaixo?
-
-[ITENS]
-
-Com os seguintes residentes:
-
-[RESIDENTS]
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="OK"/>
-	</notification>
-	<notification name="ItemsShared">
-		Itens compartilhados.
-	</notification>
-	<notification name="DeedToGroupFail">
-		Ocorreu uma falha durante a doação ao grupo.
-	</notification>
-	<notification name="AvatarRezNotification">
-		( [EXISTENCE] segundos de vida )
-O avatar de &apos;[NAME]&apos; emergiu em [TIME] segundos.
-	</notification>
-	<notification name="AvatarRezSelfBakedDoneNotification">
-		( [EXISTENCE] segundos de vida )
-Você confeccionou seu look em [TIME] segundos.
-	</notification>
-	<notification name="AvatarRezSelfBakedUpdateNotification">
-		( [EXISTENCE] segundos de vida )
-Você enviou uma atualização da sua aparência em [TIME] segundos.
-[STATUS]
-	</notification>
-	<notification name="AvatarRezCloudNotification">
-		( [EXISTENCE] segundos de vida )
-Avatar &apos;[NAME]&apos; transformou-se em nuvem.
-	</notification>
-	<notification name="AvatarRezArrivedNotification">
-		( [EXISTENCE] segundos de vida )
-Avatar &apos;[NAME]&apos; surgiu.
-	</notification>
-	<notification name="AvatarRezLeftCloudNotification">
-		( [EXISTENCE] segundos de vida )
-O avatar de &apos;[NAME]&apos; transformou-se em nuvem depois de [TIME] segundos.
-	</notification>
-	<notification name="AvatarRezEnteredAppearanceNotification">
-		( [EXISTENCE] segundos de vida )
-Avatar &apos;[NAME]&apos; entrou no modo aparência.
-	</notification>
-	<notification name="AvatarRezLeftAppearanceNotification">
-		( [EXISTENCE] segundos de vida )
-Avatar &apos;[NAME]&apos; sair do modo aparecer.
-	</notification>
-	<notification name="NoConnect">
-		Detectamos um problema de conexão com [PROTOCOL] [HOSTID].
-Verifique a configuração da sua rede e firewall.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="NoVoiceConnect">
-		Estamos tendo problemas de conexão com o seu servidor de voz:
-
-[HOSTID]
-
-Talvez não seja possível se comunicar via voz.
-Verifique a configuração da sua rede e firewall.
-		<form name="form">
-			<button name="OK" text="OK"/>
-		</form>
-	</notification>
-	<notification name="AvatarRezLeftNotification">
-		( [EXISTENCE] segundos de vida )
-Avatar &apos;[NAME]&apos; saiu totalmente carregado.
-	</notification>
-	<notification name="AvatarRezSelfBakeNotification">
-		( [EXISTENCE] segundos de vida )
-[ACTION] de textura com [RESOLUTION] para o(a) &apos;[BODYREGION]&apos; em [TIME] segundos.
-	</notification>
-	<notification name="ConfirmLeaveCall">
-		Tem certeza de que quer sair desta ligação?
-		<usetemplate ignoretext="Confirmar antes de deixar ligação" name="okcancelignore" notext="Não" yestext="Sim"/>
-	</notification>
-	<notification name="ConfirmMuteAll">
-		Você silenciou todos os participantes de uma ligação de grupo.
-Todos os demais residentes que entrarem na ligação mais tarde também serão silenciados, mesmo se você sair da ligação.
-
-
-Silenciar todos?
-		<usetemplate ignoretext="Confirmar antes de silenciar todos os participantes em ligações de grupo." name="okcancelignore" notext="Cancelar" yestext="OK"/>
-	</notification>
 	<global name="UnsupportedCPU">
 		- A velocidade da sua CPU não suporta os requisitos mínimos exigidos.
 	</global>
@@ -2764,10 +2574,7 @@ Se você continuar a receber esta mensagem, consulte o [SUPPORT_SITE].
 		- A memória do seu sistema não suporta os requisitos mínimos exigidos.
 	</global>
 	<global name="You can only set your &apos;Home Location&apos; on your land or at a mainland Infohub.">
-		Se você tem um terreno, seu terreno pode ser seu início. 
+		Se você tem um terreno, seu terreno pode ser sua casa. 
 Outra opção é procurar por lugares com a tag &apos;Infohub&apos; no mapa.
 	</global>
-	<global name="You died and have been teleported to your home location">
-		Você morreu e foi reenviado ao seu início.
-	</global>
 </notifications>
diff --git a/indra/newview/skins/default/xui/pt/panel_edit_tattoo.xml b/indra/newview/skins/default/xui/pt/panel_edit_tattoo.xml
index f85bb3c49993f9219c21e659e7143bd4a4638b8e..23cde50acc3e65f7ebcf9a30809c0cd08157b216 100644
--- a/indra/newview/skins/default/xui/pt/panel_edit_tattoo.xml
+++ b/indra/newview/skins/default/xui/pt/panel_edit_tattoo.xml
@@ -4,6 +4,5 @@
 		<texture_picker label="Tatuagem de cabeça" name="Head Tattoo" tool_tip="Clique para escolher uma foto"/>
 		<texture_picker label="Tatuagem superior" name="Upper Tattoo" tool_tip="Selecione uma foto"/>
 		<texture_picker label="Tatuagem inferior" name="Lower Tattoo" tool_tip="Selecione uma foto"/>
-		<color_swatch label="Cor/Tonalidade" name="Color/Tint" tool_tip="Selecionar a cor"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_group_general.xml b/indra/newview/skins/default/xui/pt/panel_group_general.xml
index b634ec3f642b2942c085fcb707df901fab7e13ce..0b65b4aadeec84a09f2f4f65dabd88261e9916f9 100644
--- a/indra/newview/skins/default/xui/pt/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/pt/panel_group_general.xml
@@ -47,11 +47,8 @@ Para obter mais ajuda, passe o mouse sobre as opções.
 		<check_box label="Taxa de inscrição" name="check_enrollment_fee" tool_tip="Controla a cobrança de uma taxa de associação ao grupo."/>
 		<spinner label="L$" left_delta="120" name="spin_enrollment_fee" tool_tip="Se a opção &apos;Taxa de associação&apos; estiver marcada, novos membros precisam pagar o valor definido para entrar no grupo." width="60"/>
 		<combo_box name="group_mature_check" tool_tip="Define se os dados do seu grupo são conteúdo moderado." width="170">
-			<combo_item name="select_mature">
-				- Selecione o nível de maturidade -
-			</combo_item>
-			<combo_box.item label="Conteúdo Mature" name="mature"/>
 			<combo_box.item label="Conteúdo PG" name="pg"/>
+			<combo_box.item label="Conteúdo Mature" name="mature"/>
 		</combo_box>
 		<check_box initial_value="true" label="Mostre na busca" name="show_in_group_list" tool_tip="Incluir o grupo nos resultados de busca"/>
 	</panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_group_notices.xml b/indra/newview/skins/default/xui/pt/panel_group_notices.xml
index 21136d06fb8e7f9366055849480bfaf9418eb5f1..4b5a00c761c70f21dcd7771bb5eb551565e60690 100644
--- a/indra/newview/skins/default/xui/pt/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/pt/panel_group_notices.xml
@@ -18,7 +18,7 @@ Cada grupo pode enviar no máximo 200 avisos/dia
 	<text name="notice_list_none_found">
 		Nenhum resultado foi encontrado.
 	</text>
-	<button label="Novo aviso" label_selected="Criar nova notícia" name="create_new_notice" tool_tip="Criar um novo aviso"/>
+	<button label="Criar um novo aviso" label_selected="Criar nova notícia" name="create_new_notice" tool_tip="Criar um novo aviso"/>
 	<button label="Atualizar" label_selected="Atualizar lista" name="refresh_notices" tool_tip="Atualizar lista de avisos"/>
 	<panel label="Criar nova notícia" name="panel_create_new_notice">
 		<text name="lbl">
@@ -39,7 +39,6 @@ Cada grupo pode enviar no máximo 200 avisos/dia
 		<text name="string">
 			Arrastar e soltar o item aqui para anexá-lo:
 		</text>
-		<button label="Inventário" name="open_inventory" tool_tip="Inventário aberto"/>
 		<button label="Tirar" label_selected="Remover o anexo" name="remove_attachment" tool_tip="Remover anexo da notificação."/>
 		<button label="Enviar" label_selected="Enviar" name="send_notice"/>
 		<group_drop_target name="drop_target" tool_tip="Arrastar um item do inventário para a caixa para enviá-lo com o aviso. É preciso ter autorização de cópia e transferência do item para anexá-lo ao aviso."/>
diff --git a/indra/newview/skins/default/xui/pt/panel_main_inventory.xml b/indra/newview/skins/default/xui/pt/panel_main_inventory.xml
index dbf8e4fa527c6e769d687503fe3b18f0f3b77c59..104c3bface2bb5c7a9eee257fd54567d40a2f76f 100644
--- a/indra/newview/skins/default/xui/pt/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/pt/panel_main_inventory.xml
@@ -9,20 +9,62 @@
 	<text name="ItemcountText">
 		Itens:
 	</text>
+	<menu_bar name="Inventory Menu">
+		<menu label="Arquivo" name="File">
+			<menu_item_call label="Abrir" name="Open"/>
+			<menu label="Upload" name="upload">
+				<menu_item_call label="Imagem (L$[COST])..." name="Upload Image"/>
+				<menu_item_call label="Som (L$[COST])..." name="Upload Sound"/>
+				<menu_item_call label="Animação (L$[COST])..." name="Upload Animation"/>
+				<menu_item_call label="Volume (L$[COST] per file)..." name="Bulk Upload"/>
+			</menu>
+			<menu_item_call label="Nova janela" name="New Window"/>
+			<menu_item_call label="Mostrar filtros" name="Show Filters"/>
+			<menu_item_call label="Restabelecer filtros" name="Reset Current"/>
+			<menu_item_call label="Fechar todas as pastas" name="Close All Folders"/>
+			<menu_item_call label="Esvaziar lixeira" name="Empty Trash"/>
+			<menu_item_call label="Esvaziar achados e perdidos" name="Empty Lost And Found"/>
+		</menu>
+		<menu label="Crie" name="Create">
+			<menu_item_call label="Nova pasta" name="New Folder"/>
+			<menu_item_call label="Novo script" name="New Script"/>
+			<menu_item_call label="Nova anotação" name="New Note"/>
+			<menu_item_call label="Novo gesto" name="New Gesture"/>
+			<menu label="Novas roupas" name="New Clothes">
+				<menu_item_call label="Nova camisa" name="New Shirt"/>
+				<menu_item_call label="Novas calças" name="New Pants"/>
+				<menu_item_call label="Novos sapatos" name="New Shoes"/>
+				<menu_item_call label="Novas meias" name="New Socks"/>
+				<menu_item_call label="Nova blusa" name="New Jacket"/>
+				<menu_item_call label="Nova saia" name="New Skirt"/>
+				<menu_item_call label="Novas luvas" name="New Gloves"/>
+				<menu_item_call label="Nova camiseta" name="New Undershirt"/>
+				<menu_item_call label="Novas roupa de baixo" name="New Underpants"/>
+				<menu_item_call label="Novo alpha" name="New Alpha"/>
+				<menu_item_call label="Nova tatuagem" name="New Tattoo"/>
+			</menu>
+			<menu label="Nova parte do corpo" name="New Body Parts">
+				<menu_item_call label="Nova forma" name="New Shape"/>
+				<menu_item_call label="Nova pele" name="New Skin"/>
+				<menu_item_call label="Novo cabelo" name="New Hair"/>
+				<menu_item_call label="Novos olhos" name="New Eyes"/>
+			</menu>
+		</menu>
+		<menu label="Classificar" name="Sort">
+			<menu_item_check label="Por nome" name="By Name"/>
+			<menu_item_check label="Por data" name="By Date"/>
+			<menu_item_check label="Pastas sempre por nome" name="Folders Always By Name"/>
+			<menu_item_check label="Pastas do sistema no topo" name="System Folders To Top"/>
+		</menu>
+	</menu_bar>
 	<filter_editor label="Filtro" name="inventory search editor"/>
 	<tab_container name="inventory filter tabs">
 		<inventory_panel label="Todos os itens" name="All Items"/>
-		<recent_inventory_panel label="Itens recentes" name="Recent Items"/>
+		<inventory_panel label="Itens recentes" name="Recent Items"/>
 	</tab_container>
-	<layout_stack name="bottom_panel">
-		<layout_panel name="options_gear_btn_panel">
-			<button name="options_gear_btn" tool_tip="Mostrar opções adicionais"/>
-		</layout_panel>
-		<layout_panel name="add_btn_panel">
-			<button name="add_btn" tool_tip="Adicionar novo item"/>
-		</layout_panel>
-		<layout_panel name="trash_btn_panel">
-			<dnd_button name="trash_btn" tool_tip="Remover item selecionado"/>
-		</layout_panel>
-	</layout_stack>
+	<panel name="bottom_panel">
+		<button name="options_gear_btn" tool_tip="Mostrar opções adicionais"/>
+		<button name="add_btn" tool_tip="Adicionar novo item"/>
+		<dnd_button name="trash_btn" tool_tip="Remover item selecionado"/>
+	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_people.xml b/indra/newview/skins/default/xui/pt/panel_people.xml
index efeea89fa9744241156e39eb9c989f10962dec54..1516a2bb6566d202724ef573452852199023fbc7 100644
--- a/indra/newview/skins/default/xui/pt/panel_people.xml
+++ b/indra/newview/skins/default/xui/pt/panel_people.xml
@@ -1,23 +1,14 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <!-- Side tray panel -->
 <panel label="Pessoas" name="people_panel">
-	<string name="no_recent_people" value="Ninguém, recentemente. Em busca de alguém para conversar? Use a [secondlife:///app/search/people Busca] ou o [secondlife:///app/worldmap Mapa-Múndi]."/>
-	<string name="no_filtered_recent_people" value="Não encontrou o que procura? Tente buscar no [secondlife:///app/search/people/[SEARCH_TERM] Search]."/>
-	<string name="no_one_near" value="Ninguém por perto Em busca de alguém para conversar? Use a [secondlife:///app/search/people Busca] ou o [secondlife:///app/worldmap Mapa-Múndi]."/>
-	<string name="no_one_filtered_near" value="Não encontrou o que procura? Tente buscar no [secondlife:///app/search/people/[SEARCH_TERM] Search]."/>
+	<string name="no_people" value="Nenhuma pessoa"/>
+	<string name="no_one_near" value="Ninguém por perto"/>
 	<string name="no_friends_online" value="Nenhum amigo online"/>
 	<string name="no_friends" value="Nenhum amigo"/>
-	<string name="no_friends_msg">
-		Encontre amigos fazendo uma [secondlife:///app/search/people busca de pessoas] ou clique em um residente para adicioná-lo.
-Em busca de alguém para conversar? Procure no [secondlife:///app/worldmap Mapa-Múndi].
-	</string>
-	<string name="no_filtered_friends_msg">
-		Não encontrou o que procura? Tente buscar no [secondlife:///app/search/people/[SEARCH_TERM] Search].
-	</string>
 	<string name="people_filter_label" value="Filtro de pessoas"/>
 	<string name="groups_filter_label" value="Filtro de grupos"/>
-	<string name="no_filtered_groups_msg" value="Não encontrou o que procura? Tente buscar no [secondlife:///app/search/groups/[SEARCH_TERM] Search]."/>
-	<string name="no_groups_msg" value="À procura de grupos interessantes? Tente fazer uma [secondlife:///app/search/groups Busca]."/>
+	<string name="no_filtered_groups_msg" value="[secondlife:///app/search/groups Tente encontrar o grupo na Busca]"/>
+	<string name="no_groups_msg" value="[secondlife:///app/search/groups Tente procurar grupos que lhe interessam]"/>
 	<filter_editor label="Filtro" name="filter_input"/>
 	<tab_container name="tabs">
 		<panel label="PROXIMIDADE" name="nearby_panel">
@@ -36,6 +27,10 @@ Em busca de alguém para conversar? Procure no [secondlife:///app/worldmap Mapa-
 				<button name="add_btn" tool_tip="Oferecer amizade para um residente"/>
 				<button name="del_btn" tool_tip="Remover a pessoa selecionada da sua lista de amigos"/>
 			</panel>
+			<text name="no_friends_msg">
+				Para adicionar amigos, use a [secondlife:///app/search/people busca de pessoas] ou clique em um residente para adicioná-lo.
+Para conhecer mais gente, use [secondlife:///app/worldmap o Mapa].
+			</text>
 		</panel>
 		<panel label="MEUS GRUPOS" name="groups_panel">
 			<panel label="bottom_panel" name="bottom_panel">
@@ -52,11 +47,11 @@ Em busca de alguém para conversar? Procure no [secondlife:///app/worldmap Mapa-
 		</panel>
 	</tab_container>
 	<panel name="button_bar">
-		<button label="Perfil" name="view_profile_btn" tool_tip="Exibir fotografia, grupos e outras informações dos residentes" width="50"/>
-		<button label="MI" name="im_btn" tool_tip="Iniciar MI" width="24"/>
-		<button label="Chamada" name="call_btn" tool_tip="Ligar para este residente" width="61"/>
-		<button label="Compartilhar" name="share_btn" tool_tip="Compartilhar item de inventário" width="82"/>
-		<button label="Teletransporte" name="teleport_btn" tool_tip="Oferecer teletransporte" width="86"/>
+		<button label="Perfil" name="view_profile_btn" tool_tip="Exibir fotografia, grupos e outras informações dos residentes"/>
+		<button label="MI" name="im_btn" tool_tip="Iniciar MI"/>
+		<button label="Chamada" name="call_btn" tool_tip="Ligar para este residente"/>
+		<button label="Compartilhar" name="share_btn"/>
+		<button label="Teletransporte" name="teleport_btn" tool_tip="Oferecer teletransporte"/>
 		<button label="Perfil do grupo" name="group_info_btn" tool_tip="Exibir informação de grupo"/>
 		<button label="Bate-papo de grupo" name="chat_btn" tool_tip="Iniciar bate-papo"/>
 		<button label="Ligar para o grupo" name="group_call_btn" tool_tip="Ligar para este grupo"/>
diff --git a/indra/newview/skins/default/xui/pt/panel_place_profile.xml b/indra/newview/skins/default/xui/pt/panel_place_profile.xml
index af6c9ea346c36efa8473d33dd329955e2ace2228..03f997f31bd0fb580a90db3c60c7ba64d55888eb 100644
--- a/indra/newview/skins/default/xui/pt/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/pt/panel_place_profile.xml
@@ -7,7 +7,7 @@
 	<string name="allocated" value="alocados"/>
 	<string name="title_place" value="Perfil da região"/>
 	<string name="title_teleport_history" value="Teletransportes"/>
-	<string name="not_available" value="(N/A)"/>
+	<string name="not_available" value="(N\A)"/>
 	<string name="unknown" value="(Desconhecido)"/>
 	<string name="public" value="(público)"/>
 	<string name="none_text" value="(nenhum)"/>
@@ -36,7 +36,7 @@
 		Dados sobre o local não disponíveis no momento. Favor tentar mais tarde.
 	</string>
 	<string name="server_forbidden_text">
-		Dados sobre o local controlados por lista de acesso. Verifique se você está autorizado a acessá-los com o dono do lote.
+		Dados sobre o local controlados por lista de acesso.   Verifique se você está autorizado a acessá-los com o dono do lote.
 	</string>
 	<string name="acquired_date">
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
@@ -53,18 +53,18 @@
 						<text name="rating_label" value="Classificação:"/>
 						<text name="rating_value" value="desconhecido"/>
 						<text name="voice_label" value="Voz:"/>
-						<text name="voice_value" value="Ligado"/>
+						<text name="voice_value" value="Ligar"/>
 						<text name="fly_label" value="Voar:"/>
-						<text name="fly_value" value="Ligado"/>
-						<text name="push_label" value="Empurrões:"/>
-						<text name="push_value" value="Desligado"/>
+						<text name="fly_value" value="Ligar"/>
+						<text name="push_label" value="Empurrar:"/>
+						<text name="push_value" value="Desligar"/>
 						<text name="build_label" value="Construir:"/>
-						<text name="build_value" value="Ligado"/>
+						<text name="build_value" value="Ligar"/>
 						<text name="scripts_label" value="Scripts:"/>
-						<text name="scripts_value" value="Ligado"/>
+						<text name="scripts_value" value="Ligar"/>
 						<text name="damage_label" value="Dano:"/>
-						<text name="damage_value" value="Desligado"/>
-						<button label="Sobre o terreno" name="about_land_btn"/>
+						<text name="damage_value" value="Desligar"/>
+						<button label="Sobre terrenos" name="about_land_btn"/>
 					</panel>
 				</accordion_tab>
 				<accordion_tab name="region_information_tab" title="Região">
diff --git a/indra/newview/skins/default/xui/pt/panel_places.xml b/indra/newview/skins/default/xui/pt/panel_places.xml
index 5f2c56ab8c429a2a2a7c4bdf3aba3dfa04ac0cfd..9da4201c85fb537288c34e0e71d32b0d250da58a 100644
--- a/indra/newview/skins/default/xui/pt/panel_places.xml
+++ b/indra/newview/skins/default/xui/pt/panel_places.xml
@@ -5,12 +5,11 @@
 	<filter_editor label="Filtrar meus lugares" name="Filter"/>
 	<panel name="button_panel">
 		<button label="Teletransportar" name="teleport_btn" tool_tip="Teletransportar para a área selecionada"/>
-		<button label="Mapa" name="map_btn" tool_tip="Mostrar a área no Mapa Múndi"/>
+		<button label="Mapa" name="map_btn"/>
 		<button label="Editar" name="edit_btn" tool_tip="Editar dados do marco"/>
 		<button label="▼" name="overflow_btn" tool_tip="Mostrar opções adicionais"/>
 		<button label="Salvar" name="save_btn"/>
 		<button label="Cancelar" name="cancel_btn"/>
 		<button label="Fechar" name="close_btn"/>
-		<button label="Perfil" name="profile_btn" tool_tip="Mostrar perfil do lugar"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/pt/panel_preferences_advanced.xml
index 13cb8a444ede63caa2e3a44f0fced7994280129d..f30c218c818ce4ac591b0bf53f7c0718a884eece 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_advanced.xml
@@ -11,9 +11,8 @@
 	<text name="heading2">
 		Posicionamento automático da:
 	</text>
-	<check_box label="Construção/Edição" name="edit_camera_movement" tool_tip="Use o posicionamento automático da câmera quando entrar e sair do modo de edição"/>
+	<check_box label="Construir/Editar" name="edit_camera_movement" tool_tip="Use o posicionamento automático da câmera quando entrar e sair do modo de edição"/>
 	<check_box label="Aparência" name="appearance_camera_movement" tool_tip="Use o posicionamento automático da câmera quando em modo de edição"/>
-	<check_box initial_value="verdadeiro" label="Barra lateral" name="appearance_sidebar_positioning" tool_tip="Usar posicionamento automático da câmera na barra lateral"/>
 	<check_box label="Mostre-me em visão de mouse" name="first_person_avatar_visible"/>
 	<check_box label="Teclas de seta sempre me movem" name="arrow_keys_move_avatar_check"/>
 	<check_box label="Dê dois toques e pressione para correr" name="tap_tap_hold_to_run"/>
@@ -21,9 +20,6 @@
 	<check_box label="Balão de bate-papo" name="bubble_text_chat"/>
 	<slider label="Opacidade" name="bubble_chat_opacity"/>
 	<color_swatch name="background" tool_tip="Cor do balão de bate-papo"/>
-	<text name="UI Size:">
-		Interface
-	</text>
 	<check_box label="Mostrar erros de script" name="show_script_errors"/>
 	<radio_group name="show_location">
 		<radio_item label="Bate-papo local" name="0"/>
@@ -33,5 +29,4 @@
 	<line_editor label="Botão apertar e falar" name="modifier_combo"/>
 	<button label="Definir tecla" name="set_voice_hotkey_button"/>
 	<button label="Botão do meio do mouse" name="set_voice_middlemouse_button" tool_tip="Redefinir como botão do meio do mouse"/>
-	<button label="Outros dispositivos" name="joystick_setup_button"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml
index 02b0ef35fe2e1f9e381b0dfce71f168ebe80bf4f..e566fde27cfefe63abceda442c5683b89ad57083 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml
@@ -45,7 +45,6 @@
 	</text>
 	<check_box initial_value="true" label="Executar animação digitada quando estiver conversando" name="play_typing_animation"/>
 	<check_box label="Enviar MIs por email se estiver desconectado" name="send_im_to_email"/>
-	<check_box label="Ativar MIs e bate-papos de texto simples" name="plain_text_chat_history"/>
 	<text name="show_ims_in_label">
 		Mostrar MIs em:
 	</text>
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_general.xml b/indra/newview/skins/default/xui/pt/panel_preferences_general.xml
index 8a34897c9b38b1a8dbd121ce0007677fee2dfdb1..5c69fa8de1342627f16dc737ec88049d2e815440 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_general.xml
@@ -17,7 +17,7 @@
 		<combo_box.item label="日本語 (Japonês) - Beta" name="(Japanese)"/>
 	</combo_box>
 	<text name="language_textbox2">
-		(Reinicie para trocar de idioma)
+		(Reinicie para mostrar o novo idioma)
 	</text>
 	<text name="maturity_desired_prompt">
 		Quero acessar conteúdo:
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml b/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml
index 5266f646b7fec437cba144285972b615ab3dbe51..f03063d05b20509a33345231a9a8f48504339dbf 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml
@@ -37,9 +37,9 @@
 		<radio_item label="Usar meu navegador (IE, Firefox, Safari)" name="external" tool_tip="Use o navegador incluso para consultar a ajuda, abrir links da web, etc. Uso em tela inteira não recomendado." value="1"/>
 		<radio_item label="Usar navegador incluso" name="internal" tool_tip="Use este navegador para consultar a ajuda, abrir links da web, etc. As janelas abrem dentro do [APP_NAME]." value=""/>
 	</radio_group>
-	<check_box initial_value="true" label="Habilitar plugins" name="browser_plugins_enabled"/>
-	<check_box initial_value="true" label="Aceitar cookies" name="cookies_enabled"/>
-	<check_box initial_value="true" label="Habilitar Javascript" name="browser_javascript_enabled"/>
+	<check_box initial_value="verdadeiro" label="Habilitar plugins" name="browser_plugins_enabled"/>
+	<check_box initial_value="verdadeiro" label="Aceitar cookies" name="cookies_enabled"/>
+	<check_box initial_value="verdadeiro" label="Habilitar Javascript" name="browser_javascript_enabled"/>
 	<check_box initial_value="false" label="Ativar web proxy" name="web_proxy_enabled"/>
 	<text name="Proxy location">
 		Localização do proxy:
diff --git a/indra/newview/skins/default/xui/pt/strings.xml b/indra/newview/skins/default/xui/pt/strings.xml
index 4bf2bda248f2c39bbcc2b99630a18f31bfac22b8..773aea58480f1a7fa9a23ee3d8c48dcdb7f0c2d6 100644
--- a/indra/newview/skins/default/xui/pt/strings.xml
+++ b/indra/newview/skins/default/xui/pt/strings.xml
@@ -88,24 +88,6 @@
 	<string name="LoginDownloadingClothing">
 		Baixando roupas...
 	</string>
-	<string name="InvalidCertificate">
-		O servidor respondeu com um certificado inválido ou corrompido. Por favor contate o administrador do Grid.
-	</string>
-	<string name="CertInvalidHostname">
-		Um hostname inválido foi usado para acessar o servidor. Verifique o SLURL ou hostname do Grid.
-	</string>
-	<string name="CertExpired">
-		O certificado dado pelo Grid parece estar vencido.  Verifique o relógio do sistema ou contate o administrador do Grid.
-	</string>
-	<string name="CertKeyUsage">
-		O certificado dado pelo servidor não pôde ser usado para SSL.  Por favor contate o administrador do Grid.
-	</string>
-	<string name="CertBasicConstraints">
-		A cadeia de certificados do servidor tinha certificados demais.  Por favor contate o administrador do Grid.
-	</string>
-	<string name="CertInvalidSignature">
-		A assinatura do certificado dado pelo servidor do Grid não pôde ser verificada.  Contate o administrador do seu Grid.
-	</string>
 	<string name="LoginFailedNoNetwork">
 		Erro de rede: Não foi possível estabelecer a conexão, verifique sua conexão de rede.
 	</string>
@@ -184,7 +166,6 @@
 	<string name="TooltipMustSingleDrop">
 		Apenas um item único pode ser arrastado para este local
 	</string>
-	<string name="TooltipPrice" value="L$[AMOUNT]"/>
 	<string name="TooltipHttpUrl">
 		Clique para ver a página web
 	</string>
@@ -237,6 +218,7 @@
 		Clique para ativar no secondlife:// comando
 	</string>
 	<string name="CurrentURL" value="URL atual: [CurrentURL]"/>
+	<string name="TooltipPrice" value="L$[PRICE]-"/>
 	<string name="SLurlLabelTeleport">
 		Teletransportar para
 	</string>
@@ -267,9 +249,6 @@
 	<string name="BUTTON_CLOSE_WIN">
 		Fechar (Ctrl+W)
 	</string>
-	<string name="BUTTON_CLOSE_CHROME">
-		Fechar
-	</string>
 	<string name="BUTTON_RESTORE">
 		Restaurar
 	</string>
@@ -297,9 +276,6 @@
 	<string name="ReleaseNotes">
 		Notas de versão
 	</string>
-	<string name="RELEASE_NOTES_BASE_URL">
-		http://wiki.secondlife.com/wiki/Release_Notes/
-	</string>
 	<string name="LoadingData">
 		Carregando...
 	</string>
@@ -312,9 +288,6 @@
 	<string name="GroupNameNone">
 		(nenhum)
 	</string>
-	<string name="AvalineCaller">
-		Interlocutor Avaline [ORDER]
-	</string>
 	<string name="AssetErrorNone">
 		Nenhum erro
 	</string>
@@ -645,9 +618,6 @@
 	<string name="worldmap_offline">
 		Offline
 	</string>
-	<string name="worldmap_item_tooltip_format">
-		L$[PRICE] por [AREA] m²
-	</string>
 	<string name="worldmap_results_none_found">
 		Nenhum encontrado.
 	</string>
@@ -738,12 +708,6 @@
 	<string name="land_type_unknown">
 		(desconhecido)
 	</string>
-	<string name="Estate / Full Region">
-		Propriedadade / Região inteira:
-	</string>
-	<string name="Mainland / Full Region">
-		Continente / Região inteira:
-	</string>
 	<string name="all_files">
 		Todos os arquivos
 	</string>
@@ -849,93 +813,6 @@
 	<string name="invalid">
 		Inválido
 	</string>
-	<string name="none">
-		nenhum
-	</string>
-	<string name="shirt_not_worn">
-		Camisa não vestida
-	</string>
-	<string name="pants_not_worn">
-		Calças não vestidas
-	</string>
-	<string name="shoes_not_worn">
-		Sapatos não calçados
-	</string>
-	<string name="socks_not_worn">
-		Meias não calçadas
-	</string>
-	<string name="jacket_not_worn">
-		Jaqueta não vestida
-	</string>
-	<string name="gloves_not_worn">
-		Luvas não calçadas
-	</string>
-	<string name="undershirt_not_worn">
-		Camiseta não vestida
-	</string>
-	<string name="underpants_not_worn">
-		Roupa de baixo não vestida
-	</string>
-	<string name="skirt_not_worn">
-		Saia não vestida
-	</string>
-	<string name="alpha_not_worn">
-		Alpha não vestido
-	</string>
-	<string name="tattoo_not_worn">
-		Tatuagem não usada
-	</string>
-	<string name="invalid_not_worn">
-		inválido
-	</string>
-	<string name="create_new_shape">
-		Criar novo físico
-	</string>
-	<string name="create_new_skin">
-		Criar pele nova
-	</string>
-	<string name="create_new_hair">
-		Criar cabelo novo
-	</string>
-	<string name="create_new_eyes">
-		Criar olhos novos
-	</string>
-	<string name="create_new_shirt">
-		Criar camisa nova
-	</string>
-	<string name="create_new_pants">
-		Criar calças novas
-	</string>
-	<string name="create_new_shoes">
-		Criar sapatos novos
-	</string>
-	<string name="create_new_socks">
-		Criar meias novas
-	</string>
-	<string name="create_new_jacket">
-		Criar jaqueta nova
-	</string>
-	<string name="create_new_gloves">
-		Criar luvas novas
-	</string>
-	<string name="create_new_undershirt">
-		Criar camiseta nova
-	</string>
-	<string name="create_new_underpants">
-		Criar roupa de baixo nova
-	</string>
-	<string name="create_new_skirt">
-		Criar saia nova
-	</string>
-	<string name="create_new_alpha">
-		Criar Alpha novo
-	</string>
-	<string name="create_new_tattoo">
-		Criar nova tatuagem
-	</string>
-	<string name="create_new_invalid">
-		inválido
-	</string>
 	<string name="NewWearable">
 		Novo [WEARABLE_ITEM]
 	</string>
@@ -1006,10 +883,7 @@
 		Pressione ESC para retornar para visão do mundo
 	</string>
 	<string name="InventoryNoMatchingItems">
-		Não encontrou o que procura? Tente buscar no [secondlife:///app/search/people/[SEARCH_TERM] Search].
-	</string>
-	<string name="PlacesNoMatchingItems">
-		Não encontrou o que procura? Tente buscar no [secondlife:///app/search/groups/[SEARCH_TERM] Search].
+		Nenhum item correspondente foi encontrado no inventário.  Tente fazer uma [secondlife:///app/search/groups &quot;Busca&quot;].
 	</string>
 	<string name="FavoritesNoMatchingItems">
 		Arraste um marco para adicioná-lo aos seus favoritos.
@@ -1037,10 +911,8 @@
 	<string name="AnimFlagStop" value="Parar animação"/>
 	<string name="AnimFlagStart" value="Iniciar animação"/>
 	<string name="Wave" value="Acenar"/>
-	<string name="GestureActionNone" value="Nenhum"/>
 	<string name="HelloAvatar" value="Olá, avatar!"/>
 	<string name="ViewAllGestures" value="Ver todos&gt;&gt;"/>
-	<string name="GetMoreGestures" value="Mais &gt;&gt;"/>
 	<string name="Animations" value="Animações,"/>
 	<string name="Calling Cards" value="Cartões de visitas,"/>
 	<string name="Clothing" value="Vestuário,"/>
@@ -1117,15 +989,12 @@
 	<string name="InvFolder Gestures">
 		Gestos
 	</string>
-	<string name="InvFolder Favorite">
+	<string name="InvFolder favorite">
 		Favoritos
 	</string>
 	<string name="InvFolder Current Outfit">
 		Look atual
 	</string>
-	<string name="InvFolder Initial Outfits">
-		Looks iniciais
-	</string>
 	<string name="InvFolder My Outfits">
 		Meus looks
 	</string>
@@ -1445,7 +1314,6 @@
 	<string name="SummaryForTheWeek" value="Resumo para esta semana, com início em"/>
 	<string name="NextStipendDay" value="Próximo dia de salário é"/>
 	<string name="GroupIndividualShare" value="Grupo       Divisão individualI"/>
-	<string name="GroupColumn" value="Grupo"/>
 	<string name="Balance">
 		Balanço
 	</string>
@@ -1641,30 +1509,21 @@
 	<string name="ATTACH_HUD_BOTTOM_RIGHT">
 		HUD direito inferior
 	</string>
-	<string name="Bad attachment point">
-		Ponto de encaixe inválido
-	</string>
 	<string name="CursorPos">
 		Linha [LINE], Coluna [COLUMN]
 	</string>
 	<string name="PanelDirCountFound">
 		[COUNT] encontrado
 	</string>
-	<string name="PanelContentsTooltip">
-		Conteúdo do objeto
-	</string>
 	<string name="PanelContentsNewScript">
 		Novo Script
 	</string>
+	<string name="PanelContentsTooltip">
+		Conteúdo do objeto
+	</string>
 	<string name="BusyModeResponseDefault">
 		O residente para o qual escreveu está no modo &apos;ocupado&apos;, ou seja, ele prefere não receber nada no momento. Sua mensagem será exibida como uma MI mais tarde.
 	</string>
-	<string name="NoOutfits">
-		Você ainda não tem nenhum look. Tente encontrar um na [secondlife:///app/search/groups Busca].
-	</string>
-	<string name="NoOutfitsTabsMatched">
-		Não encontrou o que procura? Tente fazer uma [secondlife:///app/search/people/[SEARCH_TERM] Busca].
-	</string>
 	<string name="MuteByName">
 		(por nome)
 	</string>
@@ -1677,16 +1536,15 @@
 	<string name="MuteGroup">
 		(grupo)
 	</string>
-	<string name="MuteExternal">
-		(Externo)
-	</string>
 	<string name="RegionNoCovenant">
 		Não foi definido um contrato para essa região.
 	</string>
 	<string name="RegionNoCovenantOtherOwner">
 		Não foi definido um contrato para essa Região. O terreno nesta região está sendo vendido pelo Proprietário, não pela Linden Lab. Favor contatar o Proprietário da região para detalhes de venda.
 	</string>
-	<string name="covenant_last_modified" value="Última modificação:"/>
+	<string name="covenant_last_modified">
+		Última modificação:
+	</string>
 	<string name="none_text" value="(nenhum)"/>
 	<string name="never_text" value="(nunca)"/>
 	<string name="GroupOwned">
@@ -3362,15 +3220,6 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="LocationCtrlComboBtnTooltip">
 		Histórico de localizações
 	</string>
-	<string name="LocationCtrlAdultIconTooltip">
-		Região Adulta
-	</string>
-	<string name="LocationCtrlModerateIconTooltip">
-		Região Moderada
-	</string>
-	<string name="LocationCtrlGeneralIconTooltip">
-		Região em geral
-	</string>
 	<string name="UpdaterWindowTitle">
 		[APP_NAME] Atualização
 	</string>
@@ -3401,12 +3250,6 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="UpdaterFailStartTitle">
 		Falha ao iniciar o visualizador
 	</string>
-	<string name="ItemsComingInTooFastFrom">
-		[APP_NAME]: Entrada de itens rápida demais de [FROM_NAME], visualização automática suspensa por [TIME] segundos
-	</string>
-	<string name="ItemsComingInTooFast">
-		[APP_NAME]: Entrada de itens rápida demais, visualização automática suspensa por [TIME] segundos
-	</string>
 	<string name="IM_logging_string">
 		-- Log de mensagem instantânea habilitado --
 	</string>
@@ -3434,17 +3277,11 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="IM_moderator_label">
 		(Moderador)
 	</string>
-	<string name="answered_call">
-		Ligação atendida
-	</string>
-	<string name="you_started_call">
-		Você iniciou uma ligação de voz
-	</string>
-	<string name="you_joined_call">
-		Você entrou na ligação
+	<string name="started_call">
+		Iniciou uma ligação de voz
 	</string>
-	<string name="name_started_call">
-		[NAME] iniciou uma ligação de voz
+	<string name="joined_call">
+		Entrou na ligação
 	</string>
 	<string name="ringing-im">
 		Entrando em ligação de voz...
@@ -3521,21 +3358,12 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="unread_chat_multiple">
 		[SOURCES] disseram alguma coisa
 	</string>
-	<string name="session_initialization_timed_out_error">
-		A inicialização da sessão expirou
-	</string>
-	<string name="voice_morphing_url">
-		http://secondlife.com/landing/voicemorphing
-	</string>
 	<string name="paid_you_ldollars">
 		[NAME] lhe pagou L$ [AMOUNT]
 	</string>
 	<string name="you_paid_ldollars">
 		You pagou L$[AMOUNT] por [REASON] a [NAME].
 	</string>
-	<string name="you_paid_ldollars_no_info">
-		Você acaba de pagar L$[AMOUNT].
-	</string>
 	<string name="you_paid_ldollars_no_reason">
 		You pagou L$[AMOUNT] a [NAME].
 	</string>
@@ -3584,9 +3412,6 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="group_role_owners">
 		Proprietários
 	</string>
-	<string name="group_member_status_online">
-		Conectado
-	</string>
 	<string name="uploading_abuse_report">
 		Carregando...
   
@@ -3640,203 +3465,13 @@ Denunciar abuso
 	<string name="Invalid Wearable">
 		Item inválido
 	</string>
-	<string name="New Gesture">
-		Novo gesto
-	</string>
 	<string name="New Script">
 		Novo script
 	</string>
-	<string name="New Note">
-		Nova nota
-	</string>
 	<string name="New Folder">
 		Nova pasta
 	</string>
 	<string name="Contents">
 		Conteúdo
 	</string>
-	<string name="Gesture">
-		Gesto
-	</string>
-	<string name="Male Gestures">
-		Gestos masculinos
-	</string>
-	<string name="Female Gestures">
-		Gestos femininos
-	</string>
-	<string name="Other Gestures">
-		Outros gestos
-	</string>
-	<string name="Speech Gestures">
-		Gestos da fala
-	</string>
-	<string name="Common Gestures">
-		Gestos comuns
-	</string>
-	<string name="Male - Excuse me">
-		Perdão - masculino
-	</string>
-	<string name="Male - Get lost">
-		Deixe-me em paz - masculino
-	</string>
-	<string name="Male - Blow kiss">
-		Mandar beijo - masculino
-	</string>
-	<string name="Male - Boo">
-		Vaia - masculino
-	</string>
-	<string name="Male - Bored">
-		Maçante - masculino
-	</string>
-	<string name="Male - Hey">
-		Ôpa! - masculino
-	</string>
-	<string name="Male - Laugh">
-		Risada - masculino
-	</string>
-	<string name="Male - Repulsed">
-		Quero distância! - masculino
-	</string>
-	<string name="Male - Shrug">
-		Encolher de ombros - masculino
-	</string>
-	<string name="Male - Stick tougue out">
-		Mostrar a língua - masculino
-	</string>
-	<string name="Male - Wow">
-		Wow - masculino
-	</string>
-	<string name="Female - Chuckle">
-		Engraçado - Feminino
-	</string>
-	<string name="Female - Cry">
-		Chorar - Feminino
-	</string>
-	<string name="Female - Embarrassed">
-		Com vergonha - Feminino
-	</string>
-	<string name="Female - Excuse me">
-		Perdão - fem
-	</string>
-	<string name="Female - Get lost">
-		Deixe-me em paz - feminino
-	</string>
-	<string name="Female - Blow kiss">
-		Mandar beijo - fem
-	</string>
-	<string name="Female - Boo">
-		Vaia - fem
-	</string>
-	<string name="Female - Bored">
-		Maçante - feminino
-	</string>
-	<string name="Female - Hey">
-		Ôpa - feminino
-	</string>
-	<string name="Female - Hey baby">
-		E aí, beliza? - Feminino
-	</string>
-	<string name="Female - Laugh">
-		Risada - feminina
-	</string>
-	<string name="Female - Looking good">
-		Que chique - Feminino
-	</string>
-	<string name="Female - Over here">
-		Acenar - Feminino
-	</string>
-	<string name="Female - Please">
-		Por favor - Feminino
-	</string>
-	<string name="Female - Repulsed">
-		Quero distância! - feminino
-	</string>
-	<string name="Female - Shrug">
-		Encolher ombros - feminino
-	</string>
-	<string name="Female - Stick tougue out">
-		Mostrar a língua - feminino
-	</string>
-	<string name="Female - Wow">
-		Wow - feminino
-	</string>
-	<string name="AvatarBirthDateFormat">
-		[mthnum,datetime,slt]/[day,datetime,slt]/[year,datetime,slt]
-	</string>
-	<string name="DefaultMimeType">
-		nenhum/nehum
-	</string>
-	<string name="texture_load_dimensions_error">
-		A imagem excede o limite [WIDTH]*[HEIGHT]
-	</string>
-	<string name="words_separator" value=","/>
-	<string name="server_is_down">
-		Aconteceu algo inesperado, apesar de termos tentador impedir isso.
-
-	Cheque secondlifegrid.net para saber se foi detectado um problema com o serviço.   
-        Se o problema persisitr, cheque a configuração da sua rede e firewall.
-	</string>
-	<string name="dateTimeWeekdaysNames">
-		Domingo:Segunda:Terça:Quarta:Quinta:Sexta:Sábado
-	</string>
-	<string name="dateTimeWeekdaysShortNames">
-		Dom:Seg:Ter:Qua:Qui:Sex:Sab
-	</string>
-	<string name="dateTimeMonthNames">
-		Janeiro:Fevereiro:Março:Abril:Maio:Junho:Julho:Agosto:Setembro:Outubro:Novembro:Dezembro
-	</string>
-	<string name="dateTimeMonthShortNames">
-		Jan:Fev:Mar:Abr:Maio:Jun:Jul:Ago:Set:Out:Nov:Dez
-	</string>
-	<string name="dateTimeDayFormat">
-		[MDAY]
-	</string>
-	<string name="dateTimeAM">
-		AM
-	</string>
-	<string name="dateTimePM">
-		PM
-	</string>
-	<string name="LocalEstimateUSD">
-		US$ [AMOUNT]
-	</string>
-	<string name="Membership">
-		Plano
-	</string>
-	<string name="Roles">
-		Cargos
-	</string>
-	<string name="Group Identity">
-		Identidade do lote
-	</string>
-	<string name="Parcel Management">
-		Gestão do lote
-	</string>
-	<string name="Parcel Identity">
-		ID do lote
-	</string>
-	<string name="Parcel Settings">
-		Configurações do lote
-	</string>
-	<string name="Parcel Powers">
-		Poderes do lote
-	</string>
-	<string name="Parcel Access">
-		Acesso ao lote
-	</string>
-	<string name="Parcel Content">
-		Conteúdo do lote
-	</string>
-	<string name="Object Management">
-		Gestão de objetos
-	</string>
-	<string name="Accounting">
-		Contabilidade
-	</string>
-	<string name="Notices">
-		Avisos
-	</string>
-	<string name="Chat">
-		Bate-papo
-	</string>
 </strings>
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index a0697af6c30b6c18097ff4658e1949d76847f9c8..ef93586c6e852c6b713f477639184321e6a02368 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -2,35 +2,15 @@
  * @file   lllogininstance_test.cpp
  * @brief  Test for lllogininstance.cpp.
  * 
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * Copyright (c) 2008, Linden Research, Inc.
  * $/LicenseInfo$
  */
 
 // Precompiled header
 #include "../llviewerprecompiledheaders.h"
 // Own header
-#include "../llsecapi.h"
-#include "../llviewernetwork.h"
 #include "../lllogininstance.h"
-
 // STL headers
 // std headers
 // external library headers
@@ -53,12 +33,7 @@ const std::string APPVIEWER_SERIALNUMBER("appviewer_serialno");
 //-----------------------------------------------------------------------------
 static LLEventStream gTestPump("test_pump");
 
-#include "../llslurl.h"
-#include "../llstartup.h"
-LLSLURL LLStartUp::sStartSLURL;
-
 #include "lllogin.h"
-
 static std::string gLoginURI;
 static LLSD gLoginCreds;
 static bool gDisconnectCalled = false;
@@ -79,75 +54,17 @@ void LLLogin::disconnect()
 	gDisconnectCalled = true;
 }
 
-LLSD LLCredential::getLoginParams()
-{
-	LLSD result = LLSD::emptyMap();
-
-	// legacy credential
-	result["passwd"] = "$1$testpasssd";
-	result["first"] = "myfirst";
-	result["last"] ="mylast";
-	return result;
-}
-void LLCredential::identifierType(std::string &idType)
-{
-}
-
-void LLCredential::authenticatorType(std::string &idType)
-{
-}
-
 //-----------------------------------------------------------------------------
 #include "../llviewernetwork.h"
-LLGridManager::~LLGridManager()
-{
-}
-
-void LLGridManager::addGrid(LLSD& grid_data)
-{
-}
-LLGridManager::LLGridManager()
-{	
-}
+unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {'1','2','3','4','5','6'};
 
-void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
+LLViewerLogin::LLViewerLogin() : mGridChoice(GRID_INFO_NONE) {}
+LLViewerLogin::~LLViewerLogin() {}
+void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const 
 {
 	uris.push_back(VIEWERLOGIN_URI);
 }
-
-void LLGridManager::addSystemGrid(const std::string& label, 
-								  const std::string& name, 
-								  const std::string& login, 
-								  const std::string& helper,
-								  const std::string& login_page,
-								  const std::string& login_id)
-{
-}
-std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
-{
-	std::map<std::string, std::string> result;
-	return result;
-}
-
-void LLGridManager::setGridChoice(const std::string& grid_name)
-{
-}
-
-bool LLGridManager::isInProductionGrid()
-{
-	return false;
-}
-
-void LLGridManager::saveFavorites()
-{}
-std::string LLGridManager::getSLURLBase(const std::string& grid_name)
-{
-	return "myslurl";
-}
-std::string LLGridManager::getAppSLURLBase(const std::string& grid_name)
-{
-	return "myappslurl";
-}
+std::string LLViewerLogin::getGridLabel() const { return VIEWERLOGIN_GRIDLABEL; }
 
 //-----------------------------------------------------------------------------
 #include "../llviewercontrol.h"
@@ -169,6 +86,10 @@ BOOL LLControlGroup::declareString(const std::string& name, const std::string &i
 #include "lluicolortable.h"
 void LLUIColorTable::saveUserSettings(void)const {}
 
+//-----------------------------------------------------------------------------
+#include "../llurlsimstring.h"
+LLURLSimString LLURLSimString::sInstance;
+bool LLURLSimString::parse() { return true; }
 
 //-----------------------------------------------------------------------------
 #include "llnotifications.h"
@@ -243,16 +164,6 @@ S32 LLNotification::getSelectedOption(const LLSD& notification, const LLSD& resp
 	return response.asInteger();
 }
 
-//-----------------------------------------------------------------------------
-#include "../llmachineid.h"
-unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2};
-
-S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len)
-{
-	memcpy(unique_id, gMACAddress, len);
-	return 1;
-}
-//-----------------------------------------------------------------------------
 // misc
 std::string xml_escape_string(const std::string& in)
 {
@@ -286,29 +197,15 @@ namespace tut
 			gSavedSettings.declareString("NextLoginLocation", "", "", FALSE);
 			gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", FALSE);
 
-			LLSD authenticator = LLSD::emptyMap();
-			LLSD identifier = LLSD::emptyMap();
-			identifier["type"] = "agent";
-			identifier["first_name"] = "testfirst";
-			identifier["last_name"] = "testlast";
-			authenticator["passwd"] = "testpass";
-			agentCredential = new LLCredential();
-			agentCredential->setCredentialData(identifier, authenticator);
-			
-			authenticator = LLSD::emptyMap();
-			identifier = LLSD::emptyMap();
-			identifier["type"] = "account";
-			identifier["username"] = "testuser";
-			authenticator["secret"] = "testsecret";
-			accountCredential = new LLCredential();
-			accountCredential->setCredentialData(identifier, authenticator);			
+			credentials["first"] = "testfirst";
+			credentials["last"] = "testlast";
+			credentials["passwd"] = "testpass";
 
 			logininstance->setNotificationsInterface(&notifications);
 		}
 
 		LLLoginInstance* logininstance;
-		LLPointer<LLCredential> agentCredential;
-		LLPointer<LLCredential> accountCredential;
+		LLSD credentials;
 		MockNotifications notifications;
     };
 
@@ -322,7 +219,7 @@ namespace tut
 		set_test_name("Test Simple Success And Disconnect");
 
 		// Test default connect.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -363,7 +260,7 @@ namespace tut
 		const std::string test_uri = "testing-uri";
 
 		// Test default connect.
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 
 		// connect should call LLLogin::connect to init gLoginURI and gLoginCreds.
 		ensure_equals("Default connect uri", gLoginURI, "testing-uri"); 
@@ -385,7 +282,7 @@ namespace tut
 		ensure("No TOS, failed auth", logininstance->authFailure());
 
 		// Start again.
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 		gTestPump.post(response); // Fail for tos again.
 		gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos.
 		ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true);
@@ -397,11 +294,11 @@ namespace tut
 		gTestPump.post(response);
 		ensure("TOS auth failure", logininstance->authFailure());
 
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 		ensure_equals("Reset to default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false);
 
 		// Critical Message failure response.
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 		response["data"]["reason"] = "critical"; // Change response to "critical message"
 		gTestPump.post(response);
 
@@ -415,7 +312,7 @@ namespace tut
 		response["data"]["reason"] = "key"; // bad creds.
 		gTestPump.post(response);
 		ensure("TOS auth failure", logininstance->authFailure());
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 		ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false);
 	}
 
@@ -426,7 +323,7 @@ namespace tut
 
 		// Part 1 - Mandatory Update, with User accepts response.
 		// Test connect with update needed.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -452,7 +349,7 @@ namespace tut
 		set_test_name("Test Mandatory Update User Decline");
 
 		// Test connect with update needed.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -478,7 +375,7 @@ namespace tut
 
 		// Part 3 - Mandatory Update, with bogus response.
 		// Test connect with update needed.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -504,7 +401,7 @@ namespace tut
 
 		// Part 3 - Mandatory Update, with bogus response.
 		// Test connect with update needed.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
old mode 100644
new mode 100755
index 0eda4007e3e3e1a0b6a219c84249b5ef0c28fcf8..18ac10fe389ef2f91ae46f89605914d8d7056ee0
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -4,31 +4,36 @@
 # @brief Description of all installer viewer files, and methods for packaging
 #        them into installers for all supported platforms.
 #
-# $LicenseInfo:firstyear=2006&license=viewerlgpl$
-# Second Life Viewer Source Code
-# Copyright (C) 2010, Linden Research, Inc.
+# $LicenseInfo:firstyear=2006&license=viewergpl$
+# 
+# Copyright (c) 2006-2009, Linden Research, Inc.
 # 
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation;
-# version 2.1 of the License only.
+# Second Life Viewer Source Code
+# The source code in this file ("Source Code") is provided by Linden Lab
+# to you under the terms of the GNU General Public License, version 2.0
+# ("GPL"), unless you have obtained a separate licensing agreement
+# ("Other License"), formally executed by you and Linden Lab.  Terms of
+# the GPL can be found in doc/GPL-license.txt in this distribution, or
+# online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
 # 
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
+# There are special exceptions to the terms and conditions of the GPL as
+# it is applied to this Source Code. View the full text of the exception
+# in the file doc/FLOSS-exception.txt in this software distribution, or
+# online at
+# http://secondlifegrid.net/programs/open_source/licensing/flossexception
 # 
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+# By copying, modifying or distributing this software, you acknowledge
+# that you have read and understood your obligations described above,
+# and agree to abide by those obligations.
 # 
-# Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+# ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+# WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+# COMPLETENESS OR PERFORMANCE.
 # $/LicenseInfo$
 import sys
 import os.path
 import re
 import tarfile
-import time
 viewer_dir = os.path.dirname(__file__)
 # add llmanifest library to our path so we don't have to muck with PYTHONPATH
 sys.path.append(os.path.join(viewer_dir, '../lib/python/indra/util'))
@@ -36,12 +41,9 @@
 
 class ViewerManifest(LLManifest):
     def is_packaging_viewer(self):
-        # Some commands, files will only be included
-        # if we are packaging the viewer on windows.
-        # This manifest is also used to copy
-        # files during the build (see copy_w_viewer_manifest
-        # and copy_l_viewer_manifest targets)
-        return 'package' in self.args['actions']
+        # This is overridden by the WindowsManifest sub-class,
+        # which has different behavior if it is not packaging the viewer.
+        return True
     
     def construct(self):
         super(ViewerManifest, self).construct()
@@ -103,12 +105,6 @@ def construct(self):
                             self.end_prefix("*/html")
                     self.end_prefix("skins")
 
-            # local_assets dir (for pre-cached textures)
-            if self.prefix(src="local_assets"):
-                self.path("*.j2c")
-                self.path("*.tga")
-                self.end_prefix("local_assets")
-
             # Files in the newview/ directory
             self.path("gpu_table.txt")
 
@@ -173,6 +169,13 @@ def final_exe(self):
         else:
             return ''.join(self.channel().split()) + '.exe'
 
+    def is_packaging_viewer(self):
+        # Some commands, files will only be included
+        # if we are packaging the viewer on windows.
+        # This manifest is also used to copy
+        # files during the build.
+        return 'package' in self.args['actions']
+
     def test_msvcrt_and_copy_action(self, src, dst):
         # This is used to test a dll manifest.
         # It is used as a temporary override during the construct method
@@ -251,16 +254,14 @@ def construct(self):
         if self.prefix(src=os.path.join(os.pardir, 'sharedlibs', self.args['configuration']),
                        dst=""):
 
-            self.enable_no_crt_manifest_check()
-
+            self.enable_crt_manifest_check()
+            
             # Get kdu dll, continue if missing.
             try:
                 self.path('llkdu.dll', dst='llkdu.dll')
             except RuntimeError:
                 print "Skipping llkdu.dll"
 
-            self.enable_crt_manifest_check()
-
             # Get llcommon and deps. If missing assume static linkage and continue.
             try:
                 self.path('llcommon.dll')
@@ -316,11 +317,8 @@ def construct(self):
         # For use in crash reporting (generates minidumps)
         self.path("dbghelp.dll")
 
-        try:
-            # FMOD for sound
-            self.path("fmod.dll")
-        except:
-            print "Skipping FMOD - not found"
+        # For using FMOD for sound... DJS
+        self.path("fmod.dll")
 
         self.enable_no_crt_manifest_check()
         
@@ -334,12 +332,6 @@ def construct(self):
             self.path("media_plugin_webkit.dll")
             self.end_prefix()
 
-        # winmm.dll shim
-        if self.prefix(src='../media_plugins/winmmshim/%s' % self.args['configuration'], dst="llplugin"):
-            self.path("winmm.dll")
-            self.end_prefix()
-
-
         if self.args['configuration'].lower() == 'debug':
             if self.prefix(src=os.path.join(os.pardir, os.pardir, 'libraries', 'i686-win32', 'lib', 'debug'),
                            dst="llplugin"):
@@ -559,10 +551,6 @@ def package_finish(self):
 
 
 class DarwinManifest(ViewerManifest):
-    def is_packaging_viewer(self):
-        # darwin requires full app bundle packaging even for debugging.
-        return True
-
     def construct(self):
         # copy over the build result (this is a no-op if run within the xcode script)
         self.path(self.args['configuration'] + "/Second Life.app", dst="")
@@ -641,35 +629,24 @@ def construct(self):
                 if dylibs["llcommon"]:
                     for libfile in ("libapr-1.0.3.7.dylib",
                                     "libaprutil-1.0.3.8.dylib",
-                                    "libexpat.0.5.0.dylib",
-                                    "libexception_handler.dylib",
-                                    ):
+                                    "libexpat.0.5.0.dylib"):
                         self.path(os.path.join(libdir, libfile), libfile)
 
-                try:
-                    # FMOD for sound
-                    self.path(self.args['configuration'] + "/libfmodwrapper.dylib", "libfmodwrapper.dylib")
-                except:
-                    print "Skipping FMOD - not found"
+                #libfmodwrapper.dylib
+                self.path(self.args['configuration'] + "/libfmodwrapper.dylib", "libfmodwrapper.dylib")
                 
                 # our apps
                 self.path("../mac_crash_logger/" + self.args['configuration'] + "/mac-crash-logger.app", "mac-crash-logger.app")
                 self.path("../mac_updater/" + self.args['configuration'] + "/mac-updater.app", "mac-updater.app")
 
-                # plugin launcher
-                self.path("../llplugin/slplugin/" + self.args['configuration'] + "/SLPlugin.app", "SLPlugin.app")
-
                 # our apps dependencies on shared libs
                 if dylibs["llcommon"]:
                     mac_crash_logger_res_path = self.dst_path_of("mac-crash-logger.app/Contents/Resources")
                     mac_updater_res_path = self.dst_path_of("mac-updater.app/Contents/Resources")
-                    slplugin_res_path = self.dst_path_of("SLPlugin.app/Contents/Resources")
                     for libfile in ("libllcommon.dylib",
                                     "libapr-1.0.3.7.dylib",
                                     "libaprutil-1.0.3.8.dylib",
-                                    "libexpat.0.5.0.dylib",
-                                    "libexception_handler.dylib",
-                                    ):
+                                    "libexpat.0.5.0.dylib"):
                         target_lib = os.path.join('../../..', libfile)
                         self.run_command("ln -sf %(target)r %(link)r" % 
                                          {'target': target_lib,
@@ -679,10 +656,9 @@ def construct(self):
                                          {'target': target_lib,
                                           'link' : os.path.join(mac_updater_res_path, libfile)}
                                          )
-                        self.run_command("ln -sf %(target)r %(link)r" % 
-                                         {'target': target_lib,
-                                          'link' : os.path.join(slplugin_res_path, libfile)}
-                                         )
+
+                # plugin launcher
+                self.path("../llplugin/slplugin/" + self.args['configuration'] + "/SLPlugin", "SLPlugin")
 
                 # plugins
                 if self.prefix(src="", dst="llplugin"):
@@ -740,72 +716,55 @@ def package_finish(self):
 
         # mount the image and get the name of the mount point and device node
         hdi_output = self.run_command('hdiutil attach -private %r' % sparsename)
-        try:
-            devfile = re.search("/dev/disk([0-9]+)[^s]", hdi_output).group(0).strip()
-            volpath = re.search('HFS\s+(.+)', hdi_output).group(1).strip()
+        devfile = re.search("/dev/disk([0-9]+)[^s]", hdi_output).group(0).strip()
+        volpath = re.search('HFS\s+(.+)', hdi_output).group(1).strip()
 
-            # Copy everything in to the mounted .dmg
+        # Copy everything in to the mounted .dmg
 
-            if self.default_channel() and not self.default_grid():
-                app_name = "Second Life " + self.args['grid']
-            else:
-                app_name = channel_standin.strip()
-
-            # Hack:
-            # Because there is no easy way to coerce the Finder into positioning
-            # the app bundle in the same place with different app names, we are
-            # adding multiple .DS_Store files to svn. There is one for release,
-            # one for release candidate and one for first look. Any other channels
-            # will use the release .DS_Store, and will look broken.
-            # - Ambroff 2008-08-20
-            dmg_template = os.path.join(
-                'installers', 
-                'darwin',
-                '%s-dmg' % "".join(self.channel_unique().split()).lower())
-
-            if not os.path.exists (self.src_path_of(dmg_template)):
-                dmg_template = os.path.join ('installers', 'darwin', 'release-dmg')
-
-            for s,d in {self.get_dst_prefix():app_name + ".app",
-                        os.path.join(dmg_template, "_VolumeIcon.icns"): ".VolumeIcon.icns",
-                        os.path.join(dmg_template, "background.jpg"): "background.jpg",
-                        os.path.join(dmg_template, "_DS_Store"): ".DS_Store"}.items():
-                print "Copying to dmg", s, d
-                self.copy_action(self.src_path_of(s), os.path.join(volpath, d))
-
-            # Hide the background image, DS_Store file, and volume icon file (set their "visible" bit)
-            for f in ".VolumeIcon.icns", "background.jpg", ".DS_Store":
-                pathname = os.path.join(volpath, f)
-                # We've observed mysterious "no such file" failures of the SetFile
-                # command, especially on the first file listed above -- yet
-                # subsequent inspection of the target directory confirms it's
-                # there. Timing problem with copy command? Try to handle.
-                for x in xrange(3):
-                    if os.path.exists(pathname):
-                        print "Confirmed existence: %r" % pathname
-                        break
-                    print "Waiting for %s copy command to complete (%s)..." % (f, x+1)
-                    sys.stdout.flush()
-                    time.sleep(1)
-                # If we fall out of the loop above without a successful break, oh
-                # well, possibly we've mistaken the nature of the problem. In any
-                # case, don't hang up the whole build looping indefinitely, let
-                # the original problem manifest by executing the desired command.
-                self.run_command('SetFile -a V %r' % pathname)
-
-            # Create the alias file (which is a resource file) from the .r
-            self.run_command('rez %r -o %r' %
-                             (self.src_path_of("installers/darwin/release-dmg/Applications-alias.r"),
-                              os.path.join(volpath, "Applications")))
-
-            # Set the alias file's alias and custom icon bits
-            self.run_command('SetFile -a AC %r' % os.path.join(volpath, "Applications"))
-
-            # Set the disk image root's custom icon bit
-            self.run_command('SetFile -a C %r' % volpath)
-        finally:
-            # Unmount the image even if exceptions from any of the above 
-            self.run_command('hdiutil detach -force %r' % devfile)
+        if self.default_channel() and not self.default_grid():
+            app_name = "Second Life " + self.args['grid']
+        else:
+            app_name = channel_standin.strip()
+
+        # Hack:
+        # Because there is no easy way to coerce the Finder into positioning
+        # the app bundle in the same place with different app names, we are
+        # adding multiple .DS_Store files to svn. There is one for release,
+        # one for release candidate and one for first look. Any other channels
+        # will use the release .DS_Store, and will look broken.
+        # - Ambroff 2008-08-20
+        dmg_template = os.path.join(
+            'installers', 
+            'darwin',
+            '%s-dmg' % "".join(self.channel_unique().split()).lower())
+
+        if not os.path.exists (self.src_path_of(dmg_template)):
+            dmg_template = os.path.join ('installers', 'darwin', 'release-dmg')
+
+        for s,d in {self.get_dst_prefix():app_name + ".app",
+                    os.path.join(dmg_template, "_VolumeIcon.icns"): ".VolumeIcon.icns",
+                    os.path.join(dmg_template, "background.jpg"): "background.jpg",
+                    os.path.join(dmg_template, "_DS_Store"): ".DS_Store"}.items():
+            print "Copying to dmg", s, d
+            self.copy_action(self.src_path_of(s), os.path.join(volpath, d))
+
+        # Hide the background image, DS_Store file, and volume icon file (set their "visible" bit)
+        for f in ".VolumeIcon.icns", "background.jpg", ".DS_Store":
+            self.run_command('SetFile -a V %r' % os.path.join(volpath, f))
+
+        # Create the alias file (which is a resource file) from the .r
+        self.run_command('rez %r -o %r' %
+                         (self.src_path_of("installers/darwin/release-dmg/Applications-alias.r"),
+                          os.path.join(volpath, "Applications")))
+
+        # Set the alias file's alias and custom icon bits
+        self.run_command('SetFile -a AC %r' % os.path.join(volpath, "Applications"))
+
+        # Set the disk image root's custom icon bit
+        self.run_command('SetFile -a C %r' % volpath)
+
+        # Unmount the image
+        self.run_command('hdiutil detach -force %r' % devfile)
 
         print "Converting temp disk image to final disk image"
         self.run_command('hdiutil convert %(sparse)r -format UDZO -imagekey zlib-level=9 -o %(final)r' % {'sparse':sparsename, 'final':finalname})
@@ -833,28 +792,6 @@ def construct(self):
         # Create an appropriate gridargs.dat for this package, denoting required grid.
         self.put_in_file(self.flags_list(), 'etc/gridargs.dat')
 
-        self.path("secondlife-bin","bin/do-not-directly-run-secondlife-bin")
-        self.path("../linux_crash_logger/linux-crash-logger","bin/linux-crash-logger.bin")
-        self.path("../linux_updater/linux-updater", "bin/linux-updater.bin")
-        self.path("../llplugin/slplugin/SLPlugin", "bin/SLPlugin")
-
-        if self.prefix("res-sdl"):
-            self.path("*")
-            # recurse
-            self.end_prefix("res-sdl")
-
-        # plugins
-        if self.prefix(src="", dst="bin/llplugin"):
-            self.path("../media_plugins/webkit/libmedia_plugin_webkit.so", "libmedia_plugin_webkit.so")
-            self.path("../media_plugins/gstreamer010/libmedia_plugin_gstreamer010.so", "libmedia_plugin_gstreamer.so")
-            self.end_prefix("bin/llplugin")
-
-        try:
-            self.path("../llcommon/libllcommon.so", "lib/libllcommon.so")
-        except:
-            print "Skipping llcommon.so (assuming llcommon was linked statically)"
-
-        self.path("featuretable_linux.txt")
 
     def package_finish(self):
         if 'installer_name' in self.args:
@@ -869,10 +806,6 @@ def package_finish(self):
             else:
                 installer_name += '_' + self.channel_oneword().upper()
 
-        if self.args['buildtype'].lower() == 'release' and self.is_packaging_viewer():
-            print "* Going strip-crazy on the packaged binaries, since this is a RELEASE build"
-            self.run_command("find %(d)r/bin %(d)r/lib -type f | xargs --no-run-if-empty strip -S" % {'d': self.get_dst_prefix()} ) # makes some small assumptions about our packaged dir structure
-
         # Fix access permissions
         self.run_command("""
                 find %(dst)s -type d | xargs --no-run-if-empty chmod 755;
@@ -909,17 +842,40 @@ def construct(self):
 
         # install either the libllkdu we just built, or a prebuilt one, in
         # decreasing order of preference.  for linux package, this goes to bin/
-        try:
-            self.path(self.find_existing_file('../llkdu/libllkdu.so',
-                '../../libraries/i686-linux/lib_release_client/libllkdu.so'),
-                  dst='bin/libllkdu.so')
-        except:
-            print "Skipping libllkdu.so - not found"
+        for lib, destdir in ("llkdu", "bin"), ("llcommon", "lib"):
+            libfile = "lib%s.so" % lib
+            try:
+                self.path(self.find_existing_file(os.path.join(os.pardir, lib, libfile),
+                    '../../libraries/i686-linux/lib_release_client/%s' % libfile), 
+                      dst=os.path.join(destdir, libfile))
+                # keep this one to preserve syntax, open source mangling removes previous lines
+                pass
+            except RuntimeError:
+                print "Skipping %s - not found" % libfile
+                pass
+
+        self.path("secondlife-bin","bin/do-not-directly-run-secondlife-bin")
+
+        self.path("../linux_crash_logger/linux-crash-logger","bin/linux-crash-logger.bin")
+        self.path("../linux_updater/linux-updater", "bin/linux-updater.bin")
+        self.path("../llplugin/slplugin/SLPlugin", "bin/SLPlugin")
+        if self.prefix("res-sdl"):
+            self.path("*")
+            # recurse
+            self.end_prefix("res-sdl")
+
+        # plugins
+        if self.prefix(src="", dst="bin/llplugin"):
+            self.path("../media_plugins/webkit/libmedia_plugin_webkit.so", "libmedia_plugin_webkit.so")
+            self.path("../media_plugins/gstreamer010/libmedia_plugin_gstreamer010.so", "libmedia_plugin_gstreamer.so")
+            self.end_prefix("bin/llplugin")
+
+        self.path("featuretable_linux.txt")
+        #self.path("secondlife-i686.supp")
 
         if self.prefix("../../libraries/i686-linux/lib_release_client", dst="lib"):
             self.path("libapr-1.so.0")
             self.path("libaprutil-1.so.0")
-            self.path("libbreakpad_client.so.0.0.0", "libbreakpad_client.so.0")
             self.path("libdb-4.2.so")
             self.path("libcrypto.so.0.9.7")
             self.path("libexpat.so.1")
@@ -941,7 +897,7 @@ def construct(self):
                     self.path("libfmod-3.75.so")
                     pass
             except:
-                    print "Skipping libfmod-3.75.so - not found"
+                    print "Skipping libkdu_v42R.so - not found"
                     pass
             self.end_prefix("lib")
 
@@ -957,6 +913,10 @@ def construct(self):
                     self.path("libvivoxplatform.so")
                     self.end_prefix("lib")
 
+        if self.args['buildtype'].lower() == 'release':
+            print "* Going strip-crazy on the packaged binaries, since this is a RELEASE build"
+            self.run_command("find %(d)r/bin %(d)r/lib -type f | xargs --no-run-if-empty strip -S" % {'d': self.get_dst_prefix()} ) # makes some small assumptions about our packaged dir structure
+
 ################################################################
 
 if __name__ == "__main__":
diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp
index 40ac019721ff1b3104d728f20ab4a8e5a8d8dc18..7e9a8336e77c6f0972cea5f6ee88d7f72c4720ee 100644
--- a/indra/test_apps/llplugintest/llmediaplugintest.cpp
+++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp
@@ -2,25 +2,30 @@
  * @file LLMediaPluginTest.cpp
  * @brief Primary test application for LLMedia (Separate Process) Plugin system
  *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -236,9 +241,6 @@ LLMediaPluginTest::~LLMediaPluginTest()
 	{
 		remMediaPanel( mMediaPanels[ i ] );
 	};
-	
-	// Stop the plugin read thread if it's running.
-	LLPluginProcessParent::setUseReadThread(false);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1045,11 +1047,6 @@ void LLMediaPluginTest::gluiCallback( int control_id )
 		}
 	}
 	else
-	if ( control_id == mIdUsePluginReadThread )
-	{
-		LLPluginProcessParent::setUseReadThread(mUsePluginReadThread);
-	}
-	else
 	if ( control_id == mIdControlCrashPlugin )
 	{
 		// send message to plugin and ask it to crash
@@ -1434,12 +1431,6 @@ void LLMediaPluginTest::makeChrome()
 	glui_window_misc_control->set_main_gfx_window( mAppWindow );
 	glui_window_misc_control->add_column( true );
 
-	mIdUsePluginReadThread = start_id++;
-	mUsePluginReadThread = 0;
-	glui_window_misc_control->add_checkbox( "Use plugin read thread", &mUsePluginReadThread, mIdUsePluginReadThread, gluiCallbackWrapper );
-	glui_window_misc_control->set_main_gfx_window( mAppWindow );
-	glui_window_misc_control->add_column( true );
-
 	mIdLargePanelSpacing = start_id++;
 	mLargePanelSpacing = 0;
 	glui_window_misc_control->add_checkbox( "Large Panel Spacing", &mLargePanelSpacing, mIdLargePanelSpacing, gluiCallbackWrapper );
diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp
index 651d803e0de87ea54269fca7aa0c1281f55f998e..b9f61ca7e1e4014b2f0c98bc586ab1871ef0b1df 100644
--- a/indra/viewer_components/login/lllogin.cpp
+++ b/indra/viewer_components/login/lllogin.cpp
@@ -1,25 +1,31 @@
 /** 
  * @file lllogin.cpp
  *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
  * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
 
@@ -116,35 +122,29 @@ class LLLogin::Impl
 	LLSD mAuthResponse, mValidAuthResponse;
 };
 
-void LLLogin::Impl::connect(const std::string& uri, const LLSD& login_params)
+void LLLogin::Impl::connect(const std::string& uri, const LLSD& credentials)
 {
-    LL_DEBUGS("LLLogin") << " connect with  uri '" << uri << "', login_params " << login_params << LL_ENDL;
-	
     // Launch a coroutine with our login_() method. Run the coroutine until
     // its first wait; at that point, return here.
     std::string coroname = 
         LLCoros::instance().launch("LLLogin::Impl::login_",
-                                   boost::bind(&Impl::login_, this, _1, uri, login_params));
-    LL_DEBUGS("LLLogin") << " connected with  uri '" << uri << "', login_params " << login_params << LL_ENDL;	
+                                   boost::bind(&Impl::login_, this, _1, uri, credentials));
 }
 
-void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_params)
+void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credentials)
 {
-	try
+	LLSD printable_credentials = credentials;
+	if(printable_credentials.has("params") 
+		&& printable_credentials["params"].has("passwd")) 
 	{
-	LLSD printable_params = login_params;
-	//if(printable_params.has("params") 
-	//	&& printable_params["params"].has("passwd")) 
-	//{
-	//	printable_params["params"]["passwd"] = "*******";
-	//}
+		printable_credentials["params"]["passwd"] = "*******";
+	}
     LL_DEBUGS("LLLogin") << "Entering coroutine " << LLCoros::instance().getName(self)
-                        << " with uri '" << uri << "', parameters " << printable_params << LL_ENDL;
+                        << " with uri '" << uri << "', credentials " << printable_credentials << LL_ENDL;
 
 	// Arriving in SRVRequest state
     LLEventStream replyPump("SRVreply", true);
     // Should be an array of one or more uri strings.
-
     LLSD rewrittenURIs;
     {
         LLEventTimeout filter(replyPump);
@@ -155,9 +155,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para
 
         // *NOTE:Mani - Completely arbitrary default timeout value for SRV request.
 		F32 seconds_to_timeout = 5.0f;
-		if(login_params.has("cfg_srv_timeout"))
+		if(credentials.has("cfg_srv_timeout"))
 		{
-			seconds_to_timeout = login_params["cfg_srv_timeout"].asReal();
+			seconds_to_timeout = credentials["cfg_srv_timeout"].asReal();
 		}
 
         // If the SRV request times out (e.g. EXT-3934), simulate response: an
@@ -167,9 +167,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para
 		filter.eventAfter(seconds_to_timeout, fakeResponse);
 
 		std::string srv_pump_name = "LLAres";
-		if(login_params.has("cfg_srv_pump"))
+		if(credentials.has("cfg_srv_pump"))
 		{
-			srv_pump_name = login_params["cfg_srv_pump"].asString();
+			srv_pump_name = credentials["cfg_srv_pump"].asString();
 		}
 
 		// Make request
@@ -194,7 +194,7 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para
              urend(rewrittenURIs.endArray());
          urit != urend; ++urit)
     {
-        LLSD request(login_params);
+        LLSD request(credentials);
         request["reply"] = loginReplyPump.getName();
         request["uri"] = *urit;
         std::string status;
@@ -291,17 +291,8 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para
 	// to success, add a data/message and data/reason fields.
 	LLSD error_response;
 	error_response["reason"] = mAuthResponse["status"];
-	error_response["errorcode"] = mAuthResponse["errorcode"];
 	error_response["message"] = mAuthResponse["error"];
-	if(mAuthResponse.has("certificate"))
-	{
-		error_response["certificate"] = mAuthResponse["certificate"];
-	}
 	sendProgressEvent("offline", "fail.login", error_response);
-	}
-	catch (...) {
-		llerrs << "login exception caught" << llendl; 
-	}
 }
 
 void LLLogin::Impl::disconnect()
diff --git a/install.xml b/install.xml
index 3795fc3757233ae9eb2b86ca4434758259c2e847..899bd0a6cc53902fa245404bbc01d28da000174e 100644
--- a/install.xml
+++ b/install.xml
@@ -111,16 +111,16 @@
           <key>darwin</key>
           <map>
             <key>md5sum</key>
-            <string>cdb2f5c4a5a1f9ecd75bc1dbdd4db8e9</string>
+            <string>d9ce3ace9235249b7edf6f564de83395</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/ares-1.7.1-darwin-20100606.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/ares-1.4.0-darwin-20080731b.tar.bz2</uri>
           </map>
           <key>linux</key>
           <map>
             <key>md5sum</key>
-            <string>91694429e391efeea1de974df26032a2</string>
+            <string>946c2e106f14f7a1e521d4a14e0e146f</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/ares-1.7.1-linux-20100527.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/ares-1.4.0-linux-20081202.tar.bz2</uri>
           </map>
           <key>linux64</key>
           <map>
@@ -132,9 +132,9 @@
           <key>windows</key>
           <map>
             <key>md5sum</key>
-            <string>4b84738eec2e21b0c096d53b79ee2681</string>
+            <string>f5cf8d121b26f2e7944f7e63cdbff04d</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/ares-1.7.1-windows-20100611a.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/ares-1.6.0-windows-20091105.tar.bz2</uri>
           </map>
         </map>
       </map>
@@ -200,9 +200,9 @@
           <key>linux</key>
           <map>
             <key>md5sum</key>
-            <string>4db3d74e40d149eeec06f4d97a609bb1</string>
+            <string>d58ac1a8396ac983b67cc3e3541457e3</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/boost-1.39.0-linux-20100624.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/boost-1.39.0-linux-20100222a.tar.bz2</uri>
           </map>
           <key>linux64</key>
           <map>
@@ -214,9 +214,9 @@
           <key>windows</key>
           <map>
             <key>md5sum</key>
-            <string>72e6e2eff5d146a107f3059b6c31fb95</string>
+            <string>94fd43f534e2055858d524086384907d</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/boost-1.39.0-windows-20100630.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/boost-1.39.0-windows-20100219.tar.bz2</uri>
           </map>
         </map>
       </map>
@@ -233,16 +233,16 @@
           <key>darwin</key>
           <map>
             <key>md5sum</key>
-            <string>752e295ccb17f0dcb7c0167db3ad1e69</string>
+            <string>1bece4ebdc5fc3818854bc3df14b511b</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.20.1-darwin-20100606.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.16.4a-darwin-20090304.tar.bz2</uri>
           </map>
           <key>linux</key>
           <map>
             <key>md5sum</key>
-            <string>a20e73f2e7d6a032ff25a5161b1b7394</string>
+            <string>0f366e421ae9c72d9659bd20a2a326d6</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.20.1-linux-20100527.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.16.4a-linux-20090303a.tar.bz2</uri>
           </map>
           <key>linux64</key>
           <map>
@@ -254,9 +254,9 @@
           <key>windows</key>
           <map>
             <key>md5sum</key>
-            <string>b28856d3d02ee680353ae440561a6579</string>
+            <string>53e5ab7affff7121a5af2f82b4d58b54</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.20.1-windows-20100611.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.19.6-windows-20091016.tar.bz2</uri>
           </map>
         </map>
       </map>
@@ -583,39 +583,6 @@
           </map>
         </map>
       </map>
-      <key>google_breakpad</key>
-      <map>
-        <key>copyright</key>
-        <string>Copyright (c) 2006, Google Inc.</string>
-        <key>description</key>
-        <string>An open-source multi-platform crash reporting system </string>
-        <key>license</key>
-        <string>bsd</string>
-        <key>packages</key>
-        <map>
-          <key>darwin</key>
-          <map>
-            <key>md5sum</key>
-            <string>ced4010b59f1a579caa7fe3c18512499</string>
-            <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/google_breakpad-0.0.0-rev599-darwin-20100528a.tar.bz2</uri>
-          </map>
-          <key>linux</key>
-          <map>
-            <key>md5sum</key>
-            <string>29c3e7dad60bbf02c811786436d99523</string>
-            <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/google_breakpad-0.0.0-rev599-linux-20100521b.tar.bz2</uri>
-          </map>
-          <key>windows</key>
-          <map>
-            <key>md5sum</key>
-            <string>0859d47242990125f17eaab30bece2ff</string>
-            <key>url</key>
-            <uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/google_breakpad-0.0.0-rev599-windows-20100524.tar.bz2</uri>
-          </map>
-        </map>
-      </map>
       <key>googlemock</key>
       <map>
         <key>copyright</key>
@@ -981,23 +948,23 @@ anguage Infrstructure (CLI) international standard</string>
           <key>darwin</key>
           <map>
             <key>md5sum</key>
-            <string>becffca6bd8dcb239de284ea2a8b485b</string>
+            <string>7d75751cbd8786ea4d710b50b5931b9b</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-4.6+cookies-darwin-20100617.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-4.6+cookies-darwin-20100402.tar.bz2</uri>
           </map>
           <key>linux</key>
           <map>
             <key>md5sum</key>
-            <string>414d72dd59e3d83c96f0e1531360792e</string>
+            <string>455d9ce60837366a7e744751bdc8b6c3</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-linux-20100618.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-linux-20100329.tar.bz2</uri>
           </map>
           <key>windows</key>
           <map>
             <key>md5sum</key>
-            <string>df1bdd683128e060d60e435f65d8f7e8</string>
+            <string>b873755dff5f4221b5a3ba63129435a7</string>
             <key>url</key>
-            <uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-windows-qt4.6-20100617.tar.bz2</uri>
+            <uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-windows-qt4.6-cookies-20100402.tar.bz2</uri>
           </map>
         </map>
       </map>
@@ -1145,9 +1112,9 @@ anguage Infrstructure (CLI) international standard</string>
           <key>darwin</key>
           <map>
             <key>md5sum</key>
-            <string>11d2be4f2b172430747b7d4a6739e3d8</string>
+            <string>a7b49e0f3eedbd5de117a3524c414b3a</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/openSSL-0.9.8l-darwin-20100428.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/openSSL-0.9.7c-darwin-20080812.tar.bz2</uri>
           </map>
           <key>linux</key>
           <map>
@@ -1419,23 +1386,23 @@ anguage Infrstructure (CLI) international standard</string>
           <key>darwin</key>
           <map>
             <key>md5sum</key>
-            <string>aa144917d0e33453d3c2cc2c05c6c47c</string>
+            <string>38d836fa53d073b9f197eecd0f5615f0</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/vivox-3.1.0001.8821-darwin-20100529.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/vivox-3.1.0001.8181-darwin-20100319.tar.bz2</uri>
           </map>
           <key>linux</key>
           <map>
             <key>md5sum</key>
-            <string>98f7945755f3ee8e52f685a3eff4d7be</string>
+            <string>dd8dd1c223ecb8b232bf626cca6c63ac</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/vivox-3.1.0001.8821-linux-20100529.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/vivox-3.1.0001.8181-linux-20100319.tar.bz2</uri>
           </map>
           <key>windows</key>
           <map>
             <key>md5sum</key>
-            <string>e8fdd46cb026c2ec72c4489eb3bf39c1</string>
+            <string>8b4ce60f25823cd38896cb3b7eb0dd43</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/vivox-3.1.0001.8821-windows-20100529.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/vivox-3.1.0001.8181-windows-20100319.tar.bz2</uri>
           </map>
         </map>
       </map>