From 8735f383c8393d3cf102681e8243a2ac64220649 Mon Sep 17 00:00:00 2001 From: dmitry Date: Thu, 29 Aug 2013 11:47:46 +0300 Subject: MAINT-3068 FIXED Inconsistent option menus on resident names in Conversations floater --- indra/newview/llchathistory.cpp | 105 ++++++++++++++++++++- .../skins/default/xui/en/menu_avatar_icon.xml | 70 +++++++++++++- 2 files changed, 168 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index af3c6eff11..afa6d4eaeb 100755 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -60,6 +60,8 @@ #include "llstring.h" #include "llurlaction.h" #include "llviewercontrol.h" +#include "llviewerobjectlist.h" +#include "llmutelist.h" static LLDefaultChildRegistry::Register r("chat_history"); @@ -181,6 +183,18 @@ public: { LLAvatarActions::startIM(getAvatarId()); } + else if (level == "teleport") + { + LLAvatarActions::offerTeleport(getAvatarId()); + } + else if (level == "voice_call") + { + LLAvatarActions::startCall(getAvatarId()); + } + else if (level == "chat_history") + { + LLAvatarActions::viewChatHistory(getAvatarId()); + } else if (level == "add") { LLAvatarActions::requestFriendshipDialog(getAvatarId(), mFrom); @@ -189,13 +203,75 @@ public: { LLAvatarActions::removeFriendDialog(getAvatarId()); } + else if (level == "invite_to_group") + { + LLAvatarActions::inviteToGroup(getAvatarId()); + } + else if (level == "zoom_in") + { + handle_zoom_to_object(getAvatarId()); + } + else if (level == "map") + { + LLAvatarActions::showOnMap(getAvatarId()); + } + else if (level == "share") + { + LLAvatarActions::share(getAvatarId()); + } + else if (level == "pay") + { + LLAvatarActions::pay(getAvatarId()); + } + else if(level == "block_unblock") + { + mute(getAvatarId(), LLMute::flagVoiceChat); + } + else if(level == "mute_unmute") + { + mute(getAvatarId(), LLMute::flagTextChat); + } + } + + bool onAvatarIconContextMenuItemChecked(const LLSD& userdata) + { + std::string level = userdata.asString(); + + if (level == "is_blocked") + { + return LLMuteList::getInstance()->isMuted(getAvatarId(), LLMute::flagVoiceChat); + } + if (level == "is_muted") + { + return LLMuteList::getInstance()->isMuted(getAvatarId(), LLMute::flagTextChat); + } + return false; + } + + void mute(const LLUUID& participant_id, U32 flags) + { + BOOL is_muted = LLMuteList::getInstance()->isMuted(participant_id, flags); + std::string name; + gCacheName->getFullName(participant_id, name); + LLMute mute(participant_id, name, LLMute::AGENT); + + if (!is_muted) + { + LLMuteList::getInstance()->add(mute, flags); + } + else + { + LLMuteList::getInstance()->remove(mute, flags); + } } BOOL postBuild() { LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar registrar_enable; registrar.add("AvatarIcon.Action", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemClicked, this, _2)); + registrar_enable.add("AvatarIcon.Check", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemChecked, this, _2)); registrar.add("ObjectIcon.Action", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemClicked, this, _2)); LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_avatar_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); @@ -460,7 +536,7 @@ protected: if(menu) { - bool is_friend = LLAvatarTracker::instance().getBuddyInfo(mAvatarID) != NULL; + bool is_friend = LLAvatarActions::isFriend(mAvatarID); menu->setItemEnabled("Add Friend", !is_friend); menu->setItemEnabled("Remove Friend", is_friend); @@ -470,13 +546,34 @@ protected: menu->setItemEnabled("Add Friend", false); menu->setItemEnabled("Send IM", false); menu->setItemEnabled("Remove Friend", false); + menu->setItemEnabled("Offer Teleport",false); + menu->setItemEnabled("Voice Call", false); + menu->setItemEnabled("Invite Group", false); + menu->setItemEnabled("Zoom In", false); + menu->setItemEnabled("Share", false); + menu->setItemEnabled("Pay", false); + menu->setItemEnabled("Block Unblock", false); + menu->setItemEnabled("Mute Text", false); } - - if (mSessionID == LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, mAvatarID)) + else { - menu->setItemVisible("Send IM", false); + LLUUID currentSessionID = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, mAvatarID); + if (mSessionID == currentSessionID) + { + menu->setItemVisible("Send IM", false); + } + menu->setItemEnabled("Offer Teleport", LLAvatarActions::canOfferTeleport(mAvatarID)); + menu->setItemEnabled("Voice Call", LLAvatarActions::canCall()); + + // We should only show 'Zoom in' item in a nearby chat + bool should_show_zoom = !LLIMModel::getInstance()->findIMSession(currentSessionID); + menu->setItemVisible("Zoom In", should_show_zoom && gObjectList.findObject(mAvatarID)); + menu->setItemEnabled("Block Unblock", LLAvatarActions::canBlock(mAvatarID)); + menu->setItemEnabled("Mute Text", LLAvatarActions::canBlock(mAvatarID)); } + menu->setItemEnabled("Chat History", LLLogChat::isTranscriptExist(mAvatarID)); + menu->setItemEnabled("Map", (LLAvatarTracker::instance().isBuddyOnline(mAvatarID) && is_agent_mappable(mAvatarID)) || gAgent.isGodlike() ); menu->buildDrawLabels(); menu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(this, menu, x, y); diff --git a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml index 50910dff32..77b9095f7c 100755 --- a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml @@ -17,7 +17,7 @@ parameter="profile" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3