Commits

Christian Goetze (CG)  committed 85e23c7 Merge

Redo the same merge as in changeset "2026f824953f", but this time with feeeeling.

  • Participants
  • Parent commits 2b197b9, f6cfc13

Comments (0)

Files changed (81)

File doc/contributions.txt

 Robin Cornelius
 	SNOW-108
 	SNOW-204
+	SNOW-484
 	VWR-2488
 	VWR-9557
 	VWR-11128

File indra/llcharacter/llkeyframemotion.cpp

 		return FALSE;
 	}
 
+	if(mJointMotionList->mEmoteName==mID.asString())
+	{
+		llwarns << "Malformed animation mEmoteName==mID" << llendl;
+		return FALSE;
+	}
+
 	//-------------------------------------------------------------------------
 	// get loop
 	//-------------------------------------------------------------------------

File indra/llcommon/llqueuedthread.cpp

 		llassert_always(req->getStatus() == STATUS_QUEUED);
 		break;
 	}
+	U32 start_priority = 0 ;
 	if (req)
 	{
 		req->setStatus(STATUS_INPROGRESS);
+		start_priority = req->getPriority();
 	}
 	unlockData();
 
 	// safe to access req.
 	if (req)
 	{
-		// process request
-		U32 start_priority = req->getPriority();
+		// process request		
 		bool complete = req->processRequest();
 
 		if (complete)

File indra/llui/llaccordionctrl.cpp

 #include "llfocusmgr.h"
 #include "lllocalcliprect.h"
 
-#include "lltrans.h"
-
 #include "boost/bind.hpp"
 
 static const S32 DRAGGER_BAR_MARGIN = 4;
 {
 	initNoTabsWidget(params.no_matched_tabs_text);
 
-	mNoVisibleTabsOrigString = LLTrans::getString(params.no_visible_tabs_text.initial_value().asString());
 	mSingleExpansion = params.single_expansion;
 	if(mFitParent && !mSingleExpansion)
 	{
 {
 	LLTextBox::Params tp = tb_params;
 	tp.rect(getLocalRect());
-	mNoMatchedTabsOrigString = LLTrans::getString(tp.initial_value().asString());
+	mNoMatchedTabsOrigString = tp.initial_value().asString();
 	mNoVisibleTabsHelpText = LLUICtrlFactory::create<LLTextBox>(tp, this);
 }
 

File indra/llui/llbutton.cpp

+
 /** 
  * @file llbutton.cpp
  * @brief LLButton base class

File indra/llui/llflatlistview.cpp

 }
 
 
-bool LLFlatListView::removeItem(LLPanel* item)
+bool LLFlatListView::removeItem(LLPanel* item, bool rearrange)
 {
 	if (!item) return false;
 	if (item->getParent() != mItemsPanel) return false;
 	item_pair_t* item_pair = getItemPair(item);
 	if (!item_pair) return false;
 
-	return removeItemPair(item_pair);
+	return removeItemPair(item_pair, rearrange);
 }
 
-bool LLFlatListView::removeItemByValue(const LLSD& value)
+bool LLFlatListView::removeItemByValue(const LLSD& value, bool rearrange)
 {
 	if (value.isUndefined()) return false;
 	
 	item_pair_t* item_pair = getItemPair(value);
 	if (!item_pair) return false;
 
-	return removeItemPair(item_pair);
+	return removeItemPair(item_pair, rearrange);
 }
 
-bool LLFlatListView::removeItemByUUID(const LLUUID& uuid)
+bool LLFlatListView::removeItemByUUID(const LLUUID& uuid, bool rearrange)
 {
-	return removeItemByValue(LLSD(uuid));
+	return removeItemByValue(LLSD(uuid), rearrange);
 }
 
 LLPanel* LLFlatListView::getItemByValue(const LLSD& value) const
 
 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)
 	{
 		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();
 	return std::find(mSelectedItemPairs.begin(), it_end, item_pair) != it_end;
 }
 
-bool LLFlatListView::removeItemPair(item_pair_t* item_pair)
+bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
 {
 	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;
 		if (selected_item_pair == item_pair)
 		{
 			it = mSelectedItemPairs.erase(it);
+			selection_changed = true;
 			break;
 		}
 	}
 	item_pair->first->die();
 	delete item_pair;
 
+	if (rearrange)
+	{
 	rearrangeItems();
 	notifyParentItemsRectChanged();
+	}
+
+	if (selection_changed && mCommitOnSelectionChange)
+	{
+		onCommit();
+	}
 
 	return true;
 }
 {
 	if (size())
 	{
-		mSelectedItemsBorder->setVisible(TRUE);
+	mSelectedItemsBorder->setVisible(TRUE);
 	}
 	gEditMenuHandler = this;
 }

File indra/llui/llflatlistview.h

 		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.
 	 */
 	 * Remove specified item
 	 * @return true if the item was removed, false otherwise 
 	 */
-	virtual bool removeItem(LLPanel* item);
+	virtual bool removeItem(LLPanel* item, bool rearrange = true);
 
 	/** 
 	 * Remove an item specified by value
 	 * @return true if the item was removed, false otherwise 
 	 */
-	virtual bool removeItemByValue(const LLSD& value);
+	virtual bool removeItemByValue(const LLSD& value, bool rearrange = true);
 
 	/** 
 	 * Remove an item specified by uuid
 	 * @return true if the item was removed, false otherwise 
 	 */
-	virtual bool removeItemByUUID(const LLUUID& uuid);
+	virtual bool removeItemByUUID(const LLUUID& uuid, bool rearrange = true);
 
 	/** 
 	 * Get an item by value 
 	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 */
 
 	virtual bool isSelected(item_pair_t* item_pair) const;
 
-	virtual bool removeItemPair(item_pair_t* item_pair);
+	virtual bool removeItemPair(item_pair_t* item_pair, bool rearrange);
 
 	/**
 	 * Notify parent about changed size of internal controls with "size_changes" action

File indra/llui/llnotifications.cpp

 
 #include "llnotifications.h"
 
+#include "llinstantmessage.h"
 #include "llxmlnode.h"
 #include "lluictrl.h"
 #include "lluictrlfactory.h"
 #include "llsdserialize.h"
 #include "lltrans.h"
 #include "llnotificationslistener.h"
+#include "llstring.h"
 
 #include <algorithm>
 #include <boost/regex.hpp>
 void LLPostponedNotification::onCachedNameReceived(const LLUUID& id, const std::string& first,
 		const std::string& last, bool is_group)
 {
-	gCacheName->getFullName(id, mName);
+	mName = first + " " + last;
+
+	LLStringUtil::trim(mName);
+	if (mName.empty())
+	{
+		llwarns << "Empty name received for Id: " << id << llendl;
+		mName = SYSTEM_FROM;
+	}
 	modifyNotificationParams();
 	LLNotifications::instance().add(mParams);
 	cleanup();

File indra/llui/lltextbase.cpp

 	{
 		return a->getStart() < b->getStart();
 	}
-	return a->getEnd() < b->getEnd();
+	else
+	{
+		return a->getEnd() < b->getEnd();
+	}
 }
 
 
 
 LLTextBase::LLTextBase(const LLTextBase::Params &p) 
 :	LLUICtrl(p, LLTextViewModelPtr(new LLTextViewModel)),
-	mURLClickSignal(),
+	mURLClickSignal(NULL),
 	mMaxTextByteLength( p.max_text_length ),
 	mDefaultFont(p.font),
 	mFontShadow(p.font_shadow),
 	mParseHTML(p.allow_html),
 	mParseHighlights(p.parse_highlights),
 	mBGVisible(p.bg_visible),
-	mScroller(NULL)
+	mScroller(NULL),
+	mStyleDirty(true)
 {
 	if(p.allow_scroll)
 	{
 
 LLTextBase::~LLTextBase()
 {
-	// Menu, like any other LLUICtrl, is deleted by its parent - gMenuHolder
-
 	mSegments.clear();
+	delete mURLClickSignal;
 }
 
 void LLTextBase::initFromParams(const LLTextBase::Params& p)
 	return did_truncate;
 }
 
-LLStyle::Params LLTextBase::getDefaultStyleParams()
+const LLStyle::Params& LLTextBase::getDefaultStyleParams()
 {
-	return LLStyle::Params()
-		.color(LLUIColor(&mFgColor))
-		.readonly_color(LLUIColor(&mReadOnlyFgColor))
-		.font(mDefaultFont)
-		.drop_shadow(mFontShadow);
+	if (mStyleDirty)
+	{
+		  mDefaultStyle
+				  .color(LLUIColor(&mFgColor))
+				  .readonly_color(LLUIColor(&mReadOnlyFgColor))
+				  .font(mDefaultFont)
+				  .drop_shadow(mFontShadow);
+		  mStyleDirty = false;
+	}
+	return mDefaultStyle;
 }
 
 void LLTextBase::onValueChange(S32 start, S32 end)
 	if (cur_segment && cur_segment->handleMouseUp(x, y, mask))
 	{
 		// Did we just click on a link?
-		if (cur_segment->getStyle()
+		if (mURLClickSignal
+			&& cur_segment->getStyle()
 		    && cur_segment->getStyle()->isLink())
 		{
 			// *TODO: send URL here?
-			mURLClickSignal(this, LLSD() );
+			(*mURLClickSignal)(this, LLSD() );
 		}
 		return TRUE;
 	}
 void LLTextBase::setColor( const LLColor4& c )
 {
 	mFgColor = c;
+	mStyleDirty = true;
 }
 
 //virtual 
 void LLTextBase::setReadOnlyColor(const LLColor4 &c)
 {
 	mReadOnlyFgColor = c;
+	mStyleDirty = true;
 }
 
 //virtual
 
 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;
 }
 	}
 }
 
+boost::signals2::connection LLTextBase::setURLClickedCallback(const commit_signal_t::slot_type& cb)
+{
+	if (!mURLClickSignal)
+	{
+		mURLClickSignal = new commit_signal_t();
+	}
+	return mURLClickSignal->connect(cb);
+}
+
 //
 // LLTextSegment
 //

File indra/llui/lltextbase.h

 	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);
-
-public:
-	// Fired when a URL link is clicked
-	commit_signal_t mURLClickSignal;
+	boost::signals2::connection setURLClickedCallback(const commit_signal_t::slot_type& cb);
 
 protected:
 	// helper structs
 	void							createDefaultSegment();
 	virtual void					updateSegments();
 	void							insertSegment(LLTextSegmentPtr segment_to_insert);
-	LLStyle::Params					getDefaultStyleParams();
+	const LLStyle::Params&			getDefaultStyleParams();
 
 	//  manage lines
 	S32								getLineStart( S32 line ) const;
 	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;
 	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
 	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;
+
 };
 
 #endif

File indra/llui/lltexteditor.cpp

 	mContextMenu(NULL),
 	mShowContextMenu(p.show_context_menu)
 {
-	mDefaultFont = p.font;
-
 	mSourceID.generate();
 
 	//FIXME: use image?

File indra/llui/lluictrl.cpp

 class CompareByDefaultTabGroup: public LLCompareByTabOrder
 {
 public:
-	CompareByDefaultTabGroup(LLView::child_tab_order_t order, S32 default_tab_group):
+	CompareByDefaultTabGroup(const LLView::child_tab_order_t& order, S32 default_tab_group):
 			LLCompareByTabOrder(order),
 			mDefaultTabGroup(default_tab_group) {}
 private:
 {
 public:
 	/*virtual*/ void operator() (LLView * parent, viewList_t &children) const
-	{
+	{	
 		children.sort(CompareByDefaultTabGroup(parent->getCtrlOrder(), parent->getDefaultTabGroup()));
 	}
 };
 
+LLFastTimer::DeclareTimer FTM_FOCUS_FIRST_ITEM("Focus First Item");
+
 BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash)
 {
+	LLFastTimer _(FTM_FOCUS_FIRST_ITEM);
 	// try to select default tab group child
 	LLCtrlQuery query = getTabOrderQuery();
 	// sort things such that the default tab group is at the front

File indra/llui/lluictrlfactory.h

 	void popFactoryFunctions();
 
 	template<typename T>
-	static T* createWidget(typename T::Params& params, LLView* parent = NULL)
+	static T* createWidget(const typename T::Params& params, LLView* parent = NULL)
 	{
 		T* widget = NULL;
 

File indra/llui/lluistring.cpp

 	mResult = mOrig;
 	
 	// get the defailt args + local args
-	LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
-	combined_args.insert(mArgs.begin(), mArgs.end());
-	LLStringUtil::format(mResult, combined_args);
+	if (mArgs.empty())
+	{
+		LLStringUtil::format(mResult, LLTrans::getDefaultArgs());
+	}
+	else
+	{
+		LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
+		combined_args.insert(mArgs.begin(), mArgs.end());
+		LLStringUtil::format(mResult, combined_args);
+	}
 }
 
 void LLUIString::updateWResult() const

File indra/llui/llview.h

 
 	virtual BOOL	postBuild() { return TRUE; }
 
-	child_tab_order_t getCtrlOrder() const		{ return mCtrlOrder; }
+	const child_tab_order_t& getCtrlOrder() const		{ return mCtrlOrder; }
 	ctrl_list_t getCtrlList() const;
 	ctrl_list_t getCtrlListSorted() const;
 	
 class LLCompareByTabOrder
 {
 public:
-	LLCompareByTabOrder(LLView::child_tab_order_t order) : mTabOrder(order) {}
+	LLCompareByTabOrder(const LLView::child_tab_order_t& order) : mTabOrder(order) {}
 	virtual ~LLCompareByTabOrder() {}
 	bool operator() (const LLView* const a, const LLView* const b) const;
 private:
 	virtual bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const { return a < b; }
-	LLView::child_tab_order_t mTabOrder;
+	// ok to store a reference, as this should only be allocated on stack during view query operations
+	const LLView::child_tab_order_t& mTabOrder;
 };
 
 template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) const

File indra/llui/llviewquery.cpp

 		if (pre.first)
 		{
 			post = runFilters(view, filtered_children, mPostFilters);
+			}
 		}
-	}
 
 	if(pre.first && post.first) 
 	{
 		(*mSorterp)(view, views); // sort the children per the sorter
 	}
 	for(LLView::child_list_iter_t iter = views.begin();
-			iter != views.end();
-			iter++)
-		{
-			viewList_t indiv_children = this->run(*iter);
-			filtered_children.insert(filtered_children.end(), indiv_children.begin(), indiv_children.end());
-		}
+		iter != views.end();
+		iter++)
+	{
+		viewList_t indiv_children = this->run(*iter);
+		filtered_children.splice(filtered_children.end(), indiv_children);
+	}
 }
 
 filterResult_t LLViewQuery::runFilters(LLView * view, const viewList_t children, const filterList_t filters) const

File indra/llui/llviewquery.h

 	viewList_t operator () (LLView * view) const { return run(view); }
 
 	// override this method to provide iteration over other types of children
-	virtual void filterChildren(LLView * view, viewList_t & filtered_children) const;
+	virtual void filterChildren(LLView * view, viewList_t& filtered_children) const;
 
 private:
 

File indra/newview/app_settings/settings.xml

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

File indra/newview/llagent.cpp

 	}
 	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());
 	}

File indra/newview/llagentwearablesfetch.cpp

 
 	virtual ~LLOrderMyOutfitsOnDestroy()
 	{
-		if (LLApp::isExiting())
+		if (!LLApp::isRunning())
 		{
 			llwarns << "called during shutdown, skipping" << llendl;
 			return;

File indra/newview/llappearancemgr.cpp

 			{
 				removeCOFItemLinks(gAgentWearables.getWearableItemID(item_to_wear->getWearableType(), wearable_count-1), false);
 			}
-			addCOFItemLink(item_to_wear, do_update);
+			addCOFItemLink(item_to_wear, do_update, cb);
 		} 
 		break;
 	case LLAssetType::AT_BODYPART:
 	}
 	else
 	{
+		LLIsOfAssetType collector = LLIsOfAssetType(LLAssetType::AT_LINK);
+
 		LLInventoryModel::cat_array_t cof_cats;
 		LLInventoryModel::item_array_t cof_items;
-		gInventory.collectDescendents(cof, cof_cats, cof_items,
-									  LLInventoryModel::EXCLUDE_TRASH);
+		gInventory.collectDescendentsIf(cof, cof_cats, cof_items,
+									  LLInventoryModel::EXCLUDE_TRASH, collector);
 
 		LLInventoryModel::cat_array_t outfit_cats;
 		LLInventoryModel::item_array_t outfit_items;
-		gInventory.collectDescendents(base_outfit, outfit_cats, outfit_items,
-									  LLInventoryModel::EXCLUDE_TRASH);
+		gInventory.collectDescendentsIf(base_outfit, outfit_cats, outfit_items,
+									  LLInventoryModel::EXCLUDE_TRASH, collector);
 
-		if(outfit_items.count() != cof_items.count() -1)
+		if(outfit_items.count() != cof_items.count())
 		{
 			// Current outfit folder should have one more item than the outfit folder.
 			// this one item is the link back to the outfit folder itself.
 			return;
 		}
 
-		//getting rid of base outfit folder link to simplify comparison
-		for (LLInventoryModel::item_array_t::iterator it = cof_items.begin(); it != cof_items.end(); ++it)
-		{
-			if (*it == base_outfit_item)
-			{
-				cof_items.erase(it);
-				break;
-			}
-		}
-
 		//"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);

File indra/newview/llavatarlist.cpp

 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;
+	LLAvalineListItem* item = new LLAvalineListItem(/*hide_number=*/false);
 	item->setAvatarId(item_id, session_id, true, false);
 	item->setName(item_name);
 

File indra/newview/llchiclet.cpp

 
 	if("end" == action)
 	{
-		LLScriptFloaterManager::instance().onRemoveNotification(getSessionId());
+		LLScriptFloaterManager::instance().removeNotification(getSessionId());
 	}
 }
 
 
 	if("end" == action)
 	{
-		LLScriptFloaterManager::instance().onRemoveNotification(getSessionId());
+		LLScriptFloaterManager::instance().removeNotification(getSessionId());
 	}
 }
 

File indra/newview/llcofwearables.cpp

 	mAttachmentsTab(NULL),
 	mBodyPartsTab(NULL),
 	mLastSelectedTab(NULL),
-	mAccordionCtrl(NULL)
+	mAccordionCtrl(NULL),
+	mCOFVersion(-1)
 {
 	mClothingMenu = new CofClothingContextMenu(this);
 	mAttachmentMenu = new CofAttachmentContextMenu(this);
 
 void LLCOFWearables::refresh()
 {
+	const LLUUID cof_id = LLAppearanceMgr::instance().getCOF();
+	if (cof_id.isNull())
+	{
+		llwarns << "COF ID cannot be NULL" << llendl;
+		return;
+	}
+
+	LLViewerInventoryCategory* catp = gInventory.getCategory(cof_id);
+	if (!catp)
+	{
+		llwarns << "COF category cannot be NULL" << llendl;
+		return;
+	}
+
+	if (mCOFVersion == catp->getVersion()) return;
+	mCOFVersion = catp->getVersion();
+
 	typedef std::vector<LLSD> values_vector_t;
 	typedef std::map<LLFlatListView*, values_vector_t> selection_map_t;
 
 	LLInventoryModel::cat_array_t cats;
 	LLInventoryModel::item_array_t cof_items;
 
-	gInventory.collectDescendents(LLAppearanceMgr::getInstance()->getCOF(), cats, cof_items, LLInventoryModel::EXCLUDE_TRASH);
+	gInventory.collectDescendents(cof_id, cats, cof_items, LLInventoryModel::EXCLUDE_TRASH);
 
 	populateAttachmentsAndBodypartsLists(cof_items);
 
 	item_panel->childSetAction("btn_edit", mCOFCallbacks.mEditWearable);
 	
 	//turning on gray separator line for the last item in the items group of the same wearable type
-	item_panel->childSetVisible("wearable_type_separator_icon", last);
+	item_panel->setSeparatorVisible(last);
 
 	return item_panel;
 }

File indra/newview/llcofwearables.h

 	LLPanel* getSelectedItem();
 	void getSelectedItems(std::vector<LLPanel*>& selected_items) const;
 
+	/* Repopulate the COF wearables list if the COF category has been changed since the last refresh */
 	void refresh();
 	void clear();
 
 	LLListContextMenu* mBodyPartMenu;
 
 	LLAccordionCtrl*	mAccordionCtrl;
+
+	/* COF category version since last refresh */
+	S32 mCOFVersion;
 };
 
 

File indra/newview/lldndbutton.cpp

 
 }
 
-LLDragAndDropButton::LLDragAndDropButton(Params& params)
+LLDragAndDropButton::LLDragAndDropButton(const Params& params)
 : LLButton(params)
 {
 

File indra/newview/lldndbutton.h

 		Params();
 	};
 
-	LLDragAndDropButton(Params& params);
+	LLDragAndDropButton(const Params& params);
 
 	typedef boost::function<bool (
 		S32 /*x*/, S32 /*y*/, MASK /*mask*/, BOOL /*drop*/,

File indra/newview/llexpandabletextbox.cpp

 	// LLTextBox::setText will obliterate the expander segment, so make sure
 	// we generate it again by clearing mExpanderVisible
 	mExpanderVisible = false;
-	LLTextEditor::setText(text, input_params);
+
+	// Workaround for EXT-8259: trim text before rendering it.
+	{
+		std::string trimmed_text(text);
+		LLStringUtil::trim(trimmed_text);
+		LLTextEditor::setText(trimmed_text, input_params);
+	}
 
 	// text contents have changed, segments are cleared out
 	// so hide the expander and determine if we need it

File indra/newview/llfolderview.h

 	BOOL needsAutoRename() { return mNeedsAutoRename; }
 	void setNeedsAutoRename(BOOL val) { mNeedsAutoRename = val; }
 	void setPinningSelectedItem(BOOL val) { mPinningSelectedItem = val; }
+	void setAutoSelectOverride(BOOL val) { mAutoSelectOverride = val; }
 
 	void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; }
 

File indra/newview/llimview.cpp

 		}
 		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)
 			{

File indra/newview/llinspectobject.cpp

 
 	// Hide floater when name links clicked
 	LLTextBox* textbox = getChild<LLTextBox>("object_creator");
-	textbox->mURLClickSignal.connect(
-		boost::bind(&LLInspectObject::closeFloater, this, false) );
+	textbox->setURLClickedCallback(boost::bind(&LLInspectObject::closeFloater, this, false) );
 
 	// Hook up functionality
 	getChild<LLUICtrl>("buy_btn")->setCommitCallback(

File indra/newview/llinventoryfunctions.cpp

 	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)

File indra/newview/llinventoryfunctions.h

 	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:
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLFindNonLinksByMask
-//
-//
+// Class LLFindByMask
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLFindByMask : public LLInventoryCollectFunctor
 {
 	}
 };
 
+/* 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
 {

File indra/newview/llinventoryitemslist.cpp

 	}
 }
 
+LLFastTimer::DeclareTimer FTM_INVENTORY_ITEMS_REFRESH("Inventory List Refresh");
+
 void LLInventoryItemsList::refresh()
 {
-	static const unsigned ADD_LIMIT = 50;
+	LLFastTimer _(FTM_INVENTORY_ITEMS_REFRESH);
+	static const unsigned ADD_LIMIT = 20;
 
 	uuid_vec_t added_items;
 	uuid_vec_t removed_items;
 	it = removed_items.begin();
 	for( ; removed_items.end() != it; ++it)
 	{
-		removeItemByUUID(*it);
+		// don't filter items right away
+		removeItemByUUID(*it, false);
 	}
 
 	// Filter, rearrange and notify parent about shape changes

File indra/newview/llinventorylistitem.cpp

 
 LLPanelInventoryListItemBase::Params::Params()
 :	default_style("default_style"),
-	worn_style("worn_style")
+	worn_style("worn_style"),
+	hover_image("hover_image"),
+	selected_image("selected_image"),
+	separator_image("separator_image"),
+	item_icon("item_icon"),
+	item_name("item_name")
 {};
 
 LLPanelInventoryListItemBase* LLPanelInventoryListItemBase::create(LLViewerInventoryItem* item)
 	LLPanelInventoryListItemBase* list_item = NULL;
 	if (item)
 	{
-		list_item = new LLPanelInventoryListItemBase(item);
-		list_item->init();
+		const LLPanelInventoryListItemBase::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelInventoryListItemBase>();
+		list_item = new LLPanelInventoryListItemBase(item, params);
+		list_item->initFromParams(params);
+		list_item->postBuild();
 	}
 	return list_item;
 }
 		}
 		setNeedsRefresh(false);
 	}
+
+	if (mHovered && mHoverImage)
+	{
+		mHoverImage->draw(getLocalRect());
+	}
+
+	if (mSelected && mSelectedImage)
+	{
+		mSelectedImage->draw(getLocalRect());
+	}
+
+	if (mSeparatorVisible && mSeparatorImage)
+	{
+		// stretch along bottom of listitem, using image height
+		LLRect separator_rect = getLocalRect();
+		separator_rect.mTop = mSeparatorImage->getHeight();
+		mSeparatorImage->draw(separator_rect);
+	}
+	
 	LLPanel::draw();
 }
 
 
 BOOL LLPanelInventoryListItemBase::postBuild()
 {
-	setIconCtrl(getChild<LLIconCtrl>("item_icon"));
-	setTitleCtrl(getChild<LLTextBox>("item_name"));
-
 	LLViewerInventoryItem* inv_item = getItem();
 	if (inv_item)
 	{
 {
 	if (!value.isMap()) return;
 	if (!value.has("selected")) return;
-	childSetVisible("selected_icon", value["selected"]);
+	mSelected = value["selected"];
 }
 
 void LLPanelInventoryListItemBase::onMouseEnter(S32 x, S32 y, MASK mask)
 {
-	childSetVisible("hovered_icon", true);
+	mHovered = true;
 	LLPanel::onMouseEnter(x, y, mask);
 }
 
 void LLPanelInventoryListItemBase::onMouseLeave(S32 x, S32 y, MASK mask)
 {
-	childSetVisible("hovered_icon", false);
+	mHovered = false;
 	LLPanel::onMouseLeave(x, y, mask);
 }
 
 	return rv;
 }
 
-LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem* item)
-: LLPanel()
-, mInventoryItemUUID(item ? item->getUUID() : LLUUID::null)
-, mIconCtrl(NULL)
-, mTitleCtrl(NULL)
-, mWidgetSpacing(WIDGET_SPACING)
-, mLeftWidgetsWidth(0)
-, mRightWidgetsWidth(0)
-, mNeedsRefresh(false)
+LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem* item, const LLPanelInventoryListItemBase::Params& params)
+:	LLPanel(params),
+	mInventoryItemUUID(item ? item->getUUID() : LLUUID::null),
+	mIconCtrl(NULL),
+	mTitleCtrl(NULL),
+	mWidgetSpacing(WIDGET_SPACING),
+	mLeftWidgetsWidth(0),
+	mRightWidgetsWidth(0),
+	mNeedsRefresh(false),
+	mHovered(false),
+	mSelected(false),
+	mSeparatorVisible(false),
+	mHoverImage(params.hover_image),
+	mSelectedImage(params.selected_image),
+	mSeparatorImage(params.separator_image)
 {
-}
+	LLIconCtrl::Params icon_params(params.item_icon);
+	applyXUILayout(icon_params, this);
 
-void LLPanelInventoryListItemBase::init()
-{
-	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_inventory_item.xml");
+	mIconCtrl = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+	if (mIconCtrl)
+	{
+		addChild(mIconCtrl);
+	}
+	else
+	{
+		mIconCtrl = dynamic_cast<LLIconCtrl*>(LLUICtrlFactory::createDefaultWidget<LLIconCtrl>("item_icon"));
+	}
+
+	LLTextBox::Params text_params(params.item_name);
+	applyXUILayout(text_params, this);
+
+	mTitleCtrl = LLUICtrlFactory::create<LLTextBox>(text_params);
+	if (mTitleCtrl)
+	{
+		addChild(mTitleCtrl);
+	}
+	else
+	{
+		mTitleCtrl = dynamic_cast<LLTextBox*>(LLUICtrlFactory::createDefaultWidget<LLTextBox>("item_title"));
+	}
 }
 
 class WidgetVisibilityChanger

File indra/newview/llinventorylistitem.h

 // llui
 #include "llpanel.h"
 #include "llstyle.h"
+#include "lliconctrl.h"
+#include "lltextbox.h"
 
 // newview
 #include "llwearabletype.h"
 
-class LLIconCtrl;
-class LLTextBox;
 class LLViewerInventoryItem;
 
 /**
 	{
 		Optional<LLStyle::Params>	default_style,
 									worn_style;
+		Optional<LLUIImage*>		hover_image,
+									selected_image,
+									separator_image;
+		Optional<LLIconCtrl::Params>	item_icon;
+		Optional<LLTextBox::Params>		item_name;
 		Params();
 	};
 
 	/** Get the associated inventory item */
 	LLViewerInventoryItem* getItem() const;
 
+	void setSeparatorVisible(bool visible) { mSeparatorVisible = visible; }
+
 	virtual ~LLPanelInventoryListItemBase(){}
 
 protected:
 
-	LLPanelInventoryListItemBase(LLViewerInventoryItem* item);
+	LLPanelInventoryListItemBase(LLViewerInventoryItem* item, const Params& params);
 
 	typedef std::vector<LLUICtrl*> widget_array_t;
 
 	/**
-	 * Use it from a factory function to build panel, do not build panel in constructor
-	 */
-	virtual void init();
-
-	/**
 	 * Called after inventory item was updated, update panel widgets to reflect inventory changes.
 	 */
 	virtual void updateItem(const std::string& name,
 							EItemState item_state = IS_DEFAULT);
 
-	/** setter for mIconCtrl */
-	void setIconCtrl(LLIconCtrl* icon) { mIconCtrl = icon; }
-	/** setter for MTitleCtrl */
-	void setTitleCtrl(LLTextBox* tb) { mTitleCtrl = tb; }
-
 	void setLeftWidgetsWidth(S32 width) { mLeftWidgetsWidth = width; }
 	void setRightWidgetsWidth(S32 width) { mRightWidgetsWidth = width; }
 
 	LLTextBox*		mTitleCtrl;
 
 	LLUIImagePtr	mIconImage;
+	LLUIImagePtr	mHoverImage;
+	LLUIImagePtr	mSelectedImage;
+	LLUIImagePtr	mSeparatorImage;
+
+	bool			mHovered;
+	bool			mSelected;
+	bool			mSeparatorVisible;
+
 	std::string		mHighlightedText;
 
 	widget_array_t	mLeftSideWidgets;

File indra/newview/lllocationinputctrl.cpp

 		//needs unescaped one
 		LLSLURL slurl;
 		LLAgentUI::buildSLURL(slurl, false);
-		mTextEntry->setText(slurl.getSLURLString());
+		mTextEntry->setText(LLURI::unescape(slurl.getSLURLString()));
 		mTextEntry->selectAll();
 
 		mMaturityButton->setVisible(FALSE);

File indra/newview/llpanelgenerictip.cpp

 
 #include "llpanelgenerictip.h"
 #include "llnotifications.h"
+#include "llviewercontrol.h" // for gSavedSettings
 
 
 LLPanelGenericTip::LLPanelGenericTip(
 
 	childSetValue("message", notification->getMessage());
 
-	// set line max count to 3 in case of a very long name
-	snapToMessageHeight(getChild<LLTextBox> ("message"), 3);
+
+	S32 max_line_count =  gSavedSettings.getS32("TipToastMessageLineCount");
+	snapToMessageHeight(getChild<LLTextBox> ("message"), max_line_count);
 }
 

File indra/newview/llpanelmaininventory.cpp

 		mFilterEditor->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterEdit, this, _2));
 	}
 
+	initListCommandsHandlers();
+
 	// *TODO:Get the cost info from the server
 	const std::string upload_cost("10");
-	childSetLabelArg("Upload Image", "[COST]", upload_cost);
-	childSetLabelArg("Upload Sound", "[COST]", upload_cost);
-	childSetLabelArg("Upload Animation", "[COST]", upload_cost);
-	childSetLabelArg("Bulk Upload", "[COST]", upload_cost);
+	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);
 
-	initListCommandsHandlers();
 	return TRUE;
 }
 

File indra/newview/llpanelonlinestatus.cpp

 
 #include "llnotifications.h"
 #include "llpanelonlinestatus.h"
+#include "llviewercontrol.h" // for gSavedSettings
 
 LLPanelOnlineStatus::LLPanelOnlineStatus(
 		const LLNotificationPtr& notification) :
 				notification, notification->getResponseTemplate()));
 	}
 
-	// set line max count to 3 in case of a very long name
-	snapToMessageHeight(getChild<LLTextBox> ("message"), 3);
+	S32 max_line_count =  gSavedSettings.getS32("TipToastMessageLineCount");
+	snapToMessageHeight(getChild<LLTextBox> ("message"), max_line_count);
 
 }

File indra/newview/llpaneloutfitedit.cpp

 #include "llsdutil.h"
 #include "llsidepanelappearance.h"
 #include "lltoggleablemenu.h"
+#include "llvoavatarself.h"
 #include "llwearablelist.h"
 #include "llwearableitemslist.h"
 #include "llwearabletype.h"
 	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::update, this));
+	observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::onCOFChanged, this));
 
 	gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, true));
 	gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, false));
 	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 LLFindByMask(ALL_ITEMS_MASK)));
-	mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Clothing"), new LLIsType(LLAssetType::AT_CLOTHING)));
-	mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Bodyparts"), new LLIsType(LLAssetType::AT_BODYPART)));
+	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)));
 	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));
+	setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2));
 
 	mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list");
 	mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
 	mInventoryItemsPanel = getChild<LLInventoryPanel>("folder_view");
 	mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK);
 	mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-	mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this));
-	mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this));
+	mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
+	mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
 
 	mCOFDragAndDropObserver = new LLCOFDragAndDropObserver(mInventoryItemsPanel->getModel());
 
 	mWearablesListViewPanel = getChild<LLPanel>("filtered_wearables_panel");
 	mWearableItemsList = getChild<LLInventoryItemsList>("list_view");
 	mWearableItemsList->setCommitOnSelectionChange(true);
-	mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this));
+	mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
 	mWearableItemsList->setDoubleClickCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this));
 
 	mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));
 		mListViewFilterCmbBox->setVisible(false);
 
 		showWearablesFilter();
+
+		// Reset mWearableItemsList position to top. See EXT-8180.
+		mWearableItemsList->goToTop();
 	}
 
 	//switching button bars
 	}
 }
 
-void LLPanelOutfitEdit::onVisibilityChange()
+void LLPanelOutfitEdit::onVisibilityChange(const LLSD &in_visible_chain)
 {
 	showAddWearablesPanel(false);
 	mWearableItemsList->resetSelection();
 	mInventoryItemsPanel->clearSelection();
+
+	if (in_visible_chain.asBoolean())
+	{
+		update();
+	}
 }
 
 void LLPanelOutfitEdit::onAddWearableClicked(void)
 {
 	static LLShopURLDispatcher url_resolver;
 
+	// will contain the resultant URL
 	std::string url;
+
+	if (isAgentAvatarValid())
+	{
+		// try to get wearable type from 'Add More' panel first (EXT-7639)
+		LLWearableType::EType type = getAddMorePanelSelectionType();
+
+		if (type == LLWearableType::WT_NONE)
+		{
+			type = getCOFWearablesSelectionType();
+		}
+
+		ESex sex = gAgentAvatarp->getSex();
+
+		// WT_INVALID comes for attachments
+		if (type != LLWearableType::WT_INVALID && type != LLWearableType::WT_NONE)
+		{
+			url = url_resolver.resolveURL(type, sex);
+		}
+
+		if (url.empty())
+		{
+			url = url_resolver.resolveURL(mCOFWearables->getExpandedAccordionAssetType(), sex);
+		}
+	}
+	else
+	{
+		llwarns << "Agent avatar is invalid" << llendl;
+
+		// the second argument is not important in this case: generic market place will be opened
+		url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE);
+	}
+
+	LLWeb::loadURLExternal(url);
+}
+
+LLWearableType::EType LLPanelOutfitEdit::getCOFWearablesSelectionType() const
+{
 	std::vector<LLPanel*> selected_items;
+	LLWearableType::EType type = LLWearableType::WT_NONE;
+
 	mCOFWearables->getSelectedItems(selected_items);
 
-	ESex sex = gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE;
-
 	if (selected_items.size() == 1)
 	{
-		LLWearableType::EType type = LLWearableType::WT_NONE;
 		LLPanel* item = selected_items.front();
 
 		// LLPanelDummyClothingListItem is lower then LLPanelInventoryListItemBase in hierarchy tree
 		{
 			type = real_item->getWearableType();
 		}
+	}
 
-		// WT_INVALID comes for attachments
-		if (type != LLWearableType::WT_INVALID)
+	return type;
+}
+
+LLWearableType::EType LLPanelOutfitEdit::getAddMorePanelSelectionType() const
+{
+	LLWearableType::EType type = LLWearableType::WT_NONE;
+
+	if (mAddWearablesPanel != NULL && mAddWearablesPanel->getVisible())
+	{
+		if (mInventoryItemsPanel != NULL && mInventoryItemsPanel->getVisible())
 		{
-			url = url_resolver.resolveURL(type, sex);
+			std::set<LLUUID> selected_uuids = mInventoryItemsPanel->getRootFolder()->getSelectionList();
+
+			if (selected_uuids.size() == 1)
+			{
+				type = getWearableTypeByItemUUID(*(selected_uuids.begin()));
+			}
+		}
+		else if (mWearableItemsList != NULL && mWearableItemsList->getVisible())
+		{
+			std::vector<LLUUID> selected_uuids;
+			mWearableItemsList->getSelectedUUIDs(selected_uuids);
+
+			if (selected_uuids.size() == 1)
+			{
+				type = getWearableTypeByItemUUID(selected_uuids.front());
+			}
 		}
 	}
 
-	if (url.empty())
-	{
-		url = url_resolver.resolveURL(mCOFWearables->getExpandedAccordionAssetType(), sex);
-	}
+	return type;
+}
 
-	LLWeb::loadURLExternal(url);
+LLWearableType::EType LLPanelOutfitEdit::getWearableTypeByItemUUID(const LLUUID& item_uuid) const
+{
+	LLViewerInventoryItem* item = gInventory.getLinkedItem(item_uuid);
+	return (item != NULL) ? item->getWearableType() : LLWearableType::WT_NONE;
 }
 
 void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void)
 	}
 }
 
-void LLPanelOutfitEdit::onInventorySelectionChange()
+void LLPanelOutfitEdit::updatePlusButton()
 {
 	uuid_vec_t selected_items;
 	getSelectedItemsUUID(selected_items);
 	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)
 	showAddWearablesPanel(true);
 	showWearablesListView();
 
-	// Reset mWearableItemsList position to top. See EXT-8180.
-	mWearableItemsList->goToTop();
-
 	//e_list_view_item_type implicitly contains LLWearableType::EType starting from LVIT_SHAPE
 	applyListViewFilter((EListViewItemType) (LVIT_SHAPE + type));
 }
 //	return selected_id;
 }
 
+void LLPanelOutfitEdit::onCOFChanged()
+{
+	//the panel is only updated when is visible to a user
+	if (!isInVisibleChain()) return;
+
+	update();
+}
+
 
 // EOF

File indra/newview/llpaneloutfitedit.h

 	void onFolderViewFilterCommitted(LLUICtrl* ctrl);
 	void onListViewFilterCommitted(LLUICtrl* ctrl);
 	void onSearchEdit(const std::string& string);
-	void onInventorySelectionChange();
+	void updatePlusButton();
 	void onPlusBtnClicked(void);
 
-	void onVisibilityChange();
+	void onVisibilityChange(const LLSD &in_visible_chain);
 
 	void applyFolderViewFilter(EFolderViewItemType type);
 	void applyListViewFilter(EListViewItemType 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;
 
 	LLTextBox*			mCurrentOutfitName;
 	LLTextBox*			mStatus;

File indra/newview/llparticipantlist.cpp

 	else
 	{
 		std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id);
-		mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? display_name : LLTrans::getString("AvatarNameWaiting"));
+		mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name);
 		mAvalineUpdater->watchAvalineCaller(avatar_id);
 	}
 	adjustParticipant(avatar_id);

File indra/newview/llpreviewtexture.cpp

 	  mLastWidth(0),
 	  mAspectRatio(0.f),
 	  mPreviewToSave(FALSE),
-	  mImage(NULL)
+	  mImage(NULL),
+	  mImageOldBoostLevel(LLViewerTexture::BOOST_NONE)
 {
 	updateImageID();
 	if (key.has("save_as"))
 	{
 		getWindow()->decBusyCount();
 	}
-
+	mImage->setBoostLevel(mImageOldBoostLevel);
 	mImage = NULL;
 }
 
 void LLPreviewTexture::loadAsset()
 {
 	mImage = LLViewerTextureManager::getFetchedTexture(mImageID, MIPMAP_TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+	mImageOldBoostLevel = mImage->getBoostLevel();
 	mImage->setBoostLevel(LLViewerTexture::BOOST_PREVIEW);
 	mImage->forceToSaveRawImage(0) ;
 	mAssetStatus = PREVIEW_ASSET_LOADING;

File indra/newview/llpreviewtexture.h

 	void				updateDimensions();
 	LLUUID				mImageID;
 	LLPointer<LLViewerFetchedTexture>		mImage;
-	BOOL				mLoadingFullImage;
+	S32                 mImageOldBoostLevel;
 	std::string			mSaveFileName;
 	LLFrameTimer		mSavedFileTimer;
+	BOOL				mLoadingFullImage;
 	BOOL                mShowKeepDiscard;
 	BOOL                mCopyToInv;
 
 	// This is stored off in a member variable, because the save-as
 	// button and drag and drop functionality need to know.
 	BOOL mIsCopyable;
-
+	BOOL mUpdateDimensions;
 	S32 mLastHeight;
 	S32 mLastWidth;
-	F32 mAspectRatio;
-	BOOL mUpdateDimensions;
+	F32 mAspectRatio;	
 
 	LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; 
 };

File indra/newview/llscriptfloater.cpp

 
 	if(getNotificationId().notNull())
 	{
-		LLScriptFloaterManager::getInstance()->onRemoveNotification(getNotificationId());
+		// we shouldn't kill notification on exit since it may be used as persistent.
+		if (app_quitting)
+		{
+			LLScriptFloaterManager::getInstance()->onRemoveNotification(getNotificationId());
+		}
+		else
+		{
+			LLScriptFloaterManager::getInstance()->removeNotification(getNotificationId());
+		}
 	}
 }
 
 				set_new_message |= !floater->hasFocus();
 			}
 
-			onRemoveNotification(it->first);
+			removeNotification(it->first);
 		}
 	}
 
 	toggleScriptFloater(notification_id, set_new_message);
 }
 
+void LLScriptFloaterManager::removeNotification(const LLUUID& notification_id)
+{
+	LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
+	if (notification != NULL && !notification->isCancelled())
+	{
+		LLNotificationsUtil::cancel(notification);
+	}
+
+	onRemoveNotification(notification_id);
+}
+
 void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id)
 {
 	if(notification_id.isNull())
 
 	LLIMWellWindow::getInstance()->removeObjectRow(notification_id);
 
+	mNotifications.erase(notification_id);
+
 	// close floater
 	LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", notification_id);
 	if(floater)
 		floater->setNotificationId(LLUUID::null);
 		floater->closeFloater();
 	}
-
-	mNotifications.erase(notification_id);
 }
 
 void LLScriptFloaterManager::toggleScriptFloater(const LLUUID& notification_id, bool set_new_message)

File indra/newview/llscriptfloater.h

 	void onAddNotification(const LLUUID& notification_id);
 
 	/**
+	 * Removes notification.
+	 */
+	void removeNotification(const LLUUID& notification_id);
+
+	/**
 	 * Handles notification removal.
 	 * Removes script notification toast, removes script chiclet, closes script floater
 	 */

File indra/newview/llsidetray.cpp

 
 LLSideTray::Params::Params()
 :	collapsed("collapsed",false),
-	tab_btn_image_normal("tab_btn_image","sidebar_tab_left.tga"),
-	tab_btn_image_selected("tab_btn_image_selected","button_enabled_selected_32x128.tga"),
+	tab_btn_image_normal("tab_btn_image",LLUI::getUIImage("sidebar_tab_left.tga")),
+	tab_btn_image_selected("tab_btn_image_selected",LLUI::getUIImage("button_enabled_selected_32x128.tga")),
 	default_button_width("tab_btn_width",32),
 	default_button_height("tab_btn_height",32),
 	default_button_margin("tab_btn_margin",0)
 {}
 
 //virtual 
-LLSideTray::LLSideTray(Params& params)
+LLSideTray::LLSideTray(const Params& params)
 	   : LLPanel(params)
 	    ,mActiveTab(0)
 		,mCollapsed(false)
 	bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_TOP);
 	bparams.rect (rect);
 	bparams.tab_stop(false);
-	bparams.image_unselected.name(sidetray_params.tab_btn_image_normal);
-	bparams.image_selected.name(sidetray_params.tab_btn_image_selected);
-	bparams.image_disabled.name(sidetray_params.tab_btn_image_normal);
-	bparams.image_disabled_selected.name(sidetray_params.tab_btn_image_selected);
+	bparams.image_unselected(sidetray_params.tab_btn_image_normal);
+	bparams.image_selected(sidetray_params.tab_btn_image_selected);
+	bparams.image_disabled(sidetray_params.tab_btn_image_normal);
+	bparams.image_disabled_selected(sidetray_params.tab_btn_image_selected);
 
 	LLButton* button = LLUICtrlFactory::create<LLButton> (bparams);
 	button->setLabel(name);

File indra/newview/llsidetray.h

 	:	public LLInitParam::Block<Params, LLPanel::Params>
 	{
 		// initial state
-		Optional<bool>		collapsed;
-		Optional<std::string>		tab_btn_image_normal;
-		Optional<std::string>		tab_btn_image_selected;
+		Optional<bool>				collapsed;
+		Optional<LLUIImage*>		tab_btn_image_normal,
+									tab_btn_image_selected;
 		
-		Optional<S32>				default_button_width;
-		Optional<S32>				default_button_height;
-		Optional<S32>				default_button_margin;
+		Optional<S32>				default_button_width,
+									default_button_height,
+									default_button_margin;
 		
 		Params();
 	};
 	static LLSideTray*	getInstance		();
 	static bool			instanceCreated	();
 protected:
-	LLSideTray(Params& params);
+	LLSideTray(const Params& params);
 	typedef std::vector<LLSideTrayTab*> child_vector_t;
 	typedef child_vector_t::iterator					child_vector_iter_t;
 	typedef child_vector_t::const_iterator  			child_vector_const_iter_t;

File indra/newview/llsyswellwindow.cpp

 //---------------------------------------------------------------------------------
 void LLIMWellWindow::ObjectRowPanel::onClosePanel()
 {
-	LLScriptFloaterManager::getInstance()->onRemoveNotification(mChiclet->getSessionId());
+	LLScriptFloaterManager::getInstance()->removeNotification(mChiclet->getSessionId());
 }
 
 void LLIMWellWindow::ObjectRowPanel::initChiclet(const LLUUID& notification_id, bool new_message/* = false*/)
 		ObjectRowPanel* obj_panel = dynamic_cast <ObjectRowPanel*> (panel);
 		if (obj_panel)
 		{
-			LLScriptFloaterManager::instance().onRemoveNotification(*iter);
+			LLScriptFloaterManager::instance().removeNotification(*iter);
 		}
 	}
 }

File indra/newview/lltexturectrl.cpp

 		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();

File indra/newview/llurllineeditorctrl.cpp