diff options
| author | Eric M. Tulla (BigPapi) <tulla@lindenlab.com> | 2009-12-10 16:09:00 -0500 | 
|---|---|---|
| committer | Eric M. Tulla (BigPapi) <tulla@lindenlab.com> | 2009-12-10 16:09:00 -0500 | 
| commit | f0146befc76f401c344ae2759c70b67b37cbf717 (patch) | |
| tree | f0f8bae973049510e04a54fa225c0daabfb960b5 /indra/newview/llpanelmaininventory.cpp | |
| parent | 99d757e04152a291ca14c8cb432597de8f2b61e2 (diff) | |
| parent | 9db47b1d4bc9c24adf23f862c729464d9422e6a3 (diff) | |
Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0/
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
| -rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 54 | 
1 files changed, 35 insertions, 19 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 21627e84ff..cef21e85d6 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -33,6 +33,7 @@  #include "llviewerprecompiledheaders.h"  #include "llpanelmaininventory.h" +#include "llagent.h"  #include "lldndbutton.h"  #include "llfilepicker.h"  #include "llfloaterinventory.h" @@ -863,7 +864,6 @@ void LLPanelMainInventory::initListCommandsHandlers()  	mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2));  	mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());  	mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); -	  }  void LLPanelMainInventory::updateListCommands() @@ -909,6 +909,22 @@ void LLPanelMainInventory::onClipboardAction(const LLSD& userdata)  	getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name);  } +void LLPanelMainInventory::saveTexture(const LLSD& userdata) +{ +	LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); +	if (!current_item) +	{ +		return; +	} +	 +	const LLUUID& item_id = current_item->getListener()->getUUID(); +	LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item_id), TAKE_FOCUS_YES); +	if (preview_texture) +	{ +		preview_texture->openToSave(); +	} +} +  void LLPanelMainInventory::onCustomAction(const LLSD& userdata)  {  	if (!isActionEnabled(userdata)) @@ -953,18 +969,7 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)  	}  	if (command_name == "save_texture")  	{ -		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); -		if (!current_item) -		{ -			return; -		} - -		const LLUUID& item_id = current_item->getListener()->getUUID(); -		LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item_id), TAKE_FOCUS_YES); -		if (preview_texture) -		{ -			preview_texture->openToSave(); -		} +		saveTexture(userdata);  	}  	// This doesn't currently work, since the viewer can't change an assetID an item.  	if (command_name == "regenerate_link") @@ -1008,6 +1013,22 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)  	}  } +bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata) +{ +	LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); +	if (current_item)  +	{ +		LLViewerInventoryItem *inv_item = current_item->getInventoryItem(); +		if(inv_item) +		{ +			bool can_save = inv_item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED); +			LLInventoryType::EType curr_type = current_item->getListener()->getInventoryType(); +			return can_save && (curr_type == LLInventoryType::IT_TEXTURE || curr_type == LLInventoryType::IT_SNAPSHOT); +		} +	} +	return false; +} +  BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)  {  	const std::string command_name = userdata.asString(); @@ -1035,12 +1056,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)  	}  	if (command_name == "save_texture")  	{ -		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); -		if (current_item) -		{ -			return (current_item->getListener()->getInventoryType() == LLInventoryType::IT_TEXTURE); -		} -		return FALSE; +		return isSaveTextureEnabled(userdata);  	}  	if (command_name == "find_original")  	{  | 
