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;
}
Example #2
0
void LLSidepanelInventory::updateVerbs()
{
	mInfoBtn->setEnabled(FALSE);
	mShareBtn->setEnabled(FALSE);

	mWearBtn->setVisible(FALSE);
	mWearBtn->setEnabled(FALSE);
	mPlayBtn->setVisible(FALSE);
	mPlayBtn->setEnabled(FALSE);
 	mTeleportBtn->setVisible(FALSE);
 	mTeleportBtn->setEnabled(FALSE);
 	mShopBtn->setVisible(TRUE);

	mShareBtn->setEnabled(canShare());

	const LLInventoryItem *item = getSelectedItem();
	if (!item)
		return;

	bool is_single_selection = getSelectedCount() == 1;

	mInfoBtn->setEnabled(is_single_selection);

	switch(item->getInventoryType())
	{
		case LLInventoryType::IT_WEARABLE:
		case LLInventoryType::IT_OBJECT:
		case LLInventoryType::IT_ATTACHMENT:
			mWearBtn->setVisible(TRUE);
			mWearBtn->setEnabled(canWearSelected());
		 	mShopBtn->setVisible(FALSE);
			break;
		case LLInventoryType::IT_SOUND:
		case LLInventoryType::IT_GESTURE:
		case LLInventoryType::IT_ANIMATION:
			mPlayBtn->setVisible(TRUE);
			mPlayBtn->setEnabled(TRUE);
		 	mShopBtn->setVisible(FALSE);
			break;
		case LLInventoryType::IT_LANDMARK:
			mTeleportBtn->setVisible(TRUE);
			mTeleportBtn->setEnabled(TRUE);
		 	mShopBtn->setVisible(FALSE);
			break;
		default:
			break;
	}
}