CHUI-394 (Group moderation tools missing in right click menus)

meow-7.2.2
MaximB ProductEngine 2012-12-10 17:22:56 +02:00
parent 53471178fe
commit f49d47b304
4 changed files with 36 additions and 31 deletions

View File

@ -46,7 +46,8 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u
mUUID(uuid),
mNeedsRefresh(true),
mConvType(CONV_UNKNOWN),
mLastActiveTime(0.0)
mLastActiveTime(0.0),
mDisplayModeratorOptions(false)
{
}
@ -56,7 +57,8 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte
mUUID(uuid),
mNeedsRefresh(true),
mConvType(CONV_UNKNOWN),
mLastActiveTime(0.0)
mLastActiveTime(0.0),
mDisplayModeratorOptions(false)
{
}
@ -66,7 +68,8 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod
mUUID(),
mNeedsRefresh(true),
mConvType(CONV_UNKNOWN),
mLastActiveTime(0.0)
mLastActiveTime(0.0),
mDisplayModeratorOptions(false)
{
}
@ -117,14 +120,13 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items)
items.push_back(std::string("block_unblock"));
items.push_back(std::string("MuteText"));
if(this->getType() != CONV_SESSION_1_ON_1)
if(this->getType() != CONV_SESSION_1_ON_1 && mDisplayModeratorOptions)
{
items.push_back(std::string("Moderator Options Separator"));
items.push_back(std::string("Moderator Options"));
items.push_back(std::string("AllowTextChat"));
items.push_back(std::string("moderate_voice_separator"));
items.push_back(std::string("ModerateVoiceMuteSelected"));
items.push_back(std::string("ModerateVoiceUnMuteSelected"));
items.push_back(std::string("ModerateVoiceToggleMuteSelected"));
items.push_back(std::string("ModerateVoiceMute"));
items.push_back(std::string("ModerateVoiceUnmute"));
}

View File

@ -138,6 +138,7 @@ protected:
EConversationType mConvType; // Type of conversation item
bool mNeedsRefresh; // Flag signaling to the view that something changed for this item
F64 mLastActiveTime;
bool mDisplayModeratorOptions;
};
class LLConversationItemSession : public LLConversationItem
@ -198,6 +199,7 @@ public:
LLConversationItemSession* getParentSession();
void dumpDebugData();
void setModeratorOptionsVisible(bool visible) { mDisplayModeratorOptions = visible; }
private:
void onAvatarNameCache(const LLAvatarName& av_name);

View File

@ -509,6 +509,22 @@ void LLFloaterIMContainer::draw()
// still needs the conversation list. Simply collapse the message pane in that case.
collapseMessagesPane(true);
}
//Update moderator options visibility
const LLConversationItem *current_session = getCurSelectedViewModelItem();
if (current_session)
{
LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = current_session->getChildrenBegin();
LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = current_session->getChildrenEnd();
while (current_participant_model != end_participant_model)
{
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
participant_model->setModeratorOptionsVisible(isGroupModerator() && participant_model->getUUID() != gAgentID);
current_participant_model++;
}
}
LLFloater::draw();
}
@ -1156,7 +1172,7 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
{
return LLAvatarActions::canOfferTeleport(uuids);
}
else if (("can_moderate_voice" == item) || ("can_allow_text_chat" == item) || ("can_mute" == item) || ("can_unmute" == item))
else if (("can_moderate_voice" == item) || ("can_allow_text_chat" == item) || ("can_mute_unmute" == item))
{
// *TODO : get that out of here...
return enableModerateContextMenuItem(item);
@ -1246,11 +1262,11 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool
}
}
// Set the focus on the selected floater
if (!session_floater->hasFocus())
{
session_floater->setFocus(TRUE);
}
// Set the focus on the selected floater
if (!session_floater->hasFocus())
{
session_floater->setFocus(TRUE);
}
return handled;
}
@ -1463,18 +1479,10 @@ bool LLFloaterIMContainer::enableModerateContextMenuItem(const std::string& user
bool voice_channel = speakerp->isInVoiceChannel();
if ("can_moderate_voice" == userdata)
if ("can_moderate_voice" == userdata || "can_mute_unmute" == userdata)
{
return voice_channel;
}
else if ("can_mute" == userdata)
{
return voice_channel && !isMuted(getCurSelectedViewModelItem()->getUUID());
}
else if ("can_unmute" == userdata)
{
return voice_channel && isMuted(getCurSelectedViewModelItem()->getUUID());
}
// The last invoke is used to check whether the "can_allow_text_chat" will enabled
return LLVoiceClient::getInstance()->isParticipantAvatar(getCurSelectedViewModelItem()->getUUID());

View File

@ -156,18 +156,11 @@
</menu_item_check>
<menu_item_separator layout="topleft" name="moderate_voice_separator" />
<menu_item_call
label="Mute this participant"
label="Toggle mute this participant"
layout="topleft"
name="ModerateVoiceMuteSelected">
name="ModerateVoiceToggleMuteSelected">
<on_click function="Avatar.DoToSelected" parameter="selected" />
<on_enable function="Avatar.EnableItem" parameter="can_mute" />
</menu_item_call>
<menu_item_call
label="Unmute this participant"
layout="topleft"
name="ModerateVoiceUnMuteSelected">
<on_click function="Avatar.DoToSelected" parameter="selected" />
<on_enable function="Avatar.EnableItem" parameter="can_unmute" />
<on_enable function="Avatar.EnableItem" parameter="can_mute_unmute" />
</menu_item_call>
<menu_item_call
label="Mute everyone"