diff options
| -rw-r--r-- | indra/newview/llfoldervieweventlistener.h | 3 | ||||
| -rw-r--r-- | indra/newview/llfolderviewitem.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llinventorybridge.cpp | 88 | ||||
| -rw-r--r-- | indra/newview/llinventorybridge.h | 14 | ||||
| -rw-r--r-- | indra/newview/llpanelobjectinventory.cpp | 12 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 7 | 
6 files changed, 105 insertions, 25 deletions
| diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h index 3bfbf36110..aee31ca033 100644 --- a/indra/newview/llfoldervieweventlistener.h +++ b/indra/newview/llfoldervieweventlistener.h @@ -96,7 +96,8 @@ public:  	// otherwise FALSE.  	virtual BOOL dragOrDrop(MASK mask, BOOL drop,  							EDragAndDropType cargo_type, -							void* cargo_data) = 0; +							void* cargo_data, +							std::string& tooltip_msg) = 0;  };  #endif diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index e2b7c45eab..2f07e084ab 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -840,7 +840,7 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,  	BOOL handled = FALSE;  	if(mListener)  	{ -		accepted = mListener->dragOrDrop(mask,drop,cargo_type,cargo_data); +		accepted = mListener->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg);  		handled = accepted;  		if (accepted)  		{ @@ -2162,7 +2162,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask,  													EAcceptance* accept,  													std::string& tooltip_msg)  { -	BOOL accepted = mListener && mListener->dragOrDrop(mask,drop,c_type,cargo_data); +	BOOL accepted = mListener && mListener->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg);  	if (accepted)   	{  		mDragAndDropTarget = TRUE; @@ -2254,7 +2254,7 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask,  	if (!handled)  	{ -		BOOL accepted = mListener && mListener->dragOrDrop(mask, drop,cargo_type,cargo_data); +		BOOL accepted = mListener && mListener->dragOrDrop(mask, drop,cargo_type,cargo_data, tooltip_msg);  		if (accepted)   		{ diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ac53532e32..01d4153d3f 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1666,10 +1666,19 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const  } -static BOOL can_move_to_outbox(LLInventoryItem* inv_item) +static BOOL can_move_to_outbox(LLInventoryItem* inv_item, std::string& tooltip_msg)  {  	bool worn = get_is_item_worn(inv_item->getUUID());  	bool allow_transfer = inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); + +	if (!allow_transfer) +	{ +		tooltip_msg = LLTrans::getString("TooltipOutboxNoTransfer"); +	} +	else if(worn) +	{ +		tooltip_msg = LLTrans::getString("TooltipOutboxWorn"); +	}  	return !worn && allow_transfer;  } @@ -1681,8 +1690,53 @@ void LLFolderBridge::dropFolderToOutbox(LLInventoryCategory* inv_cat)  	copy_folder_to_outbox(inv_cat, getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false), inv_cat->getUUID());	  } + + +int get_folder_levels(LLInventoryCategory* inv_cat) +{ +	LLInventoryModel::cat_array_t* cats; +	LLInventoryModel::item_array_t* items; +	gInventory.getDirectDescendentsOf(inv_cat->getUUID(), cats, items); + +	int max_child_levels = 0; + +	for (S32 i=0; i < cats->count(); ++i) +	{ +		LLInventoryCategory* category = cats->get(i); +		max_child_levels = max(max_child_levels, get_folder_levels(category)); +	} + +	return 1 + max_child_levels; +} + +int get_folder_path_length(const LLUUID& ancestor_id, const LLUUID& descendant_id) +{ +	int depth = 0; + +	if (ancestor_id == descendant_id) return depth; + +	const LLInventoryCategory* category = gInventory.getCategory(descendant_id); + +	while(category) +	{ +		LLUUID parent_id = category->getParentUUID(); + +		if (parent_id.isNull()) break; + +		depth++; + +		if (parent_id == ancestor_id) return depth; + +		category = gInventory.getCategory(parent_id); +	} + +	llwarns << "get_folder_path_length() couldn't trace a path from the descendant to the ancestor" << llendl; +	return -1; +} +  BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, -											BOOL drop) +											BOOL drop, +											std::string& tooltip_msg)  {  	LLInventoryModel* model = getInventoryModel(); @@ -1770,12 +1824,21 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,  			for (S32 i=0; i < descendent_items.count(); ++i)  			{  				LLInventoryItem* item = descendent_items[i]; -				if (!can_move_to_outbox(item)) +				if (!can_move_to_outbox(item, tooltip_msg))  				{  					is_movable = FALSE;  					break;   				}  			} + +			int nested_folder_levels = get_folder_path_length(outbox_id, mUUID) + get_folder_levels(inv_cat); + +			if (nested_folder_levels > 4) +			{ +				tooltip_msg = LLTrans::getString("TooltipOutboxFolderLevels"); +				is_movable = FALSE; +			} +			  		}  		//  @@ -2805,7 +2868,8 @@ BOOL LLFolderBridge::hasChildren() const  BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,  								EDragAndDropType cargo_type, -								void* cargo_data) +								void* cargo_data, +								std::string& tooltip_msg)  {  	LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; @@ -2825,7 +2889,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,  		case DAD_ANIMATION:  		case DAD_GESTURE:  		case DAD_MESH: -			accept = dragItemIntoFolder(inv_item, drop); +			accept = dragItemIntoFolder(inv_item, drop, tooltip_msg);  			break;  		case DAD_LINK:  			// DAD_LINK type might mean one of two asset types: AT_LINK or AT_LINK_FOLDER. @@ -2836,12 +2900,12 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,  				LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID());  				if (linked_category)  				{ -					accept = dragCategoryIntoFolder((LLInventoryCategory*)linked_category, drop); +					accept = dragCategoryIntoFolder((LLInventoryCategory*)linked_category, drop, tooltip_msg);  				}  			}  			else  			{ -				accept = dragItemIntoFolder(inv_item, drop); +				accept = dragItemIntoFolder(inv_item, drop, tooltip_msg);  			}  			break;  		case DAD_CATEGORY: @@ -2851,7 +2915,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,  			}  			else  			{ -				accept = dragCategoryIntoFolder((LLInventoryCategory*)cargo_data, drop); +				accept = dragCategoryIntoFolder((LLInventoryCategory*)cargo_data, drop, tooltip_msg);  			}  			break;  		case DAD_ROOT_CATEGORY: @@ -3108,7 +3172,8 @@ void LLFolderBridge::dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_c  // into the folder, as well as performing the actual drop, depending  // if drop == TRUE.  BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, -										BOOL drop) +										BOOL drop, +										std::string& tooltip_msg)  {  	LLInventoryModel* model = getInventoryModel(); @@ -3193,7 +3258,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,  		}  		else if (move_is_into_outbox)  		{ -			accept = can_move_to_outbox(inv_item); +			accept = can_move_to_outbox(inv_item, tooltip_msg);  		}  		if(accept && drop) @@ -3869,7 +3934,8 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags)  BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,  									 EDragAndDropType cargo_type, -									 void* cargo_data) +									 void* cargo_data, +									 std::string& tooltip_msg)  {  	LLViewerInventoryItem* item = getItem();  	BOOL rv = FALSE; diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index b557e128a7..4a64df1371 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -115,7 +115,8 @@ public:  	virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;  	virtual BOOL dragOrDrop(MASK mask, BOOL drop,  							EDragAndDropType cargo_type, -							void* cargo_data) { return FALSE; } +							void* cargo_data, +							std::string& tooltip_msg) { return FALSE; }  	virtual LLInventoryType::EType getInventoryType() const { return mInvType; }  	virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; } @@ -229,8 +230,9 @@ public:  		mCallingCards(FALSE),  		mWearables(FALSE)  	{} -	BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop); -	BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop); +		 +	BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg); +	BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop, std::string& tooltip_msg);  	virtual void performAction(LLInventoryModel* model, std::string action);  	virtual void openItem(); @@ -256,7 +258,8 @@ public:  	virtual BOOL hasChildren() const;  	virtual BOOL dragOrDrop(MASK mask, BOOL drop,  							EDragAndDropType cargo_type, -							void* cargo_data); +							void* cargo_data, +							std::string& tooltip_msg);  	virtual BOOL isItemRemovable() const;  	virtual BOOL isItemMovable() const ; @@ -381,7 +384,8 @@ public:  	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);  	virtual BOOL dragOrDrop(MASK mask, BOOL drop,  							EDragAndDropType cargo_type, -							void* cargo_data); +							void* cargo_data, +							std::string& tooltip_msg);  	void refreshFolderViewItem();  protected:  	LLCallingCardObserver* mObserver; diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 83ba8afbfc..44364b5831 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -140,7 +140,8 @@ public:  	virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;  	virtual BOOL dragOrDrop(MASK mask, BOOL drop,  							EDragAndDropType cargo_type, -							void* cargo_data); +							void* cargo_data, +							std::string& tooltip_msg);  };  LLTaskInvFVBridge::LLTaskInvFVBridge( @@ -581,7 +582,8 @@ BOOL LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const  BOOL LLTaskInvFVBridge::dragOrDrop(MASK mask, BOOL drop,  								   EDragAndDropType cargo_type, -								   void* cargo_data) +								   void* cargo_data, +								   std::string& tooltip_msg)  {  	//llinfos << "LLTaskInvFVBridge::dragOrDrop()" << llendl;  	return FALSE; @@ -711,7 +713,8 @@ public:  	virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;  	virtual BOOL dragOrDrop(MASK mask, BOOL drop,  							EDragAndDropType cargo_type, -							void* cargo_data); +							void* cargo_data, +							std::string& tooltip_msg);  	virtual BOOL canOpenItem() const { return TRUE; }  	virtual void openItem();  }; @@ -805,7 +808,8 @@ BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const  BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop,  									  EDragAndDropType cargo_type, -									  void* cargo_data) +									  void* cargo_data, +									  std::string& tooltip_msg)  {  	//llinfos << "LLTaskCategoryBridge::dragOrDrop()" << llendl;  	BOOL accept = FALSE; diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index f049f857f0..ced1826a03 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -165,7 +165,12 @@ Please try logging in again in a minute.</string>  	<string name="TooltipMustSingleDrop">Only a single item can be dragged here</string>  	<string name="TooltipPrice" value="L$[AMOUNT]: "/> -	<!-- tooltips for Urls --> +    <string name="TooltipOutboxNoTransfer">One or more of these objects cannot be sold or transferred to another user.</string> +    <string name="TooltipOutboxWorn">ou are wearing one or more of these objects. Remove them from your avatar and try moving them again.</string> +    <string name="TooltipOutboxFolderLevels">This folder has too many levels of subfolders. Rearrange the interior folders to a maximum of 4 levels deep (Root Folder contains A contains B contains C).</string> +    <string name="TooltipOutboxTooManyObjects">This folder contains more than 200 objects. Box some of the items to reduce the object count.</string> + +    <!-- tooltips for Urls -->  	<string name="TooltipHttpUrl">Click to view this web page</string>  	<string name="TooltipSLURL">Click to view this location's information</string>  	<string name="TooltipAgentUrl">Click to view this Resident's profile</string> | 
