コード例 #1
0
// static
void LLPanelLandMedia::onClickRemoveURLFilter(void *data)
{
	LLPanelLandMedia* panelp = (LLPanelLandMedia*)data;
	if (panelp && panelp->mURLFilterList)
	{
		LLParcel* parcel = panelp->mParcel->getParcel();
		if (parcel)
		{
			LLSD list = parcel->getMediaURLFilterList();
			
			std::vector<LLScrollListItem*> domains = panelp->mURLFilterList->getAllSelected();
			for (std::vector<LLScrollListItem*>::iterator iter = domains.begin(); iter != domains.end(); iter++)
			{
				LLScrollListItem* item = *iter;
				const std::string domain = item->getValue().asString();

				for(S32 i = 0; i < list.size(); i++)
				{
					if (list[i].asString() == domain)
					{
						list.erase(i);
						break;
					}
				}
			}
			
			parcel->setMediaURLFilterList(list);
			LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );

			panelp->refresh();
		}
	}
	
}
コード例 #2
0
// static
void LLPanelLandMedia::onClickAddURLFilter(void *userdata)
{
	LLPanelLandMedia *panelp = (LLPanelLandMedia *)userdata;
	LLParcel* parcel = panelp->mParcel->getParcel();
	
	LLSD list = parcel->getMediaURLFilterList();

	std::string domain = panelp->mMediaURLFilterDomainEdit->getText();
	LLStringUtil::trim(domain);

	BOOL add = TRUE;
	if (domain == "")
	{
		add = FALSE;
	}

	// check for dupes
	for(S32 i = 0; i < list.size(); i++)
	{
		if (list[i].asString() == domain)
		{
			add = FALSE;
			break;
		}
	}

	if (add)
	{
		list.append(domain);
		parcel->setMediaURLFilterList(list);

		LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );

		panelp->mMediaURLFilterDomainEdit->setText(std::string(""));

		panelp->refresh();
	}

}