diff options
author | Eugene Mutavchi <emutavchi@productengine.com> | 2010-04-12 17:02:16 +0300 |
---|---|---|
committer | Eugene Mutavchi <emutavchi@productengine.com> | 2010-04-12 17:02:16 +0300 |
commit | 27b457f2ce860f7fc36d15e8792bfa89bca5b93f (patch) | |
tree | 896a24879395fbaec9e1cf12dd3a05ef5ccbb21b /indra/newview/llfloateravatarpicker.cpp | |
parent | 7e76f26407c6760464b5928b7c6cb8c800a5883f (diff) |
Implemented major task EXT-6710(Feature request: Allow drag and drop from Inventory panel to Resident Picker)
- added handling the drag add drop inventory items to resident picker
- added "Share" verb button to the inventory panel which opens resident picker
- added "Share" menu item to the individual inventory context menu which acts as verb button
Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/215/
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llfloateravatarpicker.cpp')
-rw-r--r-- | indra/newview/llfloateravatarpicker.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 2cb0cdf368..01a699506e 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -38,6 +38,8 @@ #include "llcallingcard.h" #include "llfocusmgr.h" #include "llfloaterreg.h" +#include "llimview.h" // for gIMMgr +#include "lltooldraganddrop.h" // for LLToolDragAndDrop #include "llviewercontrol.h" #include "llworld.h" @@ -370,6 +372,68 @@ void LLFloaterAvatarPicker::setAllowMultiple(BOOL allow_multiple) getChild<LLScrollListCtrl>("Friends")->setAllowMultipleSelection(allow_multiple); } +LLScrollListCtrl* LLFloaterAvatarPicker::getActiveList() +{ + std::string acvtive_panel_name; + LLScrollListCtrl* list = NULL; + LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs"); + if(active_panel) + { + acvtive_panel_name = active_panel->getName(); + } + if(acvtive_panel_name == "SearchPanel") + { + list = getChild<LLScrollListCtrl>("SearchResults"); + } + else if(acvtive_panel_name == "NearMePanel") + { + list = getChild<LLScrollListCtrl>("NearMe"); + } + else if (acvtive_panel_name == "FriendsPanel") + { + list = getChild<LLScrollListCtrl>("Friends"); + } + return list; +} + +BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, + BOOL drop, EDragAndDropType cargo_type, + void *cargo_data, EAcceptance *accept, + std::string& tooltip_msg) +{ + LLScrollListCtrl* list = getActiveList(); + if(list) + { + LLRect rc_list; + LLRect rc_point(x,y,x,y); + if (localRectToOtherView(rc_point, &rc_list, list)) + { + // Keep selected only one item + list->deselectAllItems(TRUE); + list->selectItemAt(rc_list.mLeft, rc_list.mBottom, mask); + LLScrollListItem* selection = list->getFirstSelected(); + if (selection) + { + LLUUID session_id = LLUUID::null; + LLUUID dest_agent_id = selection->getUUID(); + std::string avatar_name = selection->getColumn(0)->getValue().asString(); + if (dest_agent_id.notNull() && dest_agent_id != gAgentID) + { + if (drop) + { + // Start up IM before give the item + session_id = gIMMgr->addSession(avatar_name, IM_NOTHING_SPECIAL, dest_agent_id); + } + return LLToolDragAndDrop::handleGiveDragAndDrop(dest_agent_id, session_id, drop, + cargo_type, cargo_data, accept); + } + } + } + } + *accept = ACCEPT_NO; + return TRUE; +} + // static void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void**) { |