diff options
| -rw-r--r-- | indra/newview/llinventorybridge.cpp | 63 | ||||
| -rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 17 | ||||
| -rw-r--r-- | indra/newview/lltooldraganddrop.h | 9 | 
3 files changed, 74 insertions, 15 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 869cb735d5..76576f7b75 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2095,7 +2095,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,  							// NOTE: The cargo id's count is a total of categories AND items but we err on the side of  							//       prevention rather than letting too many folders into the hierarchy of the outbox,  							//       when we're dragging the item to a new parent -							dragged_folder_count += LLToolDragAndDrop::instance().getCargoIDsCount(); +							dragged_folder_count += LLToolDragAndDrop::instance().getCargoCount();  						}  					} @@ -2819,18 +2819,62 @@ void LLFolderBridge::pasteFromClipboard()  	if(model && isClipboardPasteable())  	{  		const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); +		const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); +  		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);  		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); - -		const LLUUID parent_id(mUUID); +		const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);  		LLDynamicArray<LLUUID> objects;  		LLInventoryClipboard::instance().retrieve(objects); + +		if (move_is_into_outbox) +		{ +			LLFolderViewItem * outbox_itemp = mRoot->getItemByID(mUUID); + +			if (outbox_itemp) +			{ +				LLToolDragAndDrop::instance().setCargoCount(objects.size()); + +				BOOL can_list = TRUE; + +				for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin(); +					(iter != objects.end()) && (can_list == TRUE); +					++iter) +				{ +					const LLUUID& item_id = (*iter); +					LLInventoryItem *item = model->getItem(item_id); + +					if (item) +					{ +						MASK mask = 0x0; +						BOOL drop = FALSE; +						EDragAndDropType cargo_type = LLViewerAssetType::lookupDragAndDropType(item->getActualType()); +						void * cargo_data = (void *) item; +						std::string tooltip_msg; + +						can_list = outbox_itemp->getListener()->dragOrDrop(mask, drop, cargo_type, cargo_data, tooltip_msg); +					} +				} + +				LLToolDragAndDrop::instance().resetCargoCount(); + +				if (can_list == FALSE) +				{ +					// Notify user of failure somehow -- play error sound?  modal dialog? +					return; +				} +			} +		} + +		const LLUUID parent_id(mUUID); +  		for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();  			 iter != objects.end();  			 ++iter)  		{  			const LLUUID& item_id = (*iter); +  			LLInventoryItem *item = model->getItem(item_id);  			if (item)  			{ @@ -2873,8 +2917,17 @@ void LLFolderBridge::pasteLinkFromClipboard()  	if(model)  	{  		const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); +		const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); +  		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);  		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); +		const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); + +		if (move_is_into_outbox) +		{ +			// Notify user of failure somehow -- play error sound?  modal dialog? +			return; +		}  		const LLUUID parent_id(mUUID); @@ -3534,7 +3587,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,  	const BOOL move_is_into_favorites = (mUUID == favorites_id);  	const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);  	const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); -	const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); //(mUUID == outbox_id); +	const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);  	const BOOL move_is_from_outbox = model->isObjectDescendentOf(inv_item->getUUID(), outbox_id);  	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); @@ -3613,7 +3666,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,  			{  				const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(outbox_id, mUUID); -				int existing_item_count = LLToolDragAndDrop::instance().getCargoIDsCount(); +				int existing_item_count = LLToolDragAndDrop::instance().getCargoCount();  				if (master_folder != NULL)  				{ diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 8c32dfcb4d..c7ab934f9e 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -333,14 +333,15 @@ LLToolDragAndDrop::LLDragAndDropDictionary::LLDragAndDropDictionary()  };  LLToolDragAndDrop::LLToolDragAndDrop() -:	 LLTool(std::string("draganddrop"), NULL), -	 mDragStartX(0), -	 mDragStartY(0), -	 mSource(SOURCE_AGENT), -	 mCursor(UI_CURSOR_NO), -	 mLastAccept(ACCEPT_NO), -	 mDrop(FALSE), -	 mCurItemIndex(0) +:	LLTool(std::string("draganddrop"), NULL), +	mCargoCount(0), +	mDragStartX(0), +	mDragStartY(0), +	mSource(SOURCE_AGENT), +	mCursor(UI_CURSOR_NO), +	mLastAccept(ACCEPT_NO), +	mDrop(FALSE), +	mCurItemIndex(0)  {  } diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 188d36cd1b..245c2a23e6 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -86,8 +86,11 @@ public:  	EAcceptance getLastAccept() { return mLastAccept; }  	boost::signals2::connection setEndDragCallback( const enddrag_signal_t::slot_type& cb ) { return mEndDragSignal.connect(cb); } -	 -	uuid_vec_t::size_type getCargoIDsCount() const { return mCargoIDs.size(); } + +	void setCargoCount(U32 count) { mCargoCount = count; } +	void resetCargoCount() { mCargoCount = 0; } +	U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : mCargoIDs.size(); } +  	static S32 getOperationId() { return sOperationId; }  protected: @@ -118,6 +121,8 @@ protected:  protected: +	U32				mCargoCount; +  	S32				mDragStartX;  	S32				mDragStartY;  | 
