bool LLFloaterGesture::updateItem( LLUUID const &aItem, LLSD const &aData )
{
	std::map< LLUUID, LLScrollListItem * >::iterator itr = mItems.find( aItem );

	if( mItems.end() == itr )
		return false;

	LLScrollListItem* pItem( itr->second );

	if( !pItem )
		return false;

	std::string	sDummyShortcut = "---";
	std::string	sDummyKey = "~~~";

	if( aData[ "columns" ][ COL_NAME ][ "value" ] != "" )
		pItem->getColumn( UI_COL_NAME )->setValue( aData[ "columns" ][ COL_NAME ][ "value" ] );
	
	if( aData[ "columns" ][ COL_SHORTCUT ][ "value" ] != sDummyShortcut )
		pItem->getColumn( UI_COL_SHORTCUT )->setValue( aData[ "columns" ][ COL_SHORTCUT ][ "value" ] );

	if( aData[ "columns" ][ COL_KEY ][ "value" ] != sDummyKey )
		pItem->getColumn( UI_COL_KEY )->setValue( aData[ "columns" ][ COL_KEY ][ "value" ] );
	
	pItem->getColumn( UI_COL_NAME )->setValue( aData[ "columns" ][ COL_NAME ][ "value" ] );

	LLFontGL::StyleFlags oStyle = LLGestureMgr::getInstance()->isGestureActive(aItem) ? LLFontGL::BOLD : LLFontGL::NORMAL;

	LLScrollListText *pTextItem = dynamic_cast< LLScrollListText* >( pItem->getColumn( UI_COL_NAME ) );

	if( pTextItem )
		pTextItem->setFontStyle( oStyle );

	return true;
}
void LLFloaterVoiceEffect::refreshEffectList()
{
	if (!mVoiceEffectList)
	{
		return;
	}

	LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
	if (!effect_interface)
	{
		mVoiceEffectList->setEnabled(false);
		return;
	}

	LL_DEBUGS("Voice")<< "Rebuilding Voice Morph list."<< LL_ENDL;

	// Preserve selected items and scroll position
	S32 scroll_pos = mVoiceEffectList->getScrollPos();
	uuid_vec_t selected_items;
	std::vector<LLScrollListItem*> items = mVoiceEffectList->getAllSelected();
	for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++)
	{
		selected_items.push_back((*it)->getUUID());
	}

	mVoiceEffectList->deleteAllItems();

	{
		// Add the "No Voice Morph" entry
		LLSD element;

		element["id"] = LLUUID::null;
		element["columns"][NAME_COLUMN]["column"] = "name";
		element["columns"][NAME_COLUMN]["value"] = getString("no_voice_effect");
		element["columns"][NAME_COLUMN]["font"]["style"] = "BOLD";

		LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM);
		// *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :(
		if(sl_item)
		{
			((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(LLFontGL::BOLD);
		}
	}

	// Add each Voice Morph template, if there are any (template list includes all usable effects)
	const voice_effect_list_t& template_list = effect_interface->getVoiceEffectTemplateList();
	if (!template_list.empty())
	{
		for (voice_effect_list_t::const_iterator it = template_list.begin(); it != template_list.end(); ++it)
		{
			const LLUUID& effect_id = it->second;
			std::string effect_name = getString("effect_" + it->first); // will throw an error if the effect is not listed in the XML

			LLSD effect_properties = effect_interface->getVoiceEffectProperties(effect_id);

			// Tag the active effect.
			if (effect_id == LLVoiceClient::instance().getVoiceEffectDefault())
			{
				effect_name += " " + getString("active_voice_effect");
			}

			// Tag available effects that are new this session
			if (effect_properties["is_new"].asBoolean())
			{
				effect_name += " " + getString("new_voice_effect");
			}

			LLDate expiry_date = effect_properties["expiry_date"].asDate();
			bool is_template_only = effect_properties["template_only"].asBoolean();

			std::string font_style = "NORMAL";
			if (!is_template_only)
			{
				font_style = "BOLD";
			}

			LLSD element;
			element["id"] = effect_id;

			element["columns"][NAME_COLUMN]["column"] = "name";
			element["columns"][NAME_COLUMN]["value"] = effect_name;
			element["columns"][NAME_COLUMN]["font"]["style"] = font_style;

			element["columns"][1]["column"] = "expires";
			if (!is_template_only)
			{
				element["columns"][DATE_COLUMN]["value"] = expiry_date;
				element["columns"][DATE_COLUMN]["type"] = "date";
			}
			else {
				element["columns"][DATE_COLUMN]["value"] = getString("unsubscribed_voice_effect");
			}
//			element["columns"][DATE_COLUMN]["font"]["style"] = "NORMAL";

			LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM);
			// *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :(
			if(sl_item)
			{
				LLFontGL::StyleFlags style = is_template_only ? LLFontGL::NORMAL : LLFontGL::BOLD;
				LLScrollListText* slt = dynamic_cast<LLScrollListText*>(sl_item->getColumn(0));
				llassert(slt);
				if (slt)
				{
					slt->setFontStyle(style);
				}
			}
		}
	}

	// Re-select items that were selected before, and restore the scroll position
	for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++)
	{
		mVoiceEffectList->selectByID(*it);
	}
	mVoiceEffectList->setScrollPos(scroll_pos);
	mVoiceEffectList->setEnabled(true);
}