diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 1d75374930a9e477381591e904ef9b92745fb8fb..e6666c7f8338255906653f7eddb013888b79abb0 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 16a58718a21d50535f88e5e023ccb4be822093a0..a7f3acad4f8761d5d800445b72f7ef586ef6f2d5 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -98,6 +98,11 @@ class LLAvatarActions */ 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 6b07409676d466aee87e7ff785f42d79803c3992..b61d3ef3712cfa133733776c7516c50b30534e3e 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 900d28adcaed1526f39a422767513002bd11c529..854651cd019669af7252424af47c28f06836321c 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 9d2ccba4dab0d3e8964746d411735ea215a3174b..014a52bb4ffe1f63236220a22a9ed0c78984528e 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" /> </menu_item_call> + <menu_item_call + label="Map" + layout="topleft" + name="Map"> + <menu_item_call.on_click + function="Avatar.ShowOnMap" /> + <menu_item_call.on_enable + function="Avatar.EnableItem" + parameter="can_show_on_map" /> + </menu_item_call> <menu_item_call label="Share" layout="topleft"