diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 96ba0c8cf3..9150429059 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -51,6 +51,8 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" +#include "llavataractions.h" + //LLFloaterTopObjects* LLFloaterTopObjects::sInstance = NULL; // Globals @@ -83,7 +85,13 @@ LLFloaterTopObjects::LLFloaterTopObjects(const LLSD& key) mCommitCallbackRegistrar.add("TopObjects.GetByObjectName", boost::bind(&LLFloaterTopObjects::onGetByObjectName, this)); mCommitCallbackRegistrar.add("TopObjects.GetByOwnerName", boost::bind(&LLFloaterTopObjects::onGetByOwnerName, this)); mCommitCallbackRegistrar.add("TopObjects.CommitObjectsList",boost::bind(&LLFloaterTopObjects::onCommitObjectsList, this)); + + // TP to object mCommitCallbackRegistrar.add("TopObjects.TeleportToObject", boost::bind(&LLFloaterTopObjects::onTeleportToObject, this)); + // Estate kick avatar + mCommitCallbackRegistrar.add("TopObjects.Kick", boost::bind(&LLFloaterTopObjects::onKick, this)); + // Show profile + mCommitCallbackRegistrar.add("TopObjects.Profile", boost::bind(&LLFloaterTopObjects::onProfile, this)); } LLFloaterTopObjects::~LLFloaterTopObjects() @@ -293,6 +301,24 @@ void LLFloaterTopObjects::updateSelectionInfo() LLUUID object_id = list->getCurrentID(); if (object_id.isNull()) return; + // Use the avatar name cache to determine if selected object + // is an avatar or object and enable avatar-specific buttons + // accordingly. + LLAvatarName av_name; + if (LLAvatarNameCache::get(object_id, &av_name)) + { + bool isAvatar = !av_name.mIsTemporaryName; + getChild("profile_btn")->setEnabled(isAvatar); + getChild("estate_kick_btn")->setEnabled(isAvatar); + } + else + { + getChild("profile_btn")->setEnabled(FALSE); + getChild("estate_kick_btn")->setEnabled(FALSE); + LLAvatarNameCache::get(object_id, boost::bind(&LLFloaterTopObjects::onAvatarCheck, this, _1, _2)); + } + // + std::string object_id_string = object_id.asString(); getChild("id_editor")->setValue(LLSD(object_id_string)); @@ -502,6 +528,7 @@ void LLFloaterTopObjects::showBeacon() LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM); } +// TP to object void LLFloaterTopObjects::onTeleportToObject() { LLScrollListCtrl* list = getChild("objects_list"); @@ -520,4 +547,51 @@ void LLFloaterTopObjects::onTeleportToObject() LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent); gAgent.teleportViaLocation(pos_global); -} \ No newline at end of file +} +// TP to object + +// Estate kick avatar +void LLFloaterTopObjects::onKick() +{ + LLScrollListCtrl* list = getChild("objects_list"); + if (!list) return; + + LLScrollListItem* first_selected = list->getFirstSelected(); + if (!first_selected) return; + + const LLUUID& objectId = first_selected->getUUID(); + LLAvatarActions::estateKick(objectId); +} +// Estate kick avatar + +// Show profile +void LLFloaterTopObjects::onProfile() +{ + LLScrollListCtrl* list = getChild("objects_list"); + if (!list) return; + + LLScrollListItem* first_selected = list->getFirstSelected(); + if (!first_selected) return; + + const LLUUID& objectId = first_selected->getUUID(); + LLAvatarActions::showProfile(objectId); +} +// Show profile + +// Enable avatar-specific buttons if current selection is an avatar +void LLFloaterTopObjects::onAvatarCheck(const LLUUID& avatar_id, LLAvatarName av_name) +{ + LLScrollListCtrl* list = getChild("objects_list"); + if (!list) return; + + LLScrollListItem* first_selected = list->getFirstSelected(); + if (!first_selected) return; + + if (first_selected->getUUID() == avatar_id) + { + bool isAvatar = !av_name.mIsTemporaryName; + getChild("profile_btn")->setEnabled(isAvatar); + getChild("estate_kick_btn")->setEnabled(isAvatar); + } +} +// Enable avatar-specific buttons if current selection is an avatar \ No newline at end of file diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h index 477d74f3d9..98c0414e45 100644 --- a/indra/newview/llfloatertopobjects.h +++ b/indra/newview/llfloatertopobjects.h @@ -28,6 +28,7 @@ #define LL_LLFLOATERTOPOBJECTS_H #include "llfloater.h" +#include "llavatarname.h" class LLUICtrl; @@ -68,7 +69,15 @@ private: void onDisableAll(); void onDisableSelected(); + // TP to object void onTeleportToObject(); + // Estate kick avatar + void onKick(); + // Show profile + void onProfile(); + + // Enable avatar-specific buttons if current selection is an avatar + void onAvatarCheck(const LLUUID& avatar_id, const LLAvatarName av_name); static bool callbackReturnAll(const LLSD& notification, const LLSD& response); static bool callbackDisableAll(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/skins/default/xui/de/floater_top_objects.xml b/indra/newview/skins/default/xui/de/floater_top_objects.xml index 9bc0d1edd6..2a0ce264f0 100644 --- a/indra/newview/skins/default/xui/de/floater_top_objects.xml +++ b/indra/newview/skins/default/xui/de/floater_top_objects.xml @@ -55,6 +55,8 @@ + +