summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-12-06 01:01:06 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-12-06 12:05:35 +0200
commit4ca8d3417ca0d98f723cbf708cb37ca4f0eeec93 (patch)
tree2acb14033c0b6bf4d0689ebd3b74349675eae85b /indra
parent8eb2d17c7715dbe72d4719d7ed3dd05f8cb4b65e (diff)
SL-18107 Allow dropping inventory onto a profile for sharing
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpanelavatar.cpp5
-rw-r--r--indra/newview/llpanelavatar.h2
-rw-r--r--indra/newview/llpanelgroupnotices.cpp7
-rw-r--r--indra/newview/llpanelprofile.cpp46
-rw-r--r--indra/newview/llpanelprofile.h6
5 files changed, 52 insertions, 14 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index ff33efe4aa..e3d887d943 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -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,
diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h
index f182660c8e..bfde921df0 100644
--- a/indra/newview/llpanelavatar.h
+++ b/indra/newview/llpanelavatar.h
@@ -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,
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 82f880c9ee..54121c2656 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -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,
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index c2c9139c19..24091644e3 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -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();
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index 11632a10ae..45655cd67b 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -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
*/