SL-18107 Allow dropping inventory onto a profile for sharing

master
Andrey Kleshchev 2023-12-06 01:01:06 +02:00 committed by akleshchev
parent 8eb2d17c77
commit 4ca8d3417c
5 changed files with 52 additions and 14 deletions

View File

@ -39,11 +39,6 @@ LLProfileDropTarget::LLProfileDropTarget(const LLProfileDropTarget::Params& p)
mAgentID(p.agent_id)
{}
void LLProfileDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data)
{
LL_INFOS() << "LLProfileDropTarget::doDrop()" << LL_ENDL;
}
BOOL LLProfileDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,

View File

@ -59,8 +59,6 @@ public:
LLProfileDropTarget(const Params&);
~LLProfileDropTarget() {}
void doDrop(EDragAndDropType cargo_type, void* cargo_data);
//
// LLView functionality
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,

View File

@ -89,8 +89,6 @@ public:
LLGroupDropTarget(const Params&);
~LLGroupDropTarget() {};
void doDrop(EDragAndDropType cargo_type, void* cargo_data);
//
// LLView functionality
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
@ -114,11 +112,6 @@ LLGroupDropTarget::LLGroupDropTarget(const LLGroupDropTarget::Params& p)
mGroupID(p.group_id)
{}
void LLGroupDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data)
{
LL_INFOS() << "LLGroupDropTarget::doDrop()" << LL_ENDL;
}
BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,

View File

@ -46,6 +46,7 @@
#include "lltexteditor.h"
#include "lltexturectrl.h"
#include "lltoggleablemenu.h"
#include "lltooldraganddrop.h"
#include "llgrouplist.h"
#include "llurlaction.h"
@ -998,6 +999,51 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key)
mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileSecondLife::onAvatarNameCache, this, _1, _2));
}
BOOL LLPanelProfileSecondLife::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg)
{
// Try children first
if (LLPanelProfileTab::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg)
&& *accept != ACCEPT_NO)
{
return TRUE;
}
// No point sharing with own profile
if (getSelfProfile())
{
return FALSE;
}
// Exclude fields that look like they are editable.
S32 child_x = 0;
S32 child_y = 0;
if (localPointToOtherView(x, y, &child_x, &child_y, mDescriptionEdit)
&& mDescriptionEdit->pointInView(child_x, child_y))
{
return FALSE;
}
if (localPointToOtherView(x, y, &child_x, &child_y, mGroupList)
&& mGroupList->pointInView(child_x, child_y))
{
return FALSE;
}
// Share
LLToolDragAndDrop::handleGiveDragAndDrop(getAvatarId(),
LLUUID::null,
drop,
cargo_type,
cargo_data,
accept);
return TRUE;
}
void LLPanelProfileSecondLife::updateData()
{
LLUUID avatar_id = getAvatarId();

View File

@ -78,6 +78,12 @@ public:
void onOpen(const LLSD& key) override;
BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg) override;
/**
* LLFriendObserver trigger
*/