Example #1
0
// virtual
bool LLOutfitsList::isActionEnabled(const LLSD& userdata)
{
	if (mSelectedOutfitUUID.isNull()) return false;

	const std::string command_name = userdata.asString();
	if (command_name == "delete")
	{
		return !mItemSelected && LLAppearanceMgr::instance().getCanRemoveOutfit(mSelectedOutfitUUID);
	}
	if (command_name == "rename")
	{
		return get_is_category_renameable(&gInventory, mSelectedOutfitUUID);
	}
	if (command_name == "save_outfit")
	{
		bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked();
		bool outfit_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
		// allow save only if outfit isn't locked and is dirty
		return !outfit_locked && outfit_dirty;
	}
	if (command_name == "wear")
	{
		if (gAgentWearables.isCOFChangeInProgress())
		{
			return false;
		}

		if (hasItemSelected())
		{
			return canWearSelected();
		}

		// outfit selected
		return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID);
	}
	if (command_name == "take_off")
	{
		// Enable "Take Off" if any of selected items can be taken off
		// or the selected outfit contains items that can be taken off.
		return ( hasItemSelected() && canTakeOffSelected() )
				|| ( !hasItemSelected() && LLAppearanceMgr::getCanRemoveFromCOF(mSelectedOutfitUUID) );
	}

	if (command_name == "wear_add")
	{
		// *TODO: do we ever get here?
		if (gAgentWearables.isCOFChangeInProgress())
		{
			return false;
		}

		return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID);
	}

	return false;
}
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();
}
Example #3
0
	bool onEnable(LLSD::String param)
	{
		LLUUID outfit_cat_id = mUUIDs.back();

		if ("rename" == param)
		{
			return get_is_category_renameable(&gInventory, outfit_cat_id);
		}
		else if ("wear_replace" == param)
		{
			return LLAppearanceMgr::instance().getCanReplaceCOF(outfit_cat_id);
		}
		else if ("wear_add" == param)
		{
			return LLAppearanceMgr::getCanAddToCOF(outfit_cat_id);
		}
		else if ("take_off" == param)
		{
			return LLAppearanceMgr::getCanRemoveFromCOF(outfit_cat_id);
		}

		return true;
	}
Example #4
0
	bool onEnable(LLSD::String param)
	{
		LLUUID outfit_cat_id = mUUIDs.back();

		if ("rename" == param)
		{
			return get_is_category_renameable(&gInventory, outfit_cat_id);
		}
		else if ("wear_replace" == param)
		{
			return !gAgentWearables.isCOFChangeInProgress();
		}
		else if ("wear_add" == param)
		{
			if (gAgentWearables.isCOFChangeInProgress()) return false;
			return LLAppearanceMgr::getCanAddToCOF(outfit_cat_id);
		}
		else if ("take_off" == param)
		{
			return LLAppearanceMgr::getCanRemoveFromCOF(outfit_cat_id);
		}

		return true;
	}