Exemplo n.º 1
0
void LLFloaterBuyLandUI::updateCovenantText(const std::string &string, const LLUUID& asset_id)
{
	LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor");
	if (editor)
	{
		editor->setHandleEditKeysDirectly(FALSE);
		editor->setText(string);

		LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
		LLTextBox* box = getChild<LLTextBox>("covenant_text");
		if(check && box)
		{
			if (asset_id.isNull())
			{
				check->set(true);
				check->setEnabled(false);
				refreshUI();

				// remove the line stating that you must agree
				box->setVisible(FALSE);
			}
			else
			{
				check->setEnabled(true);

				// remove the line stating that you must agree
				box->setVisible(TRUE);
			}
		}
	}
}
// Default constructor
LLPreviewNotecard::LLPreviewNotecard(const std::string& name,
									 const LLRect& rect,
									 const std::string& title,
									 const LLUUID& item_id, 
									 const LLUUID& object_id,
									 const LLUUID& asset_id,
									 BOOL show_keep_discard,
									 LLPointer<LLViewerInventoryItem> inv_item) :
	LLPreview(name, rect, title, item_id, object_id, TRUE,
			  PREVIEW_MIN_WIDTH,
			  PREVIEW_MIN_HEIGHT,
			  inv_item),
	mAssetID( asset_id ),
	mNotecardItemID(item_id),
	mObjectID(object_id)
{
	LLRect curRect = rect;

	if (show_keep_discard)
	{
		LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard_keep_discard.xml");
		childSetAction("Keep",onKeepBtn,this);
		childSetAction("Discard",onDiscardBtn,this);
	}
	else
	{
		LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard.xml");
		// <edit>
		childSetAction("Get Items", onClickGetItems, this);
		// </edit>

		if( mAssetID.isNull() )
		{
			const LLInventoryItem* item = getItem();
			if( item )
			{
				mAssetID = item->getAssetUUID();
			}
		}
	}	
	if (hasChild("Save", true))
		childSetAction("Save",onClickSave,this);

	// only assert shape if not hosted in a multifloater
	if (!getHost())
	{
		reshape(curRect.getWidth(), curRect.getHeight(), TRUE);
		setRect(curRect);
	}
			
	if (LLUICtrl* ctrl = findChild<LLUICtrl>("lock"))
		ctrl->setVisible(false);
	
	if (hasChild("desc", true))
	{
		childSetCommitCallback("desc", LLPreview::onText, this);
		if (const LLInventoryItem* item = getItem())
			childSetText("desc", item->getDescription());
		childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
	}

	setTitle(title);
	
	LLViewerTextEditor* editor = findChild<LLViewerTextEditor>("Notecard Editor");

	if (editor)
	{
		editor->setWordWrap(TRUE);
		editor->setSourceID(item_id);
		editor->setHandleEditKeysDirectly(TRUE);
	}

	initMenu();

	gAgentCamera.changeCameraToDefault();
}