From f8299e28b92b06e4cd346ea134ce317b59617785 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Mon, 22 Feb 2010 23:20:34 +0200 Subject: Fixed low bug (EXT-5136) Add the "Map" item to the people context menu. --HG-- branch : product-engine --- indra/newview/llavataractions.cpp | 15 +++++++++++++++ indra/newview/llavataractions.h | 5 +++++ indra/newview/llpanelavatar.cpp | 6 +----- indra/newview/llpanelpeoplemenus.cpp | 10 +++++++++- indra/newview/skins/default/xui/en/menu_people_nearby.xml | 10 ++++++++++ 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 1d75374930..e6666c7f83 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -50,6 +50,7 @@ #include "llfloatergroups.h" #include "llfloaterreg.h" #include "llfloaterpay.h" +#include "llfloaterworldmap.h" #include "llinventorymodel.h" // for gInventory.findCategoryUUIDForType #include "llimview.h" // for gIMMgr #include "llmutelist.h" @@ -316,6 +317,20 @@ void LLAvatarActions::showProfile(const LLUUID& id) } } +// static +void LLAvatarActions::showOnMap(const LLUUID& id) +{ + std::string name; + if (!gCacheName->getFullName(id, name)) + { + gCacheName->get(id, FALSE, boost::bind(&LLAvatarActions::showOnMap, id)); + return; + } + + gFloaterWorldMap->trackAvatar(id, name); + LLFloaterReg::showInstance("world_map"); +} + // static void LLAvatarActions::pay(const LLUUID& id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 16a58718a2..a7f3acad4f 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -98,6 +98,11 @@ public: */ static void showProfile(const LLUUID& id); + /** + * Show avatar on world map. + */ + static void showOnMap(const LLUUID& id); + /** * Give money to the avatar. */ diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 6b07409676..b61d3ef371 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -48,7 +48,6 @@ #include "llscrollcontainer.h" #include "llavatariconctrl.h" #include "llweb.h" -#include "llfloaterworldmap.h" #include "llfloaterreg.h" #include "llnotificationsutil.h" #include "llvoiceclient.h" @@ -449,10 +448,7 @@ void LLPanelProfileTab::scrollToTop() void LLPanelProfileTab::onMapButtonClick() { - std::string name; - gCacheName->getFullName(getAvatarId(), name); - gFloaterWorldMap->trackAvatar(getAvatarId(), name); - LLFloaterReg::showInstance("world_map"); + LLAvatarActions::showOnMap(getAvatarId()); } void LLPanelProfileTab::updateButtons() diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index 900d28adca..854651cd01 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -39,6 +39,7 @@ #include "llpanelpeoplemenus.h" // newview +#include "llagent.h" #include "llagentdata.h" // for gAgentID #include "llavataractions.h" #include "llviewermenu.h" // for gMenuHolder @@ -125,7 +126,7 @@ LLContextMenu* NearbyMenu::createMenu() registrar.add("Avatar.IM", boost::bind(&LLAvatarActions::startIM, id)); registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startCall, id)); registrar.add("Avatar.OfferTeleport", boost::bind(&NearbyMenu::offerTeleport, this)); - registrar.add("Avatar.ShowOnMap", boost::bind(&LLAvatarActions::startIM, id)); // *TODO: unimplemented + registrar.add("Avatar.ShowOnMap", boost::bind(&LLAvatarActions::showOnMap, id)); registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::share, id)); registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, id)); registrar.add("Avatar.BlockUnblock", boost::bind(&LLAvatarActions::toggleBlock, id)); @@ -218,6 +219,13 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) { return LLAvatarActions::canCall(); } + else if (item == std::string("can_show_on_map")) + { + const LLUUID& id = mUUIDs.front(); + + return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id)) + || gAgent.isGodlike(); + } return false; } diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby.xml b/indra/newview/skins/default/xui/en/menu_people_nearby.xml index 9d2ccba4da..014a52bb4f 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml @@ -46,6 +46,16 @@ function="Avatar.EnableItem" parameter="can_call" /> + + + +